1.运营商首页接口

2.管理员首页接口
3.请求一次5s超时后再次请求,等待
This commit is contained in:
邱贞招 2024-07-19 20:00:16 +08:00
parent e1df5bacc9
commit 6f48868cdd
44 changed files with 1260 additions and 84 deletions

View File

@ -0,0 +1,71 @@
package com.ruoyi.web.controller.IndexController;
import cn.hutool.core.util.ObjectUtil;
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.AsUser;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.EtOperatingArea;
import com.ruoyi.system.domain.vo.IndexAdminVo;
import com.ruoyi.system.domain.vo.IndexVo;
import com.ruoyi.system.service.IEtOperatingAreaService;
import com.ruoyi.system.service.IEtOrderService;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* index首页统计
* 校验
* @author ruoyi
*/
@RestController
@RequestMapping("/index")
public class IndexController extends BaseController
{
@Autowired
private IEtOrderService etOrderService;
@Autowired
private IEtOperatingAreaService etOperatingAreaService;
/**
* 根据token获取运营区列表后台
*/
@GetMapping("/getAreaList")
public AjaxResult getAreaList()
{
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(getDeptId());
logger.info("根据token获取运营区列表【{}】", JSON.toJSON(longs));
return success(longs);
}
/**
* 首页统计-运营商
*/
@GetMapping(value = "/statistics")
public AjaxResult statistics(Long areaId)
{
logger.info("【首页统计】请求参数: areaId={}", areaId);
IndexVo indexVo = etOrderService.statistics(areaId);
return success(indexVo);
}
/**
* 首页统计-总管理
*/
@GetMapping(value = "/admim/statistics")
public AjaxResult admimStatistics()
{
logger.info("【首页统计】请求参数");
IndexAdminVo indexAdminVo = etOrderService.admimStatistics();
return success(indexAdminVo);
}
}

View File

@ -207,6 +207,11 @@ public class AppVerifyController extends BaseController
return error(CommonUtil.format(status));
}
}
// 当前有骑行中的订单
EtOrder currentOrder = etOrderService.getCurrentOrder(asDevice.getSn());
if(ObjectUtil.isNotNull(currentOrder)){
return error("当前车辆有骑行中的订单,请换车");
}
//根据余额和充值记录判断是否有充值过押金没有充值过押金提示充值押金
if(!asUserService.checkIsDeposit(order.getUserId())){
return error("您还未充值押金,请先充值押金");
@ -1041,14 +1046,14 @@ public class AppVerifyController extends BaseController
*/
@Log(title = "换车关锁", businessType = BusinessType.CHANGELOCK)
@PostMapping("/changeVehicle/lock")
public AjaxResult changeVehicleLock(String orderNo,String changeReason)
public AjaxResult changeVehicleLock(String orderNo,String changeReason,String isBluetooth,String lon,String lat,String voltage)
{
if (StrUtil.isBlank(orderNo)){
logger.info("没有orderNo参数【orderNo={}】",orderNo);
return error("请传orderNo号参数"+"【orderNo="+orderNo+"");
}
logger.info("【换车关锁请求】orderNo={}",orderNo);
Boolean aBoolean = etOrderService.changeVehicleLock(orderNo,changeReason);
Boolean aBoolean = etOrderService.changeVehicleLock(orderNo,changeReason,isBluetooth,lon,lat,voltage);
return success(aBoolean);
}
@ -1057,7 +1062,7 @@ public class AppVerifyController extends BaseController
*/
@Log(title = "换车开锁", businessType = BusinessType.CHANGEUNLOCK)
@PostMapping("/changeVehicle/unlocking")
public AjaxResult changeVehicleLockUnlocking(String orderNo,String newSn)
public AjaxResult changeVehicleLockUnlocking(String orderNo,String newSn,String isBluetooth,String lon,String lat,String voltage)
{
if (StrUtil.isBlank(newSn)){
logger.info("没有sn号参数【newSn={}】",newSn);
@ -1068,7 +1073,37 @@ public class AppVerifyController extends BaseController
return error("请传orderNo号参数"+"【orderNo="+orderNo+"");
}
logger.info("【换车开锁请求】orderNo={},newSn ={}",orderNo,newSn);
Boolean aBoolean =etOrderService.changeVehicleLockUnlocking(orderNo,newSn);
Boolean aBoolean =etOrderService.changeVehicleLockUnlocking(orderNo,newSn,isBluetooth,lon,lat,voltage);
return success(aBoolean);
}
/**
* 开坐垫锁
*/
@PostMapping("/device/seatCushionLock")
public AjaxResult seatCushionLock(String sn)
{
if(StrUtil.isBlank(sn)){
logger.info("没有sn号参数【sn={}】",sn);
return error("请传sn号参数"+"【sn="+sn+"");
}
Boolean i =asDeviceService.seatCushionLock(sn);
return success(i);
}
/**
* 坐垫锁用mac
*/
@PostMapping("/device/seatCushionLockByMac")
public AjaxResult seatCushionLockByMac(String mac)
{
if(StrUtil.isBlank(mac)){
logger.info("没有mac号参数【mac={}】",mac);
return error("请传mac号参数"+"【mac="+mac+"");
}
Boolean i =asDeviceService.seatCushionLockByMac(mac);
return success(i);
}
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,15 +1,18 @@
package com.ruoyi.web.controller.system;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.EtOperatingArea;
import com.ruoyi.system.service.IEtFeeRuleService;
import com.ruoyi.system.service.IEtOperatingAreaService;
import com.ruoyi.system.service.IWxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -33,6 +36,10 @@ public class EtOperatingAreaController extends BaseController
@Autowired
private IEtFeeRuleService etFeeRuleService;
@Autowired
private IWxPayService wxPayService;
/**
* 查询运营区列表
*/
@ -67,6 +74,11 @@ public class EtOperatingAreaController extends BaseController
{
AjaxResult ajax = AjaxResult.success();
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
SysDept sysDept = wxPayService.getDeptObjByAreaId(area.getAreaId());
if(ObjectUtil.isNotNull(sysDept)){
area.setDeptId(sysDept.getDeptId());
area.setDeptName(sysDept.getDeptName());
}
ajax.put(AjaxResult.DATA_TAG, area);
ajax.put("ruleIds", etFeeRuleService.selectRuleListByAreaId(areaId));
return ajax;

View File

@ -57,6 +57,7 @@ public class SysDeptController extends BaseController
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
startPage();
List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts);
}

View File

@ -46,6 +46,11 @@ public class IotConstants {
*/
public static final String COMMAND_OPEN = "open";
/**
* 命令 开坐垫锁
*/
public static final String COMMAND_HPEN = "hpen";
/**
* 命令 关闭
*/

View File

@ -65,7 +65,7 @@ public class ServiceConstants {
/**----------------------------支付场景end----------------------------*/
/**----------------------------订单状态start----------------------------*/
/** 订单状态:0-预约中1-取消预约2-开始骑行3-结束 4-订单结束 5-待审核 6-车辆有损坏 */
/** 订单状态:0-预约中1-取消预约2-开始骑行3-结束 4-订单结束 5-待审核 6-车辆有损坏 */
/**
* 订单状态:0-预约中
*/

View File

@ -109,6 +109,28 @@ public class SysDept extends BaseEntity
/** app用户id,用于提现 */
private Long appUserId;
/** 用户名 */
private String userName;
/** 区域名称 */
private String areaName;
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getAppUserId() {
return appUserId;
}

View File

@ -124,6 +124,10 @@ public class CommonUtil {
if(multiply.compareTo(new BigDecimal(0)) < 0){
multiply = new BigDecimal(0);
}
// 剩余续航里程大于满电续航里程 最大为满电续航里程
if(multiply.compareTo(new BigDecimal(fullEndurance)) > 0){
multiply = new BigDecimal(fullEndurance);
}
log.info("当前剩余续航里程:{}km",multiply);
return multiply.intValue();
}

View File

@ -269,6 +269,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return Date.from(zdt.toInstant());
}
/**
* 减去多少天后的时间
*/
public static Date getTimeAfterXDays(Date unlockTime, int xDays) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(unlockTime);
calendar.add(Calendar.DAY_OF_MONTH, -xDays);
return calendar.getTime(); // 返回新时间
}
/**
* 加上固定个小时后的时间
*/

View File

@ -52,6 +52,10 @@ public class EtFault extends BaseEntity
@Excel(name = "订单id")
private Long orderId;
/** 订单号 */
@Excel(name = "订单号")
private String orderNo;
/** 报修进度 */
@Excel(name = "报修进度")
private String status;

View File

@ -34,6 +34,10 @@ public class EtOperatingArea extends BaseEntityPlus implements Serializable
@TableField(exist = false)
private Long deptId;
/** 运营商 */
@TableField(exist = false)
private String deptName;
/** 区域名称 */
@Excel(name = "区域名称")
private String areaName;

View File

@ -0,0 +1,172 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 首页统计响应
*
* @author 邱贞招
* @date 2024-05-09
*/
@Data
public class IndexAdminVo {
/** 运营商数 */
private Integer operatorCount=0;
/** 独立小程序 */
private Integer appCount=0;
/** 商户总余额 */
private BigDecimal totalBalance = BigDecimal.ZERO;
/** 已提现金额 */
private BigDecimal withdrawn = BigDecimal.ZERO;
/** 运营区数 */
private Integer areaCount=0;
/** 车辆型号数 */
private Integer modelCount=0;
/** 用户总数 */
private Integer userCount=0;
/** 今日新增 */
private Integer todayUserCount=0;
/** 今日订单数 */
private Integer todayOrderCount=0;
/** 总订单数 */
private Integer totalOrderCount=0;
/** 今日订单金额 */
private BigDecimal todayOrderFee= BigDecimal.ZERO;
/** 订单总金额 */
private BigDecimal totalOrderFee= BigDecimal.ZERO;
/** 今日退款金额 */
private BigDecimal todayRefundFee= BigDecimal.ZERO;
/** 总退款金额 */
private BigDecimal totalRefundFee= BigDecimal.ZERO;
/** 待付款订单金额 */
private BigDecimal unpaidOrderFee= BigDecimal.ZERO;
/** 待付款订单数 */
private Integer unpaidOrderCount=0;
/** 待审核还车押金扣款 */
private BigDecimal returnOrderDeductFee= BigDecimal.ZERO;
/** 还车待审核订单数 */
private Integer returnOrderCount=0;
/** 今日支付手续费 */
private BigDecimal todayHandlingFee= BigDecimal.ZERO;
/** 总支付手续费 */
private BigDecimal totalHandlingFee= BigDecimal.ZERO;
/** 今日服务费 */
private BigDecimal todayServiceFee= BigDecimal.ZERO;
/** 总服务费 */
private BigDecimal totalServiceFee= BigDecimal.ZERO;
/** 车辆统计 */
private VehicleVo vehicleVo;
/** 运维统计 */
private OperationVo operationVo;
/** 收入统计list */
private List<IncomeVo> incomeVoList;
/**
* 营收统计 incomeVo
*/
@Data
public static class IncomeVo {
/** 日期 */
private String day;
/** 订单金额 */
private BigDecimal orderFee;
/** 订单数 */
private Integer orderNum;
}
/**
* 车辆统计
*/
@Data
public static class VehicleVo {
/** 全部车辆 */
private Integer allNum;
/** 行驶中 */
private Integer ridingNum;
/** 临时锁车 */
private Integer temporarilyLockNum;
/** 已禁用 */
private Integer disabledNum;
/** 已离线 */
private Integer offlineNum;
/** 正常待租 */
private Integer normalNum;
/** 预约中 */
private Integer inAppointmentNum;
/** 调度设备 */
private Integer dispatchNum;
/** 仓库设备 */
private Integer inStashNum;
/** 运营中 */
private Integer inOperation;
}
/**
* 运维统计
*/
@Data
public static class OperationVo {
/** 4g解锁失败 */
private Integer failedUnlockCount;
/** 蓝牙解锁数 */
private Integer bluetoothUnlockCount;
/** 设备离线率 */
private BigDecimal deviceOfflineRate;
/** 异常排查车辆 */
private Integer faultOrderCount;
/** 待换电 */
private Integer replacementOrderCount;
/** 待维修 */
private Integer repairCount;
}
// /**
// * 订单信息统计
// */
// @Data
// public static class OrderFeeStatisticsVo {
// /** 营收 */
// private BigDecimal incomeFee = BigDecimal.ZERO;
//
// /** 订单金额 */
// private BigDecimal orderFee = BigDecimal.ZERO;
//
// /** 订单数 */
// private Integer orderCount = 0;
// }
}

View File

@ -0,0 +1,160 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 首页统计响应
*
* @author 邱贞招
* @date 2024-05-09
*/
@Data
public class IndexVo {
/** 余额 */
private BigDecimal balance = BigDecimal.ZERO;
/** 已提现 */
private BigDecimal withdraw = BigDecimal.ZERO;
/** 待结算金额 */
private BigDecimal settlementAmount = BigDecimal.ZERO;
/** 今日营收 */
private BigDecimal todayIncome= BigDecimal.ZERO;
/** 今日订单金额 */
private BigDecimal todayOrderFee= BigDecimal.ZERO;
/** 今日订单数 */
private Integer todayOrderCount=0;
/** 总营收 */
private BigDecimal totalIncome= BigDecimal.ZERO;
/** 总订单数 */
private Integer totalOrderCount=0;
/** 总订单金额 */
private BigDecimal totalOrderFee= BigDecimal.ZERO;
/** 待付款订单数 */
private Integer unpaidOrderCount=0;
/** 待付款订单金额 */
private BigDecimal unpaidOrderFee= BigDecimal.ZERO;
/** 还车待审核订单 */
private Integer returnOrderCount=0;
/** 骑行中订单 */
private Integer ridingOrder=0;
/** 今日退款金额 */
private BigDecimal todayRefundFee= BigDecimal.ZERO;
/** 待审核故障 */
private Integer faultOrderCount=0;
/** 车辆统计 */
private VehicleVo vehicleVo;
/** 运维统计 */
private OperationVo operationVo;
/** 收入统计list */
private List<IncomeVo> incomeVoList;
/**
* 收入统计 incomeVo
*/
@Data
public static class IncomeVo {
/** 日期 */
private String day;
/** 收入 */
private BigDecimal income;
/** 订单数 */
private Integer orderNum;
}
/**
* 车辆统计
*/
@Data
public static class VehicleVo {
/** 全部车辆 */
private Integer allNum;
/** 行驶中 */
private Integer ridingNum;
/** 临时锁车 */
private Integer temporarilyLockNum;
/** 已禁用 */
private Integer disabledNum;
/** 已离线 */
private Integer offlineNum;
/** 正常待租 */
private Integer normalNum;
/** 预约中 */
private Integer inAppointmentNum;
/** 调度设备 */
private Integer dispatchNum;
/** 仓库设备 */
private Integer inStashNum;
/** 运营中 */
private Integer inOperation;
}
/**
* 运维统计
*/
@Data
public static class OperationVo {
/** 换电工单 */
private Integer replacementOrderCount;
/** 已完成换电 */
private Integer completedReplacementOrderCount;
/** 调度工单 */
private Integer dispatchCount;
/** 已完成调度工单 */
private Integer completedDispatchCount;
/** 维修工单 */
private Integer repairCount;
/** 已完成维修工单 */
private Integer completedRepairCount;
}
/**
* 订单信息统计
*/
@Data
public static class OrderFeeStatisticsVo {
/** 营收 */
private BigDecimal incomeFee = BigDecimal.ZERO;
/** 订单金额 */
private BigDecimal orderFee = BigDecimal.ZERO;
/** 订单数 */
private Integer orderCount = 0;
}
}

