From 5bffa21acc57942e316e8d002af2abb10f4e369c Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Wed, 26 Jun 2024 14:57:34 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/app/AppController.java | 4 +- .../iot/receive/ReceiveController.java | 22 +++++- .../controller/system/AsDeviceController.java | 22 ++++++ .../system/EtReconciliationControllor.java | 7 +- .../common/constant/ServiceConstants.java | 2 +- .../common/core/domain/entity/AsUser.java | 11 +++ .../common/core/domain/vo/FeeRuleVo.java | 2 +- .../com/ruoyi/common/utils/CommonUtil.java | 8 +++ .../web/service/SysLoginService.java | 12 +++- .../com/ruoyi/system/domain/AsDevice.java | 5 ++ .../ruoyi/system/domain/EtOperatingArea.java | 2 +- .../java/com/ruoyi/system/domain/EtOrder.java | 4 +- .../com/ruoyi/system/domain/EtRefund.java | 2 +- .../system/domain/vo/OperatingDataVo.java | 4 +- .../ruoyi/system/mapper/AsArticleMapper.java | 8 +++ .../ruoyi/system/mapper/AsDeviceMapper.java | 17 +++++ .../ruoyi/system/mapper/EtOrderMapper.java | 4 +- .../system/service/IAsArticleService.java | 8 +++ .../system/service/IAsDeviceService.java | 16 +++++ .../service/impl/AsArticleServiceImpl.java | 16 +++++ .../service/impl/AsDeviceServiceImpl.java | 68 +++++++++++++++++-- .../service/impl/AsUserServiceImpl.java | 15 ++-- .../service/impl/CallbackServiceImpl.java | 4 +- .../impl/EtOperatingAreaServiceImpl.java | 15 ++-- .../service/impl/EtOrderServiceImpl.java | 24 +++---- .../java/com/ruoyi/system/task/EtTask.java | 2 +- .../mapper/system/AsArticleClassifyMapper.xml | 4 +- .../mapper/system/AsArticleMapper.xml | 65 ++++++++++++++++-- .../mapper/system/AsDeviceMapper.xml | 17 ++++- .../resources/mapper/system/AsUserMapper.xml | 4 +- .../mapper/system/EtCapitalFlowMapper.xml | 34 ++++++++-- 31 files changed, 358 insertions(+), 70 deletions(-) diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java index 50e3224..f66ea8f 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java @@ -69,7 +69,7 @@ public class AppController extends BaseController public TableDataInfo articleList(EtArticle etArticle) { startPage(); - List list = asArticleService.selectAsArticleList(etArticle); + List list = asArticleService.selectAsArticleListByApp(etArticle); return getDataTable(list); } @@ -202,7 +202,7 @@ public class AppController extends BaseController // { // String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费 // String dispatchFee = sysConfigService.selectConfigByKey("dispatch.fee");//调度费 -// String vehicleManagementFee = sysConfigService.selectConfigByKey("vehicle.management.fee");//车辆管理费 +// String vehicleManagementFee = sysConfigService.selectConfigByKey("vehicle.management.fee");//车辆停车点外调度费 // String startingPrice = sysConfigService.selectConfigByKey("starting.price");//起步价 // String startingHowManyMinutes = sysConfigService.selectConfigByKey("starting.how.many.minutes");//多少分钟内按起步价 // String timeFee = sysConfigService.selectConfigByKey("time.fee");//时长费 diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java index 859473d..9b3ea13 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java @@ -307,7 +307,7 @@ public class ReceiveController { throw new ServiceException("生成换电工单失败"); } /** 改变车辆状态 */ - device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE); +// device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE); if (asDeviceService.updateAsDevice(device) > 0) { log.info("车辆状态改成换电中"); }else{ @@ -323,6 +323,26 @@ public class ReceiveController { }else{ log.info("更新定位失败:" +logEntry.getDevName()); } + }else{ + log.info("----------------未获取到定位,保存电压等数值----------------" +logEntry.getDevName()); + Integer bat = value.getBat(); + BigDecimal divide = new BigDecimal(bat).divide(new BigDecimal(10)); + log.info("保存电压:" + divide); + device.setVoltage(divide.toString());//电压 + // 根据电压计算续航里程 + EtModel model = etModelService.selectEtModelByModelId(device.getModelId()); + Integer remainingMileage = 0; + if(StrUtil.isNotBlank(device.getVoltage())){ + remainingMileage = CommonUtil.getRemainingMileage(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance()); + } + Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百 + device.setRemainingMileage(remainingMileage); + device.setRemainingPower(electricQuantity.toString()); + device.setLastTime(DateUtils.getNowDate()); + int i = asDeviceService.updateLocation(device); + if(i>0){ + log.info("未获取到定位===============保存电压等数值成功===========>" +logEntry.getDevName()); + } } }else{ log.info("未找到车辆对象:" +logEntry.getDevName()); diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java index 6122657..e1f818f 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/AsDeviceController.java @@ -116,6 +116,28 @@ public class AsDeviceController extends BaseController return toAjax(asDeviceService.deleteAsDeviceByDeviceIds(deviceIds)); } + /** + * 一键上线 + */ + @PreAuthorize("@ss.hasPermi('system:device:oneClickOnline')") + @Log(title = "设备", businessType = BusinessType.ONLINE) + @PostMapping("/oneClickOnline/{deviceIds}") + public AjaxResult oneClickOnline(@PathVariable Long[] deviceIds) + { + return toAjax(asDeviceService.oneClickOnline(deviceIds)); + } + + /** + * 一键下线 + */ + @PreAuthorize("@ss.hasPermi('system:device:oneClickOffline')") + @Log(title = "设备", businessType = BusinessType.OFFLINE) + @PostMapping("/oneClickOffline/{deviceIds}") + public AjaxResult oneClickOffline(@PathVariable Long[] deviceIds) + { + return toAjax(asDeviceService.oneClickOffline(deviceIds)); + } + /** * 响铃寻车 */ diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtReconciliationControllor.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtReconciliationControllor.java index f7e17ce..4ac869c 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtReconciliationControllor.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/EtReconciliationControllor.java @@ -65,7 +65,12 @@ public class EtReconciliationControllor extends BaseController { { SysUser user = getLoginUser().getUser(); logger.info("【后台根据token获取运营区列表】获取当前登录用户:【{}】", JSON.toJSON(user)); - List longs = etOperatingAreaService.selectAreaListByDeptId2(user.getDeptId()); + List longs; + if(user.isAdmin()){ + longs = etOperatingAreaService.selectAreaListByDeptId2(null); + }else{ + longs = etOperatingAreaService.selectAreaListByDeptId2(user.getDeptId()); + } logger.info("根据token获取运营区列表:【{}】", JSON.toJSON(longs)); return success(longs); } diff --git a/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java b/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java index 354a03c..d215862 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java +++ b/electripper-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java @@ -26,7 +26,7 @@ public class ServiceConstants { public static final String ORDER_TYPE_DEPOSIT_REFUND = "3"; /** - * 订单类型: 4-骑行订单退款(包含调度费、管理费等) + * 订单类型: 4-骑行订单退款(包含调度费、停车点外调度费) */ public static final String ORDER_TYPE_RIDING_REFUND = "4"; diff --git a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsUser.java b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsUser.java index 05849d7..03aeed1 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsUser.java +++ b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/AsUser.java @@ -91,6 +91,9 @@ public class AsUser extends BaseEntity @Excel(name = "绑定设备数量") private Integer bindDeviceNum; + /** 绑定系统用户 */ + private SysUser sysUser; + /** 展示当前设备id */ private Long deviceId; @@ -143,6 +146,14 @@ public class AsUser extends BaseEntity return sysUserId; } + public SysUser getSysUser() { + return sysUser; + } + + public void setSysUser(SysUser sysUser) { + this.sysUser = sysUser; + } + public void setSysUserId(Long sysUserId) { this.sysUserId = sysUserId; } diff --git a/electripper-common/src/main/java/com/ruoyi/common/core/domain/vo/FeeRuleVo.java b/electripper-common/src/main/java/com/ruoyi/common/core/domain/vo/FeeRuleVo.java index 0557146..eaf2820 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/core/domain/vo/FeeRuleVo.java +++ b/electripper-common/src/main/java/com/ruoyi/common/core/domain/vo/FeeRuleVo.java @@ -16,7 +16,7 @@ public class FeeRuleVo { /** 调度费 */ private String dispatchFee; - /** 管理费*/ + /** 停车点外调度费*/ private String vehicleManagementFee; /** 起步价*/ diff --git a/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java b/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java index 82b4a9a..486fc5e 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java +++ b/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java @@ -120,6 +120,10 @@ public class CommonUtil { BigDecimal divide = full.subtract(current).divide(full,2, RoundingMode.HALF_UP);//当前电量百分百 log.info("当前电量百分百:{}%",divide.multiply(new BigDecimal(100))); BigDecimal multiply = divide.multiply(new BigDecimal(fullEndurance)); + // 剩余续航里程小于0 最小为0 + if(multiply.compareTo(new BigDecimal(0)) < 0){ + multiply = new BigDecimal(0); + } log.info("当前剩余续航里程:{}km",multiply); return multiply.intValue(); } @@ -142,6 +146,10 @@ public class CommonUtil { if(multiply.compareTo(new BigDecimal(100)) > 0){ multiply = new BigDecimal(100); } + // 电量小于0 最小为0 + if(multiply.compareTo(new BigDecimal(0)) < 0){ + multiply = new BigDecimal(0); + } // log.info("当前电量百分百:{}%",multiply); return multiply.intValue(); } diff --git a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 7b757df..8e56117 100644 --- a/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/electripper-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -242,12 +242,20 @@ public class SysLoginService asUser.setCreateTime(DateUtils.getNowDate()); asUser.setWxopenid(openId); asUser.setAreaId(Long.parseLong(areaId)); - asUser.setAppName(dept.getAppName()); + if(dept.getIsUsePlatformApp().equals("true")){ + asUser.setAppName("创享电动车"); + }else{ + asUser.setAppName(dept.getAppName()); + } log.info("【微信登录/wxlogin】用户不存在,自动注册用户:【{}】", JSON.toJSON(asUser)); int i = asUserService.insertUser(asUser); user = asUser; }else{ - user.setAppName(dept.getAppName()); + if(dept.getIsUsePlatformApp().equals("true")){ + user.setAppName("创享电动车"); + }else{ + user.setAppName(dept.getAppName()); + } user.setAreaId(Long.parseLong(areaId)); int i = asUserService.updateUser(user); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/AsDevice.java b/electripper-system/src/main/java/com/ruoyi/system/domain/AsDevice.java index 3c67653..6ffcbc1 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/AsDevice.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/AsDevice.java @@ -54,6 +54,11 @@ public class AsDevice extends BaseEntityPlus implements Serializable { @TableField(exist = false) private String deptName; + /** 运营商id */ + @Excel(name = "运营商id") + @TableField(exist = false) + private Long deptId; + /** 分区 */ @Excel(name = "分区id") private Long areaId; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOperatingArea.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOperatingArea.java index 24e2f48..218c0d7 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOperatingArea.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOperatingArea.java @@ -161,7 +161,7 @@ public class EtOperatingArea extends BaseEntityPlus implements Serializable /** 调度费 */ private BigDecimal dispatchFee; - /** 管理费*/ + /** 停车点外调度费*/ private BigDecimal vehicleManagementFee; /** 预约超时保留分钟*/ diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java index 5db3d74..dc6a4a0 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrder.java @@ -123,8 +123,8 @@ public class EtOrder extends BaseEntity @Excel(name = "调度费") private BigDecimal dispatchFee; - /** 管理费 */ - @Excel(name = "管理费") + /** 停车点外调度费 */ + @Excel(name = "停车点外调度费") private BigDecimal manageFee; /** 骑行费 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java index cc27048..d039630 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java @@ -43,7 +43,7 @@ public class EtRefund extends BaseEntity /** 调度费 */ private BigDecimal dispatchFee; - /** 管理费 */ + /** 停车点外调度费 */ private BigDecimal manageFee; /** 骑行费 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/OperatingDataVo.java b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/OperatingDataVo.java index 725618e..9e9a1b3 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/OperatingDataVo.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/OperatingDataVo.java @@ -54,10 +54,10 @@ public class OperatingDataVo { //预约费已退款 private String totalAppointmentRefund; - //管理费已支付 + //停车点外调度费已支付 private String totalManageFee; - //管理费已退款 + //停车点外调度费已退款 private String totalManageRefund; } diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsArticleMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsArticleMapper.java index 37a3772..0fa0edb 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsArticleMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsArticleMapper.java @@ -28,6 +28,14 @@ public interface AsArticleMapper */ public List selectAsArticleList(EtArticle etArticle); + /** + * 查询文章列表app调用 + * + * @param etArticle 文章 + * @return 文章集合 + */ + public List selectAsArticleListByApp(EtArticle etArticle); + /** * 新增文章 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java index f219f69..07de655 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsDeviceMapper.java @@ -95,6 +95,23 @@ public interface AsDeviceMapper extends BaseMapper */ public int deleteAsDeviceByDeviceIds(Long[] deviceIds); + /** + * 一键上线 + * + * @param deviceIds 需要一键上线的设备主键集合 + * @return 结果 + */ + public int oneClickOnline(Long[] deviceIds); + + /** + * 一键下线 + * + * @param deviceIds 需要一键下线的设备主键集合 + * @return 结果 + */ + public int oneClickOffline(Long[] deviceIds); + + /** * 有订单车辆 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java index 65fb467..d9bfe2b 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java @@ -161,12 +161,12 @@ public interface EtOrderMapper String getTotalAppointmentRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId); /** - * 管理费已支付 + * 停车点外调度费已支付 */ String getTotalManageFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId); /** - * 管理费已退款 + * 停车点外调度费已退款 */ String getTotalManageRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IAsArticleService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IAsArticleService.java index 19e68fd..bdc7d41 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IAsArticleService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IAsArticleService.java @@ -28,6 +28,14 @@ public interface IAsArticleService */ public List selectAsArticleList(EtArticle etArticle); + /** + * 查询文章列表 + * + * @param etArticle 文章 + * @return 文章集合 + */ + public List selectAsArticleListByApp(EtArticle etArticle); + /** * 查询文章列表(带数据隔离) diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java index 05341c5..df9e59d 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java @@ -91,6 +91,22 @@ public interface IAsDeviceService extends IService */ public int deleteAsDeviceByDeviceIds(Long[] deviceIds); + /** + * 一键上线 + * + * @param deviceIds 需要一键上线的设备主键集合 + * @return 结果 + */ + public int oneClickOnline(Long[] deviceIds); + + /** + * 一键下线 + * + * @param deviceIds 需要一键下线的设备主键集合 + * @return 结果 + */ + public int oneClickOffline(Long[] deviceIds); + /** * 删除设备信息 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleServiceImpl.java index 4febb23..0a8bc44 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsArticleServiceImpl.java @@ -76,6 +76,22 @@ public class AsArticleServiceImpl implements IAsArticleService return etArticles; } + /** + * 查询文章列表 + * + * @param etArticle 文章 隔离 + * @return 文章 + */ + @Override + public List selectAsArticleListByApp(EtArticle etArticle) + { + List etArticles = asArticleMapper.selectAsArticleListByApp(etArticle); + for (EtArticle etArticle1 : etArticles) { + etArticle.setFormatCreateTime(DateUtils.getYYYY_MM_DD(etArticle1.getCreateTime())); + } + return etArticles; + } + /** * 新增文章 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index 5b7cfcf..e8eacee 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -311,6 +311,60 @@ public class AsDeviceServiceImpl extends ServiceImpl i return asDeviceMapper.deleteAsDeviceByDeviceIds(deviceIds); } + /** + * 一键上线 + * + * @param deviceIds 需要一键上线的设备主键集合 + * @return 结果 + */ + @Override + public int oneClickOnline(Long[] deviceIds) + { + for (Long deviceId:deviceIds) { + AsDevice device = asDeviceMapper.selectAsDeviceByDeviceId(deviceId); + if(ObjectUtil.isNull(device)){ + throw new ServiceException("车辆【"+deviceId+"】不存在"); + } + if(!device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE)){ + throw new ServiceException("车辆【"+device.getSn()+"】非下线状态,请重新选择!"); + } + } + return asDeviceMapper.oneClickOnline(deviceIds); + } + + /** + * 一键下线 + * + * @param deviceIds 需要一键下线的设备主键集合 + * @return 结果 + */ + @Override + public int oneClickOffline(Long[] deviceIds) + { + for (Long deviceId:deviceIds) { + AsDevice device = asDeviceMapper.selectAsDeviceByDeviceId(deviceId); + if(ObjectUtil.isNull(device)){ + throw new ServiceException("车辆【"+deviceId+"】不存在"); + } + if(device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT)){ + throw new ServiceException("车辆【"+device.getSn()+"】为‘预约中’状态不能下线"); + } + if(device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_IN_USING)){ + throw new ServiceException("车辆【"+device.getSn()+"】为‘使用中’状态不能下线"); + } + if(device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK)){ + throw new ServiceException("车辆【"+device.getSn()+"】为‘临时停车’状态不能下线"); + } + if(device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_NOT_LISTING)){ + throw new ServiceException("车辆【"+device.getSn()+"】为‘未上架’状态不能下线"); + } + if(device.getStatus().equals(ServiceConstants.VEHICLE_STATUS_ABANDON)){ + throw new ServiceException("车辆【"+device.getSn()+"】为‘废弃’状态不能下线"); + } + } + return asDeviceMapper.oneClickOffline(deviceIds); + } + /** * 删除设备信息 * @@ -401,7 +455,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i wrapper.eq("area_id",areaId); } if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ - wrapper.between("remaining_power", powerStart,powerEnd); + wrapper.between("remaining_power", Integer.parseInt(powerStart),Integer.parseInt(powerEnd)); } Integer allNum = asDeviceMapper.selectCount(wrapper); deviceNumVo.setAllNum(allNum);//所有车辆 @@ -421,7 +475,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i QueryWrapper wrapperForOffline = new QueryWrapper<>(); wrapperForOffline.eq("online_status","0");//在线状态:0-不在线;1-在线 if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ - wrapperForOffline.between("remaining_power", powerStart,powerEnd); + wrapperForOffline.between("remaining_power",Integer.parseInt(powerStart),Integer.parseInt(powerEnd)); } if(StrUtil.isNotBlank(areaId)){ wrapperForOffline.eq("area_id",areaId); @@ -435,7 +489,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i QueryWrapper wrapperForDispatch = new QueryWrapper<>(); wrapperForDispatch.or(i -> i.eq("in_parking_area", 1).or().eq("in_operating_area", 1)); if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ - wrapperForDispatch.between("remaining_power", powerStart,powerEnd); + wrapperForDispatch.between("remaining_power", Integer.parseInt(powerStart),Integer.parseInt(powerEnd)); } if(StrUtil.isNotBlank(areaId)){ wrapperForDispatch.eq("area_id",areaId); @@ -449,7 +503,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("status",status); if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ - wrapper.between("remaining_power", powerStart,powerEnd); + wrapper.between("remaining_power", Integer.parseInt(powerStart),Integer.parseInt(powerEnd)); } if(StrUtil.isNotBlank(areaId)){ wrapper.eq("area_id",areaId); @@ -1207,10 +1261,10 @@ public class AsDeviceServiceImpl extends ServiceImpl i } EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId()); - /** 管理费*/ + /** 停车点外调度费*/ // 根据车辆的定位判断是否在停车区内 if(!isParkingZone(order.getSn(), order.getAreaId())){ - BigDecimal vehicleManagementFee = area.getVehicleManagementFee();//车辆管理费 + BigDecimal vehicleManagementFee = area.getVehicleManagementFee();//车辆停车点外调度费 order.setManageFee(vehicleManagementFee); } /** 调度费*/ @@ -1240,7 +1294,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i totalFee = ridingFee.add(order.getManageFee()).add(order.getDispatchFee()).add(order.getAppointmentFee()); } } - log.info("【计算订单费用】骑行费:" + order.getRidingFee() + ",车辆管理费:" + order.getManageFee() + ",调度费:" + order.getDispatchFee() + ",预约费:" + order.getAppointmentFee() + ",总计:" + totalFee); + log.info("【计算订单费用】骑行费:" + order.getRidingFee() + ",车辆停车点外调度费:" + order.getManageFee() + ",调度费:" + order.getDispatchFee() + ",预约费:" + order.getAppointmentFee() + ",总计:" + totalFee); order.setTotalFee(totalFee); order.setPayFee(totalFee); }else { diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java index 3a8b3d7..f66cee3 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java @@ -7,6 +7,7 @@ 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.EtOrderDto; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; @@ -20,10 +21,8 @@ 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; -import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -68,6 +67,9 @@ public class AsUserServiceImpl implements IAsUserService @Resource private EtOrderMapper etOrderMapper; + @Resource + private SysUserMapper userMapper; + @Value("${et.verifyUrl}") private String verifyUrl; @@ -94,6 +96,11 @@ public class AsUserServiceImpl implements IAsUserService BeanUtils.copyBeanProp(etOrderVo,order); u.setLatestOrder(etOrderVo); } + if(ObjectUtil.isNotNull(u.getSysUserId())){ + Long sysUserId = u.getSysUserId(); + SysUser sysUser = userMapper.selectUserById(sysUserId); + u.setSysUser(sysUser); + } } return users; } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java index 8bd1163..27c21cf 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java @@ -296,8 +296,8 @@ public class CallbackServiceImpl implements CallbackService { dividendAmount = dividendAmount.add(order.getRidingFee().add(order.getAppointmentFee()));//1-骑行费(骑行费+预约费) } if(dividendItem.contains("2")){ - logger.info("=================调度费(调度费+管理费)=================="); - dividendAmount = dividendAmount.add(order.getManageFee().add(order.getDispatchFee()));//2-调度费(调度费+管理费) + logger.info("=================调度费(调度费+停车点外调度费)=================="); + dividendAmount = dividendAmount.add(order.getManageFee().add(order.getDispatchFee()));//2-调度费(调度费+停车点外调度费) } logger.info("=================分账金额:dividendAmount=================="+dividendAmount); BigDecimal divide = new BigDecimal(sysUser1.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOperatingAreaServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOperatingAreaServiceImpl.java index f2be24f..60c06d0 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOperatingAreaServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOperatingAreaServiceImpl.java @@ -1,30 +1,25 @@ package com.ruoyi.system.service.impl; -import java.util.List; - import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.entity.AsUser; -import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.map.GeoUtils; import com.ruoyi.system.domain.AsDevice; import com.ruoyi.system.domain.EtAreaRule; -import com.ruoyi.system.domain.SysStudent; +import com.ruoyi.system.domain.EtOperatingArea; import com.ruoyi.system.mapper.AsDeviceMapper; import com.ruoyi.system.mapper.EtAreaRuleMapper; -import com.ruoyi.system.mapper.SysStudentMapper; +import com.ruoyi.system.mapper.EtOperatingAreaMapper; import com.ruoyi.system.service.IAsDeviceService; import com.ruoyi.system.service.IEtFeeRuleService; -import jdk.nashorn.internal.ir.annotations.Reference; +import com.ruoyi.system.service.IEtOperatingAreaService; import lombok.extern.slf4j.Slf4j; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; @@ -32,12 +27,10 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.system.mapper.EtOperatingAreaMapper; -import com.ruoyi.system.domain.EtOperatingArea; -import com.ruoyi.system.service.IEtOperatingAreaService; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.List; /** * 运营区Service业务层处理 diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java index 5cdeb41..50db0d7 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java @@ -221,14 +221,14 @@ public class EtOrderServiceImpl implements IEtOrderService } List etOrders = etOrderMapper.selectEtOrderList(etOrder); //如果查询押金则增加退款记录 - if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){ - etOrders.forEach(etOrder1 -> { - EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo()); - if(ObjectUtil.isNotNull(refund)){ - etOrder1.setEtRefund(refund); - } - }); - } +// if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){ + etOrders.forEach(etOrder1 -> { + EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo()); + if(ObjectUtil.isNotNull(refund)){ + etOrder1.setEtRefund(refund); + } + }); +// } return etOrders; } @@ -470,7 +470,7 @@ public class EtOrderServiceImpl implements IEtOrderService //TODO 计算订单金额,更新订单金额 还要根据车辆定位, // 判断是否在停车区内, // 如果在停车区,正常结算费用(根据距离和距离收费,计算费用) - // 如果不在停车区,加上管理费, + // 如果不在停车区,加上停车点外调度费, // 再判断是否在运营区内 // 如果在运营区内, // 如果不在运营区内,加上调度费 @@ -580,8 +580,8 @@ public class EtOrderServiceImpl implements IEtOrderService 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));//管理费已退款 + income.setTotalManageFee(etOrderMapper.getTotalManageFee(timeStart,timeEnd,areaId));//停车点外调度费已支付 + income.setTotalManageRefund(etOrderMapper.getTotalManageRefund(timeStart,timeEnd,areaId));//停车点外调度费已退款 operatingDataVo.setIncome(income); /*订单相关*/ @@ -973,7 +973,7 @@ public class EtOrderServiceImpl implements IEtOrderService itemDesc.append("调度费:").append(dispatchFee).append("元,"); } if(ObjectUtil.isNotNull(manageFee) && !manageFee.equals(BigDecimal.ZERO)){ - itemDesc.append("管理费:").append(manageFee).append("元,"); + itemDesc.append("停车点外调度费:").append(manageFee).append("元,"); } if(ObjectUtil.isNotNull(ridingFee) && !ridingFee.equals(BigDecimal.ZERO)){ itemDesc.append("骑行费:").append(ridingFee).append("元,"); diff --git a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java index a274bac..a00df2c 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java +++ b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java @@ -332,7 +332,7 @@ public class EtTask { if(dividendItem.contains("1")){ dividendAmount.add(order1.getRidingFee().add(order1.getAppointmentFee()));//1-骑行费(骑行费+预约费) }else if(dividendItem.contains("2")){ - dividendAmount.add(order1.getManageFee().add(order1.getManageFee()));//2-调度费(调度费+管理费) + dividendAmount.add(order1.getManageFee().add(order1.getManageFee()));//2-调度费(调度费+停车点外调度费) } BigDecimal divide = new BigDecimal(user.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); etDividendDetail.setDividendAmount(dividendAmount.multiply(divide)); diff --git a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml index 0471542..e531542 100644 --- a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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' + where (1 = 1 AND ac.classify_id = #{classifyId} @@ -51,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} + or (ac.classify_id = 111 or ac.parent_id = 111)) + and ac.del_flag = '0' order by ac.parent_id, ac.order_num diff --git a/electripper-system/src/main/resources/mapper/system/AsArticleMapper.xml b/electripper-system/src/main/resources/mapper/system/AsArticleMapper.xml index 1538ec1..883f303 100644 --- a/electripper-system/src/main/resources/mapper/system/AsArticleMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsArticleMapper.xml @@ -38,19 +38,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + diff --git a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml index 698c431..1ad6012 100644 --- a/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsDeviceMapper.xml @@ -72,7 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and de.mac like concat('%', #{mac}, '%') and de.sn like concat('%', #{sn}, '%') and de.vehicle_num = #{vehicleNum} - and de.area_id = #{areaId} + and de.area_id = #{areaId} + and d.dept_id = #{deptId} and de.model_id = #{modelId} and de.online_status = #{onlineStatus} and de.status = #{status} @@ -274,4 +275,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{deviceId} + + + update et_device d set d.status = '1' where device_id in + + #{deviceId} + + + + + update et_device d set d.status = '8' where device_id in + + #{deviceId} + + diff --git a/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml b/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml index b736027..b709783 100644 --- a/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml @@ -137,11 +137,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml index 5acce2e..0bca9b2 100644 --- a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml @@ -26,12 +26,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"