forked from rongchao/epmet-cloud-rizhao
13 changed files with 318 additions and 2 deletions
@ -0,0 +1,21 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.ProjectDTO; |
||||
|
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/10/26 15:19 |
||||
|
*/ |
||||
|
public interface ProjectSendMessageService { |
||||
|
/** |
||||
|
* 滞留提醒 |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/10/26 15:21 |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result |
||||
|
*/ |
||||
|
Result projectSendMessage(ExtractOriginFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.ProjectDTO; |
||||
|
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
||||
|
import com.epmet.feign.GovProjectOpenFeignClient; |
||||
|
import com.epmet.service.ProjectSendMessageService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/10/26 15:22 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ProjectSendMessageServiceImpl implements ProjectSendMessageService { |
||||
|
@Autowired |
||||
|
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
||||
|
|
||||
|
/** |
||||
|
* 滞留提醒 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/10/26 15:21 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Result projectSendMessage(ExtractOriginFormDTO formDTO) { |
||||
|
ProjectDTO projectDTO = new ProjectDTO(); |
||||
|
projectDTO.setCustomerId(formDTO.getCustomerId()); |
||||
|
return govProjectOpenFeignClient.sendMessageJob(projectDTO); |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.epmet.task; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.extract.form.ExtractOriginFormDTO; |
||||
|
import com.epmet.service.ProjectSendMessageService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/10/26 15:26 |
||||
|
*/ |
||||
|
@Component("projectSendMessageTask") |
||||
|
public class ProjectSendMessageTask implements ITask { |
||||
|
private Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectSendMessageService projectSendMessageService; |
||||
|
/** |
||||
|
* 执行定时任务接口 |
||||
|
* |
||||
|
* @param params 参数,多参数使用JSON数据 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void run(String params) { |
||||
|
logger.info("FactOriginExtractTask定时任务正在执行,参数为:{}", params); |
||||
|
ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO(); |
||||
|
if (StringUtils.isNotBlank(params)) { |
||||
|
formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); |
||||
|
} |
||||
|
Result result = projectSendMessageService.projectSendMessage(formDTO); |
||||
|
if (result.success()) { |
||||
|
logger.info("FactOriginExtractTask定时任务执行成功"); |
||||
|
} else { |
||||
|
logger.error("FactOriginExtractTask定时任务执行失败:" + result.getMsg()); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue