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