1.调整优化等
This commit is contained in:
parent
52cf6eb9cf
commit
3808921a3f
|
|
@ -1,12 +1,13 @@
|
|||
package com.ruoyi.web.controller.app;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.map.GeoUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
|
|
@ -46,8 +47,21 @@ public class AppController extends BaseController
|
|||
@Autowired
|
||||
private IWxPayService wxPayService;
|
||||
|
||||
@Autowired
|
||||
private IAsArticleClassifyService asArticleClassifyService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据查询文章分类列表
|
||||
*/
|
||||
@GetMapping("/classify/list")
|
||||
public AjaxResult classifyList(AsArticleClassify asArticleClassify)
|
||||
{
|
||||
logger.info("查询分类列表:【asArticleClassify="+asArticleClassify+"】");
|
||||
List<AsArticleClassify> asArticleClassifies = asArticleClassifyService.selectClassifyList(asArticleClassify);
|
||||
return success(asArticleClassifies);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章列表
|
||||
*/
|
||||
|
|
@ -273,17 +287,6 @@ public class AppController extends BaseController
|
|||
return success(orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件模糊查询车辆信息
|
||||
* type:1-sn,2-mac,3-车牌号
|
||||
*/
|
||||
@GetMapping("/device/search")
|
||||
public AjaxResult deviceSearch(String key,String type)
|
||||
{
|
||||
logger.info("根据条件模糊查询车辆信息:【key="+key+"】,【type="+type+"】");
|
||||
List<AsDevice> asDevices = asDeviceService.deviceSearch(key,type);
|
||||
return success(asDevices);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据定位获取地址 逆地理编码
|
||||
|
|
@ -340,4 +343,43 @@ public class AppController extends BaseController
|
|||
return toAjax(etOrderService.deleteEtOrderByOrderNo(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mac号判断是否有绑定过
|
||||
*/
|
||||
@GetMapping("/isBandByMac")
|
||||
public AjaxResult isBandByMac(String mac)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
logger.info("根据mac号判断是否有绑定过:【mac="+mac+"】");
|
||||
if(StrUtil.isBlank(mac)){
|
||||
throw new ServiceException("mac号不能为空");
|
||||
}
|
||||
ajax.put(AjaxResult.DATA_TAG,asDeviceService.isBandByMac(mac));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算订单距离
|
||||
*/
|
||||
@GetMapping("/calculateDistance")
|
||||
public AjaxResult calculateDistance()
|
||||
{
|
||||
EtOrder order = new EtOrder();
|
||||
order.setType("1");
|
||||
List<EtOrder> orders = etOrderService.selectEtOrderList(order);
|
||||
for(EtOrder etOrder:orders){
|
||||
String tripRouteStr = etOrder.getTripRouteStr();
|
||||
if(StrUtil.isNotBlank(tripRouteStr)){
|
||||
double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
|
||||
double v = GeoUtils.calculateTotalDistance(doubles);
|
||||
etOrder.setDistance((int)Math.round(v));
|
||||
int updateEtOrder = etOrderService.updateEtOrder(etOrder);
|
||||
if(updateEtOrder>0){
|
||||
logger.info("计算订单距离成功:【orderNo="+etOrder.getOrderNo()+"】");
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import com.ruoyi.system.domain.response.FaultResponse;
|
|||
import com.ruoyi.system.domain.response.OrderResponse;
|
||||
import com.ruoyi.system.domain.vo.*;
|
||||
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.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -83,6 +85,15 @@ public class AppVerifyController extends BaseController
|
|||
@Resource
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Resource
|
||||
private AsUserMapper asUserMapper;
|
||||
|
||||
@Resource
|
||||
private EtOrderMapper etOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 故障上报
|
||||
|
|
@ -209,6 +220,7 @@ public class AppVerifyController extends BaseController
|
|||
@GetMapping("/order/list")
|
||||
public TableDataInfo orderList(EtOrder etOrder)
|
||||
{
|
||||
logger.info("【我的订单列表】接收到的参数:{}", JSON.toJSON(etOrder));
|
||||
startPage();
|
||||
List<EtOrder> list = etOrderService.selectEtOrderList(etOrder);
|
||||
return getDataTable(list);
|
||||
|
|
@ -240,12 +252,12 @@ public class AppVerifyController extends BaseController
|
|||
if(!ServiceConstants.ORDER_TYPE_RIDING.equals(etOrder1.getType())){
|
||||
throw new ServiceException("改价失败,类型必须是骑行订单");
|
||||
}
|
||||
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(etOrder1.getStatus()) && !ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT.equals(etOrder1.getStatus())){
|
||||
throw new ServiceException("改价失败,订单未结束,订单状态:"+etOrder1.getStatus());
|
||||
}
|
||||
if(!ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT.equals(etOrder1.getPaid())){
|
||||
throw new ServiceException("订单已支付,不能改价");
|
||||
}
|
||||
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(etOrder1.getStatus()) && !ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT.equals(etOrder1.getStatus())){
|
||||
throw new ServiceException("改价失败,订单未结束,订单状态:"+etOrder1.getStatus());
|
||||
}
|
||||
BigDecimal payFee = BigDecimal.ZERO;
|
||||
if(ObjectUtil.isNotNull(etOrder.getDispatchFee())){
|
||||
payFee = payFee.add(etOrder.getDispatchFee());
|
||||
|
|
@ -290,7 +302,7 @@ public class AppVerifyController extends BaseController
|
|||
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||
etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||
etOrder.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||
List<EtOrder> etOrders = etOrderService.selectEtOrderList(etOrder);
|
||||
List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder);
|
||||
if(etOrders.size()==0){
|
||||
throw new ServiceException("提现失败,未找到押金订单");
|
||||
}
|
||||
|
|
@ -421,10 +433,10 @@ public class AppVerifyController extends BaseController
|
|||
*/
|
||||
@Log(title = "还车", businessType = BusinessType.RETURN_VEHICLE)
|
||||
@PostMapping("/device/return")
|
||||
public AjaxResult returnVehicle(String orderNo,String returnType)
|
||||
public AjaxResult returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat)
|
||||
{
|
||||
logger.info("【接收还车请求参数】:{},是否辅助还车:{}", orderNo,returnType);
|
||||
Boolean aBoolean = asDeviceService.returnVehicle(orderNo,returnType);
|
||||
logger.info("【接收还车请求参数】:{},是否辅助还车:{},是否蓝牙控制:{}", orderNo,returnType,isBluetooth,lon,lat);
|
||||
Boolean aBoolean = asDeviceService.returnVehicle(orderNo,returnType,isBluetooth,lon,lat);
|
||||
return success(aBoolean);
|
||||
}
|
||||
|
||||
|
|
@ -445,10 +457,10 @@ public class AppVerifyController extends BaseController
|
|||
*/
|
||||
@Log(title = "临时锁车", businessType = BusinessType.LOCK)
|
||||
@PostMapping("/device/lock")
|
||||
public AjaxResult deviceLock(String sn,String orderNo)
|
||||
public AjaxResult deviceLock(String sn,String orderNo,String isBluetooth,String lon,String lat)
|
||||
{
|
||||
logger.info("【临时锁车请求参数】:{},订单号:{}", sn,orderNo);
|
||||
Boolean i =asDeviceService.lock(sn,orderNo);
|
||||
logger.info("【临时锁车请求参数】:{},订单号:{},是否蓝牙控制:{}", sn,orderNo,isBluetooth);
|
||||
Boolean i =asDeviceService.lock(sn,orderNo,isBluetooth,lon,lat);
|
||||
return success(i);
|
||||
}
|
||||
|
||||
|
|
@ -457,10 +469,10 @@ public class AppVerifyController extends BaseController
|
|||
*/
|
||||
@Log(title = "临时解锁", businessType = BusinessType.UNLOCK)
|
||||
@PostMapping("/device/unlock")
|
||||
public AjaxResult deviceUnlock(String sn,String orderNo)
|
||||
public AjaxResult deviceUnlock(String sn,String orderNo,String isBluetooth,String lon,String lat)
|
||||
{
|
||||
logger.info("【临时解锁请求参数】:{},订单号:{}", sn,orderNo);
|
||||
Boolean i =asDeviceService.unlock(sn,orderNo);
|
||||
logger.info("【临时解锁请求参数】:{},订单号:{},是否蓝牙控制:{}", sn,orderNo,isBluetooth);
|
||||
Boolean i =asDeviceService.unlock(sn,orderNo,isBluetooth,lon,lat);
|
||||
return success(i);
|
||||
}
|
||||
|
||||
|
|
@ -587,9 +599,9 @@ public class AppVerifyController extends BaseController
|
|||
* 所有车辆定位
|
||||
*/
|
||||
@GetMapping(value = "/allVehicleInfo")
|
||||
public AjaxResult allVehicleInfo(String powerStart,String powerEnd, String status,String sort)
|
||||
public AjaxResult allVehicleInfo(String powerStart,String powerEnd, String status,String sort,String areaId)
|
||||
{
|
||||
List<AsDevice> asDevices = asDeviceService.allVehicleInfo(powerStart,powerEnd,status,sort);
|
||||
List<AsDevice> asDevices = asDeviceService.allVehicleInfo(powerStart,powerEnd,status,sort,areaId);
|
||||
return success(asDevices);
|
||||
}
|
||||
|
||||
|
|
@ -625,9 +637,10 @@ public class AppVerifyController extends BaseController
|
|||
* 查询车辆数量
|
||||
*/
|
||||
@GetMapping(value = "/allVehicleNum")
|
||||
public AjaxResult allVehicleNum(String powerStart,String powerEnd)
|
||||
public AjaxResult allVehicleNum(String powerStart,String powerEnd,String areaId)
|
||||
{
|
||||
DeviceNumVo deviceNumVo = asDeviceService.allVehicleNum(powerStart,powerEnd);
|
||||
logger.info("【查询车辆数量】请求参数:powerStart:【{}】,powerEnd:【{}】,areaId:【{}】", powerStart,powerEnd,areaId);
|
||||
DeviceNumVo deviceNumVo = asDeviceService.allVehicleNum(powerStart,powerEnd,areaId);
|
||||
return success(deviceNumVo);
|
||||
}
|
||||
|
||||
|
|
@ -645,10 +658,10 @@ public class AppVerifyController extends BaseController
|
|||
* 运营数据
|
||||
*/
|
||||
@GetMapping(value = "/operatingData")
|
||||
public AjaxResult operatingData(String timeStart,String timeEnd)
|
||||
public AjaxResult operatingData(String timeStart,String timeEnd,String areaId)
|
||||
{
|
||||
logger.info("【运营数据】请求参数:{},{}", timeStart,timeEnd);
|
||||
OperatingDataVo operatingDataVo = etOrderService.getOperatingData(timeStart,timeEnd);
|
||||
logger.info("【运营数据】请求参数:timeStart={},timeEnd={},areaId={}", timeStart,timeEnd,areaId);
|
||||
OperatingDataVo operatingDataVo = etOrderService.getOperatingData(timeStart,timeEnd,areaId);
|
||||
return success(operatingDataVo);
|
||||
}
|
||||
|
||||
|
|
@ -658,10 +671,10 @@ public class AppVerifyController extends BaseController
|
|||
* type:1-按日期 2-按车辆
|
||||
*/
|
||||
@GetMapping(value = "/reconciliation")
|
||||
public AjaxResult reconciliation(String timeStart,String timeEnd, String type,String sn)
|
||||
public AjaxResult reconciliation(String timeStart,String timeEnd, String type,String sn,String areaId)
|
||||
{
|
||||
logger.info("【收入对账】请求参数:timeStart={},timeEnd={},type={},type={}", timeStart,timeEnd,type,type);
|
||||
ReconciliationVo operatingDataVo = etOrderService.reconciliation(timeStart,timeEnd,type,sn);
|
||||
logger.info("【收入对账】请求参数:timeStart={},timeEnd={},type={},sn={},areaId={}", timeStart,timeEnd,type,sn,areaId);
|
||||
ReconciliationVo operatingDataVo = etOrderService.reconciliation(timeStart,timeEnd,type,sn,areaId);
|
||||
return success(operatingDataVo);
|
||||
}
|
||||
|
||||
|
|
@ -764,13 +777,12 @@ public class AppVerifyController extends BaseController
|
|||
* 根据userId获取areaId(管理员属于哪个运营区)
|
||||
*/
|
||||
@PostMapping("/getAreaId")
|
||||
public AjaxResult getAreaId(String userId)
|
||||
public AjaxResult getAreaId()
|
||||
{
|
||||
logger.info("根据userId获取areaId:【userId="+userId+"】");
|
||||
if(StrUtil.isBlank(userId)){
|
||||
throw new ServiceException("userId不能为空");
|
||||
}
|
||||
AsUser asUser = asUserService.selectUserById(Long.valueOf(userId));
|
||||
Long userId = SecurityUtils.getLoginUser().getAsUser().getUserId();
|
||||
logger.info("根据userId获取areaId(管理员属于哪个运营区):【userId="+userId+"】");
|
||||
AsUser asUser = asUserMapper.selectUserById(userId);
|
||||
logger.info("根据userId获取areaId(管理员属于哪个运营区):【"+JSON.toJSON(asUser)+"】");
|
||||
if(ObjectUtil.isNull(asUser)){
|
||||
throw new ServiceException("用户【"+userId+"】不存在");
|
||||
}
|
||||
|
|
@ -781,4 +793,52 @@ public class AppVerifyController extends BaseController
|
|||
return success(sysUser.getAreaId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件模糊查询车辆信息
|
||||
* type:1-sn,2-mac,3-车牌号
|
||||
*/
|
||||
@GetMapping("/device/search")
|
||||
public AjaxResult deviceSearch(String key,String type,String areaId)
|
||||
{
|
||||
logger.info("根据条件模糊查询车辆信息:【key="+key+"】,【type="+type+"】,【areaId="+areaId+"】");
|
||||
List<AsDevice> asDevices = asDeviceService.deviceSearch(key,type,areaId);
|
||||
return success(asDevices);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度判断是否在停车区
|
||||
*/
|
||||
@GetMapping("/isInParkingArea")
|
||||
public AjaxResult isInParkingArea(String longitude,String latitude,String areaId)
|
||||
{
|
||||
if(StrUtil.isBlank(longitude) || StrUtil.isBlank(latitude)){
|
||||
logger.info("没有经纬度参数:【longitude={}】,【latitude={}】",longitude,latitude);
|
||||
return error("请传经纬度参数"+"【longitude="+longitude+"】,【latitude="+latitude+"】");
|
||||
}
|
||||
IsInParkingAreaVo isInParkingAreaVo = asDeviceService.isInParkingArea(longitude,latitude,areaId);
|
||||
return success(isInParkingAreaVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据token获取运营区列表
|
||||
*/
|
||||
@GetMapping("/getAreaList")
|
||||
public AjaxResult getAreaList()
|
||||
{
|
||||
AsUser asUser = getLoginUser().getAsUser();
|
||||
logger.info("获取到当前app登录用户:【{}】", JSON.toJSON(asUser));
|
||||
if(ObjectUtil.isNull(asUser.getSysUserId())){
|
||||
throw new RuntimeException("用户【"+asUser.getUserName()+"】未绑定系统用户");
|
||||
}
|
||||
SysUser sysUser = userService.selectUserById(asUser.getSysUserId());
|
||||
Long deptId;
|
||||
if(sysUser.isAdmin()){
|
||||
deptId = null;
|
||||
}else{
|
||||
deptId = sysUser.getDeptId();
|
||||
}
|
||||
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(deptId);
|
||||
logger.info("根据token获取运营区列表:【{}】", JSON.toJSON(longs));
|
||||
return success(longs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ public class ReceiveController {
|
|||
JSONObject jsonObject = JSONObject.parseObject(msg, JSONObject.class);
|
||||
String devName = (String)jsonObject.get("dev_name");
|
||||
/*异步更新在线状态*/
|
||||
asynchronousUpdateOnlineStatus(devName);
|
||||
AsDevice asDevice = asDeviceService.selectAsDeviceByMac(devName);
|
||||
Object ver = jsonObject.get("VER");
|
||||
asynchronousUpdateOnlineStatus(asDevice,ver);
|
||||
if(IotConstants.ONENET_LOCATION.equals(jsonObject.get("ds_id")) && ObjectUtil.isNotNull(jsonObject.get("value"))){
|
||||
LogEntry logEntry = JSONObject.parseObject(msg, LogEntry.class);
|
||||
log.info("logEntry转换后的对象: logEntry---【{}】" , JSON.toJSONString(logEntry));
|
||||
|
|
@ -339,8 +341,10 @@ public class ReceiveController {
|
|||
/**
|
||||
* 异步更新在线状态
|
||||
*/
|
||||
private void asynchronousUpdateOnlineStatus(String mac) {
|
||||
AsDevice device = asDeviceService.selectAsDeviceByMac(mac);
|
||||
private void asynchronousUpdateOnlineStatus(AsDevice device,Object verStr) {
|
||||
if(StrUtil.isBlank(device.getVersion()) && ObjectUtil.isNotNull(verStr)){
|
||||
device.setVersion((String)verStr);
|
||||
}
|
||||
//开异步线程保存回调参数
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
if(device.getOnlineStatus().equals(ServiceConstants.VEHICLE_STATUS_OFFLINE)){
|
||||
|
|
@ -374,6 +378,10 @@ public class ReceiveController {
|
|||
Geometry geometry = GeoUtils.toGeometryByLinearRing(tripRouteStr);
|
||||
String wkt = GeoUtils.wkt(geometry);
|
||||
etOrder.setTripRoute(wkt);
|
||||
// todo 放在还车的接口计算
|
||||
// double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
|
||||
// double v = GeoUtils.calculateTotalDistance(doubles);
|
||||
// etOrder.setDistance((int)Math.round(v));
|
||||
|
||||
int updateEtOrderResult = etOrderService.updateEtOrder(etOrder);
|
||||
if (updateEtOrderResult > 0) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class AsArticleClassifyController extends BaseController
|
|||
@GetMapping("/list")
|
||||
public AjaxResult list(AsArticleClassify asArticleClassify)
|
||||
{
|
||||
List<AsArticleClassify> asArticleClassifies = asArticleClassifyService.selectClassifyList(asArticleClassify);
|
||||
List<AsArticleClassify> asArticleClassifies = asArticleClassifyService.selectClassifyListWithIsolate(asArticleClassify);
|
||||
return success(asArticleClassifies);
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public class AsArticleClassifyController extends BaseController
|
|||
@GetMapping("/list/exclude/{classifyId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "classifyId", required = false) Long classifyId)
|
||||
{
|
||||
List<AsArticleClassify> articleClassifies = asArticleClassifyService.selectClassifyList(new AsArticleClassify());
|
||||
List<AsArticleClassify> articleClassifies = asArticleClassifyService.selectClassifyListWithIsolate(new AsArticleClassify());
|
||||
articleClassifies.removeIf(d -> d.getClassifyId().intValue() == classifyId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), classifyId + ""));
|
||||
return success(articleClassifies);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.EtOperatingArea;
|
||||
import com.ruoyi.system.domain.vo.ReconciliationVo;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.IEtOrderService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -13,6 +18,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对账Controller
|
||||
*
|
||||
|
|
@ -21,28 +28,45 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system")
|
||||
public class EtReconciliationControllor {
|
||||
public class EtReconciliationControllor extends BaseController {
|
||||
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private IEtOrderService etOrderService;
|
||||
|
||||
@Autowired
|
||||
private IEtOperatingAreaService etOperatingAreaService;
|
||||
|
||||
/**
|
||||
* 查询对账列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:reconciliation:list')")
|
||||
@GetMapping("/reconciliation")
|
||||
public AjaxResult list(String timeStart,String timeEnd)
|
||||
public AjaxResult list(String timeStart,String timeEnd,String areaId)
|
||||
{
|
||||
logger.info("【收入对账】请求参数:timeStart={},timeEnd={}", timeStart,timeEnd);
|
||||
logger.info("【收入对账】请求参数:timeStart={},timeEnd={},areaId={}", timeStart,timeEnd,areaId);
|
||||
if(StrUtil.isBlank(timeStart)){
|
||||
timeStart = DateUtils.getDate();
|
||||
}
|
||||
if(StrUtil.isBlank(timeEnd)){
|
||||
timeEnd = DateUtils.getDate();
|
||||
}
|
||||
ReconciliationVo reconciliation = etOrderService.reconciliation(timeStart,timeEnd,"1",null);
|
||||
// 根据token获取运营区列表
|
||||
ReconciliationVo reconciliation = etOrderService.reconciliation(timeStart,timeEnd,"1",null,areaId);
|
||||
return AjaxResult.success(reconciliation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据token获取运营区列表
|
||||
*/
|
||||
@GetMapping("/getAreaList")
|
||||
public AjaxResult getAreaList()
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
logger.info("【后台根据token获取运营区列表】获取当前登录用户:【{}】", JSON.toJSON(user));
|
||||
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(user.getDeptId());
|
||||
logger.info("根据token获取运营区列表:【{}】", JSON.toJSON(longs));
|
||||
return success(longs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
|
@ -13,6 +14,7 @@ import com.ruoyi.common.core.domain.model.LoginBody;
|
|||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.service.IAsUserService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
|
@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -50,6 +53,9 @@ public class SysLoginController
|
|||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Resource
|
||||
private AsUserMapper asUserMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
|
|
@ -102,6 +108,8 @@ public class SysLoginController
|
|||
user = userService.selectUserById(userId);
|
||||
}else{
|
||||
user = SecurityUtils.getLoginUser().getAsUser();
|
||||
log.info("获取到当前登录用户:{}", JSON.toJSON(user));
|
||||
user = asUserMapper.selectUserById(user.getUserId());
|
||||
}
|
||||
ajax.put("user", user);
|
||||
return ajax;
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: 123456
|
||||
url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: d0dbe100b71c1d09
|
||||
password: 123456
|
||||
# url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: d0dbe100b71c1d09
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.ruoyi.common.constant;
|
|||
|
||||
/**
|
||||
* 缓存的key 常量
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class CacheConstants
|
||||
|
|
@ -12,6 +12,12 @@ public class CacheConstants
|
|||
*/
|
||||
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
|
||||
/**
|
||||
* 登录用户 redis key
|
||||
*/
|
||||
public static final String APP_LOGIN_TOKEN_KEY = "app_login_tokens:";
|
||||
|
||||
|
||||
/**
|
||||
* 验证码 redis key
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class ServiceConstants {
|
|||
/**----------------------------支付场景end----------------------------*/
|
||||
|
||||
/**----------------------------订单状态start----------------------------*/
|
||||
/** 订单状态:0-预约中,1-取消预约,2-开始骑行,3-结束 */
|
||||
/** 订单状态:0-预约中,1-取消预约,2-开始骑行,3-结束 4-订单结束*/
|
||||
/**
|
||||
* 订单状态:0-预约中
|
||||
*/
|
||||
|
|
@ -480,4 +480,19 @@ public class ServiceConstants {
|
|||
public static final String PROFITSHARING_TYPE_PLATFORM = "2";
|
||||
/**----------------------------分账类型start----------------------------*/
|
||||
|
||||
/**----------------------------退款类型start----------------------------*/
|
||||
/** 还车类型:1-正常还车;2-辅助还车
|
||||
/**
|
||||
* 退款类型:1-正常还车
|
||||
*/
|
||||
public static final String RETURN_TYPE_NORMAL = "1";
|
||||
|
||||
/**
|
||||
* 退款类型:2-辅助还车
|
||||
*/
|
||||
public static final String RETURN_TYPE_SUBSIDIARY = "2";
|
||||
|
||||
|
||||
/**----------------------------退款类型end----------------------------*/
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ public class AsArticleClassify extends BaseEntity
|
|||
/** 父分类ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 运营商 */
|
||||
private String deptName;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
|
|
@ -146,4 +149,12 @@ public class AsArticleClassify extends BaseEntity
|
|||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.common.utils.map;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
|
@ -272,6 +273,46 @@ public class GeoUtils {
|
|||
return EARTH_RADIUS * c;
|
||||
}
|
||||
|
||||
public static double[][] parseJsonTrack(String jsonString) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonString);
|
||||
double[][] track = new double[jsonArray.size()][2];
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONArray coord = jsonArray.getJSONArray(i);
|
||||
track[i][0] = coord.getDouble(0);
|
||||
track[i][1] = coord.getDouble(1);
|
||||
}
|
||||
return track;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算一段轨迹的总距离
|
||||
* */
|
||||
public static double calculateTotalDistance(double[][] track) {
|
||||
double totalDistance = 0;
|
||||
for (int i = 0; i < track.length - 1; i++) {
|
||||
totalDistance += haversineDistance(track[i], track[i + 1]);
|
||||
}
|
||||
return totalDistance;
|
||||
}
|
||||
|
||||
public static double haversineDistance(double[] coord1, double[] coord2) {
|
||||
double lat1 = deg2rad(coord1[1]);
|
||||
double lon1 = deg2rad(coord1[0]);
|
||||
double lat2 = deg2rad(coord2[1]);
|
||||
double lon2 = deg2rad(coord2[0]);
|
||||
|
||||
double dLat = lat2 - lat1;
|
||||
double dLon = lon2 - lon1;
|
||||
|
||||
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(lat1) * Math.cos(lat2) *
|
||||
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
|
||||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
|
||||
return EARTH_RADIUS * c; // 距离(米)
|
||||
}
|
||||
|
||||
/**
|
||||
* 判获取到最近一个运营区
|
||||
* */
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -228,4 +230,9 @@ public class TokenService
|
|||
{
|
||||
return CacheConstants.LOGIN_TOKEN_KEY + uuid;
|
||||
}
|
||||
|
||||
private String getAppTokenKey(String uuid)
|
||||
{
|
||||
return CacheConstants.APP_LOGIN_TOKEN_KEY + uuid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,9 @@ public class AsDevice extends BaseEntityPlus implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String model;
|
||||
|
||||
/** 设备版本 */
|
||||
private String version;
|
||||
|
||||
/** 车牌号 */
|
||||
private String vehicleNum;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ public class EtOrder extends BaseEntity
|
|||
@Excel(name = "区域")
|
||||
private String area;
|
||||
|
||||
/** 区域ids */
|
||||
@Excel(name = "区域ids")
|
||||
private List<Long> areaLists;
|
||||
|
||||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private String orderNo;
|
||||
|
|
@ -49,6 +53,11 @@ public class EtOrder extends BaseEntity
|
|||
@Excel(name = "用户")
|
||||
private String userName;
|
||||
|
||||
/** 真实姓名 */
|
||||
@Excel(name = "真实姓名")
|
||||
@TableField(exist = false)
|
||||
private String realName;
|
||||
|
||||
/** 手机号 */
|
||||
@Excel(name = "手机号")
|
||||
private String phonenumber;
|
||||
|
|
@ -77,6 +86,10 @@ public class EtOrder extends BaseEntity
|
|||
@Excel(name = "设备sn编码")
|
||||
private String sn;
|
||||
|
||||
/** 车牌号 */
|
||||
@TableField(exist = false)
|
||||
private String vehicleNum;
|
||||
|
||||
/** 支付时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 区间计费
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-05-21
|
||||
*/
|
||||
@Data
|
||||
public class IsInParkingAreaVo {
|
||||
|
||||
/** 停车点还车 true:开启,false:关闭*/
|
||||
private Boolean parkingReturn;
|
||||
|
||||
/** 是否在停车区内*/
|
||||
private Boolean isInParkingArea;
|
||||
}
|
||||
|
|
@ -98,12 +98,12 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
|
|||
/**
|
||||
* 有订单车辆
|
||||
*/
|
||||
String getInOrderDevice(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getInOrderDevice(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 无订单车辆
|
||||
*/
|
||||
String getNoOrderDevice(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getNoOrderDevice(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
public int batchDisable(String[] sns);
|
||||
|
||||
|
|
|
|||
|
|
@ -139,15 +139,15 @@ public interface AsUserMapper
|
|||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
String getNewUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getNewUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 总用户
|
||||
*/
|
||||
String getTotalUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 租赁用户
|
||||
*/
|
||||
String getLeaseUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getLeaseUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public interface EtOperatingAreaMapper extends BaseMapper<EtOperatingArea>
|
|||
* @return 选中运营区ID列表
|
||||
*/
|
||||
List<Long> selectAreaListByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据部门ID获取运营区选择框列表 运营商
|
||||
*
|
||||
* @param deptId 用户ID
|
||||
* @return 选中运营区ID列表
|
||||
*/
|
||||
List<EtOperatingArea> selectAreaListByDeptId2(Long deptId);
|
||||
//
|
||||
// /**
|
||||
// * 新增运营区
|
||||
|
|
|
|||
|
|
@ -113,83 +113,83 @@ public interface EtOrderMapper
|
|||
/**
|
||||
* 总收入
|
||||
*/
|
||||
String getTotalIncome(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalIncome(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 累计待支付
|
||||
*/
|
||||
String getTotalUnpaid(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalUnpaid(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 已支付
|
||||
*/
|
||||
String getTotalPaid(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalPaid(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 已退款
|
||||
*/
|
||||
String getTotalRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 骑行已支付
|
||||
*/
|
||||
String getTotalRidingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalRidingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 骑行已退款
|
||||
*/
|
||||
String getTotalRidingRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalRidingRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 调度费已支付
|
||||
*/
|
||||
String getTotalDispatchFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalDispatchFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 调度费已退款
|
||||
*/
|
||||
String getTotalDispatchRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalDispatchRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 预约费已支付
|
||||
*/
|
||||
String getTotalAppointmentFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalAppointmentFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 预约费已退款
|
||||
*/
|
||||
String getTotalAppointmentRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalAppointmentRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 管理费已支付
|
||||
*/
|
||||
String getTotalManageFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalManageFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 管理费已退款
|
||||
*/
|
||||
String getTotalManageRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getTotalManageRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
|
||||
/**
|
||||
* 已支付订单
|
||||
*/
|
||||
String getPaidOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getPaidOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 骑行中订单
|
||||
*/
|
||||
String getRidingOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getRidingOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 退款订单
|
||||
*/
|
||||
String getRefundOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getRefundOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 待支付订单
|
||||
*/
|
||||
String getUnpaidOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
|
||||
String getUnpaidOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 手续费
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@ public interface IAsArticleClassifyService
|
|||
*/
|
||||
public List<AsArticleClassify> selectClassifyList(AsArticleClassify asArticleClassify);
|
||||
|
||||
/**
|
||||
* 查询分类管理数据(带数据隔离)
|
||||
*
|
||||
* @param asArticleClassify 分类信息
|
||||
* @return 分类信息集合
|
||||
*/
|
||||
public List<AsArticleClassify> selectClassifyListWithIsolate(AsArticleClassify asArticleClassify);
|
||||
|
||||
/**
|
||||
* 查询分类树结构信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.ruoyi.system.domain.EtOperatingArea;
|
|||
import com.ruoyi.system.domain.response.OrderResponse;
|
||||
import com.ruoyi.system.domain.vo.DeviceNumVo;
|
||||
import com.ruoyi.system.domain.vo.EtOrderVo;
|
||||
import com.ruoyi.system.domain.vo.IsInParkingAreaVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -110,12 +111,12 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
/**
|
||||
* 所有车辆定位
|
||||
*/
|
||||
List<AsDevice> allVehicleInfo(String powerStart, String powerEnd, String status,String sort);
|
||||
List<AsDevice> allVehicleInfo(String powerStart, String powerEnd, String status,String sort,String areaId);
|
||||
|
||||
/**
|
||||
* 查询车辆数量
|
||||
*/
|
||||
DeviceNumVo allVehicleNum(String powerStart, String powerEnd);
|
||||
DeviceNumVo allVehicleNum(String powerStart, String powerEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 扫码/编号开锁骑行
|
||||
|
|
@ -145,7 +146,7 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
/**
|
||||
* 临时锁车
|
||||
*/
|
||||
Boolean lock(String mac,String orderNo);
|
||||
Boolean lock(String mac,String orderNo,String isBluetooth,String lon,String lat);
|
||||
|
||||
/**
|
||||
* 管理员锁车
|
||||
|
|
@ -160,7 +161,7 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
/**
|
||||
* 临时解锁
|
||||
*/
|
||||
Boolean unlock(String sn, String orderNo);
|
||||
Boolean unlock(String sn, String orderNo,String isBluetooth,String lon,String lat);
|
||||
|
||||
/**
|
||||
* 车辆预约
|
||||
|
|
@ -175,7 +176,7 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
/**
|
||||
* 还车
|
||||
*/
|
||||
Boolean returnVehicle(String orderNo,String returnType);
|
||||
Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat);
|
||||
|
||||
/**
|
||||
* 管理员开锁
|
||||
|
|
@ -201,22 +202,22 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
* 根据条件模糊查询车辆信息
|
||||
* type:1-sn,2-mac,3-车牌号
|
||||
*/
|
||||
List<AsDevice> deviceSearch(String key,String type);
|
||||
List<AsDevice> deviceSearch(String key,String type,String areaId);
|
||||
|
||||
/**
|
||||
* 运营中车辆
|
||||
*/
|
||||
String getInOperationDevice(String timeStart, String timeEnd);
|
||||
String getInOperationDevice(String timeStart, String timeEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 有订单车辆
|
||||
*/
|
||||
String getInOrderDevice(String timeStart, String timeEnd);
|
||||
String getInOrderDevice(String timeStart, String timeEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 无订单车辆
|
||||
*/
|
||||
String getNoOrderDevice(String timeStart, String timeEnd);
|
||||
String getNoOrderDevice(String timeStart, String timeEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 根据车辆型号查询车辆数量
|
||||
|
|
@ -277,6 +278,16 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
*/
|
||||
int bandSn(AsDevice asDevice);
|
||||
|
||||
/**
|
||||
* 根据mac号判断是否有绑定过
|
||||
*/
|
||||
boolean isBandByMac(String mac);
|
||||
|
||||
/**
|
||||
* 判断是否在停车区内
|
||||
*/
|
||||
IsInParkingAreaVo isInParkingArea(String longitude, String latitude,String areaId);
|
||||
|
||||
// /**
|
||||
// * 是否靠近运营区边界
|
||||
// */
|
||||
|
|
|
|||
|
|
@ -195,17 +195,17 @@ public interface IAsUserService
|
|||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
String getNewUser(String powerStart, String powerEnd);
|
||||
String getNewUser(String powerStart, String powerEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 总用户
|
||||
*/
|
||||
String getTotalUser(String powerStart, String powerEnd);
|
||||
String getTotalUser(String powerStart, String powerEnd, String areaId);
|
||||
|
||||
/**
|
||||
* 租赁用户
|
||||
*/
|
||||
String getLeaseUser(String powerStart, String powerEnd);
|
||||
String getLeaseUser(String powerStart, String powerEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 绑定系统用户
|
||||
|
|
|
|||
|
|
@ -104,4 +104,12 @@ public interface IEtOperatingAreaService extends IService<EtOperatingArea>
|
|||
* @return 选中运营区ID列表
|
||||
*/
|
||||
public List<Long> selectAreaListByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据部门ID获取运营区选择框列表
|
||||
*
|
||||
* @param deptId 用户ID
|
||||
* @return 选中运营区ID列表
|
||||
*/
|
||||
public List<EtOperatingArea> selectAreaListByDeptId2(Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ public interface IEtOrderService
|
|||
/**
|
||||
* 运营数据
|
||||
*/
|
||||
OperatingDataVo getOperatingData(String timeStart,String timeEnd);
|
||||
OperatingDataVo getOperatingData(String timeStart,String timeEnd,String areaId);
|
||||
|
||||
/**
|
||||
* 收入对账
|
||||
*/
|
||||
ReconciliationVo reconciliation(String timeStart, String timeEnd, String type,String sn);
|
||||
ReconciliationVo reconciliation(String timeStart, String timeEnd, String type,String sn,String areaId);
|
||||
|
||||
/**
|
||||
* 最近一笔订单
|
||||
|
|
|
|||
|
|
@ -40,6 +40,18 @@ public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService
|
|||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<AsArticleClassify> selectClassifyListWithIsolate(AsArticleClassify classify)
|
||||
{
|
||||
return articleClassifyMapper.selectClassifyList(classify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类管理数据
|
||||
*
|
||||
* @param classify 分类信息
|
||||
* @return 分类信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<AsArticleClassify> selectClassifyList(AsArticleClassify classify)
|
||||
{
|
||||
return articleClassifyMapper.selectClassifyList(classify);
|
||||
|
|
@ -54,7 +66,7 @@ public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService
|
|||
@Override
|
||||
public List<TreeSelect> selectClassifyTreeList(AsArticleClassify classify)
|
||||
{
|
||||
List<AsArticleClassify> depts = selectClassifyList(classify);
|
||||
List<AsArticleClassify> depts = selectClassifyListWithIsolate(classify);
|
||||
return buildClassifyTreeSelect(depts);
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +203,7 @@ public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService
|
|||
{
|
||||
AsArticleClassify dept = new AsArticleClassify();
|
||||
dept.setClassifyId(deptId);
|
||||
List<AsArticleClassify> depts = SpringUtils.getAopProxy(this).selectClassifyList(dept);
|
||||
List<AsArticleClassify> depts = SpringUtils.getAopProxy(this).selectClassifyListWithIsolate(dept);
|
||||
if (StringUtils.isEmpty(depts))
|
||||
{
|
||||
throw new ServiceException("没有权限访问分类数据!");
|
||||
|
|
@ -214,13 +226,17 @@ public class AsArticleClassifyServiceImpl implements IAsArticleClassifyService
|
|||
dept.setDeptId(currentUser.getDeptId());
|
||||
}
|
||||
}
|
||||
AsArticleClassify info = articleClassifyMapper.selectClassifyById(dept.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
||||
{
|
||||
throw new ServiceException("分类停用,不允许新增");
|
||||
if(dept.getParentId() != 0){
|
||||
AsArticleClassify info = articleClassifyMapper.selectClassifyById(dept.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
||||
{
|
||||
throw new ServiceException("分类停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
}else{
|
||||
dept.setAncestors("0");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return articleClassifyMapper.insertClassify(dept);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@ import com.ruoyi.common.constant.HttpStatus;
|
|||
import com.ruoyi.common.constant.IotConstants;
|
||||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.map.GeoUtils;
|
||||
|
|
@ -27,11 +29,9 @@ import com.ruoyi.common.utils.onenet.Token;
|
|||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.response.OrderResponse;
|
||||
import com.ruoyi.system.domain.vo.DeviceNumVo;
|
||||
import com.ruoyi.system.domain.vo.EtOrderVo;
|
||||
import com.ruoyi.system.domain.vo.IntervalRuleVo;
|
||||
import com.ruoyi.system.domain.vo.StartingRuleVo;
|
||||
import com.ruoyi.system.domain.vo.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -96,6 +96,12 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@Autowired
|
||||
private IWxPayService wxPayService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Resource
|
||||
private EtOrderMapper etOrderMapper;
|
||||
|
||||
@Value(value = "${iot.iotUrl}")
|
||||
private String iotUrl;
|
||||
|
||||
|
|
@ -144,14 +150,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if (ObjectUtil.isNull(asDevice)) {
|
||||
throw new ServiceException("设备不存在:"+ sn);
|
||||
}
|
||||
// // 查询车辆上下线
|
||||
// if(!isOnline(sn)){
|
||||
// asDevice.setOnlineStatus(ServiceConstants.VEHICLE_STATUS_OFFLINE);
|
||||
// log.info("设备不在线:"+ sn);
|
||||
// }else{
|
||||
// asDevice.setOnlineStatus(ServiceConstants.VEHICLE_STATUS_ONLINE);
|
||||
// }
|
||||
// int i = asDeviceMapper.updateAsDevice(asDevice);
|
||||
Long areaId = asDevice.getAreaId();
|
||||
EtOperatingArea etOperatingArea;
|
||||
if (ObjectUtil.isNotNull(areaId)) {
|
||||
|
|
@ -177,7 +175,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
order.setType(ServiceConstants.ORDER_TYPE_RIDING);
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
|
||||
order.setSn(asDevice.getSn());
|
||||
List<EtOrder> etOrders = etOrderService.selectEtOrderList(order);
|
||||
List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(order);
|
||||
asDevice.setEtOrders(etOrders);
|
||||
return asDevice;
|
||||
}
|
||||
|
|
@ -365,8 +363,11 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* 所有车辆定位
|
||||
*/
|
||||
@Override
|
||||
public List<AsDevice> allVehicleInfo(String powerStart, String powerEnd, String status,String sort) {
|
||||
public List<AsDevice> allVehicleInfo(String powerStart, String powerEnd, String status,String sort,String areaId) {
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapper.eq("area_id",areaId);
|
||||
}
|
||||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapper.between("remaining_power", Integer.parseInt(powerStart), Integer.parseInt(powerEnd));
|
||||
}
|
||||
|
|
@ -393,25 +394,28 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* 查询车辆数量
|
||||
*/
|
||||
@Override
|
||||
public DeviceNumVo allVehicleNum(String powerStart, String powerEnd) {
|
||||
public DeviceNumVo allVehicleNum(String powerStart, String powerEnd,String areaId) {
|
||||
DeviceNumVo deviceNumVo = new DeviceNumVo();
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapper.eq("area_id",areaId);
|
||||
}
|
||||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapper.between("remaining_power", powerStart,powerEnd);
|
||||
}
|
||||
Integer allNum = asDeviceMapper.selectCount(wrapper);
|
||||
deviceNumVo.setAllNum(allNum);//所有车辆
|
||||
|
||||
Integer ridingNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_IN_USING);
|
||||
Integer ridingNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_IN_USING,areaId);
|
||||
deviceNumVo.setRidingNum(ridingNum);//骑行中
|
||||
|
||||
Integer temporarilyLockNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);
|
||||
Integer temporarilyLockNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK,areaId);
|
||||
deviceNumVo.setTemporarilyLockNum(temporarilyLockNum);//临时锁车
|
||||
|
||||
Integer disabledNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
|
||||
Integer disabledNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_IN_OFFLINE,areaId);
|
||||
deviceNumVo.setDisabledNum(disabledNum);//已禁用
|
||||
|
||||
Integer normalNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_NORMAL);
|
||||
Integer normalNum = setNum(powerStart, powerEnd,ServiceConstants.VEHICLE_STATUS_NORMAL,areaId);
|
||||
deviceNumVo.setNormalNum(normalNum);//正常待租
|
||||
|
||||
QueryWrapper<AsDevice> wrapperForOffline = new QueryWrapper<>();
|
||||
|
|
@ -419,10 +423,13 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapperForOffline.between("remaining_power", powerStart,powerEnd);
|
||||
}
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapperForOffline.eq("area_id",areaId);
|
||||
}
|
||||
Integer offlineNum = asDeviceMapper.selectCount(wrapperForOffline);
|
||||
deviceNumVo.setOfflineNum(offlineNum);//已离线
|
||||
|
||||
Integer inAppointmentNum = setNum(powerStart, powerEnd, ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT);
|
||||
Integer inAppointmentNum = setNum(powerStart, powerEnd, ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT,areaId);
|
||||
deviceNumVo.setInAppointmentNum(inAppointmentNum);//预约中
|
||||
|
||||
QueryWrapper<AsDevice> wrapperForDispatch = new QueryWrapper<>();
|
||||
|
|
@ -430,17 +437,23 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapperForDispatch.between("remaining_power", powerStart,powerEnd);
|
||||
}
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapperForDispatch.eq("area_id",areaId);
|
||||
}
|
||||
Integer dispatchNum = asDeviceMapper.selectCount(wrapperForDispatch);
|
||||
deviceNumVo.setDispatchNum(dispatchNum);//调度设备
|
||||
return deviceNumVo;
|
||||
}
|
||||
|
||||
private Integer setNum(String powerStart, String powerEnd,String status) {
|
||||
private Integer setNum(String powerStart, String powerEnd,String status,String areaId) {
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("status",status);
|
||||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapper.between("remaining_power", powerStart,powerEnd);
|
||||
}
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapper.eq("area_id",areaId);
|
||||
}
|
||||
return asDeviceMapper.selectCount(wrapper);
|
||||
|
||||
}
|
||||
|
|
@ -597,6 +610,15 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@Override
|
||||
public Boolean offline(String sn) {
|
||||
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||
if(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT.equals(asDevice.getStatus())){
|
||||
throw new ServiceException("车辆处于预约中,不能下线");
|
||||
}
|
||||
if(ServiceConstants.VEHICLE_STATUS_IN_USING.equals(asDevice.getStatus())){
|
||||
throw new ServiceException("车辆使用中,不能下线");
|
||||
}
|
||||
if(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK.equals(asDevice.getStatus())){
|
||||
throw new ServiceException("车辆临时停车中,不能下线");
|
||||
}
|
||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
|
||||
int device = asDeviceMapper.updateAsDevice(asDevice);
|
||||
if(device==0){
|
||||
|
|
@ -611,17 +633,21 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* type:1-sn,2-mac,3-车牌号
|
||||
*/
|
||||
@Override
|
||||
public List<AsDevice> deviceSearch(String key, String type) {
|
||||
public List<AsDevice> deviceSearch(String key, String type, String areaId) {
|
||||
QueryWrapper<AsDevice> queryWrapper = new QueryWrapper<>();
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
queryWrapper.eq("area_id",areaId);
|
||||
}
|
||||
switch (type){
|
||||
case "1":
|
||||
QueryWrapper<AsDevice> sn = new QueryWrapper<AsDevice>().like("sn", key);
|
||||
return asDeviceMapper.selectList(sn);
|
||||
queryWrapper.like("sn", key);
|
||||
return asDeviceMapper.selectList(queryWrapper);
|
||||
case "2":
|
||||
QueryWrapper<AsDevice> mac = new QueryWrapper<AsDevice>().like("mac", key);
|
||||
return asDeviceMapper.selectList(mac);
|
||||
queryWrapper.like("mac", key);
|
||||
return asDeviceMapper.selectList(queryWrapper);
|
||||
case "3":
|
||||
QueryWrapper<AsDevice> vehicleNum = new QueryWrapper<AsDevice>().like("vehicle_num", key);
|
||||
return asDeviceMapper.selectList(vehicleNum);
|
||||
queryWrapper.like("vehicle_num", key);
|
||||
return asDeviceMapper.selectList(queryWrapper);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
@ -631,9 +657,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* 运营中车辆
|
||||
*/
|
||||
@Override
|
||||
public String getInOperationDevice(String timeStart, String timeEnd) {
|
||||
public String getInOperationDevice(String timeStart, String timeEnd,String areaId) {
|
||||
if(ObjectUtil.isNotEmpty(timeStart)&&ObjectUtil.isNotEmpty(timeEnd)){
|
||||
QueryWrapper<AsDevice> wrapper = new QueryWrapper<AsDevice>().eq("status", ServiceConstants.VEHICLE_STATUS_IN_USING);
|
||||
wrapper.eq("area_id", areaId);
|
||||
return asDeviceMapper.selectCount(wrapper)+"";
|
||||
}
|
||||
return null;
|
||||
|
|
@ -643,9 +670,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* 有订单车辆
|
||||
*/
|
||||
@Override
|
||||
public String getInOrderDevice(String timeStart, String timeEnd) {
|
||||
public String getInOrderDevice(String timeStart, String timeEnd,String areaId) {
|
||||
if(ObjectUtil.isNotEmpty(timeStart)&&ObjectUtil.isNotEmpty(timeEnd)){
|
||||
return asDeviceMapper.getInOrderDevice(timeStart,timeEnd);
|
||||
return asDeviceMapper.getInOrderDevice(timeStart,timeEnd,areaId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -654,9 +681,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
* 无订单车辆
|
||||
*/
|
||||
@Override
|
||||
public String getNoOrderDevice(String timeStart, String timeEnd) {
|
||||
public String getNoOrderDevice(String timeStart, String timeEnd,String areaId) {
|
||||
if(ObjectUtil.isNotEmpty(timeStart)&&ObjectUtil.isNotEmpty(timeEnd)){
|
||||
return asDeviceMapper.getNoOrderDevice(timeStart,timeEnd);
|
||||
return asDeviceMapper.getNoOrderDevice(timeStart,timeEnd,areaId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -775,7 +802,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@Transactional
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Boolean lock(String sn,String orderNo) {
|
||||
public Boolean lock(String sn,String orderNo,String isBluetooth,String lon,String lat) {
|
||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||
if(StrUtil.isBlank(sn)) {
|
||||
sn = order.getSn();
|
||||
|
|
@ -783,8 +810,14 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||
/** 1.获取token*/
|
||||
String token = Token.getToken();
|
||||
/** 2.发送命令*/
|
||||
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_LLOSE+IotConstants.COMMAND_FREQUENCY_3600,"临时锁车");
|
||||
if(!"true".equals(isBluetooth)){
|
||||
/** 2.发送命令*/
|
||||
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_LLOSE+IotConstants.COMMAND_FREQUENCY_3600,"临时锁车");
|
||||
}else{
|
||||
asDevice.setLongitude(lon);
|
||||
asDevice.setLatitude(lat);
|
||||
asDevice.setLastTime(DateUtils.getNowDate());
|
||||
}
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
|
||||
if(StrUtil.isNotBlank(orderNo)){//有订单号,则是用户临时锁车
|
||||
/** 改变车辆状态:4-临时锁车 */
|
||||
|
|
@ -853,9 +886,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
/**
|
||||
* 临时解锁
|
||||
*/
|
||||
@Transactional
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Boolean unlock(String sn, String orderNo) {
|
||||
public Boolean unlock(String sn, String orderNo,String isBluetooth,String lon,String lat) {
|
||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||
if(order==null)throw new ServiceException("订单不存在");
|
||||
if(StrUtil.isBlank(sn)) {
|
||||
|
|
@ -865,43 +899,38 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
/** 1.获取token*/
|
||||
String token = Token.getToken();
|
||||
String finalSn = sn;
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
if(!"true".equals(isBluetooth)){
|
||||
/** 2.发送命令*/
|
||||
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_5,"临时解锁");
|
||||
//间隔1秒
|
||||
// try {
|
||||
// Thread.sleep(500);
|
||||
// } catch (InterruptedException ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_PLAY0,"临时解锁播报");
|
||||
if(StrUtil.isNotBlank(orderNo)){//有订单号,则是用户骑行中解锁
|
||||
/** 改变车辆状态:3-骑行中 */
|
||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);//骑行中
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||
int device = asDeviceMapper.updateAsDevice(asDevice);
|
||||
if(device==0){
|
||||
log.info("【临时解锁】改变车辆状态失败");
|
||||
throw new ServiceException("【临时解锁】改变车辆状态失败");
|
||||
}
|
||||
/** 5.记录行程*/
|
||||
int tripLog = tripLogService.tripLog(orderNo, finalSn,ServiceConstants.TRIP_LOG_TYPE_TEMPORARILY_UNLOCK);
|
||||
if(tripLog==0){
|
||||
log.info("【临时解锁】记录行程失败");
|
||||
throw new ServiceException("【临时解锁】记录行程失败");
|
||||
}
|
||||
}else{
|
||||
/** 改变车辆锁状态:1-开 */
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||
int device = asDeviceMapper.updateAsDevice(asDevice);
|
||||
if(device==0){
|
||||
log.info("【临时解锁】改变车辆状态失败");
|
||||
throw new ServiceException("【临时解锁】改变车辆状态失败");
|
||||
}
|
||||
}else{
|
||||
asDevice.setLongitude(lon);
|
||||
asDevice.setLatitude(lat);
|
||||
asDevice.setLastTime(DateUtils.getNowDate());
|
||||
}
|
||||
if(StrUtil.isNotBlank(orderNo)){//有订单号,则是用户骑行中解锁
|
||||
/** 改变车辆状态:3-骑行中 */
|
||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);//骑行中
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||
int device = asDeviceMapper.updateAsDevice(asDevice);
|
||||
if(device==0){
|
||||
log.info("【临时解锁】改变车辆状态失败");
|
||||
throw new ServiceException("【临时解锁】改变车辆状态失败");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if(!execute)throw new ServiceException("临时解锁失败");
|
||||
/** 5.记录行程*/
|
||||
int tripLog = tripLogService.tripLog(orderNo, finalSn,ServiceConstants.TRIP_LOG_TYPE_TEMPORARILY_UNLOCK);
|
||||
if(tripLog==0){
|
||||
log.info("【临时解锁】记录行程失败");
|
||||
throw new ServiceException("【临时解锁】记录行程失败");
|
||||
}
|
||||
}else{
|
||||
/** 改变车辆锁状态:1-开 */
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||
int device = asDeviceMapper.updateAsDevice(asDevice);
|
||||
if(device==0){
|
||||
log.info("【临时解锁】改变车辆状态失败");
|
||||
throw new ServiceException("【临时解锁】改变车辆状态失败");
|
||||
}
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1043,7 +1072,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean returnVehicle(String orderNo,String returnType) {
|
||||
public Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat) {
|
||||
if(StrUtil.isNotBlank(orderNo)){
|
||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||
if(ObjectUtil.isNull(order)){
|
||||
|
|
@ -1078,11 +1107,25 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
order.setReturnTime(DateUtils.getNowDate());
|
||||
String token = Token.getToken();
|
||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
|
||||
/** 2. 车辆远程关锁*/
|
||||
ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "还车关锁");
|
||||
if(responseVo.getCode()!=0){
|
||||
log.info("【还车关锁】远程关锁失败");
|
||||
throw new ServiceException("远程关锁失败");
|
||||
if(ServiceConstants.RETURN_TYPE_NORMAL.equals(returnType)){
|
||||
if(!"true".equals(isBluetooth)){
|
||||
/** 2. 车辆远程关锁*/
|
||||
ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "还车关锁");
|
||||
if(responseVo.getCode()!=0){
|
||||
log.info("【还车关锁】远程关锁失败");
|
||||
throw new ServiceException("远程关锁失败");
|
||||
}
|
||||
}else{
|
||||
// 更新定位
|
||||
device.setLongitude(lon);
|
||||
device.setLatitude(lat);
|
||||
device.setLastTime(DateUtils.getNowDate());
|
||||
}
|
||||
}else{
|
||||
ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "还车关锁");
|
||||
if(responseVo.getCode()!=0){
|
||||
log.info("【还车关锁】远程关锁失败");
|
||||
}
|
||||
}
|
||||
/** 4. 更新车辆状态*/
|
||||
device.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
|
||||
|
|
@ -1094,6 +1137,13 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}
|
||||
/** 3. 计算订单费用,保存订单总金额*/
|
||||
order = calculateOrderFee(order);
|
||||
/** 6.计算行车距离*/
|
||||
String tripRouteStr = order.getTripRouteStr();
|
||||
if(StrUtil.isNotBlank(tripRouteStr)){
|
||||
double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
|
||||
double v = GeoUtils.calculateTotalDistance(doubles);
|
||||
order.setDistance((int)Math.round(v));
|
||||
}
|
||||
int i = etOrderService.updateEtOrder(order);
|
||||
if(i==0){
|
||||
throw new ServiceException("更新订单状态失败");
|
||||
|
|
@ -1244,7 +1294,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}else{
|
||||
//大于起步分钟,按照时长费计算费用
|
||||
//minutes除以startingMinutes得到的结构四舍五入
|
||||
minutes = minutes - timeoutTime;//扣掉起步分钟数后
|
||||
minutes = minutes - startingTime;//扣掉起步分钟数后
|
||||
double ceil = Math.ceil(minutes / timeoutTime) +1 ;
|
||||
ridingFee = new BigDecimal(ceil * Double.parseDouble(timeoutPrice));
|
||||
BigDecimal startingPriceB = new BigDecimal(startingPrice);
|
||||
|
|
@ -1332,7 +1382,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
log.info("运营区【{}】没有停车区,",areaId);
|
||||
throw new ServiceException("运营区【{}】没有停车区"+areaId.toString());
|
||||
throw new ServiceException("运营区【{"+area.getAreaName()+"}】没有停车区");
|
||||
}
|
||||
double tolerance = area.getError(); // 误差距离
|
||||
for (EtParkingArea etParkingArea : parkingAreas) {
|
||||
|
|
@ -1354,6 +1404,32 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
return inCircle;
|
||||
}
|
||||
|
||||
private Boolean isParkingZoneByLocation(String longitude, String latitude,Long areaId) {
|
||||
Boolean inCircle = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setType(ServiceConstants.PARKING_AREA_TYPE_PARKFING);
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
log.info("运营区【{}】没有停车区,",areaId);
|
||||
throw new ServiceException("运营区【{}】没有停车区"+areaId.toString());
|
||||
}
|
||||
double tolerance = area.getError(); // 误差距离
|
||||
for (EtParkingArea etParkingArea : parkingAreas) {
|
||||
Geometry geometry = GeoUtils.fromWkt(etParkingArea.getBoundary());
|
||||
inCircle = GeoUtils.isInPolygonWithTolerance(longitude, latitude, geometry, tolerance);
|
||||
if(inCircle){
|
||||
log.info("位置【{},{}】在停车区【{}】内",longitude,latitude,etParkingArea.getParkingName());
|
||||
inCircle = true;
|
||||
break;
|
||||
}else{
|
||||
log.info("位置【{},{}】在停车区【{}】内",longitude,latitude,etParkingArea.getParkingName());
|
||||
}
|
||||
}
|
||||
return inCircle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在运营区内
|
||||
*/
|
||||
|
|
@ -1538,6 +1614,33 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mac号判断是否有绑定过
|
||||
*/
|
||||
@Override
|
||||
public boolean isBandByMac(String mac) {
|
||||
AsDevice info = asDeviceMapper.checkMACUnique(mac);
|
||||
if (StringUtils.isNull(info))
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在停车区
|
||||
*/
|
||||
@Override
|
||||
public IsInParkingAreaVo isInParkingArea(String longitude, String latitude,String areaId){
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(Long.parseLong(areaId));
|
||||
IsInParkingAreaVo isInParkingAreaVo = new IsInParkingAreaVo();
|
||||
Boolean parkingZoneByLocation = isParkingZoneByLocation(longitude, latitude, Long.parseLong(areaId));
|
||||
isInParkingAreaVo.setIsInParkingArea(parkingZoneByLocation);
|
||||
//停车点还车:0-关闭;1-开启
|
||||
isInParkingAreaVo.setParkingReturn("1".equals(area.getParkingReturn()));
|
||||
return isInParkingAreaVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sn和mac号绑定
|
||||
|
|
@ -1546,27 +1649,36 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@SneakyThrows
|
||||
@Override
|
||||
public int bandSn(AsDevice asDevice) {
|
||||
// 调用onenet接口
|
||||
CreateDeviceVo createDeviceVo = new CreateDeviceVo();
|
||||
createDeviceVo.setDevice_name(asDevice.getMac());
|
||||
createDeviceVo.setProduct_id(productId);
|
||||
String result = HttpUtils.sendPostWithToken(deviceUrl,JSON.toJSONString(createDeviceVo), Token.getToken());
|
||||
log.info("【sn和mac号绑定】===>IOT请求调用结果:【{}】",result);
|
||||
JSONObject paramsObj = JSON.parseObject(result);
|
||||
String code = paramsObj.getString("code");
|
||||
//记录命令
|
||||
if (!HttpStatus.IOT_SUCCESS.equals(code))
|
||||
{
|
||||
throw new ServiceException(code+"-----"+ paramsObj.getString("msg"));
|
||||
}
|
||||
try{
|
||||
int insert = asDeviceMapper.insert(asDevice);
|
||||
if(insert==0){
|
||||
AsDevice device = asDeviceMapper.selectAsDeviceByMac(asDevice.getMac());
|
||||
if(StringUtils.isNotNull(device)){
|
||||
device.setSn(asDevice.getSn());
|
||||
int i = asDeviceMapper.updateAsDeviceBySn(device);
|
||||
if(i>0){
|
||||
log.info("【sn和mac号绑定】===>mac【{}】已经绑定过:更新sn【{}】成功",device.getMac(),device.getSn());
|
||||
}
|
||||
}else{
|
||||
// 调用onenet接口
|
||||
CreateDeviceVo createDeviceVo = new CreateDeviceVo();
|
||||
createDeviceVo.setDevice_name(asDevice.getMac());
|
||||
createDeviceVo.setProduct_id(productId);
|
||||
String result = HttpUtils.sendPostWithToken(deviceUrl,JSON.toJSONString(createDeviceVo), Token.getToken());
|
||||
log.info("【sn和mac号绑定】===>IOT请求调用结果:【{}】",result);
|
||||
JSONObject paramsObj = JSON.parseObject(result);
|
||||
String code = paramsObj.getString("code");
|
||||
//记录命令
|
||||
if (!HttpStatus.IOT_SUCCESS.equals(code))
|
||||
{
|
||||
throw new ServiceException(code+"-----"+ paramsObj.getString("msg"));
|
||||
}
|
||||
try{
|
||||
int insert = asDeviceMapper.insert(asDevice);
|
||||
if(insert==0){
|
||||
throw new ServiceException("该SN已经存在,请勿重复绑定!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("该SN已经存在",e.getMessage());
|
||||
throw new ServiceException("该SN已经存在,请勿重复绑定!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("该SN已经存在",e.getMessage());
|
||||
throw new ServiceException("该SN已经存在,请勿重复绑定!");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.ruoyi.system.domain.EtOperatingArea;
|
|||
import com.ruoyi.system.domain.EtOrder;
|
||||
import com.ruoyi.system.domain.vo.AuthenticationVo;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.service.IAsUserService;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.IEtOrderService;
|
||||
|
|
@ -64,6 +65,9 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Resource
|
||||
private EtOrderMapper etOrderMapper;
|
||||
|
||||
@Value("${et.verifyUrl}")
|
||||
private String verifyUrl;
|
||||
|
||||
|
|
@ -456,7 +460,7 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||
etOrder.setUserId(userId);
|
||||
etOrder.setPaid("1");
|
||||
if(etOrderService.selectEtOrderList(etOrder).size()<1){//没有充值押金记录
|
||||
if(etOrderMapper.selectEtOrderList(etOrder).size()<1){//没有充值押金记录
|
||||
log.info("用户【{}】没有充值押金记录",userId);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -467,9 +471,9 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
* 新增用户
|
||||
*/
|
||||
@Override
|
||||
public String getNewUser(String powerStart, String powerEnd) {
|
||||
public String getNewUser(String powerStart, String powerEnd,String areaId) {
|
||||
if(StringUtils.isNotEmpty(powerStart) && StringUtils.isNotEmpty(powerEnd)){
|
||||
return asUserMapper.getNewUser(powerStart,powerEnd);
|
||||
return asUserMapper.getNewUser(powerStart,powerEnd,areaId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -478,9 +482,9 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
* 总用户
|
||||
*/
|
||||
@Override
|
||||
public String getTotalUser(String powerStart, String powerEnd) {
|
||||
public String getTotalUser(String powerStart, String powerEnd,String areaId) {
|
||||
if(StringUtils.isNotEmpty(powerStart) && StringUtils.isNotEmpty(powerEnd)){
|
||||
return asUserMapper.getTotalUser(powerStart,powerEnd);
|
||||
return asUserMapper.getTotalUser(powerStart,powerEnd,areaId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -489,9 +493,9 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
* 租赁用户
|
||||
*/
|
||||
@Override
|
||||
public String getLeaseUser(String powerStart, String powerEnd) {
|
||||
public String getLeaseUser(String powerStart, String powerEnd,String areaId) {
|
||||
if(StringUtils.isNotEmpty(powerStart) && StringUtils.isNotEmpty(powerEnd)){
|
||||
return asUserMapper.getLeaseUser(powerStart,powerEnd);
|
||||
return asUserMapper.getLeaseUser(powerStart,powerEnd,areaId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -503,7 +507,7 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
@Override
|
||||
public int bandSystemUser(AsUser user) {
|
||||
// 删除用户缓存
|
||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.APP_LOGIN_TOKEN_KEY + "*");
|
||||
redisCache.deleteObject(keys);
|
||||
return asUserMapper.updateUser(user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,11 +436,11 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
// 更新用户信息,清除缓存
|
||||
asUser.setBalance(BigDecimal.ZERO);
|
||||
int updateUser = userService.updateUser(asUser);
|
||||
if(updateUser>0){
|
||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
redisCache.deleteObject(keys);
|
||||
logger.info("【微信支付回调】退还押金,更新用户余额成功!");
|
||||
}
|
||||
// if(updateUser>0){
|
||||
// Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
// redisCache.deleteObject(keys);
|
||||
// logger.info("【微信支付回调】退还押金,更新用户余额成功!");
|
||||
// }
|
||||
logger.info("=================【微信支付回调】退还押金定时任务结束!!!==================");
|
||||
} else {
|
||||
throw new ServiceException("没有找到押金充值记录");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.ruoyi.common.utils.CommonUtil;
|
|||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.EtFaultMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -56,6 +57,9 @@ public class EtFaultServiceImpl implements IEtFaultService
|
|||
@Autowired
|
||||
private IEtAdminOrderHistoryService etAdminOrderHistoryService;
|
||||
|
||||
@Resource
|
||||
private AsDeviceMapper asDeviceMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -175,7 +179,7 @@ public class EtFaultServiceImpl implements IEtFaultService
|
|||
String orderNo = IdUtils.getOrderNo("wx");
|
||||
EtAdminOrder adminOrder = new EtAdminOrder();
|
||||
adminOrder.setOrderNo(orderNo);
|
||||
adminOrder.setDeviceMac(etFault.getDeviceMac());
|
||||
adminOrder.setSn(etFault.getSn());
|
||||
adminOrder.setType("1");
|
||||
adminOrder.setStatus("3");
|
||||
adminOrder.setIsEffective("1");
|
||||
|
|
@ -183,6 +187,10 @@ public class EtFaultServiceImpl implements IEtFaultService
|
|||
adminOrder.setAdminId(sysUser.getUserId());
|
||||
adminOrder.setAdminName(sysUser.getUserName());
|
||||
adminOrder.setFaultId(etFault.getFaultId());
|
||||
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(etFault.getSn());
|
||||
if(ObjectUtil.isNotNull(asDevice)){
|
||||
adminOrder.setAreaId(asDevice.getAreaId());
|
||||
}
|
||||
int adminOrder1 = etAdminOrderService.insertEtAdminOrder(adminOrder);
|
||||
if(adminOrder1>0){
|
||||
log.info("工单创建成功");
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ import com.ruoyi.common.core.domain.entity.AsUser;
|
|||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.onenet.ResponseVo;
|
||||
import com.ruoyi.common.utils.onenet.Token;
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
|
|
@ -161,7 +163,10 @@ public class EtModelServiceImpl implements IEtModelService
|
|||
Integer quantityByPercentage = CommonUtil.getElectricQuantityByPercentage(lowBatteryReminder, etModel.getFullVoltage(), etModel.getLowVoltage());
|
||||
String lowVoltageCommand = IotConstants.COMMAND_BAT + quantityByPercentage * 10 + "@";
|
||||
log.info("发送低电压命令:" + lowVoltageCommand);
|
||||
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报");
|
||||
ResponseVo responseVo = asDeviceService.sendCommandWithResp(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报");
|
||||
if(responseVo.getCode()!=0){
|
||||
log.info("【还车关锁】设备【{}】远程关锁失败", asDevice.getMac());
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
|
|
|||
|
|
@ -262,7 +262,9 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
|
|||
double lat = Double.parseDouble(latitude);
|
||||
//如果是创享小程序,根据‘是否使用创享电动车小程序’查询出所有为是的运营商下所有的运营区
|
||||
EtOperatingArea area1 = new EtOperatingArea();
|
||||
area1.setDeptId(Long.parseLong(deptId));
|
||||
if(!"100".equals(deptId)){
|
||||
area1.setDeptId(Long.parseLong(deptId));
|
||||
}
|
||||
List<EtOperatingArea> etOperatingAreas = etOperatingAreaService.selectEtOperatingAreaList(area1);
|
||||
EtOperatingArea area = null;
|
||||
for(EtOperatingArea etOperatingArea:etOperatingAreas){
|
||||
|
|
@ -325,5 +327,16 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
|
|||
return dao.selectAreaListByDeptId(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门ID获取运营区选择框列表
|
||||
*
|
||||
* @param deptId 用户ID
|
||||
* @return 选中运营区ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<EtOperatingArea> selectAreaListByDeptId2(Long deptId) {
|
||||
return dao.selectAreaListByDeptId2(deptId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ package com.ruoyi.system.service.impl;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
|
@ -83,6 +86,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
|
|
@ -102,6 +108,20 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
EtOrder order = etOrderMapper.selectEtOrderByOrderId(orderId);
|
||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
|
||||
order.setDevice(device);
|
||||
EtFeeRule etFeeRule = etFeeRuleService.selectEtFeeRuleByRuleId(order.getRuleId());
|
||||
order.setRule(etFeeRule);
|
||||
//行程记录
|
||||
EtTripLog tripLog = new EtTripLog();
|
||||
tripLog.setOrderNo(order.getOrderNo());
|
||||
List<EtTripLog> tripLogs = etTripLogService.selectEtTripLogList(tripLog);
|
||||
if(ObjectUtils.isNotEmpty(tripLogs)){
|
||||
order.setTripLogs(tripLogs);
|
||||
}
|
||||
// 退款记录
|
||||
EtRefund refund = etRefundService.selectEtRefundByOrderNo(order.getOrderNo());
|
||||
if(ObjectUtils.isNotEmpty(refund)){
|
||||
order.setEtRefund(refund);
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +167,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
if(ObjectUtils.isNotEmpty(user)){
|
||||
order.setPhonenumber(user.getPhonenumber());
|
||||
order.setUserName(user.getUserName());
|
||||
order.setRealName(user.getRealName());
|
||||
}
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
||||
if(ObjectUtils.isNotEmpty(area)){
|
||||
|
|
@ -261,6 +282,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
EtRefund refund = new EtRefund();
|
||||
refund.setType(ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
refund.setRefundResult(Constants.SUCCESS2);
|
||||
refund.setUserName(etOrder.getUserName());
|
||||
List<EtRefund> etRefunds = etRefundService.selectEtRefundListWithIsolate(refund);
|
||||
etRefunds.forEach(etRefund -> {
|
||||
AsUser asUser = asUserService.selectUserById(etRefund.getUserId());
|
||||
|
|
@ -543,45 +565,45 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
* 运营数据
|
||||
*/
|
||||
@Override
|
||||
public OperatingDataVo getOperatingData(String timeStart,String timeEnd) {
|
||||
public OperatingDataVo getOperatingData(String timeStart,String timeEnd,String areaId) {
|
||||
OperatingDataVo operatingDataVo = new OperatingDataVo();
|
||||
if(StrUtil.isNotBlank(timeStart) && StrUtil.isNotBlank(timeEnd)){
|
||||
/*收入相关*/
|
||||
OperatingDataVo.Income income = new OperatingDataVo.Income();
|
||||
income.setTotalIncome(etOrderMapper.getTotalIncome(timeStart,timeEnd));//总收入
|
||||
income.setTotalUnpaid(etOrderMapper.getTotalUnpaid(timeStart,timeEnd));//累计待支付
|
||||
income.setTotalPaid(etOrderMapper.getTotalPaid(timeStart,timeEnd));//已支付
|
||||
income.setTotalRefund(etOrderMapper.getTotalRefund(timeStart,timeEnd));//已退款
|
||||
income.setTotalRidingFee(etOrderMapper.getTotalRidingFee(timeStart,timeEnd));//骑行已支付
|
||||
income.setTotalRidingRefund(etOrderMapper.getTotalRidingRefund(timeStart,timeEnd));//骑行已退款
|
||||
income.setTotalDispatchFee(etOrderMapper.getTotalDispatchFee(timeStart,timeEnd));//调度费已支付
|
||||
income.setTotalDispatchRefund(etOrderMapper.getTotalDispatchRefund(timeStart,timeEnd));//调度费已退款
|
||||
income.setTotalAppointmentFee(etOrderMapper.getTotalAppointmentFee(timeStart,timeEnd));//预约费已支付
|
||||
income.setTotalAppointmentRefund(etOrderMapper.getTotalAppointmentRefund(timeStart,timeEnd));//预约费已退款
|
||||
income.setTotalManageFee(etOrderMapper.getTotalManageFee(timeStart,timeEnd));//管理费已支付
|
||||
income.setTotalManageRefund(etOrderMapper.getTotalManageRefund(timeStart,timeEnd));//管理费已退款
|
||||
income.setTotalIncome(etOrderMapper.getTotalIncome(timeStart,timeEnd,areaId));//总收入
|
||||
income.setTotalUnpaid(etOrderMapper.getTotalUnpaid(timeStart,timeEnd,areaId));//累计待支付
|
||||
income.setTotalPaid(etOrderMapper.getTotalPaid(timeStart,timeEnd,areaId));//已支付
|
||||
income.setTotalRefund(etOrderMapper.getTotalRefund(timeStart,timeEnd,areaId));//已退款
|
||||
income.setTotalRidingFee(etOrderMapper.getTotalRidingFee(timeStart,timeEnd,areaId));//骑行已支付
|
||||
income.setTotalRidingRefund(etOrderMapper.getTotalRidingRefund(timeStart,timeEnd,areaId));//骑行已退款
|
||||
income.setTotalDispatchFee(etOrderMapper.getTotalDispatchFee(timeStart,timeEnd,areaId));//调度费已支付
|
||||
income.setTotalDispatchRefund(etOrderMapper.getTotalDispatchRefund(timeStart,timeEnd,areaId));//调度费已退款
|
||||
income.setTotalAppointmentFee(etOrderMapper.getTotalAppointmentFee(timeStart,timeEnd,areaId));//预约费已支付
|
||||
income.setTotalAppointmentRefund(etOrderMapper.getTotalAppointmentRefund(timeStart,timeEnd,areaId));//预约费已退款
|
||||
income.setTotalManageFee(etOrderMapper.getTotalManageFee(timeStart,timeEnd,areaId));//管理费已支付
|
||||
income.setTotalManageRefund(etOrderMapper.getTotalManageRefund(timeStart,timeEnd,areaId));//管理费已退款
|
||||
operatingDataVo.setIncome(income);
|
||||
|
||||
/*订单相关*/
|
||||
OperatingDataVo.OrderVo orderVo = new OperatingDataVo.OrderVo();
|
||||
orderVo.setPaidOrder(etOrderMapper.getPaidOrder(timeStart,timeEnd));//已支付订单
|
||||
orderVo.setRidingOrder(etOrderMapper.getRidingOrder(timeStart,timeEnd));//骑行中订单
|
||||
orderVo.setRefundOrder(etOrderMapper.getRefundOrder(timeStart,timeEnd));//退款订单
|
||||
orderVo.setUnpaidOrder(etOrderMapper.getUnpaidOrder(timeStart,timeEnd));//待支付订单
|
||||
orderVo.setPaidOrder(etOrderMapper.getPaidOrder(timeStart,timeEnd,areaId));//已支付订单
|
||||
orderVo.setRidingOrder(etOrderMapper.getRidingOrder(timeStart,timeEnd,areaId));//骑行中订单
|
||||
orderVo.setRefundOrder(etOrderMapper.getRefundOrder(timeStart,timeEnd,areaId));//退款订单
|
||||
orderVo.setUnpaidOrder(etOrderMapper.getUnpaidOrder(timeStart,timeEnd,areaId));//待支付订单
|
||||
operatingDataVo.setOrder(orderVo);
|
||||
|
||||
/*设备相关*/
|
||||
OperatingDataVo.DeviceVo deviceVo = new OperatingDataVo.DeviceVo();
|
||||
deviceVo.setInOperationDevice(deviceService.getInOperationDevice(timeStart,timeEnd));//运营中车辆
|
||||
deviceVo.setInOrderDevice(deviceService.getInOrderDevice(timeStart,timeEnd));//有订单车辆
|
||||
deviceVo.setNoOrderDevice(deviceService.getNoOrderDevice(timeStart,timeEnd));//无订单车辆
|
||||
deviceVo.setInOperationDevice(deviceService.getInOperationDevice(timeStart,timeEnd,areaId));//运营中车辆
|
||||
deviceVo.setInOrderDevice(deviceService.getInOrderDevice(timeStart,timeEnd,areaId));//有订单车辆
|
||||
deviceVo.setNoOrderDevice(deviceService.getNoOrderDevice(timeStart,timeEnd,areaId));//无订单车辆
|
||||
operatingDataVo.setDevice(deviceVo);
|
||||
|
||||
/*用户相关*/
|
||||
OperatingDataVo.UserVo userVo = new OperatingDataVo.UserVo();
|
||||
userVo.setTotalUser(asUserService.getTotalUser(timeStart,timeEnd));//总用户
|
||||
userVo.setNewUser(asUserService.getNewUser(timeStart,timeEnd));//新增用户
|
||||
userVo.setLeaseUser(asUserService.getLeaseUser(timeStart,timeEnd));//租赁用户
|
||||
userVo.setTotalUser(asUserService.getTotalUser(timeStart,timeEnd,areaId));//总用户
|
||||
userVo.setNewUser(asUserService.getNewUser(timeStart,timeEnd,areaId));//新增用户
|
||||
userVo.setLeaseUser(asUserService.getLeaseUser(timeStart,timeEnd,areaId));//租赁用户
|
||||
operatingDataVo.setUser(userVo);
|
||||
return operatingDataVo;
|
||||
}else{
|
||||
|
|
@ -720,12 +742,12 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
* type: 1-按日期 2-按车辆
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ReconciliationVo reconciliation(String timeStart, String timeEnd, String type, String sn) {
|
||||
public ReconciliationVo reconciliation(String timeStart, String timeEnd, String type, String sn,String areaId) {
|
||||
ReconciliationVo reconciliationVo = new ReconciliationVo();
|
||||
List<ReconciliationVo.Reconciliation> reconciliations = new ArrayList<>();
|
||||
|
||||
if ("1".equals(type)) {
|
||||
reconciliationVo = handleReconciliationByDate(timeStart, timeEnd, reconciliations);
|
||||
reconciliationVo = handleReconciliationByDate(timeStart, timeEnd, reconciliations,areaId);
|
||||
} else if ("2".equals(type)) {
|
||||
reconciliationVo = handleReconciliationByVehicle(timeStart, timeEnd, sn, reconciliations);
|
||||
} else {
|
||||
|
|
@ -735,14 +757,13 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
return reconciliationVo;
|
||||
}
|
||||
|
||||
private ReconciliationVo handleReconciliationByDate(String timeStart, String timeEnd, List<ReconciliationVo.Reconciliation> reconciliations) throws Exception {
|
||||
private ReconciliationVo handleReconciliationByDate(String timeStart, String timeEnd, List<ReconciliationVo.Reconciliation> reconciliations,String areaId) throws Exception {
|
||||
ReconciliationVo reconciliationVo = new ReconciliationVo();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
int limit = DateUtils.differentDaysByMillisecond(timeStart, timeEnd) + 1;
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(dateFormat.parse(timeEnd));
|
||||
List<Long> areaIds = getAreaIds();
|
||||
|
||||
for (int i = 0; i < limit; i++) {
|
||||
String formattedDate = dateFormat.format(calendar.getTime());
|
||||
|
|
@ -750,9 +771,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
|
||||
if (StrUtil.isNotBlank(timeStart) && StrUtil.isNotBlank(timeEnd)) {
|
||||
for (Long areaId : areaIds) {
|
||||
reconciliations.add(createReconciliationByDate(formattedDate, startDateStr, endDateStr, areaId));
|
||||
}
|
||||
reconciliations.add(createReconciliationByDate(formattedDate, startDateStr, endDateStr, Long.parseLong(areaId)));
|
||||
}
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
|
|
@ -770,7 +789,8 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
}
|
||||
AsDevice device1 = new AsDevice();
|
||||
device1.setSn(sn);
|
||||
List<AsDevice> devices = asDeviceService.selectAsDeviceList(device1);
|
||||
List<AsDevice> devices = asDeviceMapper.selectAsDeviceList(device1);
|
||||
log.info("【收入对账】根据sn搜索出的devices:{}", JSON.toJSON(devices));
|
||||
for (AsDevice device : devices) {
|
||||
reconciliations.add(createReconciliationByVehicle(timeStart, timeEnd, device.getSn()));
|
||||
}
|
||||
|
|
@ -785,7 +805,8 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
StringBuilder ridingFee = new StringBuilder();
|
||||
StringBuilder dispatchFee = new StringBuilder();
|
||||
reconciliation.setAreaName(etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId).getAreaName());
|
||||
reconciliation.setDeptName(deptService.selectDeptById(SecurityUtils.getLoginUser().getUser().getDeptId()).getDeptName());
|
||||
SysDept deptObjByAreaId = wxPayService.getDeptObjByAreaId(areaId);
|
||||
reconciliation.setDeptName(deptObjByAreaId.getDeptName());
|
||||
reconciliation.setDay(formattedDate);
|
||||
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
|
|
@ -825,10 +846,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
return reconciliation;
|
||||
}
|
||||
|
||||
private List<Long> getAreaIds() {
|
||||
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
|
||||
return deptId == 100 ? etOperatingAreaService.selectAreaListByDeptId(null) : etOperatingAreaService.selectAreaListByDeptId(deptId);
|
||||
}
|
||||
// private List<Long> getAreaIds() {
|
||||
// Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
|
||||
// return deptId == 100 ? etOperatingAreaService.selectAreaListByDeptId(null) : etOperatingAreaService.selectAreaListByDeptId(deptId);
|
||||
// }
|
||||
|
||||
private void calculateTotal(List<ReconciliationVo.Reconciliation> reconciliations, ReconciliationVo reconciliationVo) {
|
||||
reconciliationVo.setTotalPayFee(calculateTotalField(reconciliations, ReconciliationVo.Reconciliation::getPayFee));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.ruoyi.common.utils.CommonUtil;
|
|||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import com.ruoyi.system.domain.EtOrder;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.service.IAsDeviceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -17,6 +18,8 @@ import com.ruoyi.system.mapper.EtTripLogMapper;
|
|||
import com.ruoyi.system.domain.EtTripLog;
|
||||
import com.ruoyi.system.service.IEtTripLogService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 行程记录Service业务层处理
|
||||
*
|
||||
|
|
@ -33,6 +36,9 @@ public class EtTripLogServiceImpl implements IEtTripLogService
|
|||
@Autowired
|
||||
private IAsDeviceService asDeviceService;
|
||||
|
||||
@Resource
|
||||
private AsDeviceMapper asDeviceMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询行程记录
|
||||
|
|
@ -114,7 +120,7 @@ public class EtTripLogServiceImpl implements IEtTripLogService
|
|||
etTripLog.setOrderNo(orderNo);
|
||||
AsDevice asDevice = null;
|
||||
if(StrUtil.isNotBlank(sn)){
|
||||
asDevice = asDeviceService.selectAsDeviceBySn(sn);
|
||||
asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||
etTripLog.setLatitude(asDevice.getLatitude());
|
||||
etTripLog.setLongitude(asDevice.getLongitude());
|
||||
String location = asDevice.getLongitude() + ","+asDevice.getLatitude();
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ public class EtTask {
|
|||
asUser.setBalance(BigDecimal.ZERO);
|
||||
int updateUser = asUserMapper.updateUser(asUser);
|
||||
if(updateUser>0){
|
||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
redisCache.deleteObject(keys);
|
||||
// Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.APP_LOGIN_TOKEN_KEY + "*");
|
||||
// redisCache.deleteObject(keys);
|
||||
log.info("【系统启动】退还押金,更新用户余额成功!");
|
||||
}
|
||||
log.info("=================【系统启动】退还押金定时任务结束!!!==================");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<id property="classifyId" column="classify_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
<result property="classifyName" column="classify_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
|
|
@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectClassifyList" parameterType="AsArticleClassify" resultMap="AsArticleClassifyResult">
|
||||
select ac.classify_id, ac.dept_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status, ac.del_flag, ac.create_by, ac.create_time
|
||||
select ac.classify_id, d.dept_name, ac.dept_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status, ac.del_flag, ac.create_by, ac.create_time
|
||||
from et_article_classify ac
|
||||
left join sys_dept d on d.dept_id = ac.dept_id
|
||||
where ac.del_flag = '0'
|
||||
|
|
@ -36,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="parentId != null and parentId != 0">
|
||||
AND ac.parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND ac.dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="deptName != null and deptName != ''">
|
||||
AND ac.dept_name = #{deptName}
|
||||
</if>
|
||||
<if test="classifyName != null and classifyName != ''">
|
||||
AND ac.classify_name like concat('%', #{classifyName}, '%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="sn" column="sn" />
|
||||
<result property="modelId" column="model_id" />
|
||||
<result property="vehicleNum" column="vehicle_num" />
|
||||
<result property="version" column="version" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="activationTime" column="activation_time" />
|
||||
<result property="onlineStatus" column="online_status" />
|
||||
|
|
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.vehicle_num, de.area_id,
|
||||
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,
|
||||
de.update_time, de.last_time, de.remark, de.status, de.lock_status, de.location,
|
||||
de.remaining_power, de.voltage, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking from et_device de
|
||||
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking from et_device de
|
||||
left join et_area_dept ad on ad.area_id = de.area_id
|
||||
left join sys_dept d on d.dept_id = ad.dept_id
|
||||
where 1 = 1
|
||||
|
|
@ -109,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN et_device d ON o.sn = d.sn
|
||||
WHERE
|
||||
date_format( o.create_time, '%y%m%d' ) >= date_format( #{timeStart}, '%y%m%d' )
|
||||
AND date_format( o.create_time, '%y%m%d' ) <= date_format( #{timeEnd}, '%y%m%d' ) and o.sn IS NOT NULL
|
||||
AND date_format( o.create_time, '%y%m%d' ) <= date_format( #{timeEnd}, '%y%m%d' ) and o.sn IS NOT NULL and o.area_id = #{areaId}
|
||||
GROUP BY
|
||||
o.sn
|
||||
) a
|
||||
|
|
@ -122,8 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
et_order o
|
||||
LEFT JOIN et_device d ON o.sn = d.sn
|
||||
WHERE
|
||||
date_format( o.create_time, '%y%m%d' ) >= date_format( #{timeStart}, '%y%m%d' )
|
||||
AND date_format( o.create_time, '%y%m%d' ) <= date_format( #{timeEnd}, '%y%m%d' ) and o.sn IS NOT NULL
|
||||
date_format( o.create_time, '%y%m%d' ) >= date_format( #{timeStart}, '%y%m%d' )
|
||||
AND date_format( o.create_time, '%y%m%d' ) <= date_format( #{timeEnd}, '%y%m%d' ) and o.sn IS NOT NULL and o.area_id = #{areaId}
|
||||
GROUP BY
|
||||
o.sn
|
||||
)
|
||||
|
|
@ -146,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sn != null">sn,</if>
|
||||
<if test="modelId != null">model_id,</if>
|
||||
<if test="vehicleNum != null">vehicle_num,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="activationTime != null">activation_time,</if>
|
||||
<if test="onlineStatus != null">online_status,</if>
|
||||
|
|
@ -172,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sn != null">#{sn},</if>
|
||||
<if test="modelId != null">#{modelId},</if>
|
||||
<if test="vehicleNum != null">#{vehicleNum},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="activationTime != null">#{activationTime},</if>
|
||||
<if test="onlineStatus != null">#{onlineStatus},</if>
|
||||
|
|
@ -202,6 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sn != null">sn = #{sn},</if>
|
||||
<if test="modelId != null">model_id = #{modelId},</if>
|
||||
<if test="vehicleNum != null">vehicle_num = #{vehicleNum},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="activationTime != null">activation_time = #{activationTime},</if>
|
||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
||||
|
|
|
|||
|
|
@ -131,12 +131,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where date_format(create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
and status = '0'
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getLeaseUser" resultType="java.lang.String">
|
||||
select count(1) from et_order o LEFT JOIN et_user u on o.user_id = u.user_id
|
||||
where date_format(u.create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
and date_format(u.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTotalUser" resultType="java.lang.String">
|
||||
|
|
@ -144,6 +150,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where date_format(create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
and status = '0'
|
||||
<if test="areaId != null and areaId != ''">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="isEffective != null and isEffective != ''"> and ao.is_effective = #{isEffective}</if>
|
||||
<if test="address != null and address != ''"> and ao.address = #{address}</if>
|
||||
<if test="completeTime != null "> and ao.complete_time = #{completeTime}</if>
|
||||
<if test="areaId != null "> and ao.area_id = #{areaId}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
|
@ -63,10 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="selectRepairNum" resultType="java.lang.Integer">
|
||||
select count(1) from et_admin_order where type = '1' and admin_id = #{adminId}
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPowerReplacementNum" resultType="java.lang.Integer">
|
||||
select count(1) from et_admin_order where type = '2' and admin_id = #{adminId}
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="checkOrderUnique" resultType="Integer">
|
||||
|
|
|
|||
|
|
@ -87,4 +87,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAreaListByDeptId2" resultMap="EtOperatingAreaResult" parameterType="Long">
|
||||
select a.area_id, a.area_name
|
||||
from et_operating_area a
|
||||
left join et_area_dept ad on ad.area_id = a.area_id
|
||||
left join sys_dept d on d.dept_id = ad.dept_id
|
||||
<where>
|
||||
<if test="deptId != null"> and d.dept_id = #{deptId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="ruleId" column="rule_id" />
|
||||
<result property="deviceMac" column="device_mac" />
|
||||
<result property="sn" column="sn" />
|
||||
<result property="vehicleNum" column="vehicle_num" />
|
||||
<result property="payTime" column="pay_time" />
|
||||
<result property="paid" column="paid" />
|
||||
<result property="payType" column="pay_type" />
|
||||
|
|
@ -59,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
o.rule_id,
|
||||
o.device_mac,
|
||||
o.sn,
|
||||
de.vehicle_num,
|
||||
o.pay_time,
|
||||
o.paid,
|
||||
o.pay_type,
|
||||
|
|
@ -88,12 +90,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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>
|
||||
|
|
@ -196,6 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select COALESCE(SUM(total_fee), 0) from et_order where status = 4 and type = 1
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getTotalUnpaid" resultType="java.lang.String" parameterType="String">
|
||||
|
|
@ -211,7 +217,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getTotalRefund" resultType="java.lang.String">
|
||||
select COALESCE(SUM(amount), 0) from et_refund
|
||||
select COALESCE(SUM(amount), 0) from et_refund where type = 1 AND refund_result = 'SUCCESS'
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d')
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d')
|
||||
</select>
|
||||
|
||||
<select id="getTotalRidingFee" resultType="java.lang.String">
|
||||
|
|
@ -352,17 +360,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!--todo 待修改-->
|
||||
<select id="getRefundFee" resultType="java.math.BigDecimal">
|
||||
select COALESCE(SUM(total_fee), 0) from et_order
|
||||
select COALESCE(SUM(amount), 0) from et_refund ref
|
||||
left join et_order o on o.order_no = ref.order_no
|
||||
<where>
|
||||
<if test="sn != null and sn != ''"> and sn = #{sn}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
|
||||
<if test="areaId != null"> and o.area_id = #{areaId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
<if test="endDateStr != null and endDateStr != ''">
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
|
||||
</if>
|
||||
AND status = 4 and type = 1
|
||||
AND ref.type = 1 AND ref.refund_result = 'SUCCESS'
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectLatestOrder" resultMap="EtOrderResult">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user