|
|
@@ -60,11 +60,44 @@ public class ApiPlanController {
|
|
|
return TableDataInfo.success(appPlanService.selectPage(info));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 下发
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/distribute")
|
|
|
@RequiresPermissions("core:plan:distribute")
|
|
|
public AjaxResult distribute(@RequestBody DistributeDto dto) {
|
|
|
try {
|
|
|
appPlanService.distributeToOrg(dto);
|
|
|
+ AppPlanVo plan = appPlanService.findById(dto.getId());
|
|
|
+ //如果选择了计划立即生效
|
|
|
+ if (plan.isBuildTaskNow()) {
|
|
|
+ DateTime datetime = new DateTime();
|
|
|
+ datetime.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+ //当有周期存在时保持原有接口不变(doTask),否则按照新的接口创建
|
|
|
+ Integer plancycle = plan.getPlanCycle();
|
|
|
+ if (plancycle != null) {
|
|
|
+ if (plancycle == 2) {
|
|
|
+ taskBusiness.syncDay(datetime, plancycle);
|
|
|
+ }
|
|
|
+ if (plancycle == 3) {
|
|
|
+ taskBusiness.syncWeek(datetime, plancycle);
|
|
|
+ }
|
|
|
+ if (plancycle == 4) {
|
|
|
+ taskBusiness.syncMonth(datetime, plancycle);
|
|
|
+ }
|
|
|
+ if (plancycle == 5) {
|
|
|
+ taskBusiness.syncQuarter(datetime, plancycle);
|
|
|
+ }
|
|
|
+ if (plancycle == 6) {
|
|
|
+ taskBusiness.syncHalfYear(datetime, plancycle);
|
|
|
+ }
|
|
|
+ if (plancycle == 7) {
|
|
|
+ taskBusiness.syncYear(datetime, plancycle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|