Commit 3d77677a by 墨竹

fix:新增删除定时任务方法

parent f070bf4b
......@@ -11,20 +11,20 @@ public interface TestApiService {
* @param id
* @return
*/
public String checkThread(String id,Long expireTime);
String checkThread(String id, Long expireTime);
/**
* 拉取自己部门企业微信通讯录
* @return
*/
public String listSelfQywxUser(String corpid,String secretVal, String dataId);
String listSelfQywxUser(String corpid, String secretVal, String dataId);
/**
* 拉取所有部门企业微信通讯录
* @return
*/
public String listAllQywxUser(String corpid,String secretVal, String dataId);
String listAllQywxUser(String corpid, String secretVal, String dataId);
/**
* 创建定时器
......@@ -33,12 +33,22 @@ public interface TestApiService {
* @param methodName
* @param cron
*/
public void quartzTaskConvert(String serviceName, String methodName, String cron, String params);
void quartzTaskConvert(String serviceName, String methodName, String cron, String params);
/**
* 删除定时器
*
* @param serviceName 服务名称
* @param methodName 方法名称
* @param referId 引用id
*/
void delQuartzTask(String serviceName, String methodName, String referId);
/**
* 拉取所有部门企业微信通讯录
* @return
*/
public ServiceResponse listAllQywxUser(String params);
ServiceResponse listAllQywxUser(String params);
}
......@@ -65,7 +65,7 @@ public class TestController extends WebBaseController {
*/
@RequestMapping("/create-quarter_key")
@ResponseBody
public HaobanResponse testListVo(String key) {
public HaobanResponse createQuarterKey(String key) {
QuartzEnum quartzEnum = QuartzEnum.getByKey(key);
if (null == quartzEnum) {
return resultResponse(HaoBanErrCode.ERR_0);
......@@ -81,8 +81,8 @@ public class TestController extends WebBaseController {
*/
@RequestMapping("/create-quarter")
@ResponseBody
public HaobanResponse testListVo(String serviceName, String methodName, String cron, String params) {
if (StringUtils.isAnyBlank(serviceName,methodName,cron)) {
public HaobanResponse createQuarter(String serviceName, String methodName, String cron, String params) {
if (StringUtils.isAnyBlank(serviceName, methodName, cron)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
testApiService.quartzTaskConvert(serviceName, methodName, cron, params);
......@@ -90,6 +90,22 @@ public class TestController extends WebBaseController {
}
/**
* 创建定时器
*
* @return
*/
@RequestMapping("/del-quarter")
@ResponseBody
public HaobanResponse delQuarter(String serviceName, String methodName, String referId) {
if (StringUtils.isAnyBlank(serviceName, methodName, referId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
testApiService.delQuartzTask(serviceName, methodName, referId);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/sharing-import")
@ResponseBody
public HaobanResponse sharingImport(String key) {
......@@ -194,6 +210,7 @@ public class TestController extends WebBaseController {
/**
* 刷新整个企业好友
*
* @param wxEnterpriseId
* @return
*/
......
......@@ -7,6 +7,7 @@
<bean class="com.gic.authcenter.commons.util.AuthInterceptor"/>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/test/**"/>
<mvc:exclude-mapping path="/get-pic-code"/>
<mvc:exclude-mapping path="/phone-login"/>
<mvc:exclude-mapping path="/upload-file*"/>
......
package com.gic.haoban.manage.service.service.out.impl;
import java.util.List;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.task.api.service.QuartzApiService;
import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by tgs on 2020/2/9.
*/
......@@ -95,7 +90,15 @@ public class TestServiceImpl implements TestApiService {
//延迟多少秒执行
taskDTO.setTaskTimeInfo(cron);
quartzService.addOrUpdateQuartzTask(taskDTO);
}
@Override
public void delQuartzTask(String serviceName, String methodName, String referId) {
QuartzTaskDTO taskDTO = new QuartzTaskDTO();
taskDTO.setTaskService(serviceName);
taskDTO.setTaskMethod(methodName);
taskDTO.setReferId(referId);
quartzService.delQuartzTask(taskDTO);
}
@Override
......
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