Commit 8854008a authored by hanfeng's avatar hanfeng

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

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