@@ -7,6 +7,8 @@ buildscript { | |||
dependencies { | |||
implementation "${groupname}:common-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:entity-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:comm-core:1.0.0-SNAPSHOT" | |||
implementation "${groupname}:inss-protocol:1.0.0-SNAPSHOT" | |||
implementation('cn.com.taiji.common:sso-client:2.3.10.7') | |||
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery" | |||
implementation "com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config" |
@@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.domain.EntityScan; | |||
import org.springframework.context.MessageSource; | |||
import org.springframework.context.annotation.AdviceMode; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.ComponentScan; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | |||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |||
@@ -30,9 +31,9 @@ import cn.com.taiji.iasq.model.MyFinals; | |||
basePackages = {"cn.com.taiji." + AppConfig.APP_NAME + ".repo.jpa", "cn.com.taiji.core.repo.jpa"}, | |||
repositoryFactoryBeanClass = MyJpaRespositoryFactoryBean.class) | |||
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ, proxyTargetClass = true) | |||
@ComponentScan(value = {"cn.com.taiji.core.manager.comm.client.feign"}) | |||
public class AppConfig extends AbstractManager { | |||
public static final String APP_NAME = "iasq"; | |||
@Autowired | |||
private MessageSource messageSource; | |||
@Autowired |
@@ -0,0 +1,174 @@ | |||
package cn.com.taiji.iasq.manager; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.binclient.ApiRequestException; | |||
import cn.com.taiji.common.model.file.FileProtocolSystemError; | |||
import cn.com.taiji.common.pub.LambdaTools; | |||
import cn.com.taiji.common.pub.json.JsonTools; | |||
import cn.com.taiji.common.validation.MyViolationException; | |||
import cn.com.taiji.core.manager.comm.client.IOFunction; | |||
import cn.com.taiji.core.manager.comm.client.feign.FeignClientManager; | |||
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeRequest; | |||
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeResponse; | |||
import cn.com.taiji.core.model.comm.protocol.SignJsonResponse; | |||
import cn.com.taiji.core.model.comm.protocol.valid.FieldMsgBuilder; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
import feign.RetryableException; | |||
import org.apache.http.NoHttpResponseException; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import java.io.IOException; | |||
import java.util.concurrent.Callable; | |||
public abstract class AbstractCommManager extends AbstractManager { | |||
@Autowired | |||
protected FeignClientManager feignClientManager; | |||
/** | |||
* <pre> | |||
* 重复3次提交请求,会将调接口错误的响应转换成前端的响应 | |||
* </pre> | |||
*/ | |||
public <RS extends AbstractSignTypeResponse> RS jsonPostRepeat(AbstractSignTypeRequest<RS> req) | |||
throws ManagerException { | |||
return jsonPost(req, r -> jsonPostRepeat(r, 3)); | |||
} | |||
/** | |||
* <pre> | |||
* 重复提交业务请求 | |||
* 1、IO异常重试请求,如果多次IO错误抛出异常 | |||
* 2、ApiRequestException 707返回new 创建的response | |||
* 3、ApiRequestException 其它错误抛异常 | |||
* </pre> | |||
*/ | |||
public <RS extends AbstractSignTypeResponse> RS jsonPostRepeat(AbstractSignTypeRequest<RS> req, int repeat) | |||
throws IOException { | |||
for (int i = 0; i < repeat; i++) { | |||
try { | |||
return feignClientManager.jsonPost(req, req.getResponseType()); | |||
} catch (NoHttpResponseException e) { | |||
logger.error("第 {} NoHttpResponseException:{}", i + 1, e.getMessage()); | |||
if (i >= repeat - 1) { | |||
throw e; | |||
} | |||
} catch (IOException e) { | |||
logger.error("第 {} 次执行Exception:{}", i + 1, e.getMessage()); | |||
if (i >= repeat - 1) { | |||
throw e; | |||
} | |||
} catch (ApiRequestException e) { | |||
if (e.getErrCode() == 707) { | |||
// 707压住异常 | |||
try { | |||
return req.getResponseType().getDeclaredConstructor().newInstance(); | |||
} catch (Exception ex) { | |||
throw new RuntimeException(ex); | |||
} | |||
} | |||
throw e; | |||
} | |||
} | |||
return null; | |||
} | |||
/** | |||
* 会将调接口错误的响应转换成前端的响应 | |||
*/ | |||
public <RE extends AbstractSignTypeRequest<RS>, RS extends AbstractSignTypeResponse> RS jsonPost(RE req, | |||
IOFunction<RE, RS> f) throws ManagerException { | |||
RS res = null; | |||
try { | |||
res = f.apply(req); | |||
return res; | |||
} catch (ApiRequestException e) { | |||
logger.error("", e); | |||
if (e.getErrCode() == FileProtocolSystemError.SIGN_FAILED.getCode()) { | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
SignJsonResponse jsonRes = toJsonResponse(e); | |||
assert jsonRes != null; | |||
if (e.getErrCode() == GlyServiceError.FORMAT_VALIDATE_ERR.getCode()) { | |||
throw toFieldErrorException(jsonRes, FieldMsgConvertor.defaultConvertor);// 页面上会显示到字段旁边 | |||
} | |||
if (e.getErrCode() == GlyServiceError.BUSINESS_VALIDATE_ERR.getCode()) { | |||
logger.error("BUSINESS_ERROR:ifCode:{},reqId{} \n {}", req.getServiceCommand().getIfCode(), | |||
req.getReqId(), jsonRes); | |||
throw new ManagerException(jsonRes.getErrorMsg());// 业务校验出错 | |||
} | |||
if (e.getErrCode() == FileProtocolSystemError.UNKNOWN_ERROR.getCode()) { | |||
logger.error("UNKNOWN_ERROR:ifCode:{},reqId{} \n {}", req.getServiceCommand().getIfCode(), | |||
req.getReqId(), jsonRes); | |||
throw new ManagerException("网络错误!");// 实际是服务端报错 | |||
} | |||
if (e.getErrCode() == FileProtocolSystemError.IO_ERROR.getCode()) { | |||
logger.error("IO_ERROR:ifCode:{},reqId{}", req.getServiceCommand().getIfCode(), req.getReqId()); | |||
throw new ManagerException("网络错误...");// 实际是服务端报错 | |||
} | |||
if (e.getErrCode() == 10000) {//中台接口失败 | |||
logger.error("中台接口失败:ifCode:{},reqId{}", req.getServiceCommand().getIfCode(), req.getReqId()); | |||
throw new ManagerException("网络错误。");// 实际是服务端报错 | |||
} | |||
throw new ManagerException("未知错误:" + jsonRes.getErrorMsg()); | |||
} catch (NoHttpResponseException e) { | |||
logger.error("NoHttpResponseException:ifCode:{},reqId{}", req.getServiceCommand().getIfCode(), | |||
req.getReqId(), e); | |||
throw new ManagerException("网络中断异常!"); | |||
} catch (IOException e) { | |||
logger.error("网络异常!:ifCode:{},reqId{} ", req.getServiceCommand().getIfCode(), req.getReqId()); | |||
e.printStackTrace(); | |||
throw new ManagerException("网络异常!"); | |||
} catch (RetryableException e) { | |||
logger.error("RetryableException:ifCode:{},reqId{}", req.getServiceCommand().getIfCode(), req.getReqId(), | |||
e); | |||
throw new ManagerException("服务不可用异常!"); | |||
} | |||
} | |||
/** | |||
* 当不想自己捕获异常时、当你不对异常做什么处理时可调用该方法 | |||
* | |||
*/ | |||
public <V> V doSafe(Callable<V> call) { | |||
try { | |||
return call.call(); | |||
} catch (Exception e) { | |||
logger.error("", e); | |||
// if (logManager != null) { | |||
// logManager.addConsoleLog(FeeBusinessType.EXCEPTION, businessId, "error", e.getMessage()); | |||
// } | |||
return null; | |||
} | |||
} | |||
private SignJsonResponse toJsonResponse(ApiRequestException e) { | |||
String responseJson = e.getMessage().substring(0, e.getMessage().length() - 4); | |||
try { | |||
return JsonTools.json2Object(responseJson, SignJsonResponse.class); | |||
} catch (IOException e1) { | |||
logger.error("转换json出错 json:\n{} \n exception:{}", responseJson, e1.getMessage()); | |||
} | |||
return null; | |||
} | |||
private RuntimeException toFieldErrorException(SignJsonResponse jsonResponse, FieldMsgConvertor convertor) { | |||
try { | |||
logger.info("JsonResponse:\n{}", jsonResponse.toJson(true)); | |||
FieldMsgBuilder msg = JsonTools.json2Object(jsonResponse.getErrorMsg(), FieldMsgBuilder.class); | |||
if (convertor != null) { | |||
msg = convertor.convert(msg); | |||
} | |||
MyViolationException ne = new MyViolationException(); | |||
msg.getMap().forEach((k, v) -> { | |||
ne.addViolation(k, LambdaTools.doMapJoining(v, a -> a, ";")); | |||
}); | |||
return ne; | |||
} catch (IOException ioe) { | |||
logger.error("转换json出错 json:{},\ne:{}", jsonResponse.getErrorMsg(), jsonResponse); | |||
return new RuntimeException("转换json出错"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
package cn.com.taiji.iasq.manager; | |||
import cn.com.taiji.core.model.comm.protocol.valid.FieldMsgBuilder; | |||
import java.util.Map; | |||
public interface FieldMsgConvertor { | |||
public FieldMsgBuilder convert(FieldMsgBuilder msg); | |||
public static FieldMsgConvertor defaultConvertor = a -> a; | |||
public static FieldMsgConvertor mapPropertyName(final Map<String, String> map) { | |||
return oldMsg -> { | |||
FieldMsgBuilder msg = new FieldMsgBuilder(); | |||
oldMsg.getMap().forEach((k, v) -> { | |||
if (map.containsKey(k)) { | |||
msg.getMap().put(map.get(k), v); | |||
} else { | |||
msg.getMap().put(k, v); | |||
} | |||
}); | |||
return msg; | |||
}; | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQryCardBatchManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,34 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryCardBatch; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardBatchRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardBatchResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryCardBatchRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQryCardBatchManagerImpl extends AbstractCommManager implements VfjQryCardBatchManager{ | |||
@Autowired | |||
private InvwQryCardBatchRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--卡片发行批次列表查询开始--"); | |||
VfjQryCardBatchRequest request = new VfjQryCardBatchRequest(); | |||
VfjQryCardBatchResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--卡片发行批次列表查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryCardBatch entity = new InvwQryCardBatch(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--卡片发行批次列表查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQryCardBatchTask extends AbstractCronTask { | |||
public VfjQryCardBatchTask() { | |||
super(TaskInfo.VFJ_QRY_CARD_BATCH); | |||
} | |||
@Autowired | |||
private VfjQryCardBatchManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQryCardsManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,34 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryCards; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardsRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardsResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryCardsRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQryCardsManagerImpl extends AbstractCommManager implements VfjQryCardsManager{ | |||
@Autowired | |||
private InvwQryCardsRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--卡片发行批次列查询开始--"); | |||
VfjQryCardsRequest request = new VfjQryCardsRequest(); | |||
VfjQryCardsResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--卡片发行批次列查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryCards entity = new InvwQryCards(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--卡片发行批次列查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQryCardsTask extends AbstractCronTask { | |||
public VfjQryCardsTask() { | |||
super(TaskInfo.VFJ_QRY_CARDS); | |||
} | |||
@Autowired | |||
private VfjQryCardsManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQrySmObuBatchManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,38 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryCards; | |||
import cn.com.taiji.core.entity.invw.InvwQryObuBatch; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardsRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQryCardsResponse; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQrySmObuBatchRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQrySmObuBatchResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryCardsRepo; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryObuBatchRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQrySmObuBatchManagerImpl extends AbstractCommManager implements VfjQrySmObuBatchManager{ | |||
@Autowired | |||
private InvwQryObuBatchRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--OBU发行批次列表查询开始--"); | |||
VfjQrySmObuBatchRequest request = new VfjQrySmObuBatchRequest(); | |||
VfjQrySmObuBatchResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--OBU发行批次列表查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryObuBatch entity = new InvwQryObuBatch(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--OBU发行批次列表查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQrySmObuBatchTask extends AbstractCronTask { | |||
public VfjQrySmObuBatchTask() { | |||
super(TaskInfo.VFJ_QRY_SM_OBU_BATCH); | |||
} | |||
@Autowired | |||
private VfjQrySmObuBatchManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryObus; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryGmobusRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryGmobusResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryObusRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryGmobusImpl extends AbstractCommManager implements VfjQueryGmobusManager{ | |||
@Autowired | |||
private InvwQryObusRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--双片国密OBU发行批次列表查询开始--"); | |||
VfjQueryGmobusRequest request = new VfjQueryGmobusRequest(); | |||
VfjQueryGmobusResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--双片国密OBU发行批次列表查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryObus entity = new InvwQryObus(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--双片国密OBU发行批次列表查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQueryGmobusManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryGmobusTask extends AbstractCronTask { | |||
public VfjQueryGmobusTask() { | |||
super(TaskInfo.VFJ_QRY_GM_OBUS); | |||
} | |||
@Autowired | |||
private VfjQueryGmobusManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQueryScobusManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,36 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryObus; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryGmobusRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryGmobusResponse; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryScobusRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryScobusResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryObusRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryScobusManagerImpl extends AbstractCommManager implements VfjQueryGmobusManager{ | |||
@Autowired | |||
private InvwQryObusRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--双片国密OBU发行批次列表查询开始--"); | |||
VfjQueryScobusRequest request = new VfjQueryScobusRequest(); | |||
VfjQueryScobusResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--双片国密OBU发行批次列表查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryObus entity = new InvwQryObus(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--双片国密OBU发行批次列表查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryScobusTask extends AbstractCronTask { | |||
public VfjQueryScobusTask() { | |||
super(TaskInfo.VFJ_QRY_CS_OBUS); | |||
} | |||
@Autowired | |||
private VfjQueryScobusManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
public interface VfjQueryTriDesObusManager { | |||
void execute(); | |||
} |
@@ -0,0 +1,36 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.core.entity.invw.InvwQryObus; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryScobusRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryScobusResponse; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryTriDesObusRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.VfjQueryTriDesObusResponse; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwQryObusRepo; | |||
import cn.com.taiji.iasq.manager.AbstractCommManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryTriDesObusManagerImpl extends AbstractCommManager implements VfjQueryGmobusManager{ | |||
@Autowired | |||
private InvwQryObusRepo repo; | |||
@Override | |||
public void execute() { | |||
logger.info("--DESOBU发行批次列表查询开始--"); | |||
VfjQueryTriDesObusRequest request = new VfjQueryTriDesObusRequest(); | |||
VfjQueryTriDesObusResponse response = null; | |||
try { | |||
response = jsonPostRepeat(request); | |||
} catch (ManagerException e) { | |||
logger.error("--DESOBU发行批次列表查询失败:", e); | |||
e.printStackTrace(); | |||
} | |||
InvwQryObus entity = new InvwQryObus(); | |||
BeanUtils.copyProperties(response, entity); | |||
repo.save(entity); | |||
logger.info("--DESOBU发行批次列表查询结束--"); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package cn.com.taiji.iasq.manager.quartz.vfj; | |||
import cn.com.taiji.common.manager.quartz.AbstractCronTask; | |||
import cn.com.taiji.iasq.model.TaskInfo; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class VfjQueryTriDesObusTask extends AbstractCronTask { | |||
public VfjQueryTriDesObusTask() { | |||
super(TaskInfo.VFJ_QRY_TRI_DES_OBUS); | |||
} | |||
@Autowired | |||
private VfjQueryTriDesObusManager manager; | |||
@Override | |||
public void run() { | |||
manager.execute(); | |||
} | |||
} |
@@ -30,6 +30,16 @@ public class CronPara extends AbstractSysConf { | |||
private String sample = "1 * * * * ?"; | |||
private String timeStep = "1/10 * * * * ?"; | |||
// VFJ //每天凌晨1点半执行一次 | |||
private String vfjQryCardBatch = "0 30 1 * * ?"; | |||
private String vfjQryCards = "0 30 1 * * ?"; | |||
private String vfjQrySmObuBatch = "0 30 1 * * ?"; | |||
private String vfjQryGmObus = "0 30 1 * * ?"; | |||
private String vfjQryCsObus = "0 30 1 * * ?"; | |||
private String vfjQryTriDesObus = "0 30 1 * * ?"; | |||
public CronPara() { | |||
super(SysConfType.CRON_PARA); | |||
} |
@@ -14,6 +14,7 @@ package cn.com.taiji.iasq.model; | |||
public enum TaskGroup { | |||
SYSTEM("系统内置") {}, | |||
SAMPLE("示例") {}, | |||
VFJ("省联网中心") {}, | |||
; | |||
private final String value; | |||
@@ -20,7 +20,15 @@ import cn.com.taiji.common.manager.quartz.PriorityTaskDefinition; | |||
*/ | |||
public enum TaskInfo implements PriorityTaskDefinition { | |||
SAMPLE("示例", TaskGroup.SYSTEM, "sample", 60, true, List.of(1, 2)), | |||
TIME_STEP("按时间段执行的任务", TaskGroup.SYSTEM, "timeStep", 600, true, List.of(1, 2,3)),; | |||
TIME_STEP("按时间段执行的任务", TaskGroup.SYSTEM, "timeStep", 600, true, List.of(1, 2,3)), | |||
VFJ_QRY_CARD_BATCH("卡片发行批次列表查询", TaskGroup.VFJ, "vfjQryCardBatch", 3600*2, true, List.of(1, 2,3)), | |||
VFJ_QRY_CARDS("卡片一发查询", TaskGroup.VFJ, "vfjQryCards", 3600*2, true, List.of(1, 2,3)), | |||
VFJ_QRY_SM_OBU_BATCH("OBU发行批次列表查询", TaskGroup.VFJ, "vfjQrySmObuBatch", 3600*2, true, List.of(1, 2,3)), | |||
VFJ_QRY_GM_OBUS("双片国密OBU一次发行明细查询", TaskGroup.VFJ, "vfjQryGmObus", 3600*2, true, List.of(1, 2,3)), | |||
VFJ_QRY_CS_OBUS("单片OBU一次发行明细查询", TaskGroup.VFJ, "vfjQryCsObus", 3600*2, true, List.of(1, 2,3)), | |||
VFJ_QRY_TRI_DES_OBUS("单片OBU一次发行明细查询", TaskGroup.VFJ, "vfjQryTriDesObus", 3600*2, true, List.of(1, 2,3)), | |||
; | |||
private String info; | |||
private final String cronParaPropertyName; |