View File

@ -156,4 +156,9 @@ public interface AsUserMapper
* 快速查询
*/
List<LabelVo> fastSearch(String phonenumber);
/**
* 获取用户总数
*/
Integer selectAllCount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.EtAdminOrder;
import org.apache.ibatis.annotations.Param;
/**
* 换电工单Mapper接口
@ -82,4 +83,13 @@ public interface EtAdminOrderMapper
* @return 换电工单
*/
public Integer checkOrderUnique(String sn);
/**
* 换电单状态统计
*
* @param status
* @param areaId
* @return 结果
*/
int getOrderCount(@Param("type") String type,@Param("status") String status, @Param("areaId")Long areaId);
}

View File

@ -17,4 +17,12 @@ public interface EtAreaDeptMapper extends BaseMapper<EtAreaDept>
* @return 结果
*/
public int deleteAreaDeptByDeptId(Long deptId);
/**
* 通过区域id删除区域与部门关联
*
* @param areaId 区域id
* @return 结果
*/
public int deleteAreaDeptByAreaId(Long areaId);
}

View File

@ -1,7 +1,9 @@
package com.ruoyi.system.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.system.domain.EtCapitalFlow;
import org.apache.ibatis.annotations.Param;
/**
* 资金流水Mapper接口
@ -60,4 +62,16 @@ public interface EtCapitalFlowMapper
public int deleteEtCapitalFlowByFlowIds(Long[] flowIds);
EtCapitalFlow selectEtCapitalFlowByOutTradeNo(String outTradeNo);
/**
* 已提现金额
*
* @param areaId 运营区id
* @return
*/
BigDecimal getWithdrawnFee(@Param("areaId") Long areaId, @Param("status") String status);
BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId);
BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId);
}

View File

@ -2,18 +2,19 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.EtFault;
import org.apache.ibatis.annotations.Param;
/**
* 故障上报Mapper接口
*
*
* @author 邱贞招
* @date 2024-04-06
*/
public interface EtFaultMapper
public interface EtFaultMapper
{
/**
* 查询故障上报
*
*
* @param faultId 故障上报主键
* @return 故障上报
*/
@ -21,7 +22,7 @@ public interface EtFaultMapper
/**
* 查询故障上报列表
*
*
* @param etFault 故障上报
* @return 故障上报集合
*/
@ -29,7 +30,7 @@ public interface EtFaultMapper
/**
* 新增故障上报
*
*
* @param etFault 故障上报
* @return 结果
*/
@ -37,7 +38,7 @@ public interface EtFaultMapper
/**
* 修改故障上报
*
*
* @param etFault 故障上报
* @return 结果
*/
@ -45,7 +46,7 @@ public interface EtFaultMapper
/**
* 删除故障上报
*
*
* @param faultId 故障上报主键
* @return 结果
*/
@ -53,9 +54,17 @@ public interface EtFaultMapper
/**
* 批量删除故障上报
*
*
* @param faultIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteEtFaultByFaultIds(Long[] faultIds);
/**
* 获取待审核故障数量
*
* @param areaId 区域id
* @return 结果
*/
int getAuditFaultNum(Long areaId);
}

View File

@ -5,15 +5,15 @@ import com.ruoyi.system.domain.EtModel;
/**
* 车辆型号Mapper接口
*
*
* @author 邱贞招
* @date 2024-05-13
*/
public interface EtModelMapper
public interface EtModelMapper
{
/**
* 查询车辆型号
*
*
* @param modelId 车辆型号主键
* @return 车辆型号
*/
@ -21,7 +21,7 @@ public interface EtModelMapper
/**
* 查询车辆型号列表
*
*
* @param etModel 车辆型号
* @return 车辆型号集合
*/
@ -29,7 +29,7 @@ public interface EtModelMapper
/**
* 新增车辆型号
*
*
* @param etModel 车辆型号
* @return 结果
*/
@ -37,7 +37,7 @@ public interface EtModelMapper
/**
* 修改车辆型号
*
*
* @param etModel 车辆型号
* @return 结果
*/
@ -45,7 +45,7 @@ public interface EtModelMapper
/**
* 删除车辆型号
*
*
* @param modelId 车辆型号主键
* @return 结果
*/
@ -53,9 +53,12 @@ public interface EtModelMapper
/**
* 批量删除车辆型号
*
*
* @param modelIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteEtModelByModelIds(Long[] modelIds);
int selectAllCount();
}

View File

@ -191,6 +191,26 @@ public interface EtOrderMapper
*/
String getUnpaidOrder(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
/**
* 还车待审核订单数
*/
int getAuditOrderNum(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
/**
* 待审核还车押金扣款
*/
BigDecimal getReturnOrderDeductFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
/**
* 获取订单数
*/
int getOrderNum(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId);
/**
* 订单总金额
*/
BigDecimal getOrderFee(@Param("startDateStr") String timeStart, @Param("endDateStr") String timeEnd, @Param("areaId") Long areaId);
/**
* 手续费
*/
@ -258,4 +278,7 @@ public interface EtOrderMapper
* 平台服务费
*/
BigDecimal getPlatformServiceFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("areaId") Long areaId);
Integer getAppCount();
}

View File

@ -136,4 +136,15 @@ public interface SysDeptMapper
void changeDeptBalance(@Param("amount")BigDecimal amount,@Param("deptId")Long deptId);
/**
* 获取所有运营商数
*
* @return 结果
*/
int selectAllCount();
int getAppCount();
BigDecimal selectAllBalance();
}

View File

@ -184,6 +184,11 @@ public interface IAsDeviceService extends IService<AsDevice>
*/
Boolean ring(String sn);
/**
* 开坐垫锁
*/
Boolean seatCushionLock(String sn);
/**
* 重启设备
@ -199,6 +204,11 @@ public interface IAsDeviceService extends IService<AsDevice>
*/
Boolean ringByMac(String mac);
/**
* 坐垫锁用mac
*/
Boolean seatCushionLockByMac(String mac);
/**
* 临时锁车
*/

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.service;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.system.domain.EtCapitalFlow;
@ -66,4 +67,12 @@ public interface IEtCapitalFlowService
* @return 结果
*/
public int deleteEtCapitalFlowByFlowId(Long flowId);
/**
* 已提现金额
*
* @param areaId 运营区id
* @return
*/
BigDecimal getWithdrawnFee(Long areaId,String status);
}

View File

