记得上下班打卡 | git大法好,push需谨慎

Commit 88d15771 authored by 胡佳晨's avatar 胡佳晨

提交定时任务

parent 93ea1afb
......@@ -22,7 +22,7 @@ public class KylinTimePerformanceVo implements Serializable, Cloneable {
@ApiModelProperty(value = "演出Id")
private String performanceId;
@ApiModelProperty(value = "定时上下线时间")
@ApiModelProperty(value = "定时上下线时间 []")
private String time;
@ApiModelProperty(value = "任务类型 [0|无状态|1-上线|2下线]")
......
......@@ -5,6 +5,7 @@ import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Component
......@@ -23,4 +24,7 @@ public interface FeignPlatformTaskClient {
@PostMapping("platform/order/checkTransferOrder")
ResponseDto<Boolean> checkTransferOrder(@RequestParam("minute") Integer minute);
@PutMapping("platform/performance/line")
ResponseDto<Boolean> performanceLine();
}
......@@ -62,6 +62,20 @@ public class KylinTaskHandler {
}
}
@XxlJob(value = "sev-platform:performanceLine")
public ReturnT<String> performanceLine() {
try {
String minute = XxlJobHelper.getJobParam(); //执行参数
log.debug("minute = " + Integer.parseInt(minute));
boolean result = feignPlatformTaskClient.performanceLine().getData();
log.info("checkTransferOrderHandler:结果:" + result);
return ReturnT.SUCCESS;
} catch (Exception e) {
log.info("exception = ", e);
return ReturnT.FAIL;
}
}
// @Autowired
// private FeignSequenceClient feignSequenceClient;
//
......
......@@ -615,7 +615,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
vo.setTime(time);
vo.setTaskType(2);
mongoMerchantUtils.insertTimeLine(vo);
log.info("[ OUT LINE TASK ] performanceId = " + performancesId + " time = " + time);
log.info("[ PRE OUT LINE TASK ] performanceId = " + performancesId + " time = " + time);
return null;
}
......@@ -627,7 +627,7 @@ public class KylinPerformancesPartnerServiceImpl implements IKylinPerformancesPa
vo.setTime(time);
vo.setTaskType(1);
mongoMerchantUtils.insertTimeLine(vo);
log.info("[ ON LINE TASK ] performanceId = " + performancesId + " time = " + time);
log.info("[ PRE ON LINE TASK ] performanceId = " + performancesId + " time = " + time);
return null;
}
......
......@@ -2,12 +2,26 @@ package com.liquidnet.service.platform.controller.kylin;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.KylinTimePerformanceVo;
import com.liquidnet.service.kylin.dto.vo.PerformanceOrderStatisticalVo;
import com.liquidnet.service.kylin.service.partner.IKylinPerformancesPartnerService;
import com.liquidnet.service.platform.utils.PerformanceVoTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
/**
* <p>
* 演出 前端控制器
......@@ -19,14 +33,19 @@ import org.springframework.web.bind.annotation.*;
@Api(tags = "前端-演出")
@RestController
@RequestMapping("performance")
@Slf4j
public class KylinPerformancesController {
@Autowired
private PerformanceVoTask performanceVoTask;
@Autowired
private IKylinPerformancesPartnerService performancesPartnerService;
@Autowired
private MongoTemplate mongoTemplate;
@PostMapping("/checkPerformanceTime")
@ApiOperation("演出脚本")
public ResponseDto<String> checkPerformanceTime(@RequestParam(value = "performancesId",required = false)String performancesId){
public ResponseDto<String> checkPerformanceTime(@RequestParam(value = "performancesId", required = false) String performancesId) {
try {
performanceVoTask.performanceVoStatus(performancesId);
return ResponseDto.success("成功");
......@@ -35,4 +54,28 @@ public class KylinPerformancesController {
return ResponseDto.success("失败");
}
}
@GetMapping(value = "line")
@ApiOperation(value = "演出状态管理", position = 9)
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<Boolean> performanceLine(@RequestParam("performancesId") @NotNull(message = "演出ID不能为空") String performancesId) {
try {
List<KylinTimePerformanceVo> voList = mongoTemplate.findAll(KylinTimePerformanceVo.class, KylinTimePerformanceVo.class.getSimpleName());
for (KylinTimePerformanceVo item : voList) {
if (LocalDateTime.now().isAfter(LocalDateTime.parse(item.getTime(), DTF_YMD_HMS).plusSeconds(2))) {
if (item.getTaskType() == 1) {
performancesPartnerService.onLinePerformance(item.getPerformanceId());
log.info("[FINISH ON LINE TASK] performanceId = " + item.getPerformanceId() + " time = " + item.getTime());
} else if (item.getTaskType() == 2) {
performancesPartnerService.outLinePerformance(item.getPerformanceId());
log.info("[FINISH OUT LINE TASK] performanceId = " + item.getPerformanceId() + " time = " + item.getTime());
}
}
}
return ResponseDto.success(true);
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.success(false);
}
}
}
......@@ -112,6 +112,8 @@ public class PerformancePartnerController {
// return performancesPartnerService.withdraw(performancesId);
// }
//
@GetMapping(value = "orderStatistical")
@ApiOperation(value = "演出订单统计",position = 9)
@ApiResponse(code = 200, message = "接口返回对象参数")
......
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