Commit 65b54d3f authored by lisong's avatar lisong

96333统计添加生成当月数据逻辑

parent e8e2dde7
...@@ -55,8 +55,8 @@ public class StatisticsController extends BaseController { ...@@ -55,8 +55,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalGeneration") @GetMapping(value = "/statisticalGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalGeneration() { public ResponseModel<Object> statisticalGeneration(@RequestParam(value = "type", required = false) String type) {
alertStatisticsService.statisticalGeneration(); alertStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
...@@ -106,8 +106,8 @@ public class StatisticsController extends BaseController { ...@@ -106,8 +106,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/rescueStatisticalGeneration") @GetMapping(value = "/rescueStatisticalGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> rescueStatisticalGeneration() { public ResponseModel<Object> rescueStatisticalGeneration(@RequestParam(value = "type", required = false) String type) {
alertRescueStatisticsService.statisticalGeneration(); alertRescueStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
...@@ -156,8 +156,8 @@ public class StatisticsController extends BaseController { ...@@ -156,8 +156,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalPlaceGeneration") @GetMapping(value = "/statisticalPlaceGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalPlaceGeneration() { public ResponseModel<Object> statisticalPlaceGeneration(@RequestParam(value = "type", required = false) String type) {
alertPlaceStatisticsService.statisticalGeneration(); alertPlaceStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
...@@ -205,8 +205,8 @@ public class StatisticsController extends BaseController { ...@@ -205,8 +205,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalUseUnitGeneration") @GetMapping(value = "/statisticalUseUnitGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalUseUnitGeneration() { public ResponseModel<Object> statisticalUseUnitGeneration(@RequestParam(value = "type", required = false) String type) {
alertUseUnitStatisticsService.statisticalGeneration(); alertUseUnitStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
...@@ -254,8 +254,8 @@ public class StatisticsController extends BaseController { ...@@ -254,8 +254,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalMaintenanceUnitGeneration") @GetMapping(value = "/statisticalMaintenanceUnitGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalMaintenanceUnitGeneration() { public ResponseModel<Object> statisticalMaintenanceUnitGeneration(@RequestParam(value = "type", required = false) String type) {
alertMaintenanceUnitStatisticsService.statisticalGeneration(); alertMaintenanceUnitStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
...@@ -302,8 +302,8 @@ public class StatisticsController extends BaseController { ...@@ -302,8 +302,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalDispatchGeneration") @GetMapping(value = "/statisticalDispatchGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据") @ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalDispatchGeneration() { public ResponseModel<Object> statisticalDispatchGeneration(@RequestParam(value = "type", required = false) String type) {
alertDispatchStatisticsService.statisticalGeneration(); alertDispatchStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
......
...@@ -31,14 +31,21 @@ public class AlertDispatchStatisticsServiceImpl extends BaseService<AlertDispatc ...@@ -31,14 +31,21 @@ public class AlertDispatchStatisticsServiceImpl extends BaseService<AlertDispatc
@Autowired @Autowired
private AlertStatisticsServiceImpl alertStatisticsService; private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertDispatchStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertDispatchStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask() {
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)) {
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
...@@ -33,16 +33,23 @@ public class AlertMaintenanceUnitStatisticsServiceImpl extends BaseService<Alert ...@@ -33,16 +33,23 @@ public class AlertMaintenanceUnitStatisticsServiceImpl extends BaseService<Alert
@Autowired @Autowired
private AlertStatisticsServiceImpl alertStatisticsService; private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertMaintenanceUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertMaintenanceUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
DecimalFormat decimalFormat = new DecimalFormat("0.00"); DecimalFormat decimalFormat = new DecimalFormat("0.00");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
ArrayList<AlertMaintenanceUnitStatistics> list = new ArrayList<>(); ArrayList<AlertMaintenanceUnitStatistics> list = new ArrayList<>();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
...@@ -27,15 +27,21 @@ import java.util.*; ...@@ -27,15 +27,21 @@ import java.util.*;
public class AlertPlaceStatisticsServiceImpl extends BaseService<AlertPlaceStatisticsDto, AlertPlaceStatistics, AlertPlaceStatisticsMapper> implements IAlertPlaceStatisticsService { public class AlertPlaceStatisticsServiceImpl extends BaseService<AlertPlaceStatisticsDto, AlertPlaceStatistics, AlertPlaceStatisticsMapper> implements IAlertPlaceStatisticsService {
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertPlaceStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertPlaceStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
DecimalFormat decimalFormat = new DecimalFormat("0.00"); DecimalFormat decimalFormat = new DecimalFormat("0.00");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
...@@ -32,14 +32,19 @@ public class AlertRescueStatisticsServiceImpl extends BaseService<AlertRescueSta ...@@ -32,14 +32,19 @@ public class AlertRescueStatisticsServiceImpl extends BaseService<AlertRescueSta
@Autowired @Autowired
private AlertStatisticsServiceImpl alertStatisticsService; private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertRescueStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertRescueStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
...@@ -31,15 +31,20 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto, ...@@ -31,15 +31,20 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
...@@ -27,15 +27,20 @@ import java.util.*; ...@@ -27,15 +27,20 @@ import java.util.*;
@Service @Service
public class AlertUseUnitStatisticsServiceImpl extends BaseService<AlertUseUnitStatisticsDto, AlertUseUnitStatistics, AlertUseUnitStatisticsMapper> implements IAlertUseUnitStatisticsService { public class AlertUseUnitStatisticsServiceImpl extends BaseService<AlertUseUnitStatisticsDto, AlertUseUnitStatistics, AlertUseUnitStatisticsMapper> implements IAlertUseUnitStatisticsService {
@Override
@Scheduled(cron = "0 0 0 1 * ?") @Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertUseUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M") @SchedulerLock(name = "AlertUseUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() { public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); cal.setTime(new Date());
cal.add(Calendar.MONTH, -1); if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime(); Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment