This commit is contained in:
邱贞招 2024-06-26 14:57:34 +08:00
parent 3808921a3f
commit 5bffa21acc
31 changed files with 358 additions and 70 deletions

View File

@ -69,7 +69,7 @@ public class AppController extends BaseController
public TableDataInfo articleList(EtArticle etArticle) public TableDataInfo articleList(EtArticle etArticle)
{ {
startPage(); startPage();
List<EtArticle> list = asArticleService.selectAsArticleList(etArticle); List<EtArticle> list = asArticleService.selectAsArticleListByApp(etArticle);
return getDataTable(list); return getDataTable(list);
} }
@ -202,7 +202,7 @@ public class AppController extends BaseController
// { // {
// String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费 // String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费
// String dispatchFee = sysConfigService.selectConfigByKey("dispatch.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 startingPrice = sysConfigService.selectConfigByKey("starting.price");//起步价
// String startingHowManyMinutes = sysConfigService.selectConfigByKey("starting.how.many.minutes");//多少分钟内按起步价 // String startingHowManyMinutes = sysConfigService.selectConfigByKey("starting.how.many.minutes");//多少分钟内按起步价
// String timeFee = sysConfigService.selectConfigByKey("time.fee");//时长费 // String timeFee = sysConfigService.selectConfigByKey("time.fee");//时长费

View File

@ -307,7 +307,7 @@ public class ReceiveController {
throw new ServiceException("生成换电工单失败"); throw new ServiceException("生成换电工单失败");
} }
/** 改变车辆状态 */ /** 改变车辆状态 */
device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE); // device.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
if (asDeviceService.updateAsDevice(device) > 0) { if (asDeviceService.updateAsDevice(device) > 0) {
log.info("车辆状态改成换电中"); log.info("车辆状态改成换电中");
}else{ }else{
@ -323,6 +323,26 @@ public class ReceiveController {
}else{ }else{
log.info("更新定位失败:" +logEntry.getDevName()); 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{ }else{
log.info("未找到车辆对象:" +logEntry.getDevName()); log.info("未找到车辆对象:" +logEntry.getDevName());

View File

@ -116,6 +116,28 @@ public class AsDeviceController extends BaseController
return toAjax(asDeviceService.deleteAsDeviceByDeviceIds(deviceIds)); 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));
}
/** /**
* 响铃寻车 * 响铃寻车
*/ */

View File

@ -65,7 +65,12 @@ public class EtReconciliationControllor extends BaseController {
{ {
SysUser user = getLoginUser().getUser(); SysUser user = getLoginUser().getUser();
logger.info("【后台根据token获取运营区列表】获取当前登录用户【{}】", JSON.toJSON(user)); logger.info("【后台根据token获取运营区列表】获取当前登录用户【{}】", JSON.toJSON(user));
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(user.getDeptId()); List<EtOperatingArea> longs;
if(user.isAdmin()){
longs = etOperatingAreaService.selectAreaListByDeptId2(null);
}else{
longs = etOperatingAreaService.selectAreaListByDeptId2(user.getDeptId());
}
logger.info("根据token获取运营区列表【{}】", JSON.toJSON(longs)); logger.info("根据token获取运营区列表【{}】", JSON.toJSON(longs));
return success(longs); return success(longs);
} }

View File

@ -26,7 +26,7 @@ public class ServiceConstants {
public static final String ORDER_TYPE_DEPOSIT_REFUND = "3"; public static final String ORDER_TYPE_DEPOSIT_REFUND = "3";
/** /**
* 订单类型: 4-骑行订单退款包含调度费管理费等 * 订单类型: 4-骑行订单退款包含调度费停车点外调度费
*/ */
public static final String ORDER_TYPE_RIDING_REFUND = "4"; public static final String ORDER_TYPE_RIDING_REFUND = "4";

View File

@ -91,6 +91,9 @@ public class AsUser extends BaseEntity
@Excel(name = "绑定设备数量") @Excel(name = "绑定设备数量")
private Integer bindDeviceNum; private Integer bindDeviceNum;
/** 绑定系统用户 */
private SysUser sysUser;
/** 展示当前设备id */ /** 展示当前设备id */
private Long deviceId; private Long deviceId;
@ -143,6 +146,14 @@ public class AsUser extends BaseEntity
return sysUserId; return sysUserId;
} }
public SysUser getSysUser() {
return sysUser;
}
public void setSysUser(SysUser sysUser) {
this.sysUser = sysUser;
}
public void setSysUserId(Long sysUserId) { public void setSysUserId(Long sysUserId) {
this.sysUserId = sysUserId; this.sysUserId = sysUserId;
} }

View File

@ -16,7 +16,7 @@ public class FeeRuleVo {
/** 调度费 */ /** 调度费 */
private String dispatchFee; private String dispatchFee;
/** 管理费*/ /** 停车点外调度费*/
private String vehicleManagementFee; private String vehicleManagementFee;
/** 起步价*/ /** 起步价*/

View File

@ -120,6 +120,10 @@ public class CommonUtil {
BigDecimal divide = full.subtract(current).divide(full,2, RoundingMode.HALF_UP);//当前电量百分百 BigDecimal divide = full.subtract(current).divide(full,2, RoundingMode.HALF_UP);//当前电量百分百
log.info("当前电量百分百:{}%",divide.multiply(new BigDecimal(100))); log.info("当前电量百分百:{}%",divide.multiply(new BigDecimal(100)));
BigDecimal multiply = divide.multiply(new BigDecimal(fullEndurance)); BigDecimal multiply = divide.multiply(new BigDecimal(fullEndurance));
// 剩余续航里程小于0 最小为0
if(multiply.compareTo(new BigDecimal(0)) < 0){
multiply = new BigDecimal(0);
}
log.info("当前剩余续航里程:{}km",multiply); log.info("当前剩余续航里程:{}km",multiply);
return multiply.intValue(); return multiply.intValue();
} }
@ -142,6 +146,10 @@ public class CommonUtil {
if(multiply.compareTo(new BigDecimal(100)) > 0){ if(multiply.compareTo(new BigDecimal(100)) > 0){
multiply = new BigDecimal(100); multiply = new BigDecimal(100);
} }
// 电量小于0 最小为0
if(multiply.compareTo(new BigDecimal(0)) < 0){
multiply = new BigDecimal(0);
}
// log.info("当前电量百分百:{}%",multiply); // log.info("当前电量百分百:{}%",multiply);
return multiply.intValue(); return multiply.intValue();
} }

