Compare commits

...

2 Commits

Author SHA1 Message Date
50921bdbef Merge branch 'master' of http://114.55.171.231:3000/Euni4U/backend
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
2025-09-03 09:44:38 +08:00
cea203b312 会员设备统计 2025-09-02 17:09:27 +08:00
5 changed files with 42 additions and 0 deletions

View File

@ -151,4 +151,13 @@ public class DeviceController {
return success(true);
}
@GetMapping("/get-vip-device-count")
@Operation(summary = "时间范围获取会员设备数量")
public CommonResult<List<Map<String, Object>>> getVipDeviceCountByDay(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate,
@RequestParam(value = "orgid", defaultValue = "0") Integer orgid) {
List<Map<String, Object>> list = deviceService.getVipDeviceCountByDay(startDate, endDate, orgid);
return success(list);
}
}

View File

@ -96,4 +96,9 @@ public interface DeviceMapper extends BaseMapperX<DeviceDO> {
* 首页查询设备数量统计
* */
DeviceStatistics getDevice_Statistics(@Param("orgid") Integer orgid);
/**
* 按天统计开通会员的设备数量
*/
List<Map<String, Object>> countVipDevicesByDay(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("orgid") Integer orgid);
}

View File

@ -113,4 +113,14 @@ public interface DeviceService {
* @param vipReqVO 会员信息更新参数
*/
void updateDeviceVip(@Valid DeviceVipReqVO vipReqVO);
/**
* 根据日期范围查询会员设备数量
*
* @param startDate 开始日期
* @param endDate 结束日期
* @param orgid 机构ID
* @return 会员设备数量统计列表
*/
List<Map<String, Object>> getVipDeviceCountByDay(String startDate, String endDate, Integer orgid);
}

View File

@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.device.DeviceMapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import lombok.extern.slf4j.Slf4j;
@ -257,4 +258,9 @@ public class DeviceServiceImpl implements DeviceService {
}
}
@Override
public List<Map<String, Object>> getVipDeviceCountByDay(String startDate, String endDate, Integer orgid) {
return deviceMapper.countVipDevicesByDay(startDate, endDate, orgid);
}
}

View File

@ -49,4 +49,16 @@
</where>
GROUP BY SUBSTRING_INDEX(location, '/', 1)
</select>
<select id="countVipDevicesByDay" resultType="map">
SELECT DATE_FORMAT(vipstarttime, '%Y-%m-%d') AS date, COUNT(*) AS count
FROM tb_device
WHERE isvip = 1
AND vipstarttime BETWEEN #{startDate} AND #{endDate}
<if test="orgid != null and orgid != 0">
AND orgid = #{orgid}
</if>
GROUP BY DATE_FORMAT(vipstarttime, '%Y-%m-%d')
ORDER BY date
</select>
</mapper>