8 changed files with 172 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||
package com.elink.esua.epdc.modules.item.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.modules.item.service.ItemService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* |
|||
* 项目上报网格化平台管理 |
|||
* |
|||
* @Author:liuchuang |
|||
* @Date:2019/12/25 11:16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("platform/item") |
|||
public class EpdcPlatformItemController { |
|||
|
|||
@Autowired |
|||
private ItemService itemService; |
|||
|
|||
/** |
|||
* |
|||
* 拉取市北网格化平台项目进度情况 |
|||
* |
|||
* @params [] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author liuchuang |
|||
* @since 2019/12/25 11:21 |
|||
*/ |
|||
@GetMapping(value = "query") |
|||
public Result queryItemHandle() { |
|||
return itemService.queryItemHandle(); |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.fallback.ItemFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
/** |
|||
* |
|||
* 项目模块调用 |
|||
* |
|||
* @Author:liuchuang |
|||
* @Date:2019/12/25 11:07 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_EVENTS_SERVER, fallback = ItemFeignClientFallback.class) |
|||
public interface ItemFeignClient { |
|||
|
|||
/** |
|||
* |
|||
* 拉取市北网格化平台项目进度情况 |
|||
* |
|||
* @params [] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author liuchuang |
|||
* @since 2019/12/25 11:11 |
|||
*/ |
|||
@GetMapping(value = "events/platform/item/query", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result queryItemHandle(); |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.ItemFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @Author:liuchuang |
|||
* @Date:2019/12/25 11:07 |
|||
*/ |
|||
@Component |
|||
public class ItemFeignClientFallback implements ItemFeignClient { |
|||
|
|||
@Override |
|||
public Result queryItemHandle() { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "queryItemHandle", ""); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.elink.esua.epdc.task.events; |
|||
|
|||
/** |
|||
* @Author:liuchuang |
|||
* @Date:2019/12/25 11:00 |
|||
*/ |
|||
public interface ItemReportHandleQueryTask { |
|||
|
|||
/** |
|||
* |
|||
* 拉取市北网格化平台项目进度情况 |
|||
* |
|||
* @params [params] |
|||
* @return void |
|||
* @author liuchuang |
|||
* @since 2019/12/25 11:02 |
|||
*/ |
|||
void run(String params); |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.task.events; |
|||
|
|||
import com.elink.esua.epdc.feign.ItemFeignClient; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @Author:liuchuang |
|||
* @Date:2019/12/25 11:01 |
|||
*/ |
|||
@Component("ItemHandleQueryTask") |
|||
public class ItemReportHandleQueryTaskImpl implements ItemReportHandleQueryTask { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(getClass()); |
|||
|
|||
@Autowired |
|||
private ItemFeignClient itemFeignClient; |
|||
|
|||
@Override |
|||
public void run(String params){ |
|||
logger.debug("ItemHandleQueryTask定时任务正在执行,参数为:{}", params); |
|||
itemFeignClient.queryItemHandle(); |
|||
} |
|||
} |
Loading…
Reference in new issue