diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/IndexController/IndexController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/IndexController/IndexController.java index e76a89a..f9efbb5 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/IndexController/IndexController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/IndexController/IndexController.java @@ -9,9 +9,11 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.EtOperatingArea; import com.ruoyi.system.domain.vo.IndexAdminVo; import com.ruoyi.system.domain.vo.IndexVo; +import com.ruoyi.system.domain.vo.StatisticsResult; import com.ruoyi.system.domain.vo.LeaderboardVo; import com.ruoyi.system.service.IEtOperatingAreaService; import com.ruoyi.system.service.IEtOrderService; +import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -72,10 +75,51 @@ public class IndexController extends BaseController public AjaxResult statistics(Long areaId) { logger.info("【首页统计】请求参数: areaId={}", areaId); - IndexVo indexVo = etOrderService.statistics(areaId); + IndexVo indexVo = etOrderService.statistics(areaId,"1"); return success(indexVo); } + /** + * 首页统计-运营商 + */ + @GetMapping(value = "/statisticsByDeptId") + public AjaxResult statisticsByDeptId(Long deptId) + { + logger.info("【运营商统计】请求参数: deptId={}", deptId); + if(deptId == null){ + throw new ServiceException("运营商id不能为空:deptId"); + } + List areaIds = etOperatingAreaService.selectAreaListByDeptId(deptId); + // 创建一个结果对象 + IndexVo result = new IndexVo(); + for (Long areaId : areaIds) { + IndexVo areaIndexVo = etOrderService.statistics(areaId,"2"); + // 赋值 + assign(result, areaIndexVo); + } + return success(result); + } + + private static void assign(IndexVo result, IndexVo areaIndexVo) { + result.setBalance(result.getBalance().add(areaIndexVo.getBalance())); + result.setWithdraw(result.getWithdraw().add(areaIndexVo.getWithdraw())); + result.setSettlementAmount(result.getSettlementAmount().add(areaIndexVo.getSettlementAmount())); + result.setTodayIncome(result.getTodayIncome().add(areaIndexVo.getTodayIncome())); + result.setTodayOrderFee(result.getTodayOrderFee().add(areaIndexVo.getTodayOrderFee())); + result.setTodayOrderCount(result.getTodayOrderCount() + areaIndexVo.getTodayOrderCount()); + result.setTotalIncome(result.getTotalIncome().add(areaIndexVo.getTotalIncome())); + result.setTotalOrderCount(result.getTotalOrderCount() + areaIndexVo.getTotalOrderCount()); + result.setTotalOrderFee(result.getTotalOrderFee().add(areaIndexVo.getTotalOrderFee())); + result.setUnpaidOrderCount(result.getUnpaidOrderCount() + areaIndexVo.getUnpaidOrderCount()); + result.setUnpaidOrderFee(result.getUnpaidOrderFee().add(areaIndexVo.getUnpaidOrderFee())); + result.setReturnOrderCount(result.getReturnOrderCount() + areaIndexVo.getReturnOrderCount()); + result.setRidingOrder(result.getRidingOrder() + areaIndexVo.getRidingOrder()); + result.setTodayRefundFee(result.getTodayRefundFee().add(areaIndexVo.getTodayRefundFee())); + result.setFaultOrderCount(result.getFaultOrderCount() + areaIndexVo.getFaultOrderCount()); + result.setVehicleVo(areaIndexVo.getVehicleVo()); + result.setIncomeVoList(areaIndexVo.getIncomeVoList()); + } + /** * 首页统计-总管理 diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java index 30cf0b7..5daceb5 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java @@ -345,6 +345,20 @@ public class AppController extends BaseController return success(i); } + /** + * 电压校准 + */ + @PostMapping("/voltage/check") + public AjaxResult check(String sn) + { + if(StrUtil.isBlank(sn)){ + logger.info("【电压校准】没有sn号参数:【sn={}】",sn); + return error("请传sn号参数"+"【sn="+sn+"】"); + } + Boolean i =asDeviceService.check(sn); + return success(i); + } + /** * 根据sn号查询车辆实时信息 diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 2492d28..e8fd31d 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -559,6 +559,19 @@ public class AppVerifyController extends BaseController return toAjax(asDeviceService.updateAsDeviceBySn(asDevice)); } + /** + * 修改车型 + */ + @Log(title = "修改车型", businessType = BusinessType.UPDATE) + @PutMapping("/device/editModel") + public AjaxResult editModel(String sn, Long modelId) + { + AsDevice asDevice = new AsDevice(); + asDevice.setSn(sn); + asDevice.setModelId(modelId); + return toAjax(asDeviceService.updateAsDeviceBySn(asDevice)); + } + /** * 我的工单列表 @@ -1019,8 +1032,8 @@ public class AppVerifyController extends BaseController for (Long id:longs) { BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//新增 BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//退款 - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, id);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,id);//平台服务费 ,扣除掉退款部分的 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, id,null);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,id,null);//平台服务费 ,扣除掉退款部分的 BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费 if (areaOrderAmount != null) { todayOrderAmount = todayOrderAmount.add(areaOrderAmount); @@ -1041,11 +1054,12 @@ public class AppVerifyController extends BaseController //今日订单金额 BigDecimal todayOrderAmount = BigDecimal.ZERO; - Long areaId = user.getAreaId(); - BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增 - BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款 - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的 + Long userId = user.getUserId(); + // 统计et_capital_flow中 合伙人 + BigDecimal payFee = defaultIfNull(etCapitalFlowMapper.getTotalAmountByUserId(startDateStr, endDateStr,userId), BigDecimal.ZERO); + BigDecimal refundFee = defaultIfNull(etCapitalFlowMapper.getPartnerRefundFee(startDateStr, endDateStr, userId), BigDecimal.ZERO);//退款 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, null, userId);//手续费,扣除掉退款部分的 0.01 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,userId);//平台服务费 ,扣除掉退款部分的 BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费 if (areaOrderAmount != null) { todayOrderAmount = todayOrderAmount.add(areaOrderAmount); diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 0f4f35c..0889e44 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -136,8 +136,8 @@ public class SysDeptController extends BaseController for (Long areaId:longs) { BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增 BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款 - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的 BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费 if (areaOrderAmount != null) { todayOrderAmount = todayOrderAmount.add(areaOrderAmount); @@ -172,6 +172,22 @@ public class SysDeptController extends BaseController return toAjax(deptService.insertDept(dept)); } + /** + * 快速生成 + */ + @PreAuthorize("@ss.hasPermi('system:dept:add')") + @Log(title = "快速生成", businessType = BusinessType.FASTCREATE) + @PostMapping("/fastCreate") + public AjaxResult fastInsertDept(@Validated @RequestBody SysDept dept) + { + if (!deptService.checkDeptNameUnique(dept)) + { + return error("【快速生成】新增运营商'" + dept.getDeptName() + "'失败,运营商名称已存在"); + } + dept.setCreateBy(getUsername()); + return toAjax(deptService.fastInsertDept(dept)); + } + /** * 修改运营商 */ diff --git a/electripper-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/electripper-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 90a837f..e76f86e 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/electripper-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -57,4 +57,9 @@ public class CacheConstants * 设备定位信息 redis key */ public static final String CACHE_DEVICE_KEY = "device:"; + + /** + * 首页数据 redis key + */ + public static final String INDEX_DATA = "index:"; } diff --git a/electripper-common/src/main/java/com/ruoyi/common/constant/IotConstants.java b/electripper-common/src/main/java/com/ruoyi/common/constant/IotConstants.java index 8ae3a0e..aa47589 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/constant/IotConstants.java +++ b/electripper-common/src/main/java/com/ruoyi/common/constant/IotConstants.java @@ -86,6 +86,11 @@ public class IotConstants { */ public static final String COMMAND_PLAY1 = "play1@"; + /** + * 电压校准 + */ + public static final String VOLTAGE_CHECK = "check"; + /** * 命令 2营运边界 * 接近运营边界请规划好路线 diff --git a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index b599826..139d926 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/electripper-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -34,6 +34,15 @@ public class SysDept extends BaseEntity /** 部门名称 */ private String deptName; + /** 省 */ + private String province; + + /** 市 */ + private String city; + + /** 区 */ + private String county; + /** 显示顺序 */ private Integer orderNum; @@ -133,6 +142,30 @@ public class SysDept extends BaseEntity /** 支付渠道 */ public Long payChannel; + public String getCounty() { + return county; + } + + public void setCounty(String county) { + this.county = county; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + public Long getPayChannel() { return payChannel; } diff --git a/electripper-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/electripper-common/src/main/java/com/ruoyi/common/enums/BusinessType.java index 5a6c90a..5bced93 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/enums/BusinessType.java +++ b/electripper-common/src/main/java/com/ruoyi/common/enums/BusinessType.java @@ -218,4 +218,9 @@ public enum BusinessType ZEROORDER, LOGIN, + + /** + * 快速生成 + */ + FASTCREATE, } diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrderQuery.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrderQuery.java index 055f541..1e7a0b7 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrderQuery.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtOrderQuery.java @@ -23,6 +23,10 @@ public class EtOrderQuery extends BaseEntity @Excel(name = "类型") private String type; + /** 运营商id */ + @Excel(name = "运营商id") + private Long deptId; + /** 状态:0-预约中,1-取消预约,2-开始骑行,3-结束 */ @Excel(name = "状态:0-预约中,1-取消预约,2-开始骑行,3-结束") private String status; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java index afe4667..002bf22 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtRefund.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import lombok.Data; @@ -40,6 +41,11 @@ public class EtRefund extends BaseEntity @Excel(name = "运营区id") private Long areaId; + /** 运营商id */ + @Excel(name = "运营商id") + @TableField(exist = false) + private Long deptId; + /** 运营区 */ @Excel(name = "运营区") private String areaName; diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/StatisticsResult.java b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/StatisticsResult.java new file mode 100644 index 0000000..1da6fa0 --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/StatisticsResult.java @@ -0,0 +1,11 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class StatisticsResult { + private IndexVo deptStatistics; + private List areaStatistics; +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtCapitalFlowMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtCapitalFlowMapper.java index bd8420e..d7073bd 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtCapitalFlowMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtCapitalFlowMapper.java @@ -79,7 +79,7 @@ public interface EtCapitalFlowMapper * @param areaId 运营区id * @return */ - BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId); + BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("ownerId") Long ownerId); /** * 手续费 @@ -95,7 +95,7 @@ public interface EtCapitalFlowMapper * @param areaId 运营区id * @return */ - BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId); + BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("ownerId") Long ownerId); /** * 平台服务费 * @@ -112,6 +112,13 @@ public interface EtCapitalFlowMapper */ BigDecimal getTotalAmount(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId); + /** + * 骑行订单收入 + * + * @param ownerId 用户id + * @return + */ + BigDecimal getTotalAmountByUserId(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("ownerId") Long ownerId); /** * 押金抵扣收入 * @@ -135,4 +142,12 @@ public interface EtCapitalFlowMapper * @return */ BigDecimal getAllUserReceipts(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId,@Param("channelId") Long channelId); + + /** + * 获取合伙人退款 + * + * @param userId 用户id + * @return + */ + BigDecimal getPartnerRefundFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("ownerId") Long userId); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java index a37a764..f1e9c6c 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IAsDeviceService.java @@ -232,6 +232,11 @@ public interface IAsDeviceService extends IService */ Boolean ringByMac(String mac); + /** + * 电压校准 + */ + Boolean check(String sn); + /** * 坐垫锁用mac */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java index 9aa1163..26677f5 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java @@ -263,7 +263,7 @@ public interface IEtOrderService /** * 首页统计-运营商 */ - IndexVo statistics(Long areaId); + IndexVo statistics(Long areaId,String type); /** * 首页统计-总管理 diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/electripper-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index 6480219..bfd19f4 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -132,6 +132,14 @@ public interface ISysDeptService */ public int insertDept(SysDept dept); + /** + * 快速生成 + * + * @param dept 部门信息 + * @return 结果 + */ + public int fastInsertDept(SysDept dept); + /** * 修改保存部门信息 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index a88c4aa..04ca053 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -1456,6 +1456,26 @@ public class AsDeviceServiceImpl extends ServiceImpl i return Boolean.TRUE; } + /** + * 电压校准 + * @param sn + * @return + */ + @SneakyThrows + @Override + public Boolean check(String sn) { + AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn); + /** 1.获取token*/ + String token = Token.getToken(); + Boolean execute = transactionTemplate.execute(e -> { + /** 2.发送命令*/ + sendCommand(asDevice.getMac(), token,IotConstants.VOLTAGE_CHECK,"电压校准",null,null); + return Boolean.TRUE; + }); + if(!execute)throw new ServiceException("电压校准失败"); + return Boolean.TRUE; + } + /** * 坐垫锁用mac diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java index 5853b8b..a22f581 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java @@ -262,7 +262,6 @@ public class AsUserServiceImpl implements IAsUserService @Transactional public int updateUser(AsUser user) { - Long userId = user.getUserId(); return asUserMapper.updateUser(user); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java index a22f5c6..ad85ec9 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java @@ -11,6 +11,7 @@ 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.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessStatus; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.pay.PaymentResult; @@ -44,9 +45,12 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static com.ruoyi.common.constant.CacheConstants.INDEX_DATA; + /** * 订单Service业务层处理 * @@ -138,6 +142,9 @@ public class EtOrderServiceImpl implements IEtOrderService @Autowired private TmPayService tmPayService; + @Autowired + private RedisCache redisCache; + /** * 查询订单 * @@ -834,18 +841,44 @@ public class EtOrderServiceImpl implements IEtOrderService * 首页统计-运营商 */ @Override - public IndexVo statistics(Long areaId) { + public IndexVo statistics(Long areaId, String type) { + // 定义缓存的键 + String cacheKey = "statistics:areaId_" + areaId + ":type_" + type; + IndexVo cachedIndexVo = redisCache.getCacheObject(cacheKey); + if (cachedIndexVo != null) { + log.info("【首页统计】从缓存中获取数据:" + cacheKey); + return cachedIndexVo; // 如果缓存存在,则直接返回 + } /** 首页数据*/ SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId); IndexVo indexVo = createIndexVo(areaId,sysDept); + int defualtDays; /** 营收统计*/ + if(type.equals("1")){ + /** 运维统计*/ + 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); + + defualtDays = 13; + }else{ + defualtDays = 29; + } ArrayList 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++) { + for (int i = 0; i < defualtDays; i++) { String formattedDate = dateFormat.format(calendar.getTime()); String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND; String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND; @@ -867,19 +900,8 @@ public class EtOrderServiceImpl implements IEtOrderService 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)); + redisCache.setCacheObject(cacheKey, indexVo,30, TimeUnit.MINUTES); return indexVo; } @@ -923,8 +945,8 @@ public class EtOrderServiceImpl implements IEtOrderService IndexVo.OrderFeeStatisticsVo feeStatisticsVo = new IndexVo.OrderFeeStatisticsVo(); BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增 BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款 - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的 BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费 int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId); feeStatisticsVo.setOrderFee(payFee); @@ -938,6 +960,15 @@ public class EtOrderServiceImpl implements IEtOrderService */ @Override public IndexAdminVo admimStatistics() { + // 定义缓存的键 + String cacheKey = "adminStatistics"; + + // 从 Redis 中获取缓存对象 + IndexAdminVo cachedIndexAdminVo = redisCache.getCacheObject(cacheKey); + if (cachedIndexAdminVo != null) { + log.info("【首页统计】从缓存中获取数据:{}", JSON.toJSON(cachedIndexAdminVo)); + return cachedIndexAdminVo; // 如果缓存存在,则直接返回 + } /** 首页数据*/ IndexAdminVo indexAdminVo = createIndexAdminVo(); @@ -982,6 +1013,9 @@ public class EtOrderServiceImpl implements IEtOrderService indexAdminVo.setOperationVo(operationVo); log.info("【首页统计-总管理】indexAdminVo==={}",JSON.toJSON(indexAdminVo)); + // 将生成的对象保存到 Redis + redisCache.setCacheObject(cacheKey, indexAdminVo, 30, TimeUnit.MINUTES); + return indexAdminVo; } @@ -1090,11 +1124,11 @@ public class EtOrderServiceImpl implements IEtOrderService indexAdminVo.setReturnOrderCount(etOrderMapper.getAuditOrderNum(null,null,null));//还车待审核订单 indexAdminVo.setReturnOrderDeductFee(etOrderMapper.getReturnOrderDeductFee(null,null,null));// 待审核还车押金扣款 - indexAdminVo.setTodayHandlingFee(etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null,null));// 今日支付手续费 - indexAdminVo.setTotalHandlingFee(etCapitalFlowMapper.getHandlingFee(null, null, null,null));// 总手续费 + indexAdminVo.setTodayHandlingFee(etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null,null,null));// 今日支付手续费 + indexAdminVo.setTotalHandlingFee(etCapitalFlowMapper.getHandlingFee(null, null, null,null,null));// 总手续费 - indexAdminVo.setTodayServiceFee(etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null));//今日服务费 - indexAdminVo.setTotalServiceFee(etCapitalFlowMapper.getServiceFee(null, null, null,null));// 总服务费 + indexAdminVo.setTodayServiceFee(etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,null));//今日服务费 + indexAdminVo.setTotalServiceFee(etCapitalFlowMapper.getServiceFee(null, null, null,null,null));// 总服务费 return indexAdminVo; } @@ -1359,8 +1393,8 @@ public class EtOrderServiceImpl implements IEtOrderService String totalRefund = etOrderMapper.getTotalRefund(timeStart, timeEnd, areaId);//已退款 income.setTotalPaid(totalPaid);//已支付 //handlingFee 手续费 = 0.0054 * 已支付金额 - BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, Long.parseLong(areaId));//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,Long.parseLong(areaId));//平台服务费 ,扣除掉退款部分的 + BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, Long.parseLong(areaId),null);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,Long.parseLong(areaId),null);//平台服务费 ,扣除掉退款部分的 income.setHandlingFee(handlingFee.add(platformServiceFee).toString()); // 总营收 = 已支付 - 已退款 - 手续费 @@ -1433,8 +1467,8 @@ public class EtOrderServiceImpl implements IEtOrderService /** 总支出*/ BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(timeStart, timeEnd, null, aLong), BigDecimal.ZERO);//订单退款 BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(timeStart, timeEnd, null, aLong,null), BigDecimal.ZERO);//押金退款 24795 - BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, aLong),BigDecimal.ZERO);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,aLong),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的 + BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, aLong,null),BigDecimal.ZERO);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,aLong,null),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的 BigDecimal totalExpenditure = defaultIfNull(refundFee.add(depositRefundFee).add(serviceFee).add(platformServiceFee), BigDecimal.ZERO); income.setOrderRefund(refundFee); @@ -1733,8 +1767,8 @@ public class EtOrderServiceImpl implements IEtOrderService reconciliation.setDay(formattedDate); BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增 BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款 - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId);//手续费,扣除掉退款部分的 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId);//平台服务费 ,扣除掉退款部分的 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的 BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费 reconciliation.setPayFee(payFee); @@ -1768,8 +1802,8 @@ public class EtOrderServiceImpl implements IEtOrderService reconciliation.setPayFee(payFee); BigDecimal refundFee = etOrderMapper.getRefundFee(timeStart, timeEnd, sn, null); reconciliation.setRefundFee(refundFee); - BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, sn, areaId);//手续费 - BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, sn, areaId);//平台服务费 + BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, sn, areaId,null);//手续费 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, sn, areaId,null);//平台服务费 reconciliation.setIncome(payFee.subtract(refundFee).subtract(serviceFee).subtract(platformServiceFee)); reconciliation.setServiceFee(serviceFee); reconciliation.setPlatformServiceFee(platformServiceFee); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 795a9bb..efa9c07 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -31,6 +31,7 @@ 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.TransactionTemplate; import javax.annotation.Resource; import java.math.BigDecimal; @@ -89,6 +90,15 @@ public class SysDeptServiceImpl implements ISysDeptService @Autowired private ScheduledExecutorService scheduledExecutorService; + @Autowired + private IEtModelService etModelService; + + @Autowired + private IEtFeeRuleService etFeeRuleService; + + @Autowired + private TransactionTemplate transactionTemplate; + @Value("${aliyun.accessKeyId}") private String accessKeyId; @@ -342,15 +352,6 @@ public class SysDeptServiceImpl implements ISysDeptService dept.setAppName(platform.getAppName()); dept.setDomain(platform.getDomain()); } -// if (dept.getSeparateAccount().equals("N")) { -// SysDept platform = deptMapper.selectDeptById(100L); -// dept.setMerchantId(platform.getMerchantId()); -// dept.setApiV3Key(platform.getApiV3Key()); -// dept.setNotifyUrl(platform.getNotifyUrl()); -// dept.setPrivateKeyPath(platform.getPrivateKeyPath()); -// dept.setMerchantSerialNumber(platform.getMerchantSerialNumber()); -// dept.setRefundNotifyUrl(platform.getRefundNotifyUrl()); -// } int i = deptMapper.insertDept(dept); Long[] areaIds = dept.getAreaIds(); if (StringUtils.isNotNull(areaIds)){ @@ -368,6 +369,131 @@ public class SysDeptServiceImpl implements ISysDeptService return i; } + @Override + public int fastInsertDept(SysDept dept) { + SysDept info = deptMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为正常状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new ServiceException("部门停用,不允许新增"); + } + dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + if (StrUtil.isNotBlank(dept.getIsUsePlatformApp()) && dept.getIsUsePlatformApp().equals("true")) { + SysDept platform = deptMapper.selectDeptById(100L); + dept.setAppid(platform.getAppid()); + dept.setAppSecret(platform.getAppSecret()); + dept.setAppName(platform.getAppName()); + dept.setDomain(platform.getDomain()); + } + + Boolean execute = transactionTemplate.execute(e -> { + log.info("=================【快速生成】=================="); + int i = deptMapper.insertDept(dept); + Long[] areaIds = dept.getAreaIds(); + if (StringUtils.isNotNull(areaIds)){ + for (Long areaId:areaIds){ + etAreaDeptMapper.insert(EtAreaDept.builder().areaId(areaId).deptId(dept.getDeptId()).build()); + } + } + // 添加运营商账号并添加运营商角色 + createOperator(dept); + + /** 新建运营区,绑定运营商*/ + EtOperatingArea etOperatingArea = new EtOperatingArea(); + saveOperator(dept,etOperatingArea); + + /** 新建收费方式,绑定车型*/ + EtFeeRule etFeeRule = createFeeRule(dept); + + /** 新建车型*/ + Long[] rules = {etFeeRule.getRuleId()}; + EtModel etModel = createModel(dept,etOperatingArea,rules); + + return Boolean.TRUE; + }); + if(!execute)throw new ServiceException("快速生成失败"); + return 1; + } + + + private EtFeeRule createFeeRule(SysDept dept) { + EtFeeRule etFeeRule = new EtFeeRule(); + etFeeRule.setName(dept.getDeptName()); + etFeeRule.setInstructions("按小时计费"); + etFeeRule.setDeptId(dept.getDeptId()); + etFeeRule.setAutoRefundDeposit(0); + etFeeRule.setOrderExceedMinutes(0); + etFeeRule.setOrderExceedWarn(0); + etFeeRule.setFreeRideTime(0); + etFeeRule.setRentalUnit("minutes"); + etFeeRule.setRidingRule("1"); + etFeeRule.setChargingCycle("1"); + etFeeRule.setChargingCycleValue("24"); + etFeeRule.setCappedAmount(new BigDecimal(200)); + etFeeRule.setOrderNum(1); + etFeeRule.setRidingRuleJson("{\"timeoutTime\":\"10\",\"startingPrice\":\"1\",\"startingTime\":\"10\",\"timeoutPrice\":\"1\"}"); + int i1 = etFeeRuleService.insertEtFeeRule(etFeeRule); + if(i1 == 0){ + throw new ServiceException("新增收费方式失败"); + } + return etFeeRule; + } + + private EtModel createModel(SysDept dept,EtOperatingArea etOperatingArea,Long[] rules) { + EtModel etModel = new EtModel(); + etModel.setModel(dept.getDeptName()); + etModel.setOperator(dept.getDeptId()); + etModel.setFullVoltage(new Double(53)); + etModel.setLowVoltage(new Double(48)); + etModel.setFullEndurance(50); + etModel.setAreaId(etOperatingArea.getAreaId()); + etModel.setRuleIds(rules); + etModel.setLowBatteryReminderSwitch(Boolean.FALSE); + int i2 = etModelService.insertEtModel(etModel); + if(i2 == 0){ + throw new ServiceException("新增车型失败"); + } + return etModel; + } + + private void saveOperator(SysDept dept,EtOperatingArea etOperatingArea) { + etOperatingArea.setProvince(dept.getProvince()); + etOperatingArea.setCity(dept.getCity()); + etOperatingArea.setAreaName(dept.getAreaName()); + etOperatingArea.setCounty(dept.getCounty()); + etOperatingArea.setAreaTime("1"); + String agreement = "

亲爱的用户,为了确保您的骑行安全,

请务必遵守以下骑行提示:

仅限16岁及以上用户使用。

为确保安全,后座不允许载人。

请务必佩戴安全头盔,保护自身安全。

注意道路状况,避开坑洼,小心骑行。

\uFEFF请在规定的地点还车,避免随意停放。

不逆行、不闯红灯,遵守所有交通法规。

骑行时不要使用手机,保持注意力集中。

避免急刹车和急转弯,保持适当的车速。

夜间骑行时,确保车灯和反光标识正常。


紧急情况处理:

如有紧急情况,请及时拨打客服电话。

感谢您的理解与配合,祝您骑行愉快。

"; + etOperatingArea.setAgreement(agreement); + etOperatingArea.setStatus("0"); + etOperatingArea.setDeptId(dept.getDeptId()); + etOperatingArea.setAutoReplacementOrder(10); + etOperatingArea.setAreaOutOutage("1"); + etOperatingArea.setParkingOutDispatch("1"); + etOperatingArea.setAreaOutDispatch("1"); + etOperatingArea.setNoRidingOutage("1"); + etOperatingArea.setAuthentication("0"); + etOperatingArea.setMsgSwitch("0"); + etOperatingArea.setParkingReturn("1"); + etOperatingArea.setAreaOutReturn("1"); + etOperatingArea.setIsDepositDeduction("0"); + etOperatingArea.setReturnVerify("0"); + etOperatingArea.setDeposit("10"); + etOperatingArea.setCustomService("1"); + etOperatingArea.setUndercharge("10"); + etOperatingArea.setDispatchFee(new BigDecimal(10)); + etOperatingArea.setVehicleManagementFee(new BigDecimal(10)); + etOperatingArea.setError(5); + etOperatingArea.setTimeoutMinutes(30); + etOperatingArea.setAppointmentServiceFee(new BigDecimal(2)); + etOperatingArea.setServiceName1("客服"); + etOperatingArea.setServicePhone1(dept.getPhone()); + etOperatingArea.setCreateTime(DateUtils.getNowDate()); + int i1 = etOperatingAreaService.insertEtOperatingArea(etOperatingArea); + if(i1 == 0){ + throw new ServiceException("新增运营区失败"); + } + } + /** * 修改保存部门信息 * diff --git a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java index 5cadf90..b712a72 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java +++ b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java @@ -671,7 +671,7 @@ public class EtTask { if(BigDecimal.ZERO.compareTo(lon) != 0 && BigDecimal.ZERO.compareTo(lat) != 0){ device.setLatitude(lat.toString()); device.setLongitude(lon.toString()); - device.setLastLocationTime(DateUtils.getNowDate()); + device.setLastLocationTime(new Date(logEntry.getAt())); device.setGps("1"); // 信号强度 device.setSatellites(value.getS()); diff --git a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml index 68ee473..87df91e 100644 --- a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml @@ -129,12 +129,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where f.bus_type != '5' and f.bus_type != '6' and o.sn = #{sn} - AND date_format(f.create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d') + AND DATE(f.create_time) >= #{timeStart} - AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d') + AND DATE(f.create_time) <= #{timeEnd} and f.area_id = #{areaId} + and f.owner_id = #{ownerId} select sum(amount) from et_capital_flow f where type = 1 and bus_type = 1 and pay_type != 'yj' - AND date_format(f.create_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d') + AND DATE(f.create_time) >= #{timeStart} - AND date_format(f.create_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d') + AND DATE(f.create_time) <= #{timeEnd} and f.area_id = #{areaId} + + @@ -225,10 +238,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and area_id = #{areaId} AND pay_channel = #{channelId} - AND date_format(pay_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d') + AND DATE(pay_time) >= #{timeStart} - AND date_format(pay_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d') + AND DATE(pay_time) <= #{timeEnd} AND STATUS = 4 AND type = 1 @@ -249,12 +262,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and f.area_id = #{areaId} and o.pay_channel = #{channelId} - AND date_format(o.pay_time,'%y%m%d') >= date_format(#{timeStart},'%y%m%d') + AND DATE(o.pay_time) >= #{timeStart} - AND date_format(o.pay_time,'%y%m%d') <= date_format(#{timeEnd},'%y%m%d') + AND DATE(o.pay_time) <= #{timeEnd} + diff --git a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml index c7be79c..f4d970d 100644 --- a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml @@ -168,16 +168,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.paid = #{paid} and o.pay_type = #{payType} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND DATE(o.create_time) >= #{params.beginTime} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND DATE(o.create_time) <= #{params.endTime} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') + AND DATE(o.create_time) >= #{startTime} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + AND DATE(o.create_time) <= #{endTime} AND o.status IN @@ -268,16 +268,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.paid = #{paid} and o.pay_type = #{payType} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND DATE(o.create_time) >= #{params.beginTime} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND DATE(o.create_time) <= #{params.endTime} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') + AND DATE(o.create_time) >= #{startTime} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + AND DATE(o.create_time) <= #{endTime} AND o.status IN @@ -345,12 +345,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" o.cost FROM et_order o - LEFT JOIN - et_operating_area oa ON o.area_id = oa.area_id - LEFT JOIN - et_device de ON de.sn = o.sn - LEFT JOIN - et_user u ON u.user_id = o.user_id + LEFT JOIN et_operating_area oa ON o.area_id = oa.area_id + LEFT JOIN et_device de ON de.sn = o.sn + LEFT JOIN et_user u ON u.user_id = o.user_id LEFT join et_area_dept ad on ad.area_id = oa.area_id LEFT join sys_dept d on d.dept_id = ad.dept_id where 1 = 1 @@ -358,6 +355,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.type = #{type} and o.status = #{status} and o.paid = #{paid} + and d.dept_id = #{deptId} ${params.dataScope} order by o.create_time desc @@ -459,10 +457,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -470,10 +468,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -481,10 +479,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -492,10 +490,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -503,10 +501,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -514,10 +512,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -525,10 +523,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -536,10 +534,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -547,10 +545,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -558,10 +556,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -569,10 +567,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -580,30 +578,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -611,10 +609,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -622,10 +620,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -634,10 +632,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -646,10 +644,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -657,10 +655,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -668,10 +666,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -682,10 +680,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sn = #{sn} and area_id = #{areaId} - AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + and DATE(pay_time) >= #{startDateStr} - AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + and DATE(pay_time) <= #{endDateStr} AND status = 4 and type = 1 and paid = 1 @@ -696,10 +694,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and area_id = #{areaId} - AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + and DATE(pay_time) >= #{startDateStr} - AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + and DATE(pay_time) <= #{endDateStr} AND status = 4 and type = 1 @@ -714,10 +712,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(o.create_time) >= #{startDateStr} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(o.create_time) <= #{endDateStr} AND o.status = 4 and o.type = 1 and o.paid = 1 and dd.partner_id is not null @@ -729,10 +727,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} AND o.pay_channel = #{channelId} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(o.create_time) >= #{startDateStr} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(o.create_time) <= #{endDateStr} and o.area_id != 14 AND o.status = 4 and o.type = 2 and o.paid = 1 @@ -748,10 +746,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} - AND date_format(o.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(o.create_time) >= #{startDateStr} - AND date_format(o.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(o.create_time) <= #{endDateStr} AND o.status = 4 and o.type = 1 and o.paid = 1 and dd.partner_id is null @@ -763,10 +761,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sn = #{sn} and area_id = #{areaId} - AND date_format(create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(create_time) >= #{startDateStr} - AND date_format(create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(create_time) <= #{endDateStr} AND status = 4 and type = 1 @@ -779,10 +777,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.sn = #{sn} and o.area_id = #{areaId} - AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(ref.create_time) >= #{startDateStr} - AND date_format(ref.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(ref.create_time) <= #{endDateStr} AND ref.type = 1 AND ref.refund_result = 'SUCCESS' @@ -796,10 +794,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} and o.pay_channel = #{channelId} - AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(ref.create_time) >= #{startDateStr} - AND date_format(ref.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(ref.create_time) <= #{endDateStr} AND ref.type = 1 AND ref.refund_result = 'SUCCESS' @@ -814,10 +812,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} and o.pay_channel = #{channelId} - AND date_format(ref.create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(ref.create_time) >= #{startDateStr} - AND date_format(ref.create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(ref.create_time) <= #{endDateStr} and o.area_id != 14 AND ref.type = 2 AND ref.refund_result = 'SUCCESS' @@ -932,10 +930,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and o.area_id = #{areaId} - AND date_format(o.pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d') + AND DATE(o.pay_time) >= #{startDateStr} - AND date_format(o.pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d') + AND DATE(o.pay_time) <= #{endDateStr} AND o.pay_type = 'yj' @@ -1187,7 +1185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"