View File

@ -242,12 +242,20 @@ public class SysLoginService
asUser.setCreateTime(DateUtils.getNowDate()); asUser.setCreateTime(DateUtils.getNowDate());
asUser.setWxopenid(openId); asUser.setWxopenid(openId);
asUser.setAreaId(Long.parseLong(areaId)); 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)); log.info("【微信登录/wxlogin】用户不存在自动注册用户【{}】", JSON.toJSON(asUser));
int i = asUserService.insertUser(asUser); int i = asUserService.insertUser(asUser);
user = asUser; user = asUser;
}else{ }else{
user.setAppName(dept.getAppName()); if(dept.getIsUsePlatformApp().equals("true")){
user.setAppName("创享电动车");
}else{
user.setAppName(dept.getAppName());
}
user.setAreaId(Long.parseLong(areaId)); user.setAreaId(Long.parseLong(areaId));
int i = asUserService.updateUser(user); int i = asUserService.updateUser(user);
} }

View File

@ -54,6 +54,11 @@ public class AsDevice extends BaseEntityPlus implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String deptName; private String deptName;
/** 运营商id */
@Excel(name = "运营商id")
@TableField(exist = false)
private Long deptId;
/** 分区 */ /** 分区 */
@Excel(name = "分区id") @Excel(name = "分区id")
private Long areaId; private Long areaId;

View File

@ -161,7 +161,7 @@ public class EtOperatingArea extends BaseEntityPlus implements Serializable
/** 调度费 */ /** 调度费 */
private BigDecimal dispatchFee; private BigDecimal dispatchFee;
/** 管理费*/ /** 停车点外调度费*/
private BigDecimal vehicleManagementFee; private BigDecimal vehicleManagementFee;
/** 预约超时保留分钟*/ /** 预约超时保留分钟*/

View File

@ -123,8 +123,8 @@ public class EtOrder extends BaseEntity
@Excel(name = "调度费") @Excel(name = "调度费")
private BigDecimal dispatchFee; private BigDecimal dispatchFee;
/** 管理费 */ /** 停车点外调度费 */
@Excel(name = "管理") @Excel(name = "停车点外调度")
private BigDecimal manageFee; private BigDecimal manageFee;
/** 骑行费 */ /** 骑行费 */

View File

@ -43,7 +43,7 @@ public class EtRefund extends BaseEntity
/** 调度费 */ /** 调度费 */
private BigDecimal dispatchFee; private BigDecimal dispatchFee;
/** 管理费 */ /** 停车点外调度费 */
private BigDecimal manageFee; private BigDecimal manageFee;
/** 骑行费 */ /** 骑行费 */

View File

@ -54,10 +54,10 @@ public class OperatingDataVo {
//预约费已退款 //预约费已退款
private String totalAppointmentRefund; private String totalAppointmentRefund;
//管理费已支付 //停车点外调度费已支付
private String totalManageFee; private String totalManageFee;
//管理费已退款 //停车点外调度费已退款
private String totalManageRefund; private String totalManageRefund;
} }

View File

@ -28,6 +28,14 @@ public interface AsArticleMapper
*/ */
public List<EtArticle> selectAsArticleList(EtArticle etArticle); public List<EtArticle> selectAsArticleList(EtArticle etArticle);
/**
* 查询文章列表app调用
*
* @param etArticle 文章
* @return 文章集合
*/
public List<EtArticle> selectAsArticleListByApp(EtArticle etArticle);
/** /**
* 新增文章 * 新增文章
* *

View File

@ -95,6 +95,23 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
*/ */
public int deleteAsDeviceByDeviceIds(Long[] deviceIds); public int deleteAsDeviceByDeviceIds(Long[] deviceIds);
/**
* 一键上线
*
* @param deviceIds 需要一键上线的设备主键集合
* @return 结果
*/
public int oneClickOnline(Long[] deviceIds);
/**
* 一键下线
*
* @param deviceIds 需要一键下线的设备主键集合
* @return 结果
*/
public int oneClickOffline(Long[] deviceIds);
/** /**
* 有订单车辆 * 有订单车辆
*/ */

View File

@ -161,12 +161,12 @@ public interface EtOrderMapper
String getTotalAppointmentRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId); 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 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); String getTotalManageRefund(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);

View File

@ -28,6 +28,14 @@ public interface IAsArticleService
*/ */
public List<EtArticle> selectAsArticleList(EtArticle etArticle); public List<EtArticle> selectAsArticleList(EtArticle etArticle);
/**
* 查询文章列表
*
* @param etArticle 文章
* @return 文章集合
*/
public List<EtArticle> selectAsArticleListByApp(EtArticle etArticle);
/** /**
* 查询文章列表带数据隔离 * 查询文章列表带数据隔离

View File

@ -91,6 +91,22 @@ public interface IAsDeviceService extends IService<AsDevice>
*/ */
public int deleteAsDeviceByDeviceIds(Long[] deviceIds); public int deleteAsDeviceByDeviceIds(Long[] deviceIds);
/**
* 一键上线
*
* @param deviceIds 需要一键上线的设备主键集合
* @return 结果
*/
public int oneClickOnline(Long[] deviceIds);
/**
* 一键下线
*
* @param deviceIds 需要一键下线的设备主键集合
* @return 结果
*/
public int oneClickOffline(Long[] deviceIds);
/** /**
* 删除设备信息 * 删除设备信息
* *

View File

@ -76,6 +76,22 @@ public class AsArticleServiceImpl implements IAsArticleService
return etArticles; return etArticles;
} }
/**
* 查询文章列表
*
* @param etArticle 文章 隔离
* @return 文章
*/
@Override
public List<EtArticle> selectAsArticleListByApp(EtArticle etArticle)
{
List<EtArticle> etArticles = asArticleMapper.selectAsArticleListByApp(etArticle);
for (EtArticle etArticle1 : etArticles) {
etArticle.setFormatCreateTime(DateUtils.getYYYY_MM_DD(etArticle1.getCreateTime()));
}
return etArticles;
}
/** /**
* 新增文章 * 新增文章
* *

View File

@ -311,6 +311,60 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
return asDeviceMapper.deleteAsDeviceByDeviceIds(deviceIds); 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<AsDeviceMapper, AsDevice> i
wrapper.eq("area_id",areaId); wrapper.eq("area_id",areaId);
} }
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ 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); Integer allNum = asDeviceMapper.selectCount(wrapper);
deviceNumVo.setAllNum(allNum);//所有车辆 deviceNumVo.setAllNum(allNum);//所有车辆
@ -421,7 +475,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
QueryWrapper<AsDevice> wrapperForOffline = new QueryWrapper<>(); QueryWrapper<AsDevice> wrapperForOffline = new QueryWrapper<>();
wrapperForOffline.eq("online_status","0");//在线状态0-不在线1-在线 wrapperForOffline.eq("online_status","0");//在线状态0-不在线1-在线
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ 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)){ if(StrUtil.isNotBlank(areaId)){
wrapperForOffline.eq("area_id",areaId); wrapperForOffline.eq("area_id",areaId);
@ -435,7 +489,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
QueryWrapper<AsDevice> wrapperForDispatch = new QueryWrapper<>(); QueryWrapper<AsDevice> wrapperForDispatch = new QueryWrapper<>();
wrapperForDispatch.or(i -> i.eq("in_parking_area", 1).or().eq("in_operating_area", 1)); wrapperForDispatch.or(i -> i.eq("in_parking_area", 1).or().eq("in_operating_area", 1));
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ 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)){ if(StrUtil.isNotBlank(areaId)){
wrapperForDispatch.eq("area_id",areaId); wrapperForDispatch.eq("area_id",areaId);
@ -449,7 +503,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
QueryWrapper<AsDevice> wrapper = new QueryWrapper<>(); QueryWrapper<AsDevice> wrapper = new QueryWrapper<>();
wrapper.eq("status",status); wrapper.eq("status",status);
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){ 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)){ if(StrUtil.isNotBlank(areaId)){
wrapper.eq("area_id",areaId); wrapper.eq("area_id",areaId);
@ -1207,10 +1261,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
} }
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId()); EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
/** 管理费*/ /** 停车点外调度费*/
// 根据车辆的定位判断是否在停车区内 // 根据车辆的定位判断是否在停车区内
if(!isParkingZone(order.getSn(), order.getAreaId())){ if(!isParkingZone(order.getSn(), order.getAreaId())){
BigDecimal vehicleManagementFee = area.getVehicleManagementFee();//车辆管理 BigDecimal vehicleManagementFee = area.getVehicleManagementFee();//车辆停车点外调度
order.setManageFee(vehicleManagementFee); order.setManageFee(vehicleManagementFee);
} }
/** 调度费*/ /** 调度费*/
@ -1240,7 +1294,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
totalFee = ridingFee.add(order.getManageFee()).add(order.getDispatchFee()).add(order.getAppointmentFee()); 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.setTotalFee(totalFee);
order.setPayFee(totalFee); order.setPayFee(totalFee);
}else { }else {

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.AsUser; import com.ruoyi.common.core.domain.entity.AsUser;
import com.ruoyi.common.core.domain.entity.EtOrderDto; 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.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; 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.domain.vo.AuthenticationVo;
import com.ruoyi.system.mapper.AsUserMapper; import com.ruoyi.system.mapper.AsUserMapper;
import com.ruoyi.system.mapper.EtOrderMapper; import com.ruoyi.system.mapper.EtOrderMapper;
import com.ruoyi.system.service.IAsUserService; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.IEtOperatingAreaService; import com.ruoyi.system.service.*;
import com.ruoyi.system.service.IEtOrderService;
import com.ruoyi.system.service.ISysConfigService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -68,6 +67,9 @@ public class AsUserServiceImpl implements IAsUserService
@Resource @Resource
private EtOrderMapper etOrderMapper; private EtOrderMapper etOrderMapper;
@Resource
private SysUserMapper userMapper;
@Value("${et.verifyUrl}") @Value("${et.verifyUrl}")
private String verifyUrl; private String verifyUrl;
@ -94,6 +96,11 @@ public class AsUserServiceImpl implements IAsUserService
BeanUtils.copyBeanProp(etOrderVo,order); BeanUtils.copyBeanProp(etOrderVo,order);
u.setLatestOrder(etOrderVo); u.setLatestOrder(etOrderVo);
} }
if(ObjectUtil.isNotNull(u.getSysUserId())){
Long sysUserId = u.getSysUserId();
SysUser sysUser = userMapper.selectUserById(sysUserId);
u.setSysUser(sysUser);
}
} }
return users; return users;
} }

View File