@ -5,15 +5,15 @@ import com.ruoyi.system.domain.EtModel;
/**
* 车辆型号Service接口
*
*
* @author 邱贞招
* @date 2024-05-13
*/
public interface IEtModelService
public interface IEtModelService
{
/**
* 查询车辆型号
*
*
* @param modelId 车辆型号主键
* @return 车辆型号
*/
@ -21,7 +21,7 @@ public interface IEtModelService
/**
* 查询车辆型号列表
*
*
* @param etModel 车辆型号
* @return 车辆型号集合
*/
@ -29,7 +29,7 @@ public interface IEtModelService
/**
* 新增车辆型号
*
*
* @param etModel 车辆型号
* @return 结果
*/
@ -37,7 +37,7 @@ public interface IEtModelService
/**
* 修改车辆型号
*
*
* @param etModel 车辆型号
* @return 结果
*/
@ -45,7 +45,7 @@ public interface IEtModelService
/**
* 批量删除车辆型号
*
*
* @param modelIds 需要删除的车辆型号主键集合
* @return 结果
*/
@ -53,9 +53,15 @@ public interface IEtModelService
/**
* 删除车辆型号信息
*
*
* @param modelId 车辆型号主键
* @return 结果
*/
public int deleteEtModelByModelId(Long modelId);
/**
* 查询所有车辆型号数
* @return
*/
public int selectAllCount();
}

View File

@ -5,10 +5,7 @@ import java.util.List;
import com.ruoyi.system.domain.EtOrder;
import com.ruoyi.system.domain.EtRefund;
import com.ruoyi.system.domain.vo.EtOrderVo;
import com.ruoyi.system.domain.vo.OperatingDataVo;
import com.ruoyi.system.domain.vo.RechargeVo;
import com.ruoyi.system.domain.vo.ReconciliationVo;
import com.ruoyi.system.domain.vo.*;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.refund.model.Refund;
@ -205,15 +202,25 @@ public interface IEtOrderService
/**
* 换车关锁
*/
Boolean changeVehicleLock(String orderNo,String changeReason);
Boolean changeVehicleLock(String orderNo,String changeReason,String isBluetooth,String lon,String lat,String voltage);
/**
* 换车开锁
*/
Boolean changeVehicleLockUnlocking(String orderNo,String newSn);
Boolean changeVehicleLockUnlocking(String orderNo,String newSn,String isBluetooth,String lon,String lat,String voltage);
/**
* 押金订单
*/
EtOrder getDepositOrder(Long userId);
/**
* 首页统计-运营商
*/
IndexVo statistics(Long areaId);
/**
* 首页统计-总管理
*/
IndexAdminVo admimStatistics();
}

View File

@ -161,4 +161,19 @@ public interface ISysDeptService
* 管理员提现失败
*/
int rejectWithdraw(Long flowId);
/**
* 运营商数
*/
int selectAllCount();
/**
* 独立小程序
*/
int getAppCount();
/**
* 所有余额
*/
BigDecimal selectAllBalance();
}

View File

@ -783,7 +783,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
@Override
public Boolean online(String sn) {
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL_STR);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
int device = asDeviceMapper.updateAsDevice(asDevice);
if(device==0){
log.info("车辆上线状态失败");
@ -909,6 +909,15 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
log.info(""+type+"】===>IOT请求调用结果:【{}】",result);
JSONObject paramsObj = JSON.parseObject(result);
String code = paramsObj.getString("code");
if ("10500".equals(code)) { // 超时
log.info("第一次请求超时,进行第二次请求...");
result = HttpUtils.sendPostWithToken(sendUrl, command, token);
log.info("" + type + "】===>IOT第二次请求调用结果:【{}】", result);
paramsObj = JSON.parseObject(result);
code = paramsObj.getString("code");
}
asynchronousSaveLog(sendUrl,command,mac,result,type,orderNo,userName);
//记录命令
if (!HttpStatus.IOT_SUCCESS.equals(code))
@ -980,6 +989,14 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
String result = HttpUtils.sendPostWithToken(sendUrl, command, token);
log.info(""+type+"】===>IOT请求调用结果:【{}】",result);
ResponseVo responseVo = JSON.parseObject(result, ResponseVo.class);
if (responseVo.getCode() == 10500) { // 超时
log.info("第一次请求超时,进行第二次请求...");
result = HttpUtils.sendPostWithToken(sendUrl, command, token);
log.info("" + type + "】===>IOT第二次请求调用结果:【{}】", result);
responseVo = JSON.parseObject(result, ResponseVo.class);
}
if(responseVo.getCode() != 0){
asynchronousUpdateOnlineStatus(mac);
}
@ -1017,6 +1034,26 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
return Boolean.TRUE;
}
/**
* 开坐垫锁
* @param sn
* @return
*/
@SneakyThrows
@Override
public Boolean seatCushionLock(String sn) {
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
/** 1.获取token*/
String token = Token.getToken();
Boolean execute = transactionTemplate.execute(e -> {
/** 2.发送命令*/
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_HPEN,"开坐垫锁",null,null);
return Boolean.TRUE;
});
if(!execute)throw new ServiceException("开坐垫锁失败");
return Boolean.TRUE;
}
/**
* 重启设备
* @param sn
@ -1075,6 +1112,26 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
return Boolean.TRUE;
}
/**
* 坐垫锁用mac
* @param mac
* @return
*/
@SneakyThrows
@Override
public Boolean seatCushionLockByMac(String mac) {
/** 1.获取token*/
String token = Token.getToken();
Boolean execute = transactionTemplate.execute(e -> {
/** 2.发送命令*/
sendCommand(mac, token,IotConstants.COMMAND_HPEN,"开坐垫锁",null,null);
return Boolean.TRUE;
});
if(!execute)throw new ServiceException("开坐垫锁失败");
return Boolean.TRUE;
}
/**
* 临时锁车
* @param orderNo
@ -1132,7 +1189,13 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
/** 2.发送命令*/
sendCommand(asDevice.getMac(), Token.getToken(),IotConstants.COMMAND_CLOSE+IotConstants.COMMAND_FREQUENCY_3600,"管理员锁车",null,userName);
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
// 判断该sn是否有正在骑行中的订单如果有骑行中的订单则修改为临时锁车
EtOrder etOrder = etOrderService.getCurrentOrder(sn);
if(ObjectUtil.isNotNull(etOrder)){
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);
}else{
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
}
asDevice.setIsAdminUnlocking("0");
int device = asDeviceMapper.updateAsDevice(asDevice);
if(device==0){

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.service.impl;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.annotation.DataScope;
@ -106,4 +107,15 @@ public class EtCapitalFlowServiceImpl implements IEtCapitalFlowService
{
return etCapitalFlowMapper.deleteEtCapitalFlowByFlowId(flowId);
}
/**
* 已提现金额
*
* @param areaId 运营区id
* @return
*/
@Override
public BigDecimal getWithdrawnFee(Long areaId,String status) {
return etCapitalFlowMapper.getWithdrawnFee(areaId,status);
}
}

View File

@ -2,11 +2,14 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.IEtOperatingAreaService;
import com.ruoyi.system.service.IWxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EtFeeRuleMapper;
@ -28,6 +31,9 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService
@Autowired
private IEtOperatingAreaService etOperatingAreaService;
@Autowired
private IWxPayService wxPayService;
/**
* 查询收费方式
*
@ -64,6 +70,10 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService
@DataScope(deptAlias = "d")
public List<EtFeeRule> selectEtFeeRuleList(EtFeeRule etFeeRule)
{
if(ObjectUtil.isNotNull(etFeeRule.getAreaId())){
SysDept sysDept = wxPayService.getDeptObjByAreaId(etFeeRule.getAreaId());
etFeeRule.setDeptId(sysDept.getDeptId());
}
return etFeeRuleMapper.selectEtFeeRuleList(etFeeRule);
}

View File

@ -206,4 +206,9 @@ public class EtModelServiceImpl implements IEtModelService
return etModelMapper.deleteEtModelByModelId(modelId);
}
@Override
public int selectAllCount() {
return etModelMapper.selectAllCount();
}
}

View File

@ -9,12 +9,15 @@ import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.map.GeoUtils;
import com.ruoyi.system.domain.AsDevice;
import com.ruoyi.system.domain.EtAreaDept;
import com.ruoyi.system.domain.EtAreaRule;
import com.ruoyi.system.domain.EtOperatingArea;
import com.ruoyi.system.mapper.AsDeviceMapper;
import com.ruoyi.system.mapper.EtAreaDeptMapper;
import com.ruoyi.system.mapper.EtAreaRuleMapper;
import com.ruoyi.system.mapper.EtOperatingAreaMapper;
import com.ruoyi.system.service.IAsDeviceService;
@ -60,6 +63,9 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
@Resource
private AsDeviceMapper asDeviceMapper;
@Resource
private EtAreaDeptMapper etAreaDeptMapper;
/**
* 查询运营区
@ -144,8 +150,21 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
etOperatingArea.setBoundary(wkt);
int insert = dao.insert(etOperatingArea);
Long[] ruleIds = etOperatingArea.getRuleIds();
for (Long ruleId:ruleIds){
etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build());
if(ObjectUtil.isNotNull(ruleIds) && ruleIds.length > 0){
for (Long ruleId:ruleIds){
etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build());
}
}
Long deptId = SecurityUtils.getDeptId();
if(deptId == 100){
deptId = etOperatingArea.getDeptId();
}
if(!ObjectUtil.isNotNull(etOperatingArea.getDeptId()) && deptId == 100){
throw new ServiceException("请选择运营商");
}
int insert1 = etAreaDeptMapper.insert(EtAreaDept.builder().areaId(etOperatingArea.getAreaId()).deptId(deptId).build());
if(insert1 > 0){
log.info("新增运营区与运营商关联成功");
}
return insert;
}
@ -175,6 +194,17 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
}
}
}
Long deptId = SecurityUtils.getDeptId();
if(deptId == 100){
deptId = etOperatingArea.getDeptId();
}
if(!ObjectUtil.isNotNull(etOperatingArea.getDeptId()) && deptId == 100){
throw new ServiceException("请选择运营商");
}
int i1 = etAreaDeptMapper.deleteAreaDeptByAreaId(etOperatingArea.getAreaId());
if(i1 > 0){
etAreaDeptMapper.insert(EtAreaDept.builder().areaId(etOperatingArea.getAreaId()).deptId(deptId).build());
}
return i;
}
@ -285,19 +315,24 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
Point point = geometryFactory.createPoint(coordinate);
if(ObjectUtil.isNotNull(etOperatingAreas) && etOperatingAreas.size()>0){
for(EtOperatingArea etOperatingArea:etOperatingAreas){
Geometry geometry = GeoUtils.fromWkt(etOperatingArea.getBoundary());
if (geometry.contains(point)) {
return etOperatingArea;
}else{
// 获取多边形的外边界
Coordinate[] coordinates = geometry.getCoordinates();
for (Coordinate coord : coordinates) {
double distance = GeoUtils.calculateDistance(lat, lon, coord.y, coord.x);
if (distance < minDistance) {
minDistance = distance;
closestArea = etOperatingArea;
String boundary = etOperatingArea.getBoundary();
if(StrUtil.isNotBlank(boundary)){
Geometry geometry = GeoUtils.fromWkt(etOperatingArea.getBoundary());
if (geometry.contains(point)) {
return etOperatingArea;
}else{
// 获取多边形的外边界
Coordinate[] coordinates = geometry.getCoordinates();
for (Coordinate coord : coordinates) {
double distance = GeoUtils.calculateDistance(lat, lon, coord.y, coord.x);
if (distance < minDistance) {
minDistance = distance;
closestArea = etOperatingArea;
}
}
}
}else{
log.info("运营区【{}】没有边界",etOperatingArea.getAreaName());
}
}
}else{

View File

@ -3,24 +3,25 @@ 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.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.IotConstants;
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;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.onenet.ResponseVo;
import com.ruoyi.common.utils.onenet.Token;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.*;
import com.ruoyi.system.mapper.AsDeviceMapper;
import com.ruoyi.system.mapper.EtOperatingAreaMapper;
import com.ruoyi.system.mapper.EtOrderMapper;
import com.ruoyi.system.mapper.EtRefundMapper;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.*;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.refund.model.Refund;
@ -29,11 +30,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.web.bind.annotation.RequestBody;
@ -62,6 +60,9 @@ public class EtOrderServiceImpl implements IEtOrderService
@Resource
private IAsUserService asUserService;
@Resource
private AsUserMapper asUserMapper;
@Autowired
private IEtOperatingAreaService etOperatingAreaService;
@ -92,8 +93,8 @@ public class EtOrderServiceImpl implements IEtOrderService
@Autowired
private CallbackService callbackService;
// @Value("${et.handlingCharge}")
// private String handlingCharge;
@Autowired
private ISysDeptService deptService;
@Resource
private EtRefundMapper etRefundMapper;
@ -101,6 +102,21 @@ public class EtOrderServiceImpl implements IEtOrderService
@Autowired
private TransactionTemplate transactionTemplate;
@Resource
private IEtModelService etModelService;
@Autowired
private IEtCapitalFlowService etCapitalFlowService;
@Resource
private EtFaultMapper etFaultMapper;
@Autowired
private EtAdminOrderMapper etAdminOrderMapper;
@Autowired
private EtCapitalFlowMapper etCapitalFlowMapper;
/**
* 查询订单
*
@ -537,6 +553,198 @@ public class EtOrderServiceImpl implements IEtOrderService
throw new ServiceException("押金充值记录不存在");
}
/**
* 首页统计-运营商
*/
@Override
public IndexVo statistics(Long areaId) {
/** 首页数据*/
SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
IndexVo indexVo = createIndexVo(areaId,sysDept);
/** 营收统计*/
ArrayList<IndexVo.IncomeVo> incomeVos = new ArrayList<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtils.getNowDate());
for (int i = 0; i < 13; i++) {
String formattedDate = dateFormat.format(calendar.getTime());
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
IndexVo.OrderFeeStatisticsVo todayOrderInfo = getOrderFeeStatistics(startDateStr, endDateStr, areaId,sysDept);
log.info("【首页统计】营收统计----------todayOrderInfo: {}" , JSON.toJSON(todayOrderInfo));
IndexVo.IncomeVo incomeVo = new IndexVo.IncomeVo();
incomeVo.setDay(formattedDate);
incomeVo.setOrderNum(todayOrderInfo.getOrderCount());
incomeVo.setIncome(todayOrderInfo.getIncomeFee());
incomeVos.add(incomeVo);
calendar.add(Calendar.DATE, -1);
}
indexVo.setIncomeVoList(incomeVos);
/** 车辆统计*/
IndexVo.VehicleVo vehicleVo = new IndexVo.VehicleVo();
DeviceNumVo deviceNumVo = asDeviceService.allVehicleNum("0","100",areaId+"");
com.ruoyi.common.utils.bean.BeanUtils.copyBeanProp(vehicleVo,deviceNumVo);
indexVo.setVehicleVo(vehicleVo);
/** 运维统计*/
IndexVo.OperationVo operationVo = new IndexVo.OperationVo();
operationVo.setReplacementOrderCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPLACEMENT,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY,areaId));
operationVo.setCompletedReplacementOrderCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPLACEMENT,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_COMPLETED,areaId));
operationVo.setDispatchCount(0);// 暂时没有调度工单
operationVo.setCompletedDispatchCount(0);// 暂时没有调度工单
operationVo.setRepairCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPAIR,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_REPAIR,areaId));
operationVo.setCompletedRepairCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPAIR,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_COMPLETED,areaId));
indexVo.setOperationVo(operationVo);
log.info("【首页统计】indexVo==={}",JSON.toJSON(indexVo));
return indexVo;
}
private IndexVo createIndexVo(Long areaId,SysDept sysDept) {
IndexVo indexVo = new IndexVo();
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtils.getNowDate());
String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
indexVo.setBalance(sysDept.getBalance());//余额
BigDecimal withdrawFee = etCapitalFlowService.getWithdrawnFee(areaId,ServiceConstants.FLOW_STATUS_COMPLETE);
BigDecimal applyFee = etCapitalFlowService.getWithdrawnFee(areaId,ServiceConstants.FLOW_STATUS_APPLY);
indexVo.setWithdraw(defaultIfNull(withdrawFee, BigDecimal.ZERO));//已提现
indexVo.setSettlementAmount(defaultIfNull(applyFee, BigDecimal.ZERO));//待结算金额
IndexVo.OrderFeeStatisticsVo todayOrderInfo = getOrderFeeStatistics(startDateStr, endDateStr, areaId,sysDept);
indexVo.setTodayIncome(todayOrderInfo.getIncomeFee());//今日营收
indexVo.setTodayOrderFee(todayOrderInfo.getOrderFee());//今日订单金额
indexVo.setTodayOrderCount(todayOrderInfo.getOrderCount());//今日订单数
IndexVo.OrderFeeStatisticsVo totalOrderInfo = getOrderFeeStatistics(null, null, areaId,sysDept);
indexVo.setTotalIncome(totalOrderInfo.getIncomeFee());//总营收
indexVo.setTotalOrderFee(totalOrderInfo.getOrderFee());//总订单金额
indexVo.setTotalOrderCount(totalOrderInfo.getOrderCount());//总订单数
indexVo.setUnpaidOrderCount(Integer.parseInt(etOrderMapper.getUnpaidOrder(null,null,areaId+"")));//待付款订单数
indexVo.setUnpaidOrderFee(new BigDecimal(etOrderMapper.getTotalUnpaid(null,null,areaId+"")));//待付款订单金额
indexVo.setReturnOrderCount(etOrderMapper.getAuditOrderNum(null,null,areaId+""));//还车待审核订单
indexVo.setRidingOrder(Integer.parseInt(etOrderMapper.getRidingOrder(null,null,areaId+"")));//骑行中订单
indexVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(startDateStr,endDateStr,areaId+"")));// 今日退款金额
indexVo.setFaultOrderCount(etFaultMapper.getAuditFaultNum(areaId));//待审核故障数量
return indexVo;
}
/**
* 订单信息统计
*/
private IndexVo.OrderFeeStatisticsVo getOrderFeeStatistics(String startDateStr, String endDateStr, Long areaId,SysDept sysDept) {
IndexVo.OrderFeeStatisticsVo feeStatisticsVo = new IndexVo.OrderFeeStatisticsVo();
String handlingCharge = sysDept.getHandlingCharge();
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
BigDecimal divide = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 4, RoundingMode.HALF_UP);
BigDecimal serviceFee = payFee.multiply(divide).setScale(2, RoundingMode.HALF_UP);//手续费
BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee), BigDecimal.ZERO);//营收 = 支付金额 - 手续费 - 退款金额
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId);
feeStatisticsVo.setOrderFee(payFee);
feeStatisticsVo.setIncomeFee(incomeFee);
feeStatisticsVo.setOrderCount(orderCount);
return feeStatisticsVo;
}
/**
* 首页统计-总管理
*/
@Override
public IndexAdminVo admimStatistics() {
/** 首页数据*/
IndexAdminVo indexAdminVo = createIndexAdminVo();
/** 营收统计*/
ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtils.getNowDate());
for (int i = 0; i < 13; i++) {
String formattedDate = dateFormat.format(calendar.getTime());
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null);
IndexAdminVo.IncomeVo incomeVo = new IndexAdminVo.IncomeVo();
incomeVo.setDay(formattedDate);
incomeVo.setOrderNum(orderCount);
incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null));
incomeVos.add(incomeVo);
calendar.add(Calendar.DATE, -1);
}
indexAdminVo.setIncomeVoList(incomeVos);
/** 车辆统计*/
IndexAdminVo.VehicleVo vehicleVo = new IndexAdminVo.VehicleVo();
DeviceNumVo deviceNumVo = asDeviceService.allVehicleNum("0","100",null);
com.ruoyi.common.utils.bean.BeanUtils.copyBeanProp(vehicleVo,deviceNumVo);
indexAdminVo.setVehicleVo(vehicleVo);
/** 运维统计*/
IndexAdminVo.OperationVo operationVo = new IndexAdminVo.OperationVo();
operationVo.setReplacementOrderCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPLACEMENT,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY,null));
operationVo.setRepairCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPAIR,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_REPAIR,null));
indexAdminVo.setOperationVo(operationVo);
log.info("【首页统计-总管理】indexAdminVo==={}",JSON.toJSON(indexAdminVo));
return indexAdminVo;
}
private IndexAdminVo createIndexAdminVo() {
IndexAdminVo indexAdminVo = new IndexAdminVo();
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtils.getNowDate());
String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
indexAdminVo.setOperatorCount(deptService.selectAllCount());// 运营商数
indexAdminVo.setAppCount(deptService.getAppCount());// 独立小程序
indexAdminVo.setTotalBalance(deptService.selectAllBalance());//商户总余额
BigDecimal withdrawFee = etCapitalFlowService.getWithdrawnFee(null,ServiceConstants.FLOW_STATUS_COMPLETE);
indexAdminVo.setWithdrawn(defaultIfNull(withdrawFee, BigDecimal.ZERO));//已提现金额
indexAdminVo.setAreaCount(etOperatingAreaService.count());//运营区数
indexAdminVo.setModelCount(etModelService.selectAllCount());//车辆型号数
indexAdminVo.setUserCount(asUserMapper.selectAllCount(null,null));//用户总数
indexAdminVo.setTodayUserCount(asUserMapper.selectAllCount(startDateStr,endDateStr));//今日新增
indexAdminVo.setTodayOrderCount(etOrderMapper.getOrderNum(startDateStr, endDateStr, null));//今日订单数
indexAdminVo.setTodayOrderFee(etOrderMapper.getPayFee(startDateStr, endDateStr, null, null));//今日订单金额
indexAdminVo.setTodayOrderCount(etOrderMapper.getOrderNum(null, null, null));//总订单数
indexAdminVo.setTodayOrderFee(etOrderMapper.getPayFee(null, null, null, null));//总订单金额
indexAdminVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(startDateStr,endDateStr,null)));// 今日退款金额
indexAdminVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(null,null,null)));// 总退款金额
indexAdminVo.setUnpaidOrderCount(Integer.parseInt(etOrderMapper.getUnpaidOrder(null,null,null)));//待付款订单数
indexAdminVo.setUnpaidOrderFee(new BigDecimal(etOrderMapper.getTotalUnpaid(null,null,null)));//待付款订单金额
indexAdminVo.setReturnOrderCount(etOrderMapper.getAuditOrderNum(null,null,null));//还车待审核订单
indexAdminVo.setReturnOrderDeductFee(etOrderMapper.getReturnOrderDeductFee(null,null,null));// 待审核还车押金扣款
indexAdminVo.setTodayHandlingFee(etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null));// 今日支付手续费
indexAdminVo.setTotalHandlingFee(etCapitalFlowMapper.getHandlingFee(null, null, null));// 总手续费
indexAdminVo.setTodayServiceFee(etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null));//今日服务费
indexAdminVo.setTotalServiceFee(etCapitalFlowMapper.getServiceFee(null, null, null));// 总服务费
return indexAdminVo;
}
private boolean toBePaid(String[] statusList) {
boolean hasOne = false;
boolean hasThree = false;
@ -1270,7 +1478,7 @@ public class EtOrderServiceImpl implements IEtOrderService
@Override
@Transactional
@SneakyThrows
public Boolean changeVehicleLock(String orderNo,String changeReason) {
public Boolean changeVehicleLock(String orderNo,String changeReason,String isBluetooth,String lon,String lat,String voltage) {
EtOrder order = etOrderMapper.selectEtOrderByOrderNo(orderNo);
if(!ServiceConstants.ORDER_STATUS_RIDING.equals(order.getStatus())){
throw new ServiceException("该订单状态非骑行中");
@ -1279,7 +1487,29 @@ public class EtOrderServiceImpl implements IEtOrderService
if(StrUtil.isBlank(sn))throw new ServiceException("sn不能为空");
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
/** 2.发送命令*/
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), IotConstants.COMMAND_CLOSE+IotConstants.COMMAND_FREQUENCY_3600,"换车关锁",order.getOrderNo(),order.getUserName());
if(!"true".equals(isBluetooth)){
ResponseVo responseVo = asDeviceService.sendCommandWithResp(asDevice.getMac(), Token.getToken(), IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "换车关锁",orderNo);
if(responseVo.getCode()!=0){
log.info("【还车关锁】远程关锁失败");
throw new ServiceException("远程关锁失败");
}
}else{
asDevice.setLongitude(lon);
asDevice.setLatitude(lat);
if(StrUtil.isNotBlank(voltage)){
BigDecimal divide = new BigDecimal(voltage).divide(new BigDecimal(10));
asDevice.setVoltage(divide.toString());
EtModel model = etModelService.selectEtModelByModelId(asDevice.getModelId());
Integer remainingMileage = 0;
if(StrUtil.isNotBlank(asDevice.getVoltage())){
remainingMileage = CommonUtil.getRemainingMileage(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
}
Integer electricQuantity = CommonUtil.getElectricQuantity(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
asDevice.setRemainingMileage(remainingMileage);
asDevice.setRemainingPower(electricQuantity.toString());
}
asDevice.setLastTime(DateUtils.getNowDate());
}
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
asDevice.setIsAdminUnlocking("0");
@ -1313,7 +1543,7 @@ public class EtOrderServiceImpl implements IEtOrderService
@SneakyThrows
@Override
@Transactional
public Boolean changeVehicleLockUnlocking(String orderNo, String newSn) {
public Boolean changeVehicleLockUnlocking(String orderNo, String newSn,String isBluetooth,String lon,String lat,String voltage) {
EtOrder order = etOrderMapper.selectEtOrderByOrderNo(orderNo);
if(!ServiceConstants.ORDER_STATUS_RIDING.equals(order.getStatus())){
throw new ServiceException("该订单状态非骑行中");
@ -1326,7 +1556,29 @@ public class EtOrderServiceImpl implements IEtOrderService
String token = Token.getToken();
Boolean execute = transactionTemplate.execute(e -> {
/** 2.发送命令*/
asDeviceService.sendCommand(newDevice.getMac(), token,IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_20,"换车开锁",order.getOrderNo(),order.getUserName());
if(!"true".equals(isBluetooth)){
ResponseVo responseVo = asDeviceService.sendCommandWithResp(newDevice.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "换车开锁",orderNo);
if(responseVo.getCode()!=0){
log.info("【还车关锁】远程关锁失败");
throw new ServiceException("远程关锁失败");
}
}else{
newDevice.setLongitude(lon);
newDevice.setLatitude(lat);
if(StrUtil.isNotBlank(voltage)){
BigDecimal divide = new BigDecimal(voltage).divide(new BigDecimal(10));
newDevice.setVoltage(divide.toString());
EtModel model = etModelService.selectEtModelByModelId(newDevice.getModelId());
Integer remainingMileage = 0;
if(StrUtil.isNotBlank(newDevice.getVoltage())){
remainingMileage = CommonUtil.getRemainingMileage(newDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
}
Integer electricQuantity = CommonUtil.getElectricQuantity(newDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
newDevice.setRemainingMileage(remainingMileage);
newDevice.setRemainingPower(electricQuantity.toString());
}
newDevice.setLastTime(DateUtils.getNowDate());
}
newDevice.setIsAdminUnlocking("1");
newDevice.setStatus(ServiceConstants.VEHICLE_STATUS_SCHEDULING);
newDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);

View File

@ -530,6 +530,21 @@ public class SysDeptServiceImpl implements ISysDeptService
return i;
}
@Override
public int selectAllCount() {
return deptMapper.selectAllCount();
}
@Override
public int getAppCount() {
return deptMapper.getAppCount();
}
@Override
public BigDecimal selectAllBalance() {
return deptMapper.selectAllBalance();
}
/**
* 递归列表
*/

View File

@ -157,6 +157,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="fastSearch" resultType="com.ruoyi.common.core.domain.vo.LabelVo">
select phonenumber label,user_id as `value`,app_name appName from et_user where phonenumber like concat('%', #{phonenumber}, '%')
</select>
<select id="selectAllCount" resultType="java.lang.Integer">
select count(DISTINCT phonenumber) from et_user where 1=1
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
</select>
<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId">
insert into et_user(

View File

@ -78,6 +78,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from et_admin_order where sn = #{sn}
</select>
<select id="getOrderCount" resultType="java.lang.Integer">
select count(1) from et_admin_order where 1=1
<if test="status != null"> and status = #{status}</if>
<if test="type != null"> and type = #{type}</if>
<if test="areaId != null"> and area_id = #{areaId}</if>
</select>
<insert id="insertEtAdminOrder" parameterType="EtAdminOrder" useGeneratedKeys="true" keyProperty="id">
insert into et_admin_order
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -7,4 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteAreaDeptByDeptId">
delete from et_area_dept where dept_id=#{deptId}
</delete>
<delete id="deleteAreaDeptByAreaId">
delete from et_area_dept where area_id=#{areaId}
</delete>
</mapper>

View File

@ -90,6 +90,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where out_trade_no = #{outTradeNo}
</select>
<select id="getWithdrawnFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(amount), 0) from et_capital_flow f
where f.bus_type = '5'
<if test="areaId != null "> and f.area_id = #{areaId}</if>
<if test="status != null "> and f.status = #{status}</if>
</select>
<select id="getHandlingFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(handling_charge), 0) from et_capital_flow f where area_id != 14
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<select id="getServiceFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(platform_service_fee), 0) from et_capital_flow f where area_id != 14
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<insert id="insertEtCapitalFlow" parameterType="EtCapitalFlow">
insert into et_capital_flow
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -14,17 +14,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="picture" column="picture" />
<result property="detail" column="detail" />
<result property="orderId" column="order_id" />
<result property="orderNo" column="order_no" />
<result property="status" column="status" />
<result property="areaId" column="area_id" />
<result property="address" column="address" />
</resultMap>
<sql id="selectEtFaultVo">
select fault_id, area_id, user_id, device_mac, sn, type, create_time, picture, detail, order_id, status, address from et_fault
select fault_id, area_id, user_id, device_mac, sn, type, create_time, picture, detail, order_id, order_no, status, address from et_fault
</sql>
<select id="selectEtFaultList" parameterType="EtFault" resultMap="EtFaultResult">
select f.fault_id, f.area_id, f.user_id, f.device_mac, f.sn, f.type, f.create_time, f.picture, f.detail, f.order_id, f.status, f.address from et_fault f
select f.fault_id, f.area_id, f.user_id, f.device_mac, f.sn, f.type, f.create_time, f.picture, f.detail, f.order_id, f.order_no,f.status, f.address from et_fault f
left join et_area_dept ad on ad.area_id = f.area_id
left join sys_dept d on d.dept_id = ad.dept_id
where 1 = 1
@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">picture,</if>
<if test="detail != null">detail,</if>
<if test="orderId != null">order_id,</if>
<if test="orderNo != null">order_no,</if>
<if test="status != null">status,</if>
<if test="address != null">address,</if>
</trim>
@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">#{picture},</if>
<if test="detail != null">#{detail},</if>
<if test="orderId != null">#{orderId},</if>
<if test="orderNo != null">#{orderNo},</if>
<if test="status != null">#{status},</if>
<if test="address != null">#{address},</if>
</trim>
@ -84,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">picture = #{picture},</if>
<if test="detail != null">detail = #{detail},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
<if test="status != null">status = #{status},</if>
<if test="address != null">address = #{address},</if>
</trim>
@ -100,4 +104,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{faultId}
</foreach>
</delete>
<select id="getAuditFaultNum" parameterType="long" resultType="java.lang.Integer">
select COALESCE(count(1), 0) from et_fault f
where f.status = '1'
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
</select>
</mapper>

View File

@ -42,6 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where model_id = #{modelId}
</select>
<select id="selectAllCount" resultType="java.lang.Integer">
select count(1) from et_model
</select>
<insert id="insertEtModel" parameterType="EtModel" keyProperty="modelId" useGeneratedKeys="true">
insert into et_model
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -67,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEtOperatingAreaList" parameterType="EtOperatingArea" resultMap="EtOperatingAreaResult">
select a.area_id, a.area_name, AsText(a.boundary) boundary,
a.boundary_str, a.picture, a.longitude, a.latitude, a.create_by, a.create_time,
a.boundary_str, a.picture, a.longitude, a.latitude, a.create_by, a.create_time,d.dept_id deptId,d.dept_name deptName,
a.contact, a.phone, a.status, a.area_time, a.service_phone, a.slogan, a.province, a.city,
a.county, a.area_out_outage, a.parking_out_dispatch, a.area_out_dispatch,
a.no_riding_outage, a.authentication, a.msg_switch, a.undercharge, a.error, a.agreement, a.deposit,

View File

@ -225,8 +225,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalUnpaid" resultType="java.lang.String" parameterType="String">
select COALESCE(SUM(total_fee), 0) from et_order where status = 3 and type = 1 and paid = 0
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
@ -303,7 +307,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select COALESCE(count(1), 0) from et_order where status = 4 and type = 1 and paid = 1
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<select id="getRidingOrder" resultType="java.lang.String">
select COALESCE(count(1), 0) from et_order where status = 2 and type = 1
@ -321,8 +325,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getUnpaidOrder" resultType="java.lang.String">
select COALESCE(count(1), 0) from et_order where status = 3 and type = 1 and paid = 0
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<!--还车待审核订单数-->
<select id="getAuditOrderNum" resultType="java.lang.Integer">
select COALESCE(count(1), 0) from et_order where status = 5 and type = 1
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<!--待审核还车押金扣款 -->
<select id="getReturnOrderDeductFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(total_fee), 0) from et_order where status > 5 and type = 1
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
<select id="getOrderNum" resultType="java.lang.Integer">
select COALESCE(count(1), 0) from et_order where type = 1
<if test="timeStart != null and timeStart != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
</select>
@ -348,6 +391,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getOrderFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(pay_fee), 0) from et_order
<where>
<if test="areaId != null"> and area_id = #{areaId}</if>
<if test="startDateStr != null and startDateStr != ''">
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startDateStr},'%y%m%d')
</if>
<if test="endDateStr != null and endDateStr != ''">
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endDateStr},'%y%m%d')
</if>
AND status = 4 and type = 1
</where>
</select>
<select id="getPartnerFee" resultType="java.math.BigDecimal">
SELECT COALESCE
( SUM( dd.dividend_amount ), 0 )

View File

@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="delFlag" column="" />
<result property="parentName" column="parent_name" />
<result property="platformServiceFee" column="platform_service_fee" />
<result property="handlingCharge" column="handling_charge" />
@ -43,30 +43,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select d.dept_id, d.parent_id, d.ancestors, d.dept_name,
d.order_num, d.leader, d.phone, d.email, d.status,
d.del_flag,d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url,d.refund_notify_url, d.app_user_id,
d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url, d.app_user_id,
d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
SELECT d.dept_id, d.parent_id, d.ancestors, d.dept_name,
d.order_num, d.leader, d.phone, d.email, d.status,
d.del_flag, d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path, d.merchant_serial_number, d.refund_notify_url, d.app_user_id,
u.user_name AS userName,
GROUP_CONCAT(oa.area_name SEPARATOR ' | ') AS areaName,
d.create_by, d.create_time
FROM sys_dept d
LEFT JOIN et_user u ON d.app_user_id = u.user_id
LEFT JOIN et_area_dept ad ON ad.dept_id = d.dept_id
LEFT JOIN et_operating_area oa ON oa.area_id = ad.area_id
WHERE d.del_flag = '0' AND d.parent_id != 0
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
AND d.dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
<if test="parentId != null and parentId != 0">
AND d.parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
AND d.dept_name LIKE CONCAT('%', #{deptName}, '%')
</if>
<if test="areaName != null and areaName != ''">
AND oa.area_name LIKE CONCAT('%', #{areaName}, '%')
</if>
<if test="userName != null and userName != ''">
AND u.user_name LIKE CONCAT('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
AND d.status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
GROUP BY d.dept_id
ORDER BY d.create_time DESC
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
@ -243,4 +260,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<select id="selectAllCount" resultType="java.lang.Integer">
select count(1) from sys_dept where del_flag = '0'
</select>
<select id="getAppCount" resultType="java.lang.Integer">
select count(1) from sys_dept where is_use_platform_app = 'false' and del_flag = '0'
</select>
<select id="selectAllBalance" resultType="java.math.BigDecimal">
select COALESCE(SUM(balance), 0) from sys_dept where del_flag = '0'
</select>
</mapper>

View File

@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="appUserId" column="app_user_id" />
<result property="cooperationTime" column="cooperation_time" />
<result property="dividendStatus" column="dividend_status" />
<result property="balance" column="balance" />
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
@ -53,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.area_id,u.dividend_proportion,u.dividend_item,u.app_user_id, u.cooperation_time,u.dividend_status,
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.area_id,u.dividend_proportion,u.dividend_item,u.app_user_id, u.cooperation_time,u.dividend_status,u.balance,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,a.area_name areaName
from sys_user u
@ -64,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.area_id,u.dividend_proportion,u.dividend_item,u.app_user_id, u.cooperation_time,u.dividend_status,d.dept_name, d.leader,a.area_name areaName from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.area_id,u.dividend_proportion,u.dividend_item,u.app_user_id, u.cooperation_time,u.dividend_status,u.balance, d.dept_name, d.leader,a.area_name areaName from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join et_operating_area a on u.area_id = a.area_id
where u.del_flag = '0'