Compare commits
	
		
			4 Commits
		
	
	
		
			b6272765cb
			...
			368df7be5f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 368df7be5f | |||
| e097b900bb | |||
| f7aeb814d0 | |||
| 428cc5ea64 | 
| 
						 | 
				
			
			@ -6,7 +6,9 @@ import com.alibaba.fastjson2.JSON;
 | 
			
		|||
import com.alibaba.fastjson2.JSONObject;
 | 
			
		||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
 | 
			
		||||
import com.aliyuncs.exceptions.ClientException;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
import com.ruoyi.common.constant.ServiceConstants;
 | 
			
		||||
import com.ruoyi.common.core.controller.BaseController;
 | 
			
		||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.AsArticleClassify;
 | 
			
		||||
| 
						 | 
				
			
			@ -25,12 +27,12 @@ import com.ruoyi.framework.web.service.SysLoginService;
 | 
			
		|||
import com.ruoyi.system.domain.*;
 | 
			
		||||
import com.ruoyi.system.mapper.AsDeviceMapper;
 | 
			
		||||
import com.ruoyi.system.mapper.AsUserMapper;
 | 
			
		||||
import com.ruoyi.system.mapper.EtOrderMapper;
 | 
			
		||||
import com.ruoyi.system.service.*;
 | 
			
		||||
import com.wechat.pay.java.service.payments.model.Transaction;
 | 
			
		||||
import com.wechat.pay.java.service.refund.model.Refund;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Value;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +41,7 @@ import java.math.BigDecimal;
 | 
			
		|||
import java.math.RoundingMode;
 | 
			
		||||
import java.security.InvalidKeyException;
 | 
			
		||||
