Commit 8854008a authored by hanfeng's avatar hanfeng

修改实名认证异步设置积分

parent 0bb68725
......@@ -12,6 +12,7 @@ import com.xxfc.platform.universal.biz.MQServiceBiZ;
import com.xxfc.platform.universal.entity.IdInformation;
import com.xxfc.platform.universal.service.CertificationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.task.TaskExecutor;
......@@ -21,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
......@@ -46,9 +50,11 @@ public class CertificationController {
private TaskExecutor executor;
@Autowired
MQServiceBiZ mqServiceBiZ;
private MQServiceBiZ mqServiceBiZ;
private ExecutorService executorService = Executors.newCachedThreadPool();
/**
* 实名认证
* @param idInformation
......@@ -90,15 +96,18 @@ public class CertificationController {
if (type!=null&&type==0){
ObjectRestResponse<Integer> result = certificationService.certificate(idInformation);
if (result.getRel()) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
setIntegral(appUserDTO.getUserid(),result.getData());
}
});
thread.start();
CompletableFuture.supplyAsync(()->{
setIntegral(appUserDTO.getUserid(),result.getData());
return null;
},executorService);
// Thread thread = new Thread(new Runnable() {
// @Override
// public void run() {
// setIntegral(appUserDTO.getUserid(),result.getData());
// }
// });
// thread.start();
}
return result ;
}
} catch (Exception e) {
......
......@@ -23,6 +23,10 @@ import org.springframework.stereotype.Service;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -41,6 +45,8 @@ public class TrafficViolationsService {
private String CODE;
@Value("${RETURN.TYPE}")
private String TYPE;
private ExecutorService executorService= Executors.newCachedThreadPool();
/**
* 下列参数,根据使用不同的公司的接口进行修改
*/
......@@ -190,6 +196,13 @@ public class TrafficViolationsService {
List<LicensePlateType> finalLicensePlateTypes = licensePlateTypes;
CompletableFuture.supplyAsync(()->{
insertLicensePlateType(finalLicensePlateTypes);
return null;
},executorService);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
......
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