|
@ -23,6 +23,7 @@ import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
@ -312,20 +313,28 @@ public class AdminService { |
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void addMockSchedule(AddMockScheduleReq bo) { |
|
|
public void addMockSchedule(AddMockScheduleReq bo, Integer adminId) { |
|
|
MatrixApp app = appMapper.selectById(bo.appId); |
|
|
MatrixAdmin admin = adminMapper.selectById(adminId); |
|
|
|
|
|
Assert.isTrue(admin != null && admin.getRole() == SUPER_ADMIN, "非法请求"); |
|
|
|
|
|
Assert.isTrue(!CollectionUtils.isEmpty(bo.scheduleTime), "时间不能为空"); |
|
|
|
|
|
Assert.isTrue(!CollectionUtils.isEmpty(bo.appId), "应用不能为空"); |
|
|
|
|
|
List<MatrixMockSchedule> list = new ArrayList<>(); |
|
|
|
|
|
for(Integer appId: bo.appId) { |
|
|
|
|
|
MatrixApp app = appMapper.selectById(appId); |
|
|
if (app == null || !StringUtils.hasText(app.getChannel())) { |
|
|
if (app == null || !StringUtils.hasText(app.getChannel())) { |
|
|
throw new PaganiException(PaganiExceptionCode.ILLEGAL_REQUEST, "应用不存在或渠道为空"); |
|
|
throw new PaganiException(PaganiExceptionCode.ILLEGAL_REQUEST, "应用不存在或渠道为空"); |
|
|
} |
|
|
} |
|
|
bo.scheduleTime.forEach(x -> { |
|
|
bo.scheduleTime.forEach(x -> { |
|
|
MatrixMockSchedule schedule = new MatrixMockSchedule(); |
|
|
MatrixMockSchedule schedule = new MatrixMockSchedule(); |
|
|
schedule.setAppId(bo.appId); |
|
|
schedule.setAppId(appId); |
|
|
schedule.setScheduleTime(new Timestamp(x)); |
|
|
schedule.setScheduleTime(new Timestamp(x)); |
|
|
schedule.setChannel(app.getChannel()); |
|
|
schedule.setChannel(app.getChannel()); |
|
|
schedule.setIncomeYuan(bo.incomeYuan); |
|
|
schedule.setIncomeYuan(bo.incomeYuan); |
|
|
mockScheduleMapper.insert(schedule); |
|
|
list.add(schedule); |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mockScheduleMapper.insertBatch(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public OverviewBo incomeOverview(int adminId, String code) { |
|
|
public OverviewBo incomeOverview(int adminId, String code) { |
|
|