|
@ -2,11 +2,23 @@ package com.qs.serve.common.framework.manager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.qs.serve.common.config.DevEnvironmentConfig; |
|
|
import com.qs.serve.common.config.DevEnvironmentConfig; |
|
|
|
|
|
import com.qs.serve.common.util.AuthContextUtils; |
|
|
import com.qs.serve.common.util.JsonUtil; |
|
|
import com.qs.serve.common.util.JsonUtil; |
|
|
import com.qs.serve.common.util.SpringUtils; |
|
|
import com.qs.serve.common.util.SpringUtils; |
|
|
import com.qs.serve.modules.sys.entity.SysOperationLog; |
|
|
import com.qs.serve.modules.sys.entity.SysOperationLog; |
|
|
import com.qs.serve.modules.sys.mapper.SysOperationLogMapper; |
|
|
import com.qs.serve.modules.sys.mapper.SysOperationLogMapper; |
|
|
|
|
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
|
|
|
|
|
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
|
|
|
|
|
import com.qs.serve.modules.tbs.service.impl.TbsCostApplyOperationServiceImpl; |
|
|
|
|
|
import com.qs.serve.modules.tzc.service.impl.TzcPolicyOperationServiceImpl; |
|
|
|
|
|
import com.qs.serve.modules.vtb.entity.VtbVerification; |
|
|
|
|
|
import com.qs.serve.modules.vtb.service.VtbVerificationApplication; |
|
|
|
|
|
import com.qs.serve.modules.vtb.service.impl.VtbVerificationOperationServiceImpl; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.springframework.beans.BeansException; |
|
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.TimerTask; |
|
|
import java.util.TimerTask; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -14,6 +26,7 @@ import java.util.TimerTask; |
|
|
* @author YenHex |
|
|
* @author YenHex |
|
|
* @since 2022/2/24 |
|
|
* @since 2022/2/24 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
public class AsyncFactory { |
|
|
public class AsyncFactory { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -33,4 +46,89 @@ public class AsyncFactory { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 异步保存政策状态 |
|
|
|
|
|
* @param policyId |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public static TimerTask submitPolicy(Long policyId) { |
|
|
|
|
|
return new TimerTask() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
AuthContextUtils.setTenant("001"); |
|
|
|
|
|
Thread.sleep(10*1000); |
|
|
|
|
|
log.debug("submitPolicy"); |
|
|
|
|
|
TzcPolicyOperationServiceImpl operationService = SpringUtils.getBean(TzcPolicyOperationServiceImpl.class); |
|
|
|
|
|
String summeryResult = operationService.checkAffairSummery(policyId.toString()); |
|
|
|
|
|
if(summeryResult.equals(TzcPolicyOperationServiceImpl.SummeryState_Success)){ |
|
|
|
|
|
//调用成功回调方法
|
|
|
|
|
|
TbsAffairCommitBo finishedParam = new TbsAffairCommitBo(); |
|
|
|
|
|
finishedParam.setPolicyId(policyId); |
|
|
|
|
|
operationService.doFinished(finishedParam); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 异步保存费用申请状态 |
|
|
|
|
|
* @param costApply |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public static TimerTask submitCostApply(TbsCostApply costApply) { |
|
|
|
|
|
return new TimerTask() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
AuthContextUtils.setTenant("001"); |
|
|
|
|
|
Thread.sleep(10*1000); |
|
|
|
|
|
log.debug("submitCostApply"); |
|
|
|
|
|
TbsCostApplyOperationServiceImpl applyOperationService = SpringUtils.getBean(TbsCostApplyOperationServiceImpl.class); |
|
|
|
|
|
String summeryResult = applyOperationService.checkAffairSummery(costApply.getId().toString()); |
|
|
|
|
|
if(summeryResult.equals(TbsCostApplyOperationServiceImpl.SummeryState_Success)){ |
|
|
|
|
|
//调用成功回调方法
|
|
|
|
|
|
TbsAffairCommitBo finishedParam = new TbsAffairCommitBo(); |
|
|
|
|
|
finishedParam.setCostApplyId(costApply.getId()); |
|
|
|
|
|
applyOperationService.doFinished(finishedParam); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 异步保存核销状态 |
|
|
|
|
|
* @param verification |
|
|
|
|
|
* @param totalAmount |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public static TimerTask saveVtbSubmit(VtbVerification verification, BigDecimal totalAmount) { |
|
|
|
|
|
return new TimerTask() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
AuthContextUtils.setTenant("001"); |
|
|
|
|
|
Thread.sleep(10*1000); |
|
|
|
|
|
log.debug("saveVtbSubmit"); |
|
|
|
|
|
VtbVerificationOperationServiceImpl verificationOperationService = SpringUtils.getBean(VtbVerificationOperationServiceImpl.class); |
|
|
|
|
|
String summeryResult = verificationOperationService.checkAffairSummery(verification.getId().toString()); |
|
|
|
|
|
if(summeryResult.equals(VtbVerificationOperationServiceImpl.SummeryState_Success)){ |
|
|
|
|
|
//调用成功回调方法
|
|
|
|
|
|
VtbVerificationApplication verificationApplication = SpringUtils.getBean(VtbVerificationApplication.class); |
|
|
|
|
|
verificationApplication.finishCallBack(verification, totalAmount); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|