6 changed files with 120 additions and 8 deletions
			
			
		@ -0,0 +1,24 @@ | 
				
			|||||
 | 
					package com.epmet.feign; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
				
			||||
 | 
					import com.epmet.feign.impl.DataAggregatorFeignClientClientFallBackFactory; | 
				
			||||
 | 
					import org.springframework.cloud.openfeign.FeignClient; | 
				
			||||
 | 
					import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
 | 
					import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback = DataAggregatorFeignClientClientFallBackFactory.class) | 
				
			||||
 | 
					// @FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback= DataAggregatorFeignClientClientFallBackFactory.class,url = "localhost:8114")
 | 
				
			||||
 | 
					public interface DataAggregatorFeignClient { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 定时任务导出网格活跃统计表 | 
				
			||||
 | 
					     * @param form | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @PostMapping(value = "data/aggregator/org/export-send-msg") | 
				
			||||
 | 
					    Result exportGridLiveRes(@RequestBody GridLivelyFormDTO form); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					package com.epmet.feign.impl; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.ModuleUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
				
			||||
 | 
					import com.epmet.feign.DataAggregatorFeignClient; | 
				
			||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@Component | 
				
			||||
 | 
					public class DataAggregatorFeignClientClientFallBackFactory implements DataAggregatorFeignClient { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 定时任务导出网格活跃统计表 | 
				
			||||
 | 
					     * @param form | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public Result exportGridLiveRes(GridLivelyFormDTO form) { | 
				
			||||
 | 
					        return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "pcworkRecordListExportSendMsg",form); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,39 @@ | 
				
			|||||
 | 
					package com.epmet.task; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.alibaba.fastjson.JSON; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			||||
 | 
					import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
				
			||||
 | 
					import com.epmet.feign.DataAggregatorFeignClient; | 
				
			||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||
 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 每个星期一的凌晨5点执行,查询网格活跃度统计导出excel,上传oss, 发送钉钉@小雷哥 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Slf4j | 
				
			||||
 | 
					@Component("exportGridLiveResTask") | 
				
			||||
 | 
					public class ExportGridLiveResTask implements ITask { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private DataAggregatorFeignClient dataAggregatorFeignClient; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public void run(String params) { | 
				
			||||
 | 
					        if(StringUtils.isBlank(params)){ | 
				
			||||
 | 
					            return; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        GridLivelyFormDTO formDTO = new GridLivelyFormDTO(); | 
				
			||||
 | 
					        if (StringUtils.isNotBlank(params)) { | 
				
			||||
 | 
					            formDTO = JSON.parseObject(params, GridLivelyFormDTO.class); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(formDTO,GridLivelyFormDTO.Grid.class); | 
				
			||||
 | 
					        Result result = dataAggregatorFeignClient.exportGridLiveRes(formDTO); | 
				
			||||
 | 
					        if(!result.success()){ | 
				
			||||
 | 
					            log.error(String.format("exportGridLiveResTask网格活跃度统计导出失败,入参:%s",params)); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue