|
|
@ -72,9 +72,22 @@ public class AdminDeviceService { |
|
|
|
mapper.updateStatusByDeviceId(STATUS_OFFLINE, deviceId, adminId); |
|
|
|
} |
|
|
|
|
|
|
|
public void setStatusOnline(Integer adminId, String deviceId) { |
|
|
|
MatrixAdminDevice record = mapper.selectByDeviceId(deviceId); |
|
|
|
if (record == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
MatrixAdmin admin = adminMapper.selectById(record.getAdminId()); |
|
|
|
long cnt = queryBindCnt(admin.getId(), record.getAppId()); |
|
|
|
if (cnt >= admin.getDeviceCnt()) { |
|
|
|
throw new PaganiException(PaganiExceptionCode.GENERAL_ERROR, "绑定设备数已达上限"); |
|
|
|
} |
|
|
|
mapper.updateStatusByDeviceId(STATUS_DEFAULT, deviceId, adminId); |
|
|
|
} |
|
|
|
|
|
|
|
public String bind(String deviceId, String appCode, String adminName) { |
|
|
|
MatrixAdminDevice device = mapper.selectByDeviceId(deviceId); |
|
|
|
if (device != null) { |
|
|
|
if (device != null && device.getStatus() != STATUS_OFFLINE) { |
|
|
|
return "设备已绑定"; |
|
|
|
} |
|
|
|
MatrixAdmin admin = adminMapper.query(adminName); |
|
|
@ -229,11 +242,11 @@ public class AdminDeviceService { |
|
|
|
query.between(MatrixAdvRecord::getCreatedAt, new Timestamp(dateBegin), new Timestamp(dateEnd)); |
|
|
|
query.eq(MatrixAdvRecord::getAdvType, 3);//设备主只算激励视频
|
|
|
|
query.gt(MatrixAdvRecord::getAdminId, 0); |
|
|
|
query.groupBy(MatrixAdvRecord::getAdminId,MatrixAdvRecord::getAppId, MatrixAdvRecord::getPlatform); |
|
|
|
query.groupBy(MatrixAdvRecord::getAdminId, MatrixAdvRecord::getAppId, MatrixAdvRecord::getPlatform); |
|
|
|
List<MatrixAdvRecord> records = advRecordMapper.selectList(query); |
|
|
|
List<MatrixAdvAggregationSub> aggregations = new ArrayList<>(); |
|
|
|
List<MatrixAdmin> adminList = adminMapper.selectList(null); |
|
|
|
Map<Integer, MatrixAdmin> adminMap = adminList.stream().collect(Collectors.toMap(x->x.getId(), x->x)); |
|
|
|
Map<Integer, MatrixAdmin> adminMap = adminList.stream().collect(Collectors.toMap(x -> x.getId(), x -> x)); |
|
|
|
for (MatrixAdvRecord r : records) { |
|
|
|
MatrixAdvAggregationSub aggregation = new MatrixAdvAggregationSub(); |
|
|
|
aggregation.setAdminId(r.getAdminId()); |
|
|
|