@ -296,8 +296,8 @@ public class CallbackServiceImpl implements CallbackService {
dividendAmount = dividendAmount.add(order.getRidingFee().add(order.getAppointmentFee()));//1-骑行费骑行费+预约费 dividendAmount = dividendAmount.add(order.getRidingFee().add(order.getAppointmentFee()));//1-骑行费骑行费+预约费
} }
if(dividendItem.contains("2")){ if(dividendItem.contains("2")){
logger.info("=================调度费(调度费+管理费)=================="); logger.info("=================调度费(调度费+停车点外调度费)==================");
dividendAmount = dividendAmount.add(order.getManageFee().add(order.getDispatchFee()));//2-调度费调度费+管理 dividendAmount = dividendAmount.add(order.getManageFee().add(order.getDispatchFee()));//2-调度费调度费+停车点外调度
} }
logger.info("=================分账金额dividendAmount=================="+dividendAmount); logger.info("=================分账金额dividendAmount=================="+dividendAmount);
BigDecimal divide = new BigDecimal(sysUser1.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); BigDecimal divide = new BigDecimal(sysUser1.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);

View File

@ -1,30 +1,25 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants; 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.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.map.GeoUtils; import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.system.domain.AsDevice; import com.ruoyi.system.domain.AsDevice;
import com.ruoyi.system.domain.EtAreaRule; 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.AsDeviceMapper;
import com.ruoyi.system.mapper.EtAreaRuleMapper; 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.IAsDeviceService;
import com.ruoyi.system.service.IEtFeeRuleService; 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 lombok.extern.slf4j.Slf4j;
import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Geometry;
@ -32,12 +27,10 @@ import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Point;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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 org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* 运营区Service业务层处理 * 运营区Service业务层处理

View File

