Compare commits
3 Commits
8901137783
...
a9a4a36b8a
Author | SHA1 | Date | |
---|---|---|---|
a9a4a36b8a | |||
6bff182276 | |||
293c3e580b |
|
@ -79,8 +79,6 @@ public class ReceiveController {
|
||||||
|
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
private boolean lockCommandSent = false; // 添加标志变量
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能描述:第三方平台数据接收。<p>
|
* 功能描述:第三方平台数据接收。<p>
|
||||||
|
@ -265,16 +263,18 @@ public class ReceiveController {
|
||||||
// 判断该车辆是否在进行中的订单,并且车辆的锁状态是关,状态是骑行中
|
// 判断该车辆是否在进行中的订单,并且车辆的锁状态是关,状态是骑行中
|
||||||
Boolean inOrderBySn = etOrderService.isInOrderBySn(device.getSn());
|
Boolean inOrderBySn = etOrderService.isInOrderBySn(device.getSn());
|
||||||
if (inOrderBySn && ServiceConstants.VEHICLE_STATUS_IN_USING.equals(device.getStatus()) && ServiceConstants.LOCK_STATUS_CLOSE.equals(device.getLockStatus())) { // 有正在骑行的订单,给车辆上电
|
if (inOrderBySn && ServiceConstants.VEHICLE_STATUS_IN_USING.equals(device.getStatus()) && ServiceConstants.LOCK_STATUS_CLOSE.equals(device.getLockStatus())) { // 有正在骑行的订单,给车辆上电
|
||||||
log.info("返回营运区上电,有正在骑行的订单,给车辆上电--SN:" + device.getSn());
|
if(!noRidingArea){
|
||||||
asDeviceService.sendCommand(device.getMac(), Token.getToken(), IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_5, "返回营运区上电",null,null);
|
log.info("返回营运区上电,有正在骑行的订单,给车辆上电--SN:" + device.getSn());
|
||||||
// 更新车辆状态和锁状态
|
asDeviceService.sendCommand(device.getMac(), Token.getToken(), IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_5, "返回营运区上电",null,null);
|
||||||
/** 3.更新车辆状态*/
|
// 更新车辆状态和锁状态
|
||||||
device.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
/** 3.更新车辆状态*/
|
||||||
device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);
|
device.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||||
device.setIsAdminUnlocking("0");
|
device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);
|
||||||
int i1 = asDeviceService.updateAsDevice(device);
|
device.setIsAdminUnlocking("0");
|
||||||
if(i1>1){
|
int i1 = asDeviceService.updateAsDevice(device);
|
||||||
log.info("【返回营运区上电】更新车辆状态成功");
|
if(i1>1){
|
||||||
|
log.info("【返回营运区上电】更新车辆状态成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,16 +299,9 @@ public class ReceiveController {
|
||||||
// 优化轨迹,如果获取到的定位与最后一个定位相同,则不添加
|
// 优化轨迹,如果获取到的定位与最后一个定位相同,则不添加
|
||||||
optimizeRoute(jsonArray, newPoint,lon,lat,etOrder);
|
optimizeRoute(jsonArray, newPoint,lon,lat,etOrder);
|
||||||
|
|
||||||
// 重置关锁命令发送标志
|
|
||||||
lockCommandSent = false;
|
|
||||||
}else{
|
}else{
|
||||||
//当前无订单,并且不是管理员开锁的情况下,直接关锁
|
if(ServiceConstants.LOCK_STATUS_CLOSE.equals(device.getLockStatus())){
|
||||||
if(!isAdminUnlocking.equals("1")){
|
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "车辆锁同步关锁", null, null, msg);
|
||||||
if (!lockCommandSent) { // 如果未发送过关锁命令
|
|
||||||
log.info("当前无订单,并且不是管理员开锁的情况下,直接关锁--------" + logEntry.getDevName());
|
|
||||||
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "无订单关锁", null, null, msg);
|
|
||||||
lockCommandSent = true; // 设置标志为已发送
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.EtCapitalFlow;
|
import com.ruoyi.system.domain.EtCapitalFlow;
|
||||||
import com.ruoyi.system.domain.EtWithdraw;
|
import com.ruoyi.system.domain.EtWithdraw;
|
||||||
import com.ruoyi.system.service.IEtCapitalFlowService;
|
import com.ruoyi.system.service.IEtCapitalFlowService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +39,9 @@ public class EtCapitalFlowController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService sysConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询资金流水列表
|
* 查询资金流水列表
|
||||||
*/
|
*/
|
||||||
|
@ -117,6 +122,11 @@ public class EtCapitalFlowController extends BaseController
|
||||||
if(ObjectUtil.isNull(deptId)){
|
if(ObjectUtil.isNull(deptId)){
|
||||||
deptId = getDeptId();
|
deptId = getDeptId();
|
||||||
}
|
}
|
||||||
|
String minimumWithdrawalAmount = sysConfigService.selectConfigByKey("minimum.withdrawal.amount");//最低提现金额
|
||||||
|
BigDecimal minimum = new BigDecimal(minimumWithdrawalAmount);
|
||||||
|
if(etWithdraw.getAmount().compareTo(minimum) < 0){
|
||||||
|
throw new RuntimeException("最低提现金额不能小于"+minimum);
|
||||||
|
}
|
||||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||||
String method = etWithdraw.getMethod();
|
String method = etWithdraw.getMethod();
|
||||||
if(method.equals(ServiceConstants.WITHDRAW_METHOD_WX)){
|
if(method.equals(ServiceConstants.WITHDRAW_METHOD_WX)){
|
||||||
|
|
|
@ -180,6 +180,9 @@ public class AsDevice extends BaseEntityPlus implements Serializable {
|
||||||
/** 是否是管理员开锁:0-否;1-是(用于控制运营区外是否断电判断) */
|
/** 是否是管理员开锁:0-否;1-是(用于控制运营区外是否断电判断) */
|
||||||
private String isAdminUnlocking;
|
private String isAdminUnlocking;
|
||||||
|
|
||||||
|
// /** 是否已经发送过无订单关锁命令:0-否;1-是 */
|
||||||
|
// private String isLocked;
|
||||||
|
|
||||||
/** 正在进行中的订单 */
|
/** 正在进行中的订单 */
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<EtOrder> etOrders;
|
private List<EtOrder> etOrders;
|
||||||
|
|
|
@ -82,6 +82,10 @@ public class EtOrder extends BaseEntity
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private EtRefund etRefund;
|
private EtRefund etRefund;
|
||||||
|
|
||||||
|
/** 退款对象 */
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<EtRefund> etRefunds;
|
||||||
|
|
||||||
/** 设备sn编码 */
|
/** 设备sn编码 */
|
||||||
@Excel(name = "设备sn编码")
|
@Excel(name = "设备sn编码")
|
||||||
private String sn;
|
private String sn;
|
||||||
|
|
|
@ -1584,9 +1584,11 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
device.setLastTime(DateUtils.getNowDate());
|
device.setLastTime(DateUtils.getNowDate());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "辅助还车关锁",orderNo);
|
if(ObjectUtil.isNotNull(device)){
|
||||||
if(responseVo.getCode()!=0){
|
ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "辅助还车关锁",orderNo);
|
||||||
log.info("【还车关锁】远程关锁失败");
|
if(responseVo.getCode()!=0){
|
||||||
|
log.info("【还车关锁】远程关锁失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** 4. 更新车辆状态*/
|
/** 4. 更新车辆状态*/
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
// 退款记录
|
// 退款记录
|
||||||
List<EtRefund> refunds = etRefundService.selectEtRefundByOrderNo(order.getOrderNo());
|
List<EtRefund> refunds = etRefundService.selectEtRefundByOrderNo(order.getOrderNo());
|
||||||
if(ObjectUtils.isNotEmpty(refunds) && refunds.size() > 0){
|
if(ObjectUtils.isNotEmpty(refunds) && refunds.size() > 0){
|
||||||
order.setEtRefund(refunds.get(0));
|
order.setEtRefunds(refunds);
|
||||||
}
|
}
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
@ -441,26 +441,28 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
if(updateEtOrder1 == 0){
|
if(updateEtOrder1 == 0){
|
||||||
throw new ServiceException("押金抵扣失败,更新押金订单失败");
|
throw new ServiceException("押金抵扣失败,更新押金订单失败");
|
||||||
}
|
}
|
||||||
/** 退款剩余押金*/
|
if(afterDeductionFee.compareTo(BigDecimal.ZERO) > 0){
|
||||||
Refund refund = wxPayService.refund(depositOrder, "押金抵扣退款",afterDeductionFee,IdUtils.getOrderNo("ref"));
|
/** 退款剩余押金*/
|
||||||
/** 2.记录退款表 创建退款对象*/
|
Refund refund = wxPayService.refund(depositOrder, "押金抵扣退款",afterDeductionFee,IdUtils.getOrderNo("ref"));
|
||||||
depositOrder.setReason("押金抵扣退款");
|
/** 2.记录退款表 创建退款对象*/
|
||||||
EtRefund refund1= createRefund(depositOrder, afterDeductionFee, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
|
depositOrder.setReason("押金抵扣退款");
|
||||||
int i = etRefundService.insertEtRefund(refund1);
|
EtRefund refund1= createRefund(depositOrder, afterDeductionFee, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||||
if(i == 0){
|
int i = etRefundService.insertEtRefund(refund1);
|
||||||
log.info("【押金抵扣】保存退款对象失败");
|
if(i == 0){
|
||||||
throw new ServiceException("【押金抵扣】,保存退款对象失败");
|
log.info("【押金抵扣】保存退款对象失败");
|
||||||
}
|
throw new ServiceException("【押金抵扣】,保存退款对象失败");
|
||||||
/** 更新用户余额*/
|
}
|
||||||
AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
|
/** 更新用户余额*/
|
||||||
if(asUser!=null){
|
AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
|
||||||
// 更新用户并更新缓存
|
if(asUser!=null){
|
||||||
asUser.setBalance(BigDecimal.ZERO);
|
// 更新用户并更新缓存
|
||||||
if (asUserService.updateUserProfile(asUser) > 0)
|
asUser.setBalance(BigDecimal.ZERO);
|
||||||
{
|
if (asUserService.updateUserProfile(asUser) > 0)
|
||||||
log.info("【押金抵扣成功】更新用户信息成功:"+ JSON.toJSON(asUser));
|
{
|
||||||
}else{
|
log.info("【押金抵扣成功】更新用户信息成功:"+ JSON.toJSON(asUser));
|
||||||
throw new ServiceException("【押金抵扣】,更新用户信息失败");
|
}else{
|
||||||
|
throw new ServiceException("【押金抵扣】,更新用户信息失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user