Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
yinzuomei 3 years ago
parent
commit
d33133c2ae
  1. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java
  2. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  3. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  4. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  5. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  6. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/AsyncConfig.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.config; package com.epmet.commons.tools.config;
import com.alibaba.ttl.TtlRunnable;
import com.alibaba.ttl.threadpool.TtlExecutors; import com.alibaba.ttl.threadpool.TtlExecutors;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -64,8 +65,9 @@ public class AsyncConfig {
executor.setKeepAliveSeconds(keepAliveSeconds); executor.setKeepAliveSeconds(keepAliveSeconds);
// 设置装饰器,使用MDC将runnable进行装饰,实现日志上下文传递到子线程 // 设置装饰器,使用MDC将runnable进行装饰,实现日志上下文传递到子线程
executor.setTaskDecorator((Runnable r) -> { executor.setTaskDecorator((Runnable r) -> {
// 1.mdc包装,日志追踪
Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap(); Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap();
return () -> { Runnable rr = () -> {
try { try {
if (copyOfContextMap != null && copyOfContextMap.size() > 0) { if (copyOfContextMap != null && copyOfContextMap.size() > 0) {
MDC.setContextMap(copyOfContextMap); MDC.setContextMap(copyOfContextMap);
@ -75,6 +77,9 @@ public class AsyncConfig {
MDC.clear(); MDC.clear();
} }
}; };
// 2.ttl包装,异步线程上下文透传
return TtlRunnable.get(rr);
}); });
executor.initialize(); executor.initialize();
return executor; return executor;

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -85,8 +85,8 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
private IcNatRelationDao icNatRelationDao; private IcNatRelationDao icNatRelationDao;
@Autowired @Autowired
private IcResiUserDao icResiUserDao; private IcResiUserDao icResiUserDao;
@Autowired //@Autowired
private UserService userService; //private UserService userService;
/** /**
* @Author sun * @Author sun
@ -310,7 +310,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
} }
} }
@Async("executorService") @Async
@Override @Override
public void execAsyncExcelImport(Path filePath, String importTaskId) { public void execAsyncExcelImport(Path filePath, String importTaskId) {
String userId = null; String userId = null;
@ -320,7 +320,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); String app = EpmetRequestHolder.getHeader(AppClientConstant.APP);
String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT);
LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId); LoginUserDetailsResultDTO loginUserDetails = SpringContextUtils.getBean(UserService.class).getLoginUserDetails(app, client, userId);
String agencyId = loginUserDetails.getAgencyId(); String agencyId = loginUserDetails.getAgencyId();

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -539,14 +539,14 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
List<String> errors = new ArrayList<>(); List<String> errors = new ArrayList<>();
if (idCard.length() > 18) { if (StringUtils.isNotBlank(idCard) && idCard.length() > 18) {
// 身份证号超长了哦,不可以的 // 身份证号超长了哦,不可以的
errors.add("身份证号过长,限制18位"); errors.add("身份证号过长");
} }
if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) { if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) {
// 手机号超长也是不可以的 // 手机号超长也是不可以的
errors.add("手机号过长,限制15位"); errors.add("手机号过长");
} }
if (errors.size() > 0) { if (errors.size() > 0) {

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -120,8 +120,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private IcUserTransferRecordService icUserTransferRecordService; private IcUserTransferRecordService icUserTransferRecordService;
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Resource //@Resource
private IcNatService icNatService; //private IcNatService icNatService;
//@Resource //@Resource
//private IcVaccineService icVaccineService; //private IcVaccineService icVaccineService;
@Resource @Resource
@ -1354,7 +1354,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
IcResiUserEntity icResiUser = baseDao.selectById(formDTO.getId()); IcResiUserEntity icResiUser = baseDao.selectById(formDTO.getId());
if (null != icResiUser) { if (null != icResiUser) {
//核酸检测 //核酸检测
List<NatListDTO> natList = icNatService.getNatList(formDTO.getCustomerId(), icResiUser.getIdCard()); List<NatListDTO> natList = SpringContextUtils.getBean(IcNatService.class).getNatList(formDTO.getCustomerId(), icResiUser.getIdCard());
result.setNatList(natList); result.setNatList(natList);
//疫苗接种 //疫苗接种
List<VaccineListDTO> vaccineList = SpringContextUtils.getBean(IcVaccineService.class).getVaccineList(formDTO.getCustomerId(), icResiUser.getIdCard()); List<VaccineListDTO> vaccineList = SpringContextUtils.getBean(IcVaccineService.class).getVaccineList(formDTO.getCustomerId(), icResiUser.getIdCard());

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -334,7 +334,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Async("executorService") @Async
@Override @Override
public void execAsyncExcelImport(Path filePath, String importTaskId,String customerId,String userId) { public void execAsyncExcelImport(Path filePath, String importTaskId,String customerId,String userId) {
try { try {

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

@ -160,7 +160,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
} }
} }
@Async("executorService") @Async
@Override @Override
public void execAsyncExcelImport(Path filePath, String importTaskId) { public void execAsyncExcelImport(Path filePath, String importTaskId) {
String userId = null; String userId = null;

Loading…
Cancel
Save