@ -221,14 +221,14 @@ public class EtOrderServiceImpl implements IEtOrderService
} }
List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder); List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder);
//如果查询押金则增加退款记录 //如果查询押金则增加退款记录
if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){ // if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){
etOrders.forEach(etOrder1 -> { etOrders.forEach(etOrder1 -> {
EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo()); EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo());
if(ObjectUtil.isNotNull(refund)){ if(ObjectUtil.isNotNull(refund)){
etOrder1.setEtRefund(refund); etOrder1.setEtRefund(refund);
} }
}); });
} // }
return etOrders; return etOrders;
} }
@ -470,7 +470,7 @@ public class EtOrderServiceImpl implements IEtOrderService
//TODO 计算订单金额更新订单金额 还要根据车辆定位 //TODO 计算订单金额更新订单金额 还要根据车辆定位
// 判断是否在停车区内 // 判断是否在停车区内
// 如果在停车区正常结算费用根据距离和距离收费计算费用 // 如果在停车区正常结算费用根据距离和距离收费计算费用
// 如果不在停车区加上管理 // 如果不在停车区加上停车点外调度
// 再判断是否在运营区内 // 再判断是否在运营区内
// 如果在运营区内 // 如果在运营区内
// 如果不在运营区内加上调度费 // 如果不在运营区内加上调度费
@ -580,8 +580,8 @@ public class EtOrderServiceImpl implements IEtOrderService
income.setTotalDispatchRefund(etOrderMapper.getTotalDispatchRefund(timeStart,timeEnd,areaId));//调度费已退款 income.setTotalDispatchRefund(etOrderMapper.getTotalDispatchRefund(timeStart,timeEnd,areaId));//调度费已退款
income.setTotalAppointmentFee(etOrderMapper.getTotalAppointmentFee(timeStart,timeEnd,areaId));//预约费已支付 income.setTotalAppointmentFee(etOrderMapper.getTotalAppointmentFee(timeStart,timeEnd,areaId));//预约费已支付
income.setTotalAppointmentRefund(etOrderMapper.getTotalAppointmentRefund(timeStart,timeEnd,areaId));//预约费已退款 income.setTotalAppointmentRefund(etOrderMapper.getTotalAppointmentRefund(timeStart,timeEnd,areaId));//预约费已退款
income.setTotalManageFee(etOrderMapper.getTotalManageFee(timeStart,timeEnd,areaId));//管理费已支付 income.setTotalManageFee(etOrderMapper.getTotalManageFee(timeStart,timeEnd,areaId));//停车点外调度费已支付
income.setTotalManageRefund(etOrderMapper.getTotalManageRefund(timeStart,timeEnd,areaId));//管理费已退款 income.setTotalManageRefund(etOrderMapper.getTotalManageRefund(timeStart,timeEnd,areaId));//停车点外调度费已退款
operatingDataVo.setIncome(income); operatingDataVo.setIncome(income);
/*订单相关*/ /*订单相关*/
@ -973,7 +973,7 @@ public class EtOrderServiceImpl implements IEtOrderService
itemDesc.append("调度费:").append(dispatchFee).append("元,"); itemDesc.append("调度费:").append(dispatchFee).append("元,");
} }
if(ObjectUtil.isNotNull(manageFee) && !manageFee.equals(BigDecimal.ZERO)){ 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)){ if(ObjectUtil.isNotNull(ridingFee) && !ridingFee.equals(BigDecimal.ZERO)){
itemDesc.append("骑行费:").append(ridingFee).append("元,"); itemDesc.append("骑行费:").append(ridingFee).append("元,");

View File

@ -332,7 +332,7 @@ public class EtTask {
if(dividendItem.contains("1")){ if(dividendItem.contains("1")){
dividendAmount.add(order1.getRidingFee().add(order1.getAppointmentFee()));//1-骑行费骑行费+预约费 dividendAmount.add(order1.getRidingFee().add(order1.getAppointmentFee()));//1-骑行费骑行费+预约费
}else if(dividendItem.contains("2")){ }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); BigDecimal divide = new BigDecimal(user.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
etDividendDetail.setDividendAmount(dividendAmount.multiply(divide)); etDividendDetail.setDividendAmount(dividendAmount.multiply(divide));

View File

@ -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 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 from et_article_classify ac
left join sys_dept d on d.dept_id = ac.dept_id left join sys_dept d on d.dept_id = ac.dept_id
where ac.del_flag = '0' where (1 = 1
<if test="classifyId != null and classifyId != 0"> <if test="classifyId != null and classifyId != 0">
AND ac.classify_id = #{classifyId} AND ac.classify_id = #{classifyId}
</if> </if>
@ -51,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${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 order by ac.parent_id, ac.order_num
</select> </select>

View File

@ -38,19 +38,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectAsArticleList" parameterType="EtArticle" resultMap="AsArticleResult"> <select id="selectAsArticleList" parameterType="EtArticle" resultMap="AsArticleResult">
select a.article_id, a.area_id, a.classify_id, a.title, a.logo, a.master_picture, a.tag,a.is_hot, a.introduction, a.content, a.author, SELECT
a.create_by, a.create_time, a.update_by, a.update_time, a.remark, ac.classify_name from et_article a a.article_id,
left join et_article_classify ac on ac.classify_id = a.classify_id a.area_id,
left join et_area_dept ad on ad.area_id = a.area_id a.classify_id,
left join sys_dept d on d.dept_id = ad.dept_id a.title,
where 1 = 1 a.logo,
a.master_picture,
a.tag,
a.is_hot,
a.introduction,
a.content,
a.author,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
ac.classify_name
FROM
et_article a
LEFT JOIN et_article_classify ac ON ac.classify_id = a.classify_id
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 (1 = 1
<if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if> <if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if>
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if> <if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
<if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if> <if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if>
<if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if> <if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if>
<if test="tag != null and tag != ''"> and a.tag = #{tag}</if> <if test="tag != null and tag != ''"> and a.tag = #{tag}</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}) or ac.parent_id = 111 or ac.classify_id = 111
order by a.create_time desc
</select>
<select id="selectAsArticleListByApp" parameterType="EtArticle" resultMap="AsArticleResult">
SELECT
a.article_id,
a.area_id,
a.classify_id,
a.title,
a.logo,
a.master_picture,
a.tag,
a.is_hot,
a.introduction,
a.content,
a.author,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
ac.classify_name
FROM
et_article a
LEFT JOIN et_article_classify ac ON ac.classify_id = a.classify_id
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 1 = 1
<if test="classifyId != null and classifyId != ''"> and a.classify_id = #{classifyId}</if>
<if test="title != null and title != ''"> and a.title like concat('%', #{title}, '%')</if>
<if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if>
<if test="areaId != null and areaId != ''"> and a.area_id = #{areaId}</if>
<if test="tag != null and tag != ''"> and a.tag = #{tag}</if>
order by a.create_time desc order by a.create_time desc
</select> </select>

View File

@ -72,7 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mac != null and mac != ''"> and de.mac like concat('%', #{mac}, '%')</if> <if test="mac != null and mac != ''"> and de.mac like concat('%', #{mac}, '%')</if>
<if test="sn != null and sn != ''"> and de.sn like concat('%', #{sn}, '%')</if> <if test="sn != null and sn != ''"> and de.sn like concat('%', #{sn}, '%')</if>
<if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num = #{vehicleNum}</if> <if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num = #{vehicleNum}</if>
<if test="areaId != null and areaId != ''"> and de.area_id = #{areaId}</if> <if test="areaId != null "> and de.area_id = #{areaId}</if>
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
<if test="modelId != null and modelId != ''"> and de.model_id = #{modelId}</if> <if test="modelId != null and modelId != ''"> and de.model_id = #{modelId}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if> <if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if>
<if test="status != null and status != ''"> and de.status = #{status}</if> <if test="status != null and status != ''"> and de.status = #{status}</if>
@ -274,4 +275,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deviceId} #{deviceId}
</foreach> </foreach>
</delete> </delete>
<delete id="oneClickOnline" parameterType="String">
update et_device d set d.status = '1' where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
<delete id="oneClickOffline" parameterType="String">
update et_device d set d.status = '8' where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
</mapper> </mapper>

View File

@ -137,11 +137,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getLeaseUser" resultType="java.lang.String"> <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 SELECT COUNT(DISTINCT o.user_id) 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') &gt;= date_format(#{timeStart},'%y%m%d') where date_format(u.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
and date_format(u.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d') and date_format(u.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="areaId != null and areaId != ''"> <if test="areaId != null and areaId != ''">
and area_id = #{areaId} and o.area_id = #{areaId}
</if> </if>
</select> </select>

View File

@ -26,12 +26,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectEtCapitalFlowList" parameterType="EtCapitalFlow" resultMap="EtCapitalFlowResult"> <select id="selectEtCapitalFlowList" parameterType="EtCapitalFlow" resultMap="EtCapitalFlowResult">
select cf.flow_id, cf.area_id, cf.order_no, cf.out_trade_no, cf.type, cf.bus_type, cf.amount, cf.handling_charge, SELECT
cf.operator_dividend, cf.operator_balance, cf.partner_dividend, cf.pay_type, cf.create_time,a.area_name from et_capital_flow cf cf.flow_id,
left join et_operating_area a on a.area_id = cf.area_id cf.area_id,
left join et_area_dept ad on ad.area_id = cf.area_id cf.order_no,
left join sys_dept d on d.dept_id = ad.dept_id cf.out_trade_no,
where 1 = 1 cf.type,
cf.bus_type,
cf.amount,
cf.handling_charge,
cf.operator_dividend,
cf.operator_balance,
cf.partner_dividend,
cf.pay_type,
cf.create_time,
a.area_name
FROM
et_capital_flow cf
LEFT JOIN et_operating_area a ON a.area_id = cf.area_id
LEFT JOIN et_area_dept ad ON ad.area_id = cf.area_id
LEFT JOIN sys_dept d ON d.dept_id = ad.dept_id
WHERE
1 = 1
<if test="areaId != null "> and cf.area_id = #{areaId}</if> <if test="areaId != null "> and cf.area_id = #{areaId}</if>
<if test="orderNo != null and orderNo != ''"> and cf.order_no = #{orderNo}</if> <if test="orderNo != null and orderNo != ''"> and cf.order_no = #{orderNo}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and cf.out_trade_no = #{outTradeNo}</if> <if test="outTradeNo != null and outTradeNo != ''"> and cf.out_trade_no = #{outTradeNo}</if>
@ -43,6 +59,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operatorBalance != null "> and cf.operator_balance = #{operatorBalance}</if> <if test="operatorBalance != null "> and cf.operator_balance = #{operatorBalance}</if>
<if test="partnerDividend != null "> and cf.partner_dividend = #{partnerDividend}</if> <if test="partnerDividend != null "> and cf.partner_dividend = #{partnerDividend}</if>
<if test="payType != null and payType != ''"> and cf.pay_type = #{payType}</if> <if test="payType != null and payType != ''"> and cf.pay_type = #{payType}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND cf.create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND cf.create_time &lt;= #{params.endTime}
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by cf.create_time desc order by cf.create_time desc