import java.security.NoSuchAlgorithmException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -92,6 +95,9 @@ public class AppController extends BaseController
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private IEtCouponService etCouponService;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private EtOrderMapper etOrderMapper;
 | 
			
		||||
 | 
			
		||||
    @Value("${aliyun.accessKeyId}")
 | 
			
		||||
    private String accessKeyId;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -684,4 +690,52 @@ public class AppController extends BaseController
 | 
			
		|||
        return success(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 不同状态的订单
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping("/getErrorOrder")
 | 
			
		||||
    public AjaxResult getErrorOrder()
 | 
			
		||||
    {
 | 
			
		||||
        List<EtOrder> errorOrders = new ArrayList<>();
 | 
			
		||||
        // 当前有骑行中的订单
 | 
			
		||||
        List<EtOrder> orders = etOrderService.getCurrentOrderList();
 | 
			
		||||
        for (EtOrder order:orders) {
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if(ObjectUtil.isNotNull(device) && device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_NORMAL)){
 | 
			
		||||
                errorOrders.add(order);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return success(errorOrders);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 不同状态的车辆
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping("/getErrorDevice")
 | 
			
		||||
    public AjaxResult getErrorDevice()
 | 
			
		||||
    {
 | 
			
		||||
        List<AsDevice> errorDevices = new ArrayList<>();
 | 
			
		||||
        // 2. 如果车辆状态是骑行中或临时锁车,查询当前没有订单,则修改车辆状态为待骑行
 | 
			
		||||
        QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
 | 
			
		||||
        wrapper.in("status", "3","4"); // 设备状态正常
 | 
			
		||||
        // 查询所有设备
 | 
			
		||||
        List<AsDevice> allDevices = asDeviceMapper.selectList(wrapper);
 | 
			
		||||
        for(AsDevice device:allDevices){
 | 
			
		||||
            if(ObjectUtil.isNull(etOrderService.getCurrentOrder2(device.getSn()))){
 | 
			
		||||
                errorDevices.add(device);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return success(errorDevices);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 押金抵扣不成功订单
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping("/getDeductionErrorOrder")
 | 
			
		||||
    public AjaxResult getDeductionErrorOrder()
 | 
			
		||||
    {
 | 
			
		||||
        List<EtOrder> orders = etOrderMapper.deductionErrorOrderList();
 | 
			
		||||
        return success(orders);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -922,11 +922,13 @@ public class AppVerifyController extends BaseController
 | 
			
		|||
        logger.info("【获取运营商信息】获取到areaId:【{}】", areaId);
 | 
			
		||||
        SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
 | 
			
		||||
 | 
			
		||||
        BigDecimal todayOrderAmount = getTodayOrderAmount(sysDept);
 | 
			
		||||
        // 更新 sysDept 的余额字段
 | 
			
		||||
        if (sysDept.getBalance() != null) {
 | 
			
		||||
            sysDept.setSettlementAmount(todayOrderAmount);
 | 
			
		||||
            sysDept.setWithdrawableAmount(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
        if(ObjectUtil.isNotNull(sysDept)){
 | 
			
		||||
            BigDecimal todayOrderAmount = getTodayOrderAmount(sysDept);
 | 
			
		||||
            // 更新 sysDept 的余额字段
 | 
			
		||||
            if (sysDept.getBalance() != null) {
 | 
			
		||||
                sysDept.setSettlementAmount(todayOrderAmount);
 | 
			
		||||
                sysDept.setWithdrawableAmount(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return success(sysDept);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1169,7 +1171,7 @@ public class AppVerifyController extends BaseController
 | 
			
		|||
        }
 | 
			
		||||
        // 当前有骑行中的订单
 | 
			
		||||
        EtOrder currentOrder = etOrderService.getCurrentOrder(newDevice.getSn());
 | 
			
		||||
        if(ObjectUtil.isNotNull(currentOrder)){
 | 
			
		||||
        if(ObjectUtil.isNotNull(currentOrder) && !currentOrder.getOrderNo().equals(orderNo)){
 | 
			
		||||
            return error("当前车辆有骑行中的订单,请换车");
 | 
			
		||||
        }
 | 
			
		||||
        //低电量不得骑行判断
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,6 +46,17 @@ public class EtHardwareVersionController extends BaseController
 | 
			
		|||
        return getDataTable(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本列表
 | 
			
		||||
     */
 | 
			
		||||
    @PreAuthorize("@ss.hasPermi('system:hardwareVersion:list')")
 | 
			
		||||
    @GetMapping("/list/exclude")
 | 
			
		||||
    public AjaxResult listExclude(EtHardwareVersion etHardwareVersion)
 | 
			
		||||
    {
 | 
			
		||||
        List<EtHardwareVersion> list = etHardwareVersionService.selectEtHardwareVersionListExclude(etHardwareVersion);
 | 
			
		||||
        return success(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 导出硬件版本列表
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,41 +1,29 @@
 | 
			
		|||
package com.ruoyi.web.controller.system;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.alibaba.fastjson2.JSON;
 | 
			
		||||
import com.ruoyi.common.constant.ServiceConstants;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.AsUser;
 | 
			
		||||
import com.ruoyi.common.core.domain.model.LoginUser;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.framework.web.service.TokenService;
 | 
			
		||||
import com.ruoyi.system.domain.EtOperatingArea;
 | 
			
		||||
import com.ruoyi.system.domain.vo.RechargeVo;
 | 
			
		||||
import com.ruoyi.system.service.IAsUserService;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PutMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.DeleteMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PathVariable;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
import com.ruoyi.common.constant.ServiceConstants;
 | 
			
		||||
import com.ruoyi.common.core.controller.BaseController;
 | 
			
		||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.enums.BusinessType;
 | 
			
		||||
import com.ruoyi.system.domain.EtOrder;
 | 
			
		||||
import com.ruoyi.system.service.IEtOrderService;
 | 
			
		||||
import com.ruoyi.common.utils.poi.ExcelUtil;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.AsUser;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.enums.BusinessType;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.utils.poi.ExcelUtil;
 | 
			
		||||
import com.ruoyi.framework.web.service.TokenService;
 | 
			
		||||
import com.ruoyi.system.domain.EtOrder;
 | 
			
		||||
import com.ruoyi.system.domain.vo.RechargeVo;
 | 
			
		||||
import com.ruoyi.system.service.IAsUserService;
 | 
			
		||||
import com.ruoyi.system.service.IEtOrderService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 订单Controller
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,15 +105,17 @@ public class SysDeptController extends BaseController
 | 
			
		|||
        AjaxResult ajax = AjaxResult.success();
 | 
			
		||||
        deptService.checkDeptDataScope(deptId);
 | 
			
		||||
        SysDept sysDept = deptService.selectDeptById(deptId);
 | 
			
		||||
        BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);
 | 
			
		||||
        if(ObjectUtil.isNotNull(sysDept)){
 | 
			
		||||
            BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);
 | 
			
		||||
 | 
			
		||||
        if(todayOrderAmount.compareTo(sysDept.getBalance()) > 0){
 | 
			
		||||
            todayOrderAmount = sysDept.getBalance();
 | 
			
		||||
        }
 | 
			
		||||
        // 更新 sysDept 的余额字段
 | 
			
		||||
        if (sysDept.getBalance() != null) {
 | 
			
		||||
            sysDept.setSettlementAmount(todayOrderAmount);
 | 
			
		||||
            sysDept.setWithdrawableAmount(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
            if(todayOrderAmount.compareTo(sysDept.getBalance()) > 0){
 | 
			
		||||
                todayOrderAmount = sysDept.getBalance();
 | 
			
		||||
            }
 | 
			
		||||
            // 更新 sysDept 的余额字段
 | 
			
		||||
            if (sysDept.getBalance() != null) {
 | 
			
		||||
                sysDept.setSettlementAmount(todayOrderAmount);
 | 
			
		||||
                sysDept.setWithdrawableAmount(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ajax.put(AjaxResult.DATA_TAG,sysDept);
 | 
			
		||||
| 
						 | 
				
			
			@ -260,10 +262,12 @@ public class SysDeptController extends BaseController
 | 
			
		|||
        }
 | 
			
		||||
        AjaxResult ajax = AjaxResult.success();
 | 
			
		||||
        SysDept sysDept = deptService.selectDeptById(deptId);
 | 
			
		||||
        BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);//获取今日金额
 | 
			
		||||
        // 更新 sysDept 的余额字段
 | 
			
		||||
        if (sysDept.getBalance() != null) {
 | 
			
		||||
            sysDept.setBalance(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
        if(ObjectUtil.isNotNull(sysDept)){
 | 
			
		||||
            BigDecimal todayOrderAmount = getTodayOrderAmount(deptId);//获取今日金额
 | 
			
		||||
            // 更新 sysDept 的余额字段
 | 
			
		||||
            if (sysDept.getBalance() != null) {
 | 
			
		||||
                sysDept.setBalance(sysDept.getBalance().subtract(todayOrderAmount));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ajax.put(AjaxResult.DATA_TAG, sysDept);
 | 
			
		||||
        return ajax;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,4 +89,11 @@ public class EtCapitalFlow extends BaseEntity
 | 
			
		|||
    @TableField(exist = false)
 | 
			
		||||
    private String[] typeList;
 | 
			
		||||
 | 
			
		||||
    /** 型号id   */
 | 
			
		||||
    private Long modelId;
 | 
			
		||||
 | 
			
		||||
    /** 型号   */
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private String model;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,4 +57,8 @@ public class RechargeVo {
 | 
			
		|||
    @Excel(name = "是否已退款")
 | 
			
		||||
    private Boolean isRefunded;
 | 
			
		||||
 | 
			
		||||
    /** 是否押金抵扣:0-否;1-是 */
 | 
			
		||||
    @Excel(name = "是否押金抵扣")
 | 
			
		||||
    private String depositDeduction;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
package com.ruoyi.system.mapper;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
import com.ruoyi.common.enums.BusinessType;
 | 
			
		||||
import com.ruoyi.system.domain.AsDevice;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +71,7 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
 | 
			
		|||
     * @param asDevice 设备
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    @Log(title = "修改设备", businessType = BusinessType.UPDATE)
 | 
			
		||||
    public int updateAsDevice(AsDevice asDevice);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,14 @@ public interface EtHardwareVersionMapper
 | 
			
		|||
     */
 | 
			
		||||
    public List<EtHardwareVersion> selectEtHardwareVersionList(EtHardwareVersion etHardwareVersion);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本列表(排除父节点)
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 硬件版本集合
 | 
			
		||||
     */
 | 
			
		||||
    public List<EtHardwareVersion> selectEtHardwareVersionListExclude(EtHardwareVersion etHardwareVersion);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增硬件版本
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,14 @@ public interface EtOrderMapper
 | 
			
		|||
     */
 | 
			
		||||
    public List<EtOrder> selectEtOrderList(EtOrder etOrder);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询订单列表(不带路由)
 | 
			
		||||
     *
 | 
			
		||||
     * @param etOrder 订单
 | 
			
		||||
     * @return 订单集合
 | 
			
		||||
     */
 | 
			
		||||
    public List<EtOrder> selectEtOrderListNoRoute(EtOrder etOrder);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增订单
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -312,4 +320,14 @@ public interface EtOrderMapper
 | 
			
		|||
     * 7天前未支付的订单
 | 
			
		||||
     */
 | 
			
		||||
    List<EtOrder> selectToBePaidEtOrderList();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询所有正在骑行中的订单
 | 
			
		||||
     */
 | 
			
		||||
    List<EtOrder> getCurrentOrderList();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 押金抵扣不成功的修复
 | 
			
		||||
     */
 | 
			
		||||
    List<EtOrder> deductionErrorOrderList();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -390,6 +390,11 @@ public interface IAsDeviceService extends IService<AsDevice>
 | 
			
		|||
     */
 | 
			
		||||
    boolean updateLatestLocation(String sn);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取最新的位置信息
 | 
			
		||||
     */
 | 
			
		||||
    double[] getLatestLocation(String mac);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据时间查询车辆轨迹
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,15 +5,15 @@ import com.ruoyi.system.domain.EtHardwareVersion;
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * 硬件版本Service接口
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author qiuzhenzhao
 | 
			
		||||
 * @date 2024-07-22
 | 
			
		||||
 */
 | 
			
		||||
public interface IEtHardwareVersionService 
 | 
			
		||||
public interface IEtHardwareVersionService
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 硬件版本主键
 | 
			
		||||
     * @return 硬件版本
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -21,15 +21,24 @@ public interface IEtHardwareVersionService
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本列表
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 硬件版本集合
 | 
			
		||||
     */
 | 
			
		||||
    public List<EtHardwareVersion> selectEtHardwareVersionList(EtHardwareVersion etHardwareVersion);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本列表(排除父节点)
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 硬件版本集合
 | 
			
		||||
     */
 | 
			
		||||
    public List<EtHardwareVersion> selectEtHardwareVersionListExclude(EtHardwareVersion etHardwareVersion);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增硬件版本
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +46,7 @@ public interface IEtHardwareVersionService
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改硬件版本
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +54,7 @@ public interface IEtHardwareVersionService
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * 批量删除硬件版本
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param ids 需要删除的硬件版本主键集合
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -53,7 +62,7 @@ public interface IEtHardwareVersionService
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除硬件版本信息
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 硬件版本主键
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,6 +185,16 @@ public interface IEtOrderService
 | 
			
		|||
     */
 | 
			
		||||
    EtOrder getCurrentOrder(String sn);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取当前正在骑行中的订单
 | 
			
		||||
     */
 | 
			
		||||
    EtOrder getCurrentOrder2(String sn);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询所有正在骑行中的订单
 | 
			
		||||
     */
 | 
			
		||||
    List<EtOrder> getCurrentOrderList();
 | 
			
		||||
 | 
			
		||||
//    /**
 | 
			
		||||
//     * 判断当前是否有正在骑行中的订单
 | 
			
		||||
//     */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -971,7 +971,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
        Boolean inOrderBySn = etOrderService.isInOrderBySn(sn);//有进行中的订单,跳过
 | 
			
		||||
        if(!inOrderBySn){
 | 
			
		||||
            AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
			
		||||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//车辆解禁
 | 
			
		||||
            int device = asDeviceMapper.updateAsDevice(asDevice);
 | 
			
		||||
            if(device==0){
 | 
			
		||||
                log.info("车辆解禁状态失败");
 | 
			
		||||
| 
						 | 
				
			
			@ -1455,7 +1455,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);
 | 
			
		||||
        }else{
 | 
			
		||||
            if(!asDevice.getStatus().equals(ServiceConstants.VEHICLE_STATUS_NOT_LISTING)){
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//管理员锁车
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        asDevice.setIsAdminUnlocking("0");
 | 
			
		||||
| 
						 | 
				
			
			@ -1487,7 +1487,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);
 | 
			
		||||
        }else{
 | 
			
		||||
            if(!asDevice.getStatus().equals(ServiceConstants.VEHICLE_STATUS_NOT_LISTING)){
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//管理员锁车
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        asDevice.setIsAdminUnlocking("0");
 | 
			
		||||
| 
						 | 
				
			
			@ -1602,7 +1602,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
                throw new ServiceException("【车辆超时预约】:更新订单状态失败");
 | 
			
		||||
            }
 | 
			
		||||
            // 改变车辆状态
 | 
			
		||||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
            asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//定时取消预约
 | 
			
		||||
            asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
 | 
			
		||||
            int device = asDeviceMapper.updateAsDevice(asDevice);
 | 
			
		||||
            if(device==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -1644,7 +1644,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
        if(i==0){
 | 
			
		||||
            throw new ServiceException("【取消预约】:更新订单失败");
 | 
			
		||||
        }
 | 
			
		||||
        asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
        asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//取消预约
 | 
			
		||||
        asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
 | 
			
		||||
        int device = asDeviceMapper.updateAsDevice(asDevice);
 | 
			
		||||
        if(device==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -1777,7 +1777,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
            }
 | 
			
		||||
            if(ObjectUtil.isNotNull(device)){
 | 
			
		||||
                /** 4. 更新车辆状态*/
 | 
			
		||||
                device.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
                device.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//还车
 | 
			
		||||
                device.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
			
		||||
                int deviceUpdate = asDeviceMapper.updateAsDevice(device);
 | 
			
		||||
                if(deviceUpdate==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -2244,7 +2244,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
                inCircle = true;
 | 
			
		||||
                break;
 | 
			
		||||
            }else{
 | 
			
		||||
                log.info("位置【{},{}】在停车区【{}】内",longitude,latitude,etParkingArea.getParkingName());
 | 
			
		||||
                log.info("位置【{},{}】不在停车区【{}】内",longitude,latitude,etParkingArea.getParkingName());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return inCircle;
 | 
			
		||||
| 
						 | 
				
			
			@ -2495,7 +2495,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 判断是否在停车区申请人
 | 
			
		||||
     * 判断是否在停车区
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public IsInParkingAreaVo isInParkingArea(String longitude, String latitude,String areaId,String sn){
 | 
			
		||||
| 
						 | 
				
			
			@ -2504,13 +2504,17 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
        IsInParkingAreaVo isInParkingAreaVo = new IsInParkingAreaVo();
 | 
			
		||||
        if(StringUtils.isNotEmpty(sn)){
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
 | 
			
		||||
            String longitude1 = device.getLongitude();
 | 
			
		||||
            String latitude1 = device.getLatitude();
 | 
			
		||||
            Boolean parkingZoneByLocation = isParkingZoneByLocation(longitude1, latitude1, Long.parseLong(areaId));
 | 
			
		||||
            if(parkingZoneByLocation){
 | 
			
		||||
                isInParkingAreaVo.setIsInParkingArea(parkingZoneByLocation);
 | 
			
		||||
                isInParkingAreaVo.setParkingReturn("1".equals(area.getParkingReturn()));
 | 
			
		||||
                return isInParkingAreaVo;
 | 
			
		||||
            double[] latestLocation = getLatestLocation(device.getMac());
 | 
			
		||||
            if(ObjectUtil.isNotNull(latestLocation)){
 | 
			
		||||
                BigDecimal longitude1 = new BigDecimal(latestLocation[1]).setScale(8, RoundingMode.HALF_UP);
 | 
			
		||||
                BigDecimal latitude1 = new BigDecimal(latestLocation[0]).setScale(8, RoundingMode.HALF_UP);
 | 
			
		||||
                log.info("【判断是否在停车区】,lon:{},lat:{}",longitude1,latitude1);
 | 
			
		||||
                Boolean parkingZoneByLocation = isParkingZoneByLocation(longitude1.toString(), latitude1.toString(), Long.parseLong(areaId));
 | 
			
		||||
                if(parkingZoneByLocation){
 | 
			
		||||
                    isInParkingAreaVo.setIsInParkingArea(true);
 | 
			
		||||
                    isInParkingAreaVo.setParkingReturn("1".equals(area.getParkingReturn()));
 | 
			
		||||
                    return isInParkingAreaVo;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        Boolean parkingZoneByLocation = isParkingZoneByLocation(longitude, latitude, Long.parseLong(areaId));
 | 
			
		||||
| 
						 | 
				
			
			@ -2736,6 +2740,48 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
 | 
			
		|||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取最新的位置信息
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    @SneakyThrows
 | 
			
		||||
    public double[] getLatestLocation(String mac) {
 | 
			
		||||
        AsDevice device = asDeviceMapper.selectAsDeviceByMac(mac);
 | 
			
		||||
        String token = Token.getToken();
 | 
			
		||||
        DataPointRes datapoints = historyDatapoints(mac, token);
 | 
			
		||||
        if(datapoints.getCode() == 0){
 | 
			
		||||
            Data data = datapoints.getData();
 | 
			
		||||
            List<Datastream> datastreams = data.getDevices();
 | 
			
		||||
            for (Datastream datastream: datastreams) {
 | 
			
		||||
                List<Datapoint> datapointList = datastream.getDatastreams();
 | 
			
		||||
                if(ObjectUtil.isNotNull(datapointList)){
 | 
			
		||||
                    for (Datapoint datapoint:datapointList) {
 | 
			
		||||
                        if(datapoint.getId().equals(IotConstants.ONENET_LOCATION)){
 | 
			
		||||
                            String string = JSON.toJSONString(datapoint.getValue());
 | 
			
		||||
                            String at = datapoint.getAt();
 | 
			
		||||
                            if(StrUtil.isNotBlank(string)){
 | 
			
		||||
                                LocationVo locationVo = JSONObject.parseObject(string, LocationVo.class);
 | 
			
		||||
                                log.info("【手动更新】: locationVo---【{}】" , JSON.toJSONString(locationVo));
 | 
			
		||||
                                double[] doubles = CommonUtil.coordinateConvert(locationVo.getLon(), locationVo.getLat());
 | 
			
		||||
                                BigDecimal lat = new BigDecimal(doubles[0]).setScale(8, RoundingMode.HALF_UP);
 | 
			
		||||
                                BigDecimal lon = new BigDecimal(doubles[1]).setScale(8, RoundingMode.HALF_UP);
 | 
			
		||||
                                log.info("转换后的GCJ02经纬度:" + lon + "---" + lat);
 | 
			
		||||
                                if(BigDecimal.ZERO.compareTo(lon) != 0 && BigDecimal.ZERO.compareTo(lat) != 0){
 | 
			
		||||
                                    /** 计算电量和里程后更新设备*/
 | 
			
		||||
                                    int i = updateDevice(at,locationVo, device, lon, lat);
 | 
			
		||||
                                    return doubles;
 | 
			
		||||
                                }else{
 | 
			
		||||
                                    noLocationUpdateDevice(at,locationVo,device);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 计算电量和里程后更新设备*/
 | 
			
		||||
    public int updateDevice(String at,LocationVo locationVo, AsDevice device, BigDecimal lon, BigDecimal lat) {
 | 
			
		||||
        device.setLatitude(lat.toString());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,6 +124,9 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private CallbackService callbackService;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private EtModelMapper etModelMapper;
 | 
			
		||||
 | 
			
		||||
    @Value("${aliyun.accessKeyId}")
 | 
			
		||||
    private String accessKeyId;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -684,6 +687,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
            }
 | 
			
		||||
            capitalFlow.setPayType(payType);
 | 
			
		||||
            capitalFlow.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if (device != null) {
 | 
			
		||||
                capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
            }
 | 
			
		||||
            logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
            int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
            if(i==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -731,6 +738,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
            }
 | 
			
		||||
            capitalFlow.setPayType(payType);
 | 
			
		||||
            capitalFlow.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if (device != null) {
 | 
			
		||||
                capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
            }
 | 
			
		||||
            logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
            int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
            if(i==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -843,6 +854,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
            }
 | 
			
		||||
            capitalFlow.setPayType(payType);
 | 
			
		||||
            capitalFlow.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if (device != null) {
 | 
			
		||||
                capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
            }
 | 
			
		||||
            logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
            int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
            if(i==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -890,6 +905,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
            }
 | 
			
		||||
            capitalFlow.setPayType(payType);
 | 
			
		||||
            capitalFlow.setCreateTime(order.getPayTime());
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if (device != null) {
 | 
			
		||||
                capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
            }
 | 
			
		||||
            logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
            int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
            if(i==0){
 | 
			
		||||
| 
						 | 
				
			
			@ -953,6 +972,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
        }
 | 
			
		||||
        capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX);
 | 
			
		||||
        capitalFlow.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
        AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
        if (device != null) {
 | 
			
		||||
            capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("【保存资金流水】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
        int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
        return i;
 | 
			
		||||
| 
						 | 
				
			
			@ -1010,6 +1033,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
        }
 | 
			
		||||
        capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX);
 | 
			
		||||
        capitalFlow.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
        AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
        if (device != null) {
 | 
			
		||||
            capitalFlow.setModelId(device.getModelId());
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("【保存资金流水】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
 | 
			
		||||
        int i = etCapitalFlowService.insertEtCapitalFlow(capitalFlow);
 | 
			
		||||
        return i;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,15 @@
 | 
			
		|||
package com.ruoyi.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.ruoyi.common.utils.DateUtils;
 | 
			
		||||
import com.ruoyi.system.mapper.AsDeviceMapper;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import com.ruoyi.system.mapper.EtHardwareVersionMapper;
 | 
			
		||||
import com.ruoyi.system.domain.EtHardwareVersion;
 | 
			
		||||
import com.ruoyi.system.mapper.AsDeviceMapper;
 | 
			
		||||
import com.ruoyi.system.mapper.EtHardwareVersionMapper;
 | 
			
		||||
import com.ruoyi.system.service.IEtHardwareVersionService;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 硬件版本Service业务层处理
 | 
			
		||||
| 
						 | 
				
			
			@ -86,6 +86,18 @@ public class EtHardwareVersionServiceImpl implements IEtHardwareVersionService
 | 
			
		|||
        return etHardwareVersions;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询硬件版本列表(排除父节点)
 | 
			
		||||
     *
 | 
			
		||||
     * @param etHardwareVersion 硬件版本
 | 
			
		||||
     * @return 硬件版本
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<EtHardwareVersion> selectEtHardwareVersionListExclude(EtHardwareVersion etHardwareVersion) {
 | 
			
		||||
        List<EtHardwareVersion> etHardwareVersions = etHardwareVersionMapper.selectEtHardwareVersionListExclude(etHardwareVersion);
 | 
			
		||||
        return etHardwareVersions;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增硬件版本
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +107,12 @@ public class EtHardwareVersionServiceImpl implements IEtHardwareVersionService
 | 
			
		|||
    @Override
 | 
			
		||||
    public int insertEtHardwareVersion(EtHardwareVersion etHardwareVersion)
 | 
			
		||||
    {
 | 
			
		||||
        if(ObjectUtil.isNull(etHardwareVersion.getParentId()) || etHardwareVersion.getParentId() == 0){
 | 
			
		||||
            etHardwareVersion.setAncestors("0");
 | 
			
		||||
        }else{
 | 
			
		||||
            EtHardwareVersion info = etHardwareVersionMapper.selectEtHardwareVersionById(etHardwareVersion.getParentId());
 | 
			
		||||
            etHardwareVersion.setAncestors(info.getAncestors() + "," + etHardwareVersion.getParentId());
 | 
			
		||||
        }
 | 
			
		||||
        etHardwareVersion.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
        return etHardwareVersionMapper.insertEtHardwareVersion(etHardwareVersion);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -307,13 +307,14 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
        if(StrUtil.isBlank(status) || "1".equals(status)){
 | 
			
		||||
            etOrder.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
 | 
			
		||||
            etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
 | 
			
		||||
            List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder);
 | 
			
		||||
            List<EtOrder> etOrders = etOrderMapper.selectEtOrderListNoRoute(etOrder);
 | 
			
		||||
            etOrders.forEach(etOrder1 -> {
 | 
			
		||||
                RechargeVo rechargeVo = new RechargeVo();
 | 
			
		||||
                BeanUtils.copyProperties(etOrder1,rechargeVo);
 | 
			
		||||
                rechargeVo.setRechargeStatus(ServiceConstants.RECHARGE_STATUS_SUCCESS);
 | 
			
		||||
                rechargeVo.setRechargeType(ServiceConstants.ORDER_TYPE_DEPOSIT);
 | 
			
		||||
                rechargeVo.setTotalFee(etOrder1.getPayFee());
 | 
			
		||||
                rechargeVo.setDepositDeduction(etOrder1.getDepositDeduction());
 | 
			
		||||
                List<EtRefund> etRefunds = etRefundMapper.selectEtRefundByOrderNo(etOrder1.getOrderNo());
 | 
			
		||||
                if(ObjectUtil.isNull(etRefunds) || etRefunds.size() == 0){
 | 
			
		||||
                    rechargeVo.setIsRefunded(false);
 | 
			
		||||
| 
						 | 
				
			
			@ -332,7 +333,7 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
            PageUtils.startPage();
 | 
			
		||||
            List<EtRefund> etRefunds = etRefundMapper.selectEtRefundList(refund);
 | 
			
		||||
            etRefunds.forEach(etRefund -> {
 | 
			
		||||
                AsUser asUser = asUserService.selectUserById(etRefund.getUserId());
 | 
			
		||||
                AsUser asUser = asUserMapper.selectUserById(etRefund.getUserId());
 | 
			
		||||
                RechargeVo rechargeVo = new RechargeVo();
 | 
			
		||||
                BeanUtils.copyProperties(etRefund,rechargeVo);
 | 
			
		||||
                rechargeVo.setOutTradeNo(etRefund.getRefundNo());
 | 
			
		||||
| 
						 | 
				
			
			@ -370,6 +371,34 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取当前正在骑行中的订单
 | 
			
		||||
     * @param sn
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public EtOrder getCurrentOrder2(String sn) {
 | 
			
		||||
        EtOrder etOrder = new EtOrder();
 | 
			
		||||
        etOrder.setSn(sn);
 | 
			
		||||
        etOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
 | 
			
		||||
        List<EtOrder> etOrders = etOrderMapper.selectEtOrderListNoRoute(etOrder);
 | 
			
		||||
        if(ObjectUtil.isNotEmpty(etOrders)){
 | 
			
		||||
            return etOrders.get(0);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询所有正在骑行中的订单
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<EtOrder> getCurrentOrderList() {
 | 
			
		||||
        List<EtOrder> etOrders = etOrderMapper.getCurrentOrderList();
 | 
			
		||||
        return etOrders;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//    /**
 | 
			
		||||
//     * 获取当前正在骑行中的订单数量
 | 
			
		||||
//     * @param sn
 | 
			
		||||
| 
						 | 
				
			
			@ -670,11 +699,13 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
            Refund refund = wxPayService.refund(depositOrder, "还车审核通过后退押金",residualDeposit,IdUtils.getOrderNo("ref"));
 | 
			
		||||
            /** 3.记录退款表  创建退款对象*/
 | 
			
		||||
            depositOrder.setReason("还车审核通过后退押金");
 | 
			
		||||
            EtRefund refund1= createRefund(depositOrder, residualDeposit, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
 | 
			
		||||
            int i = etRefundService.insertEtRefund(refund1);
 | 
			
		||||
            if(i == 0){
 | 
			
		||||
                log.info("【还车审核通过】保存退款对象失败");
 | 
			
		||||
                throw new ServiceException("【还车审核通过】,保存退款对象失败");
 | 
			
		||||
            if(deductionAmount.compareTo(BigDecimal.ZERO) > 0){
 | 
			
		||||
                EtRefund refund1= createRefund(depositOrder, residualDeposit, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
 | 
			
		||||
                int i = etRefundService.insertEtRefund(refund1);
 | 
			
		||||
                if(i == 0){
 | 
			
		||||
                    log.info("【还车审核通过】保存退款对象失败");
 | 
			
		||||
                    throw new ServiceException("【还车审核通过】,保存退款对象失败");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            /** 4.更新用户余额*/
 | 
			
		||||
            AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
 | 
			
		||||
| 
						 | 
				
			
			@ -688,7 +719,7 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
                    throw new ServiceException("【还车审核通过】,更新用户信息失败");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if(deductionAmount.compareTo(BigDecimal.ZERO) > 0){//抵扣金额大于0时,增加车损收入
 | 
			
		||||
            if(deductionAmount.compareTo(BigDecimal.ZERO) >= 0){//抵扣金额大于0时,增加车损收入
 | 
			
		||||
                /** 押金抵扣后生成资金流水记录 */
 | 
			
		||||
                etOrder.setPayFee(deductionAmount);
 | 
			
		||||
                callbackService.capitalFlowRecords(etOrder,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_VEHICLE_DAMAGE,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_YJ);
 | 
			
		||||
| 
						 | 
				
			
			@ -1835,7 +1866,7 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
			
		|||
            }
 | 
			
		||||
            Boolean execute = transactionTemplate.execute(e -> {
 | 
			
		||||
                asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
                asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//换车关锁
 | 
			
		||||
                asDevice.setIsAdminUnlocking("0");
 | 
			
		||||
                int device = asDeviceMapper.updateAsDevice(asDevice);
 | 
			
		||||
                if(device==0){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ package com.ruoyi.system.task;
 | 
			
		|||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import com.alibaba.fastjson2.JSON;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.ruoyi.common.constant.Constants;
 | 
			
		||||
import com.ruoyi.common.constant.ServiceConstants;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.AsUser;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +16,6 @@ import com.ruoyi.common.utils.uuid.IdUtils;
 | 
			
		|||
import com.ruoyi.system.domain.*;
 | 
			
		||||
import com.ruoyi.system.mapper.*;
 | 
			
		||||
import com.ruoyi.system.service.*;
 | 
			
		||||
import com.wechat.pay.java.service.payments.model.Transaction;
 | 
			
		||||
import com.wechat.pay.java.service.refund.model.Refund;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,6 +86,9 @@ public class EtTask {
 | 
			
		|||
    @Resource
 | 
			
		||||
    private EtLocationLogMapper etLocationLogMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IAsDeviceService deviceService;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -373,7 +376,7 @@ public class EtTask {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *  开始骑行未结束的订单,10秒算一次距离
 | 
			
		||||
     *  开始骑行未结束的订单,1分钟算一次距离
 | 
			
		||||
     *  cron: 0 5 0 * * ?
 | 
			
		||||
     */
 | 
			
		||||
    public void computeDistance(){
 | 
			
		||||
| 
						 | 
				
			
			@ -383,7 +386,9 @@ public class EtTask {
 | 
			
		|||
        order.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
 | 
			
		||||
        List<EtOrder> orders = etOrderService.selectEtOrderList(order);
 | 
			
		||||
        for(EtOrder etOrder:orders){
 | 
			
		||||
            String tripRouteStr = etOrder.getTripRouteStr();
 | 
			
		||||
            String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getNowDate());
 | 
			
		||||
            String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, etOrder.getUnlockTime());
 | 
			
		||||
            String tripRouteStr = deviceService.trajectory(etOrder.getSn(), startTime, endTime);
 | 
			
		||||
            if(StrUtil.isNotBlank(tripRouteStr)){
 | 
			
		||||
                double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
 | 
			
		||||
                double v = GeoUtils.calculateTotalDistance(doubles);
 | 
			
		||||
| 
						 | 
				
			
			@ -408,6 +413,52 @@ public class EtTask {
 | 
			
		|||
        etLocationLogMapper.deleteLocationLogByCreateTime();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *  车辆与订单状态同步
 | 
			
		||||
     *  1. 如果有正在骑行中的订单,车辆的状态是待骑行的,改成临时锁车,不发命令
 | 
			
		||||
     *  2. 如果车辆状态是骑行中或临时锁车,查询订单没有订单,则修改车辆状态为待骑行
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public void stausSynchronization(){
 | 
			
		||||
        log.info("-------------------【定时任务】车辆与订单状态同步-------------------");
 | 
			
		||||
        // 当前有骑行中的订单
 | 
			
		||||
        List<EtOrder> orders = etOrderService.getCurrentOrderList();
 | 
			
		||||
        for (EtOrder order:orders) {
 | 
			
		||||
            AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
 | 
			
		||||
            if(ObjectUtil.isNotNull(device) && device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_NORMAL)){
 | 
			
		||||
                AsDevice device1 = new AsDevice();
 | 
			
		||||
                device1.setSn(device.getSn());
 | 
			
		||||
                device1.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);
 | 
			
		||||
                device1.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
			
		||||
                int i = asDeviceMapper.updateAsDeviceBySn(device1);
 | 
			
		||||
                if(i>0){
 | 
			
		||||
                    log.info("【定时任务】车辆状态修改为临时锁车:【sn="+device.getSn()+"】");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 2. 如果车辆状态是骑行中或临时锁车,查询当前没有订单,则修改车辆状态为待骑行
 | 
			
		||||
        QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
 | 
			
		||||
        wrapper.in("status", "3","4"); // 设备状态正常
 | 
			
		||||
        // 查询所有设备
 | 
			
		||||
        List<AsDevice> allDevices = asDeviceMapper.selectList(wrapper);
 | 
			
		||||
        for(AsDevice device:allDevices){
 | 
			
		||||
            if(ObjectUtil.isNotNull(etOrderService.getCurrentOrder2(device.getSn()))){
 | 
			
		||||
                continue;
 | 
			
		||||
            }else{
 | 
			
		||||
                AsDevice device1 = new AsDevice();
 | 
			
		||||
                device1.setSn(device.getSn());
 | 
			
		||||
                device1.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
 | 
			
		||||
                device1.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
			
		||||
                int i = asDeviceMapper.updateAsDeviceBySn(device1);
 | 
			
		||||
               if(i>0){
 | 
			
		||||
                   log.info("【定时任务】车辆状态修改为待骑行:【sn="+device.getSn()+"】");
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 写一个定时,如果车辆是骑行中,没有现在骑行中的订单,则关闭车辆
 | 
			
		||||
    /**
 | 
			
		||||
     *  自动押金抵扣
 | 
			
		||||
| 
						 | 
				
			
			@ -427,42 +478,30 @@ public class EtTask {
 | 
			
		|||
                    updateOrderPaid(order);
 | 
			
		||||
                }else{
 | 
			
		||||
                    etOrderService.deduction(order);
 | 
			
		||||
//                    if(StrUtil.isNotBlank(order.getOutTradeNo())){
 | 
			
		||||
//                        String outTradeNo = order.getOutTradeNo();
 | 
			
		||||
//                        log.info("【自动押金抵扣】订单【{}】,有outTradeNo = 【{}】", order.getOrderNo(),outTradeNo);
 | 
			
		||||
//                        // 如果原来有outtradeno,去查询一次,查询是否支付过
 | 
			
		||||
//                        Transaction transaction = wxPayService.queryOrderByOutTradeNo(outTradeNo);
 | 
			
		||||
//                        if(Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
 | 
			
		||||
//                            // 订单已支付
 | 
			
		||||
//                            order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
 | 
			
		||||
//                            order.setPayTime(DateUtils.getNowDate());
 | 
			
		||||
//                            order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
 | 
			
		||||
//                            order.setPayType(ServiceConstants.PAY_TYPE_WX);
 | 
			
		||||
//                            order.setMark("主动查询-骑行支付");
 | 
			
		||||
//                            int updateEtOrder = etOrderMapper.updateEtOrder(order);
 | 
			
		||||
//                            if (updateEtOrder == 0) {
 | 
			
		||||
//                                throw new ServiceException("押金抵扣失败,更新骑行订单失败");
 | 
			
		||||
//                            }
 | 
			
		||||
//                        }else{
 | 
			
		||||
//                            updateOrderPaid(order);
 | 
			
		||||
//                        }
 | 
			
		||||
//                    }else{
 | 
			
		||||
//                        // 3. 查询用户是否还有未退款的押金,如果有,则进行押金抵扣,如果没有,则结束订单
 | 
			
		||||
//                        List<EtOrder> yjOrders = etRefundService.checkUserDeposit(order.getUserId());
 | 
			
		||||
//                        if(ObjectUtil.isNotNull(yjOrders) && yjOrders.size()>0){
 | 
			
		||||
//                            // 取出最后一个订单对象
 | 
			
		||||
//                            yjOrders.sort(Comparator.comparing(EtOrder::getCreateTime)); // 按create_time升序排序
 | 
			
		||||
//                            EtOrder lastOrder = yjOrders.get(yjOrders.size() - 1); // 获取最后一个订单对象
 | 
			
		||||
//                            etOrderService.deduction();
 | 
			
		||||
//                        }else{
 | 
			
		||||
//                            updateOrderPaid(order);
 | 
			
		||||
//                        }
 | 
			
		||||
//                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *  押金抵扣不成功的修复
 | 
			
		||||
     *  1. 找出所有押金抵扣不成功的订单
 | 
			
		||||
     *  2. 将状态改成已结束
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public void deductionErrorOrder(){
 | 
			
		||||
        log.info("-------------------【定时任务】押金抵扣不成功的修复---开始----------------");
 | 
			
		||||
        List<EtOrder> orders = etOrderMapper.deductionErrorOrderList();
 | 
			
		||||
        for (EtOrder order:orders) {
 | 
			
		||||
            EtOrder order1 = new EtOrder();
 | 
			
		||||
            order1.setOrderId(order.getOrderId());
 | 
			
		||||
            order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
 | 
			
		||||
            order1.setMark("押金抵扣修复,订单已结束");
 | 
			
		||||
            etOrderMapper.updateEtOrder(order1);
 | 
			
		||||
        }
 | 
			
		||||
        log.info("-------------------【定时任务】押金抵扣不成功的修复---结束----------------");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** 更新订单为已支付*/
 | 
			
		||||
    private void updateOrderPaid(EtOrder order) {
 | 
			
		||||
        order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,10 +24,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        <result property="partnerDividend"    column="partner_dividend"    />
 | 
			
		||||
        <result property="payType"    column="pay_type"    />
 | 
			
		||||
        <result property="createTime"    column="create_time"    />
 | 
			
		||||
        <result property="modelId"    column="model_id"    />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <sql id="selectEtCapitalFlowVo">
 | 
			
		||||
        select flow_id, area_id, owner, owner_id, owner_type, order_no, out_trade_no, type, bus_type, status, amount, handling_charge, platform_service_fee, operator_dividend, operator_balance, partner_dividend, pay_type, create_time from et_capital_flow
 | 
			
		||||
        select flow_id, area_id, owner, owner_id, owner_type, order_no, out_trade_no, type, bus_type, status, amount, handling_charge, platform_service_fee, operator_dividend, operator_balance, partner_dividend, pay_type, create_time, model_id from et_capital_flow
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
    <select id="selectEtCapitalFlowList" parameterType="EtCapitalFlow" resultMap="EtCapitalFlowResult">
 | 
			
		||||
| 
						 | 
				
			
			@ -50,12 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            cf.partner_dividend,
 | 
			
		||||
            cf.pay_type,
 | 
			
		||||
            cf.create_time,
 | 
			
		||||
            a.area_name
 | 
			
		||||
            a.area_name,
 | 
			
		||||
            m.model
 | 
			
		||||
        FROM
 | 
			
		||||
            et_capital_flow cf
 | 
			
		||||
            LEFT JOIN et_operating_area a ON a.area_id = cf.area_id
 | 
			
		||||
            LEFT JOIN et_area_dept ad ON ad.area_id = cf.area_id
 | 
			
		||||
            LEFT JOIN sys_dept d ON d.dept_id = ad.dept_id
 | 
			
		||||
            LEFT JOIN et_model m ON m.model_id = cf.model_id
 | 
			
		||||
        WHERE
 | 
			
		||||
        1 = 1
 | 
			
		||||
        <if test="areaId != null "> and cf.area_id = #{areaId}</if>
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        <if test="operatorDividend != null "> and cf.operator_dividend = #{operatorDividend}</if>
 | 
			
		||||
        <if test="operatorBalance != null "> and cf.operator_balance = #{operatorBalance}</if>
 | 
			
		||||
        <if test="partnerDividend != null "> and cf.partner_dividend = #{partnerDividend}</if>
 | 
			
		||||
        <if test="modelId != null "> and cf.model_id = #{modelId}</if>
 | 
			
		||||
        <if test="payType != null  and payType != ''"> and cf.pay_type = #{payType}</if>
 | 
			
		||||
        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
 | 
			
		||||
            AND cf.create_time >= #{params.beginTime}
 | 
			
		||||
| 
						 | 
				
			
			@ -186,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="partnerDividend != null">partner_dividend,</if>
 | 
			
		||||
            <if test="payType != null">pay_type,</if>
 | 
			
		||||
            <if test="createTime != null">create_time,</if>
 | 
			
		||||
            <if test="modelId != null">model_id,</if>
 | 
			
		||||
         </trim>
 | 
			
		||||
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
			
		||||
            <if test="flowId != null">#{flowId},</if>
 | 
			
		||||
| 
						 | 
				
			
			@ -206,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="partnerDividend != null">#{partnerDividend},</if>
 | 
			
		||||
            <if test="payType != null">#{payType},</if>
 | 
			
		||||
            <if test="createTime != null">#{createTime},</if>
 | 
			
		||||
            <if test="modelId != null">#{modelId},</if>
 | 
			
		||||
         </trim>
 | 
			
		||||
    </insert>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -229,6 +235,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="partnerDividend != null">partner_dividend = #{partnerDividend},</if>
 | 
			
		||||
            <if test="payType != null">pay_type = #{payType},</if>
 | 
			
		||||
            <if test="createTime != null">create_time = #{createTime},</if>
 | 
			
		||||
            <if test="modelId != null">model_id = #{modelId},</if>
 | 
			
		||||
        </trim>
 | 
			
		||||
        where flow_id = #{flowId}
 | 
			
		||||
    </update>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        order by version
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectEtHardwareVersionListExclude" parameterType="EtHardwareVersion" resultMap="EtHardwareVersionResult">
 | 
			
		||||
        <include refid="selectEtHardwareVersionVo"/>
 | 
			
		||||
        where parent_id !=0
 | 
			
		||||
            <if test="version != null  and version != ''"> and version = #{version}</if>
 | 
			
		||||
            <if test="productionTime != null "> and production_time = #{productionTime}</if>
 | 
			
		||||
            <if test="instructions != null  and instructions != ''"> and instructions = #{instructions}</if>
 | 
			
		||||
        order by version
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectEtHardwareVersionById" parameterType="Long" resultMap="EtHardwareVersionResult">
 | 
			
		||||
        <include refid="selectEtHardwareVersionVo"/>
 | 
			
		||||
        where id = #{id}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="deptId != null"> and d.dept_id = #{deptId}</if>
 | 
			
		||||
            <if test="areaId != null"> and a.area_id = #{areaId}</if>
 | 
			
		||||
        </where>
 | 
			
		||||
        order by a.area_name
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,6 +159,99 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        order by o.create_time desc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectEtOrderListNoRoute" parameterType="EtOrder" resultMap="EtOrderResult">
 | 
			
		||||
        SELECT
 | 
			
		||||
            o.order_id,
 | 
			
		||||
            o.area_id,
 | 
			
		||||
            oa.area_name AS area,
 | 
			
		||||
            oa.is_deposit_deduction isDepositDeduction,
 | 
			
		||||
            u.user_name AS userName,
 | 
			
		||||
            u.phonenumber AS phonenumber,
 | 
			
		||||
            u.real_name AS realName,
 | 
			
		||||
            o.order_no,
 | 
			
		||||
            o.out_trade_no,
 | 
			
		||||
            o.user_id,
 | 
			
		||||
            o.rule_id,
 | 
			
		||||
            o.device_mac,
 | 
			
		||||
            o.sn,
 | 
			
		||||
            de.vehicle_num,
 | 
			
		||||
            o.pay_time,
 | 
			
		||||
            o.paid,
 | 
			
		||||
            o.pay_type,
 | 
			
		||||
            o.type,
 | 
			
		||||
            COALESCE(o.total_fee, 0) AS total_fee,
 | 
			
		||||
            COALESCE(o.pay_fee, 0) AS pay_fee,
 | 
			
		||||
            COALESCE(o.dispatch_fee, 0) AS dispatch_fee,
 | 
			
		||||
            COALESCE(o.manage_fee, 0) AS manage_fee,
 | 
			
		||||
            COALESCE(o.riding_fee, 0) AS riding_fee,
 | 
			
		||||
            COALESCE(o.appointment_fee, 0) AS appointment_fee,
 | 
			
		||||
            o.mark,
 | 
			
		||||
            o.duration,
 | 
			
		||||
            o.distance,
 | 
			
		||||
            o.status,
 | 
			
		||||
            o.create_time,
 | 
			
		||||
            o.appointment_start_time,
 | 
			
		||||
            o.appointment_end_time,
 | 
			
		||||
            o.appointment_timeout,
 | 
			
		||||
            o.unlock_time,
 | 
			
		||||
            o.return_time,
 | 
			
		||||
            o.rule_end_time,
 | 
			
		||||
            o.return_type,
 | 
			
		||||
            o.video_url,
 | 
			
		||||
            o.upload_time,
 | 
			
		||||
            o.deduction_amount,
 | 
			
		||||
            o.deposit_deduction,
 | 
			
		||||
            o.audio_files,
 | 
			
		||||
            o.used_sn,
 | 
			
		||||
            o.change_reason,
 | 
			
		||||
            o.locking
 | 
			
		||||
        FROM
 | 
			
		||||
        et_order o
 | 
			
		||||
        LEFT JOIN
 | 
			
		||||
        et_operating_area oa ON o.area_id = oa.area_id
 | 
			
		||||
        LEFT JOIN
 | 
			
		||||
        et_device de ON de.sn = o.sn
 | 
			
		||||
        LEFT JOIN
 | 
			
		||||
        et_user u ON u.user_id = o.user_id
 | 
			
		||||
        LEFT join et_area_dept ad on ad.area_id = oa.area_id
 | 
			
		||||
        LEFT join sys_dept d on d.dept_id = ad.dept_id
 | 
			
		||||
        where 1 = 1
 | 
			
		||||
        <if test="orderNo != null  and orderNo != ''"> and o.order_no like concat('%', #{orderNo}, '%')</if>
 | 
			
		||||
        <if test="area != null  and area != ''"> and oa.area_name like concat('%', #{area}, '%')</if>
 | 
			
		||||
        <if test="areaId != null"> and o.area_id = #{areaId}</if>
 | 
			
		||||
        <if test="userName != null  and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
 | 
			
		||||
        <if test="phonenumber != null  and phonenumber != ''"> and u.phonenumber like concat('%', #{phonenumber}, '%')</if>
 | 
			
		||||
        <if test="userId != null  and userId != ''"> and o.user_id = #{userId}</if>
 | 
			
		||||
        <if test="deviceMac != null  and deviceMac != ''"> and o.device_mac like concat('%', #{deviceMac}, '%')</if>
 | 
			
		||||
        <if test="vehicleNum  != null  and vehicleNum  != ''"> and de.vehicle_num  like concat('%', #{vehicleNum }, '%')</if>
 | 
			
		||||
        <if test="sn != null  and sn != ''"> and o.sn like concat('%', #{sn}, '%')</if>
 | 
			
		||||
        <if test="type != null  and type != ''"> and o.type = #{type}</if>
 | 
			
		||||
        <if test="status != null  and status != ''"> and o.status = #{status}</if>
 | 
			
		||||
        <if test="paid != null  and paid != ''"> and o.paid = #{paid}</if>
 | 
			
		||||
        <if test="payType != null  and payType != ''"> and o.pay_type = #{payType}</if>
 | 
			
		||||
        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
 | 
			
		||||
            AND date_format(o.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
 | 
			
		||||
            AND date_format(o.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
 | 
			
		||||
            AND date_format(o.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
 | 
			
		||||
            AND date_format(o.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="statusList != null">
 | 
			
		||||
            AND o.status IN
 | 
			
		||||
            <foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
 | 
			
		||||
                #{item}
 | 
			
		||||
            </foreach>
 | 
			
		||||
        </if>
 | 
			
		||||
        <!-- 数据范围过滤 -->
 | 
			
		||||
        ${params.dataScope}
 | 
			
		||||
        order by o.create_time desc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectEtOrderByOrderId" parameterType="Long" resultMap="EtOrderResult">
 | 
			
		||||
        select o.order_id,
 | 
			
		||||
               o.area_id,
 | 
			
		||||
| 
						 | 
				
			
			@ -874,5 +967,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        where status = 3 and return_time <= DATE_SUB(NOW(), INTERVAL 7 DAY)
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getCurrentOrderList" resultType="com.ruoyi.system.domain.EtOrder">
 | 
			
		||||
        select order_id, area_id, order_no, sn from et_order
 | 
			
		||||
        where status = 2
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="deductionErrorOrderList" resultType="com.ruoyi.system.domain.EtOrder">
 | 
			
		||||
        select order_id, area_id, order_no, sn,`status`,pay_type from et_order
 | 
			
		||||
        where status = 3 and pay_type = 'yj' and pay_time is not null
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user