diff --git a/smart-switch-ruoyi/smart-switch-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullLongTyperHandler.java b/smart-switch-ruoyi/smart-switch-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullLongTyperHandler.java new file mode 100644 index 00000000..1cc0df72 --- /dev/null +++ b/smart-switch-ruoyi/smart-switch-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullLongTyperHandler.java @@ -0,0 +1,39 @@ +package com.ruoyi.system.mapper.typehandler; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * 非空Integer类型处理器,为空时,返回0 + * @author wjh + * 2024/4/12 + */ +public class NonNullLongTyperHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, Long parameter, JdbcType jdbcType) throws SQLException { + ps.setLong(i, parameter); + } + + @Override + public Long getNullableResult(ResultSet rs, String columnName) + throws SQLException { + return rs.getLong(columnName); + } + + @Override + public Long getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + return rs.getLong(columnIndex); + } + + @Override + public Long getNullableResult(CallableStatement cs, int columnIndex) + throws SQLException { + return cs.getLong(columnIndex); + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java new file mode 100644 index 00000000..10db256b --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/BusinessStatisticsQuery.java @@ -0,0 +1,36 @@ +package com.ruoyi.dashboard.domain.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; +import java.util.List; + +/** + * @author wjh + * 2024/10/8 + */ +@Data +public class BusinessStatisticsQuery { + + @ApiModelProperty("日期范围") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private List dateRange; + + @ApiModelProperty("商户ID") + private Long mchId; + + @ApiModelProperty("店铺ID") + private Long storeId; + + @ApiModelProperty("订单状态") + private List billStatusList; + + @ApiModelProperty("订单类型") + private String billType; + + @ApiModelProperty("店铺名称") + private String storeName; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/ServiceIncomeQuery.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/ServiceIncomeQuery.java similarity index 92% rename from smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/ServiceIncomeQuery.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/ServiceIncomeQuery.java index 422aab60..b72f8a86 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/ServiceIncomeQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/dto/ServiceIncomeQuery.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.dashboard; +package com.ruoyi.dashboard.domain.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BillCountVo.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BillCountVo.java similarity index 98% rename from smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BillCountVo.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BillCountVo.java index d2ac0a67..df76bb8b 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BillCountVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BillCountVo.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.dashboard.vo; +package com.ruoyi.dashboard.domain.vo; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BriefVo.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BriefVo.java similarity index 96% rename from smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BriefVo.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BriefVo.java index d5c037c5..aaf7852e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/BriefVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BriefVo.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.dashboard.vo; +package com.ruoyi.dashboard.domain.vo; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo; import lombok.Data; diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BusinessStatisticsVO.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BusinessStatisticsVO.java new file mode 100644 index 00000000..117f7383 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/BusinessStatisticsVO.java @@ -0,0 +1,39 @@ +package com.ruoyi.dashboard.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author wjh + * 2024/10/8 + */ +@Data +public class BusinessStatisticsVO { + + @ApiModelProperty("店铺ID") + private Long storeId; + + @ApiModelProperty("店铺名称") + private String storeName; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("设备数量") + private Integer deviceCount; + + @ApiModelProperty("订单数量") + private Integer orderCount; + + @ApiModelProperty("总时长(秒)") + private BigDecimal seconds; + + @ApiModelProperty("总电量(度)") + private BigDecimal ele; + + @ApiModelProperty("收入总金额") + private BigDecimal arrivalAmount; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/ServiceIncomeVO.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/ServiceIncomeVO.java similarity index 93% rename from smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/ServiceIncomeVO.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/ServiceIncomeVO.java index dacb00d4..e553902e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/ServiceIncomeVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/ServiceIncomeVO.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.dashboard.vo; +package com.ruoyi.dashboard.domain.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/SmUserCountVo.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/SmUserCountVo.java similarity index 75% rename from smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/SmUserCountVo.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/SmUserCountVo.java index afc4a01b..3106de78 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/dashboard/vo/SmUserCountVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/SmUserCountVo.java @@ -1,4 +1,4 @@ -package com.ruoyi.ss.dashboard.vo; +package com.ruoyi.dashboard.domain.vo; import lombok.Data; diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/vo/TodoListVO.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/TodoListVO.java similarity index 94% rename from smart-switch-service/src/main/java/com/ruoyi/dashboard/vo/TodoListVO.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/TodoListVO.java index 25cff094..d7041616 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/dashboard/vo/TodoListVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/domain/vo/TodoListVO.java @@ -1,4 +1,4 @@ -package com.ruoyi.dashboard.vo; +package com.ruoyi.dashboard.domain.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.java new file mode 100644 index 00000000..a02a6c9f --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.java @@ -0,0 +1,19 @@ +package com.ruoyi.dashboard.mapper; + +import com.ruoyi.dashboard.domain.dto.BusinessStatisticsQuery; +import com.ruoyi.dashboard.domain.vo.BusinessStatisticsVO; + +import java.util.List; + +/** + * @author wjh + * 2024/10/8 + */ +public interface DashboardMapper { + + List selectBusinessStatisticsByStore(BusinessStatisticsQuery query); + + List selectBusinessStatisticsByDevice(BusinessStatisticsQuery query); +} + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml new file mode 100644 index 00000000..e528b706 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/mapper/DashboardMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + select + stb.store_id, + if (stb.store_id is null, '未分配店铺', ss.name) as store_name, + count(distinct stb.device_id) as device_count, + sd.device_name as device_name, + count(stb.bill_id) as order_count, + sum(if(stb.suit_fee_type in ('1', '4'), timestampdiff(second, stb.suit_start_time, stb.suit_end_time), 0)) as `seconds`, + sum(if(stb.suit_fee_type in ('2', '3'), stb.suit_end_ele - stb.suit_start_ele, 0)) as `ele`, + sum(stb.arrival_amount) as arrival_amount + from sm_transaction_bill stb + left join sm_store ss on ss.store_id = stb.store_id + left join sm_device sd on sd.device_id = stb.device_id + + and stb.mch_id = #{mchId} + and stb.store_id = #{storeId} + and stb.type = #{billType} + and ss.name like concat('%', #{storeName}, '%') + + and date(stb.create_time) >= #{dateRange[0]} and date(stb.create_time) <= #{dateRange[1]} + + + and stb.status in + + #{item} + + + + + + + + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/dashboard/DashboardService.java b/smart-switch-service/src/main/java/com/ruoyi/dashboard/service/DashboardService.java similarity index 88% rename from smart-switch-service/src/main/java/com/ruoyi/dashboard/DashboardService.java rename to smart-switch-service/src/main/java/com/ruoyi/dashboard/service/DashboardService.java index 626c5aa6..c3fd1eca 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/dashboard/DashboardService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/dashboard/service/DashboardService.java @@ -1,8 +1,11 @@ -package com.ruoyi.dashboard; +package com.ruoyi.dashboard.service; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.collection.CollectionUtils; -import com.ruoyi.dashboard.vo.TodoListVO; +import com.ruoyi.dashboard.domain.dto.BusinessStatisticsQuery; +import com.ruoyi.dashboard.domain.vo.BusinessStatisticsVO; +import com.ruoyi.dashboard.domain.vo.TodoListVO; +import com.ruoyi.dashboard.mapper.DashboardMapper; import com.ruoyi.ss.abnormal.domain.AbnormalQuery; import com.ruoyi.ss.abnormal.domain.enums.AbnormalStatus; import com.ruoyi.ss.abnormal.service.AbnormalService; @@ -12,8 +15,8 @@ import com.ruoyi.ss.bonus.domain.vo.BonusDailyAmountVO; import com.ruoyi.ss.bonus.service.BonusService; import com.ruoyi.ss.complaint.domain.SmComplaintQuery; import com.ruoyi.ss.complaint.service.ISmComplaintService; -import com.ruoyi.ss.dashboard.ServiceIncomeQuery; -import com.ruoyi.ss.dashboard.vo.ServiceIncomeVO; +import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery; +import com.ruoyi.dashboard.domain.vo.ServiceIncomeVO; import com.ruoyi.ss.device.domain.DeviceQuery; import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.mchApply.domain.MchApplyQuery; @@ -48,6 +51,9 @@ import java.util.List; @Service public class DashboardService { + @Autowired + private DashboardMapper dashboardMapper; + @Autowired private TransactionBillService transactionBillService; @@ -189,4 +195,17 @@ public class DashboardService { } return result; } + + public List businessStatisticsByStore(BusinessStatisticsQuery query) { + query.setBillType(TransactionBillType.RECHARGE.getType()); + query.setBillStatusList(TransactionBillStatus.payedOrder()); + return dashboardMapper.selectBusinessStatisticsByStore(query); + } + + + public List businessStatisticsByDevice(BusinessStatisticsQuery query) { + query.setBillType(TransactionBillType.RECHARGE.getType()); + query.setBillStatusList(TransactionBillStatus.payedOrder()); + return dashboardMapper.selectBusinessStatisticsByDevice(query); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java index 7abc426c..14df7360 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java @@ -4,7 +4,7 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriod; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery; import com.ruoyi.ss.balancePeriod.mapper.SmBalancePeriodMapper; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/ISmBusinessRecordService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/ISmBusinessRecordService.java index 4a0e7b42..c251036d 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/ISmBusinessRecordService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/ISmBusinessRecordService.java @@ -3,7 +3,7 @@ package com.ruoyi.ss.businessRecord.service; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo; -import com.ruoyi.ss.dashboard.vo.BriefVo; +import com.ruoyi.dashboard.domain.vo.BriefVo; import java.util.Date; import java.util.List; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java index 8d7d391c..456f6e27 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java @@ -8,8 +8,8 @@ import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo; import com.ruoyi.ss.businessRecord.mapper.SmBusinessRecordMapper; -import com.ruoyi.ss.dashboard.vo.BillCountVo; -import com.ruoyi.ss.dashboard.vo.BriefVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BriefVo; import com.ruoyi.ss.device.domain.DeviceQuery; import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus; import com.ruoyi.ss.device.service.DeviceService; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java index f098835a..ee527da3 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java @@ -29,7 +29,7 @@ public interface DeviceService * @param deviceId 设备主键 * @return 设备 */ - public DeviceVO selectSmDeviceByDeviceId(Long deviceId); + public DeviceVO selectById(Long deviceId); /** * 查询设备列表 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java index ec948dfc..e0be091d 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java @@ -56,4 +56,11 @@ public interface DeviceValidator { * 后校验 */ void afterCheck(DeviceVO vo); + + /** + * 判断用户是否设备的代理商 + * @param device 设备 + * @param userId 用户ID + */ + boolean isAgent(DeviceVO device, Long userId); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java index 51558629..ef890758 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java @@ -2,7 +2,7 @@ package com.ruoyi.ss.device.service.impl; import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.collection.CollectionUtils; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceAssembler; import com.ruoyi.ss.deviceSuit.domain.DeviceSuitQuery; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index 1b329d82..839b05f6 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -138,7 +138,7 @@ public class DeviceServiceImpl implements DeviceService * @return 设备 */ @Override - public DeviceVO selectSmDeviceByDeviceId(Long deviceId) + public DeviceVO selectById(Long deviceId) { return deviceMapper.selectSmDeviceByDeviceId(deviceId); } @@ -183,7 +183,7 @@ public class DeviceServiceImpl implements DeviceService ServiceUtil.assertion(insert != 1, "新增设备失败"); // 后校验 - DeviceVO vo = this.selectSmDeviceByDeviceId(data.getDeviceId()); + DeviceVO vo = this.selectById(data.getDeviceId()); deviceValidator.afterCheck(vo); // 创建OneNet设备1 @@ -220,7 +220,7 @@ public class DeviceServiceImpl implements DeviceService ServiceUtil.assertion(update != 1, "更新设备失败"); // 后校验 - DeviceVO vo = this.selectSmDeviceByDeviceId(data.getDeviceId()); + DeviceVO vo = this.selectById(data.getDeviceId()); deviceValidator.afterCheck(vo); // 更新套餐关联 @@ -408,7 +408,7 @@ public class DeviceServiceImpl implements DeviceService */ @Override public boolean switchDevice(Long deviceId, boolean open) { - DeviceVO device = selectSmDeviceByDeviceId(deviceId); + DeviceVO device = selectById(deviceId); ServiceUtil.assertion(device == null, "设备不存在"); if (open) { return iotService.open(device); @@ -539,7 +539,7 @@ public class DeviceServiceImpl implements DeviceService @Override public int resetEle(Long deviceId, boolean required) { // 获取设备信息 - DeviceVO device = selectSmDeviceByDeviceId(deviceId); + DeviceVO device = selectById(deviceId); return resetEle(device, required); } @@ -551,7 +551,7 @@ public class DeviceServiceImpl implements DeviceService // 拉取设备信息 pullDeviceInfo(deviceId); - DeviceVO device = selectSmDeviceByDeviceId(deviceId); + DeviceVO device = selectById(deviceId); ServiceUtil.assertion(device == null, "设备不存在"); // 尝试关闭该设备未结束的所有订单 @@ -577,7 +577,7 @@ public class DeviceServiceImpl implements DeviceService @Override public boolean addEle(Long deviceId, BigDecimal ele, boolean withIot, String reason) { - DeviceVO device = selectSmDeviceByDeviceId(deviceId); + DeviceVO device = selectById(deviceId); if (device == null) { return false; } @@ -630,7 +630,7 @@ public class DeviceServiceImpl implements DeviceService @Override public int setWifi(DeviceWifiDTO dto) { - DeviceVO device = selectSmDeviceByDeviceId(dto.getDeviceId()); + DeviceVO device = selectById(dto.getDeviceId()); if (device == null) { return 0; } @@ -672,7 +672,7 @@ public class DeviceServiceImpl implements DeviceService // 物联网设备增加时长 if (withIot) { - DeviceVO newDevice = selectSmDeviceByDeviceId(deviceId); + DeviceVO newDevice = selectById(deviceId); long betweenSeconds = Duration.between(LocalDateTime.now(), newDevice.getExpireTime()).getSeconds(); if (betweenSeconds > 0) { CommandResponse rechargeResult = iotService.setTime(device, betweenSeconds); @@ -1043,8 +1043,10 @@ public class DeviceServiceImpl implements DeviceService ServiceUtil.assertion(record != 1, "添加绑定记录失败"); // 用户设置为商户 - int changeType = userService.changeType(userId, UserType.MCH); - ServiceUtil.assertion(changeType != 1, "修改用户类型失败"); + if (UserType.USER.getType().equals(user.getType())) { + int changeType = userService.changeType(userId, UserType.MCH); + ServiceUtil.assertion(changeType != 1, "修改用户类型失败"); + } return updateCount; }); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java index 0d334566..a846c0aa 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java @@ -61,7 +61,7 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato if (deviceId == null || userId == null) { return false; } - DeviceVO device = deviceService.selectSmDeviceByDeviceId(deviceId); + DeviceVO device = deviceService.selectById(deviceId); return device != null && Objects.equals(device.getUserId(), userId); } @@ -169,12 +169,20 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato if (StringUtils.hasText(vo.getMac()) || StringUtils.hasText(vo.getMac2())) { ServiceUtil.assertion(Objects.equals(vo.getMac(), vo.getMac2()), "MAC-1和MAC-2不允许相同"); } - if (vo.getUserId() != null || vo.getAgentId() != null) { - ServiceUtil.assertion(Objects.equals(vo.getUserId(), vo.getAgentId()), "代理商和商户不允许是同一个用户"); - } +// if (vo.getUserId() != null || vo.getAgentId() != null) { +// ServiceUtil.assertion(Objects.equals(vo.getUserId(), vo.getAgentId()), "代理商和商户不允许是同一个用户"); +// } ServiceUtil.assertion(this.isRepeatMac(vo.getDeviceId(), vo.getMac()), "MAC-1重复:" + vo.getMac()); ServiceUtil.assertion(this.isRepeatMac(vo.getDeviceId(), vo.getMac2()), "MAC-2重复:" + vo.getMac2()); ServiceUtil.assertion(this.isRepeatSn(vo.getDeviceId(), vo.getDeviceNo()), "SN重复"); } + + @Override + public boolean isAgent(DeviceVO device, Long userId) { + if (device == null || userId == null) { + return false; + } + return Objects.equals(device.getAgentId(), userId); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreAssemblerImpl.java index 3084be1f..5790da16 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreAssemblerImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreAssemblerImpl.java @@ -2,7 +2,7 @@ package com.ruoyi.ss.store.service.impl; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.collection.CollectionUtils; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.device.domain.DeviceCountVO; import com.ruoyi.ss.device.domain.DeviceQuery; import com.ruoyi.ss.device.domain.enums.DeviceGroupBy; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/timeBill/service/impl/TimeBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/timeBill/service/impl/TimeBillServiceImpl.java index 0f15c124..85f0dfb1 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/timeBill/service/impl/TimeBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/timeBill/service/impl/TimeBillServiceImpl.java @@ -157,7 +157,7 @@ public class TimeBillServiceImpl implements TimeBillService, AfterPay ServiceUtil.assertion(!redisLock.lock(RedisLockKey.ADD_TIME_BILL, lockKey), "当前使用该设备的人数过多,请稍后再试"); try { // 查询设备 - DeviceVO device = deviceService.selectSmDeviceByDeviceId(dto.getDeviceId()); + DeviceVO device = deviceService.selectById(dto.getDeviceId()); ServiceUtil.assertion(device == null, "设备不存在"); dto.setDevice(device); @@ -217,7 +217,7 @@ public class TimeBillServiceImpl implements TimeBillService, AfterPay ServiceUtil.assertion(update != 1, "订单状态已发生变化,请刷新后重试"); // 关闭设备 - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); ServiceUtil.assertion(device == null, "设备不存在"); boolean close = iotService.close(device); ServiceUtil.assertion(!close, "关闭设备失败,请检查设备是否在线"); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java index 74d3d6d0..a01bc3c7 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java @@ -1,6 +1,6 @@ package com.ruoyi.ss.transactionBill.mapper; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.transactionBill.domain.TransactionBill; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.vo.TransactionAmountVO; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml index 235ea841..9a2a0c9c 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml @@ -291,7 +291,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where stb.bill_id = #{billId} - + diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java index 2b16dfa2..423f04ee 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java @@ -1,6 +1,6 @@ package com.ruoyi.ss.transactionBill.service; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.payBill.domain.vo.DoPayVO; import com.ruoyi.ss.transactionBill.domain.TransactionBill; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/RechargeDepositAfterPay.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/RechargeDepositAfterPay.java index fe61ba94..6f4c712e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/RechargeDepositAfterPay.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/RechargeDepositAfterPay.java @@ -47,7 +47,7 @@ public class RechargeDepositAfterPay implements AfterPay { deviceService.pullDeviceInfo(bill.getDeviceId()); - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); ServiceUtil.assertion(device == null, "设备不存在"); Integer result = transactionTemplate.execute(status -> { diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java index 2c47b2d3..82df21f9 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java @@ -151,7 +151,7 @@ public class TransactionBillConverterImpl implements TransactionBillConverter { bo.setOrder(bill); bo.setUser(userService.selectSmUserByUserId(bill.getUserId())); bo.setMch(userService.selectSmUserByUserId(bill.getMchId())); - bo.setDevice(deviceService.selectSmDeviceByDeviceId(bill.getDeviceId())); + bo.setDevice(deviceService.selectById(bill.getDeviceId())); bo.setChannel(channelService.selectSmChannelByChannelId(channelId)); bo.setPlatform(deptService.selectDeptById(Constants.ROOT_DEPT)); return bo; @@ -187,7 +187,7 @@ public class TransactionBillConverterImpl implements TransactionBillConverter { bo.setTotalEle(dto.getTotalEle()); if (order != null) { deviceService.pullDeviceInfo(order.getDeviceId()); - bo.setDevice(deviceService.selectSmDeviceByDeviceId(order.getDeviceId())); + bo.setDevice(deviceService.selectById(order.getDeviceId())); } return bo; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 3e87534c..e91ae9eb 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -20,7 +20,7 @@ import com.ruoyi.ss.bonus.service.BonusConverter; import com.ruoyi.ss.bonus.service.BonusService; import com.ruoyi.ss.channelWithdraw.domain.ChannelWithdrawVO; import com.ruoyi.ss.channelWithdraw.service.ChannelWithdrawService; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceService; @@ -842,7 +842,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After // 刷新设备数据 deviceService.pullDeviceInfo(bill.getDeviceId()); - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); // 如果设备离线,则直接返回失败 if (DeviceOnlineStatus.OFFLINE.getStatus().equals(device.getOnlineStatus())) { @@ -1244,7 +1244,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After ServiceUtil.assertion(bill == null, "计算金额出错,订单不存在"); if(SuitFeeType.COUNT.getType().equals(bill.getSuitFeeType()) || SuitFeeType.TIMING_COUNT.getType().equals(bill.getSuitFeeType())) { - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); totalEle = this.calcTotalEle(device, totalEle); } @@ -1649,7 +1649,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After ServiceUtil.assertion( result != 1, "蓝牙充值回调失败,设备状态已发生改变"); // 更新套餐使用信息 - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); int updateInfo = this.updateSuitInfoBeforeDevice(bill, device); ServiceUtil.assertion(updateInfo != 1, "更新套餐使用信息失败"); @@ -1674,7 +1674,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After // 记录时长变化记录 private void recordTime(TransactionBillVO bill, String reason) { scheduledExecutorService.schedule(() -> { - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); if (device == null) { return; } @@ -1950,7 +1950,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After ServiceUtil.assertion(bill == null, "订单不存在"); ServiceUtil.assertion(bill.getIsUsing() == null || !bill.getIsUsing(), "该订单不是正在使用中的订单,无法操作"); - DeviceVO device = deviceService.selectSmDeviceByDeviceId(bill.getDeviceId()); + DeviceVO device = deviceService.selectById(bill.getDeviceId()); ServiceUtil.assertion(device == null, "设备不存在"); ServiceUtil.assertion(StringUtils.isBlank(device.getMac()), "设备MAC为空,请联系管理员处理"); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java index 969d89a5..56109aa4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java @@ -2,11 +2,9 @@ package com.ruoyi.ss.transactionBill.service.impl; import com.ruoyi.common.core.domain.BaseValidator; import com.ruoyi.common.core.domain.ValidateResult; -import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.ss.channel.domain.ChannelVO; -import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.model.domain.enums.ModelTag; @@ -31,11 +29,9 @@ import com.ruoyi.ss.user.service.UserValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -242,7 +238,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans */ @Override public boolean canRechargeOnline(Long deviceId) { - DeviceVO device = deviceService.selectSmDeviceByDeviceId(deviceId); + DeviceVO device = deviceService.selectById(deviceId); if (device == null) { return false; } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/agent/AgentDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/agent/AgentDeviceController.java new file mode 100644 index 00000000..ed17330e --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/agent/AgentDeviceController.java @@ -0,0 +1,47 @@ +package com.ruoyi.web.controller.agent; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.ss.device.domain.DeviceQuery; +import com.ruoyi.ss.device.domain.vo.DeviceVO; +import com.ruoyi.ss.device.service.DeviceService; +import com.ruoyi.ss.device.service.DeviceValidator; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author wjh + * 2024/10/8 + */ +@RestController +@RequestMapping("/agent/device") +public class AgentDeviceController extends BaseController { + + @Autowired + private DeviceService deviceService; + + @Autowired + private DeviceValidator deviceValidator; + + @ApiOperation("代理商获取设备列表") + @GetMapping("/list") + public TableDataInfo list(DeviceQuery query) { + startPage(); + startOrderBy(); + query.setAgentId(getUserId()); + return getDataTable(deviceService.selectSmDeviceList(query)); + } + + @ApiOperation("代理商解绑设备商户") + @PutMapping("/unbindMch") + public AjaxResult unbindMch(@RequestParam Long deviceId) { + DeviceVO device = deviceService.selectById(deviceId); + if (!deviceValidator.isAgent(device, getUserId())) { + return error("您不是该设备的代理商,无权操作"); + } + return toAjax(deviceService.unbind(deviceId)); + } + +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java index 53ab3eb7..82b8a715 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java @@ -25,7 +25,6 @@ import com.ruoyi.ss.device.service.DeviceValidator; import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordQuery; import com.ruoyi.ss.meterReadingRecord.service.ISmMeterReadingRecordService; -import com.ruoyi.ss.suit.domain.enums.SuitFeeType; import com.ruoyi.ss.suit.domain.enums.SuitTimeUnit; import com.ruoyi.web.core.annotation.DeviceAdminRequired; import io.swagger.annotations.Api; @@ -81,6 +80,7 @@ public class AppDeviceController extends BaseController { smDevice.setUserId(getUserId()); List list = smDeviceService.selectSmDeviceList(smDevice); smDeviceService.pullDeviceInfoList(list); + deviceAssembler.assembleRealServiceRate(list); return getDataTable(list); } @@ -100,7 +100,7 @@ public class AppDeviceController extends BaseController { @GetMapping(value = "/{deviceId}") public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) { // smDeviceService.pullDeviceInfo(Collections.singletonList(deviceId)); - DeviceVO device = smDeviceService.selectSmDeviceByDeviceId(deviceId); + DeviceVO device = smDeviceService.selectById(deviceId); List list = Collections.singletonList(device); deviceAssembler.assembleOrderCountInfo(list); // 订单统计信息 return success(device); @@ -161,7 +161,7 @@ public class AppDeviceController extends BaseController { @ApiParam("是否操作物联网设备") @RequestParam(required = false, defaultValue = "true") Boolean withIot ) { ServiceUtil.assertion(!deviceValidator.isBelong(deviceId, getUserId()), "这不是您的设备"); - DeviceVO device = smDeviceService.selectSmDeviceByDeviceId(deviceId); + DeviceVO device = smDeviceService.selectById(deviceId); ServiceUtil.assertion(device == null || !getUserId().equals(device.getUserId()), "设备不存在或您无权充值"); // 电量 diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index ebdade50..f49df744 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -10,7 +10,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ServiceUtil; -import com.ruoyi.ss.dashboard.vo.BillCountVo; +import com.ruoyi.dashboard.domain.vo.BillCountVo; import com.ruoyi.ss.device.service.DeviceValidator; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.bo.EndUseBO; @@ -37,7 +37,6 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Collections; -import java.util.Date; import java.util.List; import java.util.Objects; diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchDashboardController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchDashboardController.java new file mode 100644 index 00000000..ae91c590 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/mch/MchDashboardController.java @@ -0,0 +1,38 @@ +package com.ruoyi.web.controller.mch; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.dashboard.domain.dto.BusinessStatisticsQuery; +import com.ruoyi.dashboard.service.DashboardService; +import io.swagger.annotations.ApiOperation; +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; + +/** + * @author wjh + * 2024/10/8 + */ +@RestController +@RequestMapping("/mch/dashboard") +public class MchDashboardController extends BaseController { + + @Autowired + private DashboardService dashboardService; + + @ApiOperation("商户获取店铺维度的订单统计") + @GetMapping("/businessStatisticsByStore") + public AjaxResult businessStatisticsByStore(BusinessStatisticsQuery query) { + query.setMchId(getUserId()); + return success(dashboardService.businessStatisticsByStore(query)); + } + + @ApiOperation("商户获取指定店铺的订单统计") + @GetMapping("/businessStatisticsByDevice") + public AjaxResult businessStatisticsByDevice(BusinessStatisticsQuery query) { + query.setMchId(getUserId()); + return success(dashboardService.businessStatisticsByDevice(query)); + } + +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java index 40a70fd5..c368f5d3 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java @@ -4,19 +4,19 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.ValidGroup; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.dashboard.DashboardService; +import com.ruoyi.dashboard.service.DashboardService; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery; import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService; import com.ruoyi.ss.bonus.domain.BonusQuery; import com.ruoyi.ss.bonus.service.BonusService; import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService; -import com.ruoyi.ss.dashboard.ServiceIncomeQuery; +import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo; -import com.ruoyi.ss.dashboard.vo.BriefVo; +import com.ruoyi.dashboard.domain.vo.BriefVo; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java index 70b35df3..6775ed3c 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java @@ -85,7 +85,7 @@ public class SmDeviceController extends BaseController @PreAuthorize("@ss.hasPermi('system:device:query')") @GetMapping(value = "/{deviceId}") public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) { - DeviceVO device = deviceService.selectSmDeviceByDeviceId(deviceId); + DeviceVO device = deviceService.selectById(deviceId); deviceAssembler.assembleRealServiceRate(device); return success(device); }