8 changed files with 272 additions and 0 deletions
@ -0,0 +1,41 @@ |
|||
package com.epmet.task; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 获取楼栋的数据存入ca_开头的表 |
|||
* |
|||
* @param |
|||
* @return |
|||
* @author LZN |
|||
* @date 2022/6/6 14:37 |
|||
*/ |
|||
@Slf4j |
|||
@Component("getPreserLouDongVation") |
|||
public class GuardarDatosLouDongTask implements ITask { |
|||
|
|||
@Autowired |
|||
private GuardarDatosFeignClient guardarDatosFeignClient; |
|||
|
|||
@Override |
|||
public void run(String params) { |
|||
log.info("LouDong定时任务执行,参数为:" + params); |
|||
PreserVationFormDTO formDTO = new PreserVationFormDTO(); |
|||
if (StringUtils.isNotBlank(params)) { |
|||
formDTO = JSON.parseObject(params, PreserVationFormDTO.class); |
|||
} |
|||
Result result = guardarDatosFeignClient.getPreserLouDongVation(formDTO); |
|||
if (result.success()){ |
|||
log.debug("LouDong执行成功"); |
|||
}else{ |
|||
log.debug("LouDong执行失败" + result.getMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.task; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* 获取平房的数据存入ca_开头的表 |
|||
* |
|||
* @param |
|||
* @return |
|||
* @author LZN |
|||
* @date 2022/6/6 14:37 |
|||
*/ |
|||
@Component("getPreserPingFangVation") |
|||
@Slf4j |
|||
public class GuardarDatosPingFangTask implements ITask { |
|||
|
|||
@Resource |
|||
private GuardarDatosFeignClient feignClient; |
|||
|
|||
@Override |
|||
public void run(String params) { |
|||
PreserVationFormDTO formDTO = new PreserVationFormDTO(); |
|||
if (StringUtils.isNotBlank(params)) { |
|||
formDTO = JSON.parseObject(params, PreserVationFormDTO.class); |
|||
} |
|||
Result result = feignClient.getPreserPingFangVation(formDTO); |
|||
if (result.success()) { |
|||
log.debug("pingfang执行成功"); |
|||
} else { |
|||
log.debug("pingfang执行失败" + result.getMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.task; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 获取出租房的数据存入ca_开头的表 |
|||
* |
|||
* @param |
|||
* @return |
|||
* @author LZN |
|||
* @date 2022/6/6 14:38 |
|||
*/ |
|||
@Component("getPreserRentalVation") |
|||
@Slf4j |
|||
public class GuardarDatosRentalTask implements ITask { |
|||
|
|||
@Autowired |
|||
private GuardarDatosFeignClient feignClient; |
|||
|
|||
@Override |
|||
public void run(String params) { |
|||
PreserVationFormDTO formDTO = new PreserVationFormDTO(); |
|||
if (StringUtils.isNotBlank(params)) { |
|||
formDTO = JSON.parseObject(params, PreserVationFormDTO.class); |
|||
} |
|||
Result result = feignClient.getPreserRentalVation(formDTO); |
|||
if (result.success()) { |
|||
log.debug("Rental执行成功"); |
|||
}else{ |
|||
log.debug("Rental执行失败" + result.getMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.task; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* 获取人口的数据存入ca_开头的表 |
|||
* |
|||
* @param |
|||
* @return |
|||
* @author LZN |
|||
* @date 2022/6/6 14:39 |
|||
*/ |
|||
@Component("getPreserResidentVation") |
|||
@Slf4j |
|||
public class GuardarDatosResidentTask implements ITask { |
|||
|
|||
@Resource |
|||
private GuardarDatosFeignClient feignClient; |
|||
|
|||
@Override |
|||
public void run(String params) { |
|||
PreserVationFormDTO formDTO = new PreserVationFormDTO(); |
|||
if (StringUtils.isNotBlank(params)) { |
|||
formDTO = JSON.parseObject(params, PreserVationFormDTO.class); |
|||
} |
|||
Result result = feignClient.getPreserResidentVation(formDTO); |
|||
if (result.success()) { |
|||
log.debug("Resident执行成功"); |
|||
} else { |
|||
log.debug("Resident执行失败" + result.getMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.task; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 获取流动人口的数据存入ca_开头的表 |
|||
* |
|||
* @param |
|||
* @return |
|||
* @author LZN |
|||
* @date 2022/6/6 14:39 |
|||
*/ |
|||
@Component("getPreserRotatorsVation") |
|||
@Slf4j |
|||
public class GuardarDatosRotatorsTask implements ITask { |
|||
|
|||
@Autowired |
|||
private GuardarDatosFeignClient guardarDatosFeignClient; |
|||
|
|||
@Override |
|||
public void run(String params) { |
|||
PreserVationFormDTO formDTO = new PreserVationFormDTO(); |
|||
if (StringUtils.isNotBlank(params)) { |
|||
formDTO = JSON.parseObject(params, PreserVationFormDTO.class); |
|||
} |
|||
Result result = guardarDatosFeignClient.getPreserRotatorsVation(formDTO); |
|||
if (result.success()) { |
|||
log.debug("Rotators执行成功"); |
|||
} else { |
|||
log.debug("Rotators执行失败" + result.getMsg()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.opendata.feign; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.impl.GuardarDatosFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
@FeignClient(name = "open-data-worker-server",fallback = GuardarDatosFeignClientFallBack.class) |
|||
public interface GuardarDatosFeignClient { |
|||
|
|||
@PostMapping(value = "/opendata/caLoudong/preserLouDongVation") |
|||
Result getPreserLouDongVation(PreserVationFormDTO dto); |
|||
|
|||
@PostMapping(value = "/opendata/caPingfang/preserPingFangVation") |
|||
Result getPreserPingFangVation(PreserVationFormDTO dto); |
|||
|
|||
@PostMapping("/opendata/caRental/preserRentalVation") |
|||
Result getPreserRentalVation(PreserVationFormDTO dto); |
|||
|
|||
@PostMapping("/opendata/caResident/preserResidentVation") |
|||
Result getPreserResidentVation(PreserVationFormDTO dto); |
|||
|
|||
@PostMapping("/opendata/caRotators/preserRotatorsVation") |
|||
Result getPreserRotatorsVation(PreserVationFormDTO dto); |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.epmet.opendata.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.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.feign.GuardarDatosFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
public class GuardarDatosFeignClientFallBack implements GuardarDatosFeignClient { |
|||
|
|||
@Override |
|||
public Result getPreserLouDongVation(PreserVationFormDTO dto) { |
|||
return ModuleUtils.feignConError("open-data-worker", "getPreserLouDongVation", dto); |
|||
} |
|||
|
|||
@Override |
|||
public Result getPreserPingFangVation(PreserVationFormDTO dto) { |
|||
return ModuleUtils.feignConError("open-data-worker", "getPreserPingFangVation", dto); |
|||
} |
|||
|
|||
@Override |
|||
public Result getPreserRentalVation(PreserVationFormDTO dto) { |
|||
return ModuleUtils.feignConError("open-data-worker", "getPreserRentalVation", dto); |
|||
} |
|||
|
|||
@Override |
|||
public Result getPreserResidentVation(PreserVationFormDTO dto) { |
|||
return ModuleUtils.feignConError("open-data-worker", "getPreserResidentVation", dto); |
|||
} |
|||
|
|||
@Override |
|||
public Result getPreserRotatorsVation(PreserVationFormDTO dto) { |
|||
return ModuleUtils.feignConError("open-data-worker", "getPreserRotatorsVation", dto); |
|||
} |
|||
} |
Loading…
Reference in new issue