1.管理员首页统计

2.审核通过后,判断是否还有正在进行中的订单,没有没有才退款
This commit is contained in:
邱贞招 2024-07-20 18:34:58 +08:00
parent 6f48868cdd
commit b18cd3cceb
14 changed files with 296 additions and 90 deletions

View File

@ -40,7 +40,13 @@ public class IndexController extends BaseController
@GetMapping("/getAreaList")
public AjaxResult getAreaList()
{
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(getDeptId());
Long deptId;
if(getUserId() == 1){
deptId = null;
}else{
deptId = getDeptId();
}
List<EtOperatingArea> longs = etOperatingAreaService.selectAreaListByDeptId2(deptId);
logger.info("根据token获取运营区列表【{}】", JSON.toJSON(longs));
return success(longs);
}

View File

@ -945,6 +945,7 @@ public class AppVerifyController extends BaseController
if(!ServiceConstants.ORDER_TYPE_RIDING.equals(etOrder1.getType())){
throw new ServiceException("保存视频失败,类型必须是骑行订单");
}
etOrder.setUploadTime(DateUtils.getNowDate());
return toAjax(etOrderService.updateEtOrderByOrderNo(etOrder));
}

View File

@ -4,9 +4,9 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.AsArticleClassify;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.domain.entity.AsArticleClassify;
import com.ruoyi.system.service.IAsArticleClassifyService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -51,6 +51,22 @@ public class AsArticleClassifyController extends BaseController
return success(articleClassifies);
}
/**
* 查询分类列表排除节点
*/
@PreAuthorize("@ss.hasPermi('system:articleClassify:list')")
@GetMapping("/list/excludes/{classifyIds}")
public AjaxResult excludeChild(@PathVariable(value = "classifyIds", required = false) List<Long> classifyIds)
{
List<AsArticleClassify> articleClassifies = asArticleClassifyService.selectClassifyListWithIsolate(new AsArticleClassify());
if (classifyIds != null && !classifyIds.isEmpty()) {
for (Long classifyId:classifyIds) {
articleClassifies.removeIf(d -> d.getClassifyId().intValue() == classifyId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), classifyId + ""));
}
}
return success(articleClassifies);
}
/**
* 根据分类编号获取详细信息
*/

View File

@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
"/appCaptcha",
"/appCodeLogin",
"/app/**",
// "/appVerify/**",
"/appVerify/**",
"/common/upload",
"/common/receive",
"/payment/callback/**",

View File

@ -239,6 +239,11 @@ public class EtOrder extends BaseEntity
@Excel(name = "还车视频")
private String videoUrl;
/** 视频上传时间 */
@Excel(name = "视频上传时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date uploadTime;
/** 扣除金额 */
@Excel(name = "扣除金额")
private String deductionAmount;

View File

@ -134,22 +134,25 @@ public class IndexAdminVo {
@Data
public static class OperationVo {
/** 4g解锁失败 */
private Integer failedUnlockCount;
private Integer failedUnlockCount=0;
/** 4g解锁次数 */
private Integer unlockCount=0;
/** 蓝牙解锁数 */
private Integer bluetoothUnlockCount;
private Integer bluetoothUnlockCount=0;
/** 设备离线率 */
private BigDecimal deviceOfflineRate;
/** 异常排查车辆 */
private Integer faultOrderCount;
/** 异常排查车辆 */
private Integer faultOrderCount=0;
/** 待换电 */
private Integer replacementOrderCount;
private Integer replacementOrderCount=0;
/** 待维修 */
private Integer repairCount;
private Integer repairCount=0;
}

View File

@ -2,24 +2,25 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysOperLog;
import org.apache.ibatis.annotations.Param;
/**
* 操作日志 数据层
*
*
* @author ruoyi
*/
public interface SysOperLogMapper
{
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@ -27,7 +28,7 @@ public interface SysOperLogMapper
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -35,7 +36,7 @@ public interface SysOperLogMapper
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@ -45,4 +46,16 @@ public interface SysOperLogMapper
* 清空操作日志
*/
public void cleanOperLog();
/**
* 4g解锁失败
* @return
*/
Integer getUnlockCount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("status") String status);
/**
* 蓝牙解锁数
* @return
*/
Integer getBluetoothUnlockCount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd , @Param("status") String status);
}

View File

@ -175,6 +175,11 @@ public interface IEtOrderService
*/
EtOrder getCurrentOrder(String sn);
/**
* 根据userId获取当前正在骑行中的订单
*/
EtOrder getCurrentOrderByUserId(Long userId);
/**
* 删除订单信息

View File

@ -5,21 +5,21 @@ import com.ruoyi.system.domain.SysOperLog;
/**
* 操作日志 服务层
*
*
* @author ruoyi
*/
public interface ISysOperLogService
{
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
public void insertOperlog(SysOperLog operLog);
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@ -27,7 +27,7 @@ public interface ISysOperLogService
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -35,7 +35,7 @@ public interface ISysOperLogService
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@ -45,4 +45,16 @@ public interface ISysOperLogService
* 清空操作日志
*/
public void cleanOperLog();
/**
* 4g解锁失败
* @return
*/
Integer getUnlockCount(String timeStart,String timeEnd,String status);
/**
* 蓝牙解锁数
* @return
*/
Integer getBluetoothUnlockCount(String todayStartDateStr, String todayEndDateStr,String status);
}

View File

@ -3,19 +3,17 @@ 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.enums.BusinessStatus;
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;
@ -111,12 +109,15 @@ public class EtOrderServiceImpl implements IEtOrderService
@Resource
private EtFaultMapper etFaultMapper;
@Autowired
@Resource
private EtAdminOrderMapper etAdminOrderMapper;
@Autowired
@Resource
private EtCapitalFlowMapper etCapitalFlowMapper;
@Autowired
private ISysOperLogService operLogService;
/**
* 查询订单
*
@ -357,6 +358,23 @@ public class EtOrderServiceImpl implements IEtOrderService
return null;
}
/**
* 根据userId获取当前正在骑行中的订单
* @param userId
* @return
*/
@Override
public EtOrder getCurrentOrderByUserId(Long userId) {
EtOrder etOrder = new EtOrder();
etOrder.setUserId(userId);
etOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder);
if(ObjectUtil.isNotEmpty(etOrders)){
return etOrders.get(0);
}
return null;
}
/**
* 删除订单信息
*
@ -463,29 +481,36 @@ public class EtOrderServiceImpl implements IEtOrderService
if(updateEtOrder == 0){
throw new ServiceException("还车审核失败,更新订单失败");
}
/** 2.退押金*/
EtOrder depositOrder = getDepositOrder(etOrder.getUserId());
BigDecimal deposit = depositOrder.getTotalFee();
Refund refund = wxPayService.refund(depositOrder, "还车审核通过后退押金",deposit,IdUtils.getOrderNo("ref"));
/** 3.记录退款表 创建退款对象*/
depositOrder.setReason("还车审核通过后退押金");
EtRefund refund1= createRefund(depositOrder, deposit, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
int i = etRefundService.insertEtRefund(refund1);
if(i == 0){
log.info("【还车审核通过】保存退款对象失败");
throw new ServiceException("【还车审核通过】,保存退款对象失败");
}
/** 4.更新用户余额*/
AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
if(asUser!=null){
// 更新用户并更新缓存
asUser.setBalance(BigDecimal.ZERO);
if (asUserService.updateUserProfile(asUser) > 0)
{
log.info("【还车审核通过】更新用户信息成功:"+ JSON.toJSON(asUser));
}else{
throw new ServiceException("【还车审核通过】,更新用户信息失败");
// 当前还有正在骑行中的订单不退押金只有用户没有正在骑行中的订单时才发起退款
EtOrder currentOrder = etOrderService.getCurrentOrderByUserId(etOrder.getUserId());
if(ObjectUtil.isNull(currentOrder)){
log.info("【还车审核通过】当前用户没有正在骑行的订单,开始退押金");
/** 2.退押金*/
EtOrder depositOrder = getDepositOrder(etOrder.getUserId());
BigDecimal deposit = depositOrder.getTotalFee();
Refund refund = wxPayService.refund(depositOrder, "还车审核通过后退押金",deposit,IdUtils.getOrderNo("ref"));
/** 3.记录退款表 创建退款对象*/
depositOrder.setReason("还车审核通过后退押金");
EtRefund refund1= createRefund(depositOrder, deposit, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
int i = etRefundService.insertEtRefund(refund1);
if(i == 0){
log.info("【还车审核通过】保存退款对象失败");
throw new ServiceException("【还车审核通过】,保存退款对象失败");
}
/** 4.更新用户余额*/
AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
if(asUser!=null){
// 更新用户并更新缓存
asUser.setBalance(BigDecimal.ZERO);
if (asUserService.updateUserProfile(asUser) > 0)
{
log.info("【还车审核通过】更新用户信息成功:"+ JSON.toJSON(asUser));
}else{
throw new ServiceException("【还车审核通过】,更新用户信息失败");
}
}
}else{
log.info("【还车审核通过】当前用户还有正在骑行的订单------不退押金");
}
return true;
}
@ -692,9 +717,17 @@ public class EtOrderServiceImpl implements IEtOrderService
indexAdminVo.setVehicleVo(vehicleVo);
/** 运维统计*/
String formattedDate = dateFormat.format(calendar.getTime());
String todayStartDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
String todayEndDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
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));
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));//待维修
operationVo.setFailedUnlockCount(operLogService.getUnlockCount(todayStartDateStr, todayEndDateStr,BusinessStatus.FAIL.name()));// 4g解锁失败
operationVo.setUnlockCount(operLogService.getUnlockCount(todayStartDateStr, todayEndDateStr,BusinessStatus.SUCCESS.name()));//4g解锁次数
operationVo.setDeviceOfflineRate(new BigDecimal(deviceNumVo.getOfflineNum()).divide(new BigDecimal(deviceNumVo.getInOperation()), 2, RoundingMode.HALF_UP));//设备离线率
operationVo.setBluetoothUnlockCount(operLogService.getBluetoothUnlockCount(todayStartDateStr, todayEndDateStr,BusinessStatus.SUCCESS.name()));//蓝牙解锁数
indexAdminVo.setOperationVo(operationVo);
log.info("【首页统计-总管理】indexAdminVo==={}",JSON.toJSON(indexAdminVo));
@ -724,8 +757,8 @@ public class EtOrderServiceImpl implements IEtOrderService
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.setTotalOrderCount(etOrderMapper.getOrderNum(null, null, null));//总订单数
indexAdminVo.setTotalOrderFee(etOrderMapper.getPayFee(null, null, null, null));//总订单金额
indexAdminVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(startDateStr,endDateStr,null)));// 今日退款金额
indexAdminVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(null,null,null)));// 总退款金额
@ -934,7 +967,11 @@ public class EtOrderServiceImpl implements IEtOrderService
etOrder.setAppointmentStartTime(DateUtils.getNowDate());//预约开始时间
}else if(order.getType().equals("4")){//押金创建初始订单根据计费规则结算费用
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(user.getAreaId());
if(ObjectUtil.isNull(order.getAreaId())){
log.info("【预下单-创建订单】支付场景为:押金支付--order.getAreaId()"+order.getAreaId());
throw new ServiceException("【预下单-创建订单】支付场景为:押金支付--order.getAreaId()"+order.getAreaId());
}
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
BigDecimal deposit = new BigDecimal(area.getDeposit());
etOrder.setTotalFee(deposit);
etOrder.setPayFee(deposit);

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysOperLog;
@ -9,7 +11,7 @@ import com.ruoyi.system.service.ISysOperLogService;
/**
* 操作日志 服务层处理
*
*
* @author ruoyi
*/
@Service
@ -20,7 +22,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 新增操作日志
*
*
* @param operLog 操作日志对象
*/
@Override
@ -31,7 +33,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 查询系统操作日志集合
*
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@ -43,7 +45,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 批量删除系统操作日志
*
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@ -55,7 +57,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
/**
* 查询操作日志详细
*
*
* @param operId 操作ID
* @return 操作日志对象
*/
@ -73,4 +75,23 @@ public class SysOperLogServiceImpl implements ISysOperLogService
{
operLogMapper.cleanOperLog();
}
/**
* 4g解锁失败
* @return
*/
@Override
public Integer getUnlockCount(String timeStart,String timeEnd,String status) {
return operLogMapper.getUnlockCount(timeStart, timeEnd,status);
}
/**
* 蓝牙解锁数
* @return
*/
@Override
public Integer getBluetoothUnlockCount(String timeStart,String timeEnd,String status) {
return operLogMapper.getBluetoothUnlockCount(timeStart, timeEnd,status);
}
}

View File

@ -117,9 +117,9 @@ public class WxPayService implements IWxPayService {
request.setMchid(sysDept.getMerchantId());
String type = order.getType();
String description = type.equals(ServiceConstants.ORDER_TYPE_RIDING) ? "骑行订单-"+billNo : "押金充值-"+billNo;
LoginUser loginUser = SecurityUtils.getLoginUser();
log.info("【预下单】获取登录用户信息:"+JSON.toJSONString(loginUser));
request.setAttach(JSON.toJSONString(new AttachVo(payType,user.getUserId(), loginUser.getToken())));
// LoginUser loginUser = SecurityUtils.getLoginUser();
// log.info("【预下单】获取登录用户信息:"+JSON.toJSONString(loginUser));
request.setAttach(JSON.toJSONString(new AttachVo(payType,user.getUserId(), "")));
request.setDescription(description);
request.setNotifyUrl(sysDept.getNotifyUrl());
request.setPayer(getPayer(user.getWxopenid()));

View File

@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="cycle" column="cycle" />
<result property="depositDeduction" column="deposit_deduction" />
<result property="videoUrl" column="video_url" />
<result property="uploadTime" column="upload_time" />
<result property="deductionAmount" column="deduction_amount" />
<result property="audioFiles" column="audio_files" />
<result property="usedSn" column="used_sn" />
@ -52,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
device_mac, sn, pay_time, paid, pay_type, type, total_fee, pay_fee, dispatch_fee,
manage_fee, riding_fee, appointment_fee, mark, duration, distance, status,
create_time, appointment_start_time, appointment_end_time,appointment_timeout, unlock_time,return_time,
rule_end_time, return_type, AsText(trip_route) trip_route,trip_route_str,cycle,deposit_deduction,video_url,deduction_amount,audio_files,used_sn,change_reason from et_order
rule_end_time, return_type, AsText(trip_route) trip_route,trip_route_str,cycle,deposit_deduction,video_url,upload_time,deduction_amount,audio_files,used_sn,change_reason from et_order
</sql>
<select id="selectEtOrderList" parameterType="EtOrder" resultMap="EtOrderResult">
@ -96,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AsText(o.trip_route),
o.trip_route_str,
o.video_url,
o.upload_time,
o.deduction_amount,
o.audio_files,
o.used_sn,
@ -161,6 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.paid,
o.pay_type,
o.video_url,
o.upload_time,
o.deduction_amount,
o.audio_files,
o.type, COALESCE(o.total_fee, 0) AS total_fee,
@ -218,8 +221,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalIncome" resultType="java.lang.String">
select COALESCE(SUM(total_fee), 0) from et_order where status = 4 and type = 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="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>
@ -236,90 +243,142 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalPaid" resultType="java.lang.String">
select COALESCE(SUM(total_fee), 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="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="getTotalRefund" resultType="java.lang.String">
select COALESCE(SUM(r.amount), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
<select id="getTotalRidingFee" resultType="java.lang.String">
select COALESCE(SUM(riding_fee), 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="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="getTotalRidingRefund" resultType="java.lang.String">
select COALESCE(SUM(r.riding_fee), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
<select id="getTotalDispatchFee" resultType="java.lang.String">
select COALESCE(SUM(dispatch_fee), 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="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="getTotalDispatchRefund" resultType="java.lang.String">
select COALESCE(SUM(r.dispatch_fee), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
<select id="getTotalAppointmentFee" resultType="java.lang.String">
select COALESCE(SUM(appointment_fee), 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="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="getTotalAppointmentRefund" resultType="java.lang.String">
select COALESCE(SUM(r.appointment_fee), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
<select id="getTotalManageFee" resultType="java.lang.String">
select COALESCE(SUM(manage_fee), 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="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="getTotalManageRefund" resultType="java.lang.String">
select COALESCE(SUM(r.manage_fee), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
<select id="getPaidOrder" resultType="java.lang.String">
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="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="getRidingOrder" resultType="java.lang.String">
select COALESCE(count(1), 0) from et_order where status = 2 and type = 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="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="getRefundOrder" resultType="java.lang.String">
select COALESCE(count(1), 0) from et_refund r left join et_order o on o.order_no = r.order_no where r.type = 1 AND refund_result = 'SUCCESS'
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
<if test="timeStart != null and timeStart != ''">
AND date_format(r.create_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(r.create_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="areaId != null and areaId != ''"> and o.area_id = #{areaId}</if>
</select>
@ -371,8 +430,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getServiceFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(total_fee), 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="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>
@ -632,6 +695,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cycle != null">cycle = #{cycle},</if>
<if test="depositDeduction != null">deposit_deduction = #{depositDeduction},</if>
<if test="videoUrl != null">video_url = #{videoUrl},</if>
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
<if test="deductionAmount != null">deduction_amount = #{deductionAmount},</if>
<if test="audioFiles != null">audio_files = #{audioFiles},</if>
<if test="usedSn != null">used_sn = #{usedSn},</if>
@ -675,6 +739,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cycle != null">cycle = #{cycle},</if>
<if test="depositDeduction != null">deposit_deduction = #{depositDeduction},</if>
<if test="videoUrl != null">video_url = #{videoUrl},</if>
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
<if test="deductionAmount != null">deduction_amount = #{deductionAmount},</if>
<if test="audioFiles != null">audio_files = #{audioFiles},</if>
<if test="usedSn != null">used_sn = #{usedSn},</if>

View File

@ -80,6 +80,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where oper_id = #{operId}
</select>
<select id="getUnlockCount" resultType="java.lang.Integer">
select count(1) from sys_oper_log where business_type = 10
<if test="timeStart != null and timeStart != ''">
AND date_format(oper_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(oper_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</select>
<select id="getBluetoothUnlockCount" resultType="java.lang.Integer">
select count(1) from sys_oper_log where business_type = 10 AND oper_param like concat('%', '"isBluetooth":"true"', '%')
<if test="timeStart != null and timeStart != ''">
AND date_format(oper_time,'%y%m%d') &gt;= date_format(#{timeStart},'%y%m%d')
</if>
<if test="timeEnd != null and timeEnd != ''">
AND date_format(oper_time,'%y%m%d') &lt;= date_format(#{timeEnd},'%y%m%d')
</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</select>
<update id="cleanOperLog">
truncate table sys_oper_log
</update>