This commit is contained in:
@@ -5,13 +5,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableScheduling
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
||||
@@ -4,10 +4,14 @@ import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.system.domain.af.AfDevice;
|
||||
import com.ruoyi.system.service.af.IAfDeviceService;
|
||||
|
||||
@@ -37,4 +41,21 @@ public class AfDeviceController extends BaseController
|
||||
List<AfDevice> list = deviceService.selectAfDeviceList(device);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:device:edit')")
|
||||
@PostMapping("/dispatch/enable")
|
||||
public AjaxResult enableDispatch(@RequestBody java.util.Map<String, Object> body)
|
||||
{
|
||||
Long deviceId = Convert.toLong(body.get("deviceId"));
|
||||
return toAjax(deviceService.enableDispatch(deviceId, getUsername()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:device:edit')")
|
||||
@PostMapping("/dispatch/disable")
|
||||
public AjaxResult disableDispatch(@RequestBody java.util.Map<String, Object> body)
|
||||
{
|
||||
Long deviceId = Convert.toLong(body.get("deviceId"));
|
||||
String maintainReason = Convert.toStr(body.get("maintainReason"));
|
||||
return toAjax(deviceService.disableDispatch(deviceId, maintainReason, getUsername()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.web.controller.af;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.system.domain.af.AfDispatchPolicy;
|
||||
import com.ruoyi.system.service.af.IAfDispatchPolicyService;
|
||||
import com.ruoyi.system.service.af.IAfDispatchService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/af/dispatch")
|
||||
public class AfDispatchController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAfDispatchPolicyService dispatchPolicyService;
|
||||
|
||||
@Autowired
|
||||
private IAfDispatchService dispatchService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@GetMapping("/policy")
|
||||
public AjaxResult getPolicy()
|
||||
{
|
||||
return success(dispatchPolicyService.getPolicy());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@PostMapping("/policy")
|
||||
public AjaxResult savePolicy(@RequestBody AfDispatchPolicy policy)
|
||||
{
|
||||
return success(dispatchPolicyService.savePolicy(policy, getUsername()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@PostMapping("/trigger")
|
||||
public AjaxResult trigger(@RequestBody(required = false) Map<String, Object> body)
|
||||
{
|
||||
Integer limit = body == null ? null : Convert.toInt(body.get("limit"));
|
||||
String triggerType = body == null ? null : Convert.toStr(body.get("triggerType"));
|
||||
Map<String, Object> triggerResult = dispatchService.triggerAutoDispatch(limit, triggerType, getUsername());
|
||||
AjaxResult result = success();
|
||||
result.putAll(triggerResult);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,21 @@ public class AfMobileController extends BaseController
|
||||
return success(deviceService.heartbeat(userName, deviceCode, taskStatus, currentTaskId, userName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端更新设备工作状态。
|
||||
*
|
||||
* @param body 请求体
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PostMapping("/device/work/status")
|
||||
public AjaxResult updateWorkStatus(@RequestBody Map<String, Object> body)
|
||||
{
|
||||
String userName = resolveUserName(body);
|
||||
String deviceCode = Convert.toStr(body.get("deviceCode"));
|
||||
String workStatus = Convert.toStr(body.get("workStatus"));
|
||||
return success(deviceService.updateWorkStatus(userName, deviceCode, workStatus, userName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端拉取任务。
|
||||
*
|
||||
|
||||
@@ -87,9 +87,10 @@ public class AfOrderController extends BaseController
|
||||
public AjaxResult autoDispatch(@RequestBody(required = false) Map<String, Object> body)
|
||||
{
|
||||
Integer limit = body == null ? null : Convert.toInt(body.get("limit"));
|
||||
int dispatchedCount = dispatchService.autoDispatch(limit, getUsername());
|
||||
String triggerType = body == null ? null : Convert.toStr(body.get("triggerType"));
|
||||
Map<String, Object> triggerResult = dispatchService.triggerAutoDispatch(limit, triggerType, getUsername());
|
||||
AjaxResult result = success();
|
||||
result.put("dispatchedCount", dispatchedCount);
|
||||
result.putAll(triggerResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.system.domain.af.AfDispatchTask;
|
||||
import com.ruoyi.system.domain.af.AfTaskStepLog;
|
||||
import com.ruoyi.system.service.af.IAfTaskService;
|
||||
@@ -67,4 +70,19 @@ public class AfTaskController extends BaseController
|
||||
List<AfTaskStepLog> logs = taskService.selectTaskStepLogs(taskId);
|
||||
return success(logs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工释放卡住任务。
|
||||
*
|
||||
* @param body 请求体
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('af:task:release')")
|
||||
@PostMapping("/release")
|
||||
public AjaxResult release(@RequestBody java.util.Map<String, Object> body)
|
||||
{
|
||||
Long taskId = Convert.toLong(body.get("taskId"));
|
||||
String failReason = Convert.toStr(body.get("failReason"));
|
||||
return toAjax(taskService.releaseTask(taskId, failReason, getUsername()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user