Commit 711096ee authored by hanfeng's avatar hanfeng

修改违章,把查询到的车型代码和类型保存到数据库3

parent 0cf880f4
......@@ -17,10 +17,20 @@ import java.util.List;
@Service
public class LicensePlateTypeBiz extends BaseBiz<LicensePlateTypeMapper, LicensePlateType> {
/**
* 获取车牌类型和和编码
* @param licensePlateTypes
*/
@Transactional
public void insertLicensePlateType(List<LicensePlateType> licensePlateTypes) {
mapper.insertLicensePlateType(licensePlateTypes);
}
/**
* 修改数据库数据
* @param licensePlateTypes
* @throws SQLException
*/
@Transactional
public void updateLicensePlateType(List<LicensePlateType> licensePlateTypes) throws SQLException {
// List<LicensePlateType> saveLicensePlateTypes = mapper.selectAll();
......
......@@ -17,6 +17,7 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.sql.SQLException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -38,7 +39,9 @@ public class TrafficViolationsService {
private String CODE;
@Value("${RETURN.TYPE}")
private String TYPE;
/**
* 下列参数,根据使用不同的公司的接口进行修改
*/
private static final String CITY_HOST = "https://weizhang.market.alicloudapi.com";
private static final String CITY_PATH = "/wz/province";
private static final String CITY_METHOD = "GET";
......@@ -125,7 +128,7 @@ public class TrafficViolationsService {
/**
* Unicode转汉字字符串
* Unicode转汉字字符串(根据接口返回编码的类型使用)
* @param str
* @return
*/
......@@ -191,8 +194,12 @@ public class TrafficViolationsService {
return licensePlateTypes;
}
@Scheduled(cron = "0 0 0 0/3 * *")
private void updateLicensePlateType(){
/**
* 定时修改车牌类型
* @throws SQLException
*/
@Scheduled(cron = "0 0 0 0/7 * ?")
private void updateLicensePlateType() throws SQLException {
List<LicensePlateType> licensePlateTypes = licensePlateTypeBiz.selectListAll();
licensePlateTypeBiz.updateLicensePlateType(licensePlateTypes);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment