parent
922e663e42
commit
f9fb072baa
@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.pt.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.annotation.Alias;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Keyperson)表实体类
|
||||||
|
*
|
||||||
|
* @author wu
|
||||||
|
* @since 2024-04-26 17:24:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("实体类")
|
||||||
|
@TableName(value = "keyperson")
|
||||||
|
public class Keyperson implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -45344189272733752L;
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
@Alias(value = "RYLX_NAME")
|
||||||
|
private String aspect1;
|
||||||
|
@Alias(value = "RYLXDETAIL_NAME")
|
||||||
|
private String aspect2;
|
||||||
|
@Alias(value = "XM")
|
||||||
|
private String keypersonName;
|
||||||
|
@Alias(value = "LXDH")
|
||||||
|
private String keypersonTel;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.pt.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.pt.entity.Keyperson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Keyperson)表数据库访问层
|
||||||
|
*
|
||||||
|
* @author wu
|
||||||
|
* @since 2024-04-26 17:24:36
|
||||||
|
*/
|
||||||
|
public interface KeypersonMapper extends BaseMapper<Keyperson> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除重点人员数据
|
||||||
|
*/
|
||||||
|
void delAll();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.ruoyi.pt.quartz;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.pt.entity.Keyperson;
|
||||||
|
import com.ruoyi.pt.service.KeypersonService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取重点人员数据
|
||||||
|
*
|
||||||
|
* @author wu
|
||||||
|
* @since 2024/4/26 下午5:30
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@EnableScheduling
|
||||||
|
@Async
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("remoteCall/test")
|
||||||
|
//@Api(tags = "获取重点人员数据")
|
||||||
|
public class KeypersonQuartz {
|
||||||
|
|
||||||
|
public static final Logger log = LoggerFactory.getLogger(KeypersonQuartz.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeypersonService keypersonService;
|
||||||
|
|
||||||
|
@Value("${keyPersonUrl}")
|
||||||
|
private String keyPersonUrl;
|
||||||
|
|
||||||
|
// @GetMapping("/zdry")
|
||||||
|
// @ApiOperation(value = "获取重点人员数据")
|
||||||
|
@Scheduled(cron = "0 30 2 * * ?")
|
||||||
|
public synchronized void pushData() {
|
||||||
|
log.info("==============获取重点人员数据开始" + LocalDateTime.now() + "============");
|
||||||
|
|
||||||
|
String res = HttpRequest.get(keyPersonUrl)
|
||||||
|
.header("appId", "szjsc")
|
||||||
|
.header("appSecret", "cUuC51fB").execute().body();
|
||||||
|
JSONObject resObj = JSON.parseObject(res);
|
||||||
|
String dataList = resObj.getString("data");
|
||||||
|
List<Keyperson> list = JSONUtil.toList(dataList, Keyperson.class);
|
||||||
|
log.info("==============获取重点人员数据条数" + list.size() + "============");
|
||||||
|
// 删除重点人员数据
|
||||||
|
keypersonService.delAll();
|
||||||
|
// 保存重点人员数据
|
||||||
|
keypersonService.saveBatch(list);
|
||||||
|
log.info("==============获取重点人员数据结束" + LocalDateTime.now() + "============");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.pt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.pt.entity.Keyperson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Keyperson)表服务接口
|
||||||
|
*
|
||||||
|
* @author wu
|
||||||
|
* @since 2024-04-26 17:24:36
|
||||||
|
*/
|
||||||
|
public interface KeypersonService extends IService<Keyperson> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除重点人员数据
|
||||||
|
*/
|
||||||
|
void delAll();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.pt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.pt.mapper.KeypersonMapper;
|
||||||
|
import com.ruoyi.pt.entity.Keyperson;
|
||||||
|
import com.ruoyi.pt.service.KeypersonService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (Keyperson)表服务实现类
|
||||||
|
*
|
||||||
|
* @author wu
|
||||||
|
* @since 2024-04-26 17:24:36
|
||||||
|
*/
|
||||||
|
@Service("keypersonService")
|
||||||
|
public class KeypersonServiceImpl extends ServiceImpl<KeypersonMapper, Keyperson> implements KeypersonService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除重点人员数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void delAll() {
|
||||||
|
baseMapper.delAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.pt.mapper.KeypersonMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="delAll">
|
||||||
|
TRUNCATE TABLE keyperson
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in new issue