1.出入磅定时任务按钮调整权限问题
This commit is contained in:
parent
b3234688c7
commit
72671b142e
|
@ -6,6 +6,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import com.ruoyi.bill.domain.PoundBill;
|
||||
import com.ruoyi.bill.service.IPoundBillService;
|
||||
import com.ruoyi.quartz.domain.SysJob;
|
||||
import com.ruoyi.quartz.service.ISysJobService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.util.Util;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -37,6 +42,15 @@ public class OutInPoundController extends BaseController
|
|||
@Autowired
|
||||
private IPoundBillService poundBillService;
|
||||
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
@Autowired
|
||||
private Util util;
|
||||
|
||||
/**
|
||||
* 查询磅单信息列表
|
||||
*/
|
||||
|
@ -105,4 +119,15 @@ public class OutInPoundController extends BaseController
|
|||
List<String> list = Arrays.asList(ids);
|
||||
return toAjax(poundBillService.removeByIds(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务同步
|
||||
*/
|
||||
@PostMapping("/synchronizeData")
|
||||
public AjaxResult synchronizeData() throws SchedulerException
|
||||
{
|
||||
String s = sysConfigService.selectConfigByKey("synchronizeData");
|
||||
boolean b = util.synchronizeData(s);
|
||||
return b?success():error("任务不存在或已过期");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ package com.ruoyi.util;
|
|||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quartz.domain.SysJob;
|
||||
import com.ruoyi.quartz.service.ISysJobService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -13,6 +16,8 @@ import java.util.List;
|
|||
public class Util {
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
|
||||
/**
|
||||
* 根据字典类型获取字典所有标签
|
||||
|
@ -57,4 +62,17 @@ public class Util {
|
|||
String dictValue = DictUtils.getDictValue(dictType, label);
|
||||
return dictValue;
|
||||
}
|
||||
|
||||
public boolean synchronizeData(String param) throws SchedulerException {
|
||||
SysJob sysJob = new SysJob();
|
||||
sysJob.setInvokeTarget(param);
|
||||
sysJob.setMisfirePolicy("0");
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
if (list.size()!=0) {
|
||||
sysJob.setJobId(list.get(0).getJobId());
|
||||
sysJob.setJobGroup(list.get(0).getJobGroup());
|
||||
return jobService.run(sysJob);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,3 +42,11 @@ export function delOutinpound(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询定时任务调度列表
|
||||
export function synchronizeData() {
|
||||
return request({
|
||||
url: '/measurement/operation/outinpound/synchronizeData',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listOutinpound, getOutinpound, delOutinpound, addOutinpound, updateOutinpound } from "@/api/measurement/operation/outinpound"
|
||||
import { synchronizeData } from "@/api/measurement/operation/outinpound"
|
||||
import SearchSelect from "@/components/SearchSelect/index.vue";
|
||||
//导入过磅申请的列表查询。
|
||||
import { listPoundappli, getPoundappli, delPoundappli, addPoundappli, updatePoundappli } from "@/api/measurement/bill/poundappli"
|
||||
|
@ -499,7 +499,6 @@ import {mulToString,mulToArray} from "@/api/tool/util.js"
|
|||
import { getSearchSelectData } from "@/api/tool/gen.js";
|
||||
//引入searchData组件
|
||||
import {selectConfigs} from "@/components/SearchSelect/searchdata.js";
|
||||
import { listJob, runJob} from "@/api/monitor/job";
|
||||
export default {
|
||||
name: "Outinpound",
|
||||
components: {SearchSelect},
|
||||
|
@ -548,15 +547,6 @@ export default {
|
|||
weightTimer: null, // 存储定时器ID
|
||||
// 表单参数
|
||||
form: {},
|
||||
//定时任务参数
|
||||
TaskQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
jobName: null,
|
||||
invokeTarget: 'apiTask.getOAData()',
|
||||
jobGroup: undefined,
|
||||
status: undefined
|
||||
},
|
||||
tabs: [
|
||||
{ name: 'weighingRequest', label: '过磅申请' },
|
||||
{ name: 'tareRequest', label: '过皮申请' },
|
||||
|
@ -1112,12 +1102,9 @@ export default {
|
|||
//同步定时任务
|
||||
synchronizeData(){
|
||||
this.loading = true;
|
||||
listJob(this.TaskQueryParams).then(response => {
|
||||
let row = response.rows[0];
|
||||
runJob(row.jobId, row.jobGroup).then(response =>{
|
||||
this.$modal.msgSuccess("执行成功,同步详情可在定时任务日志查看");
|
||||
this.loading = false;
|
||||
})
|
||||
synchronizeData().then(response => {
|
||||
this.$modal.msgSuccess("执行成功,同步详情可在定时任务日志查看");
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue