diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ThreadDispatcherConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ThreadDispatcherConfig.java new file mode 100644 index 0000000000..1b2d32c2cc --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/config/ThreadDispatcherConfig.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *
+ * https://www.renren.io + *
+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.RequestContextFilter; +import org.springframework.web.servlet.DispatcherServlet; + +import javax.annotation.PostConstruct; + + +/** + * DESC:设置线程继承属性为true,便于子线程获取到父线程的request,两个都设置为了保险 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Configuration +public class ThreadDispatcherConfig { + + @Autowired + RequestContextFilter requestContextFilter; + @Autowired + DispatcherServlet dispatcherServlet; + + @PostConstruct + public void init() { + // 设置线程继承属性为true,便于子线程获取到父线程的request,两个都设置为了保险。 + requestContextFilter.setThreadContextInheritable(true); + dispatcherServlet.setThreadContextInheritable(true); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 400e3893e4..77875d5415 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -171,4 +171,7 @@ public interface Constant { * 被禁用标识 * */ String DISABLE = "disable"; + + String OPITON_SOURCE_REMOTE = "remote"; + String OPITON_SOURCE_LOCAL = "local"; } diff --git a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java index a1630c821e..064b59610e 100644 --- a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java +++ b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java @@ -10,6 +10,7 @@ package com.epmet; import com.epmet.commons.tools.aspect.ServletExceptionHandler; import com.epmet.commons.tools.config.RedissonConfig; +import com.epmet.commons.tools.config.ThreadDispatcherConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -27,7 +28,7 @@ import org.springframework.context.annotation.FilterType; @EnableDiscoveryClient @EnableFeignClients //@ServletComponentScan -@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ServletExceptionHandler.class})) +@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class})) public class GatewayApplication { public static void main(String[] args) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiExportBaseInfoData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiExportBaseInfoData.java new file mode 100644 index 0000000000..5dc0d0b7c5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/ResiExportBaseInfoData.java @@ -0,0 +1,27 @@ +package com.epmet.bean; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:导出居民信息 基础信息 给其他sheet使用 + */ +@Data +public class ResiExportBaseInfoData implements Serializable { + private static final long serialVersionUID = 1L; + + private String GRID_ID; + private String VILLAGE_ID; + private String BUILD_ID; + private String UNIT_ID; + private String HOME_ID; + private String IS_BDHJ; + private String NAME; + private String MOBILE; + private String GENDER; + private String ID_CARD; + private String BIRTHDAY; + private String CONTACTS; + private String CONTACTS_MOBILE; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 1350ce159f..303d951526 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -24,6 +24,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper; import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -293,6 +294,7 @@ public class IcResiUserController { @RequestMapping(value = "/exportExcel") public void exportExcelByEasyExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { //tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02"); + long startM = System.currentTimeMillis(); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); String staffOrgPath = null; if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { @@ -322,7 +324,7 @@ public class IcResiUserController { map.putIfAbsent(tableName,exportItem); String columnName = item.getColumnName().concat(item.getColumnNum() == NumConstant.ZERO ? StrConstant.EPMETY_STR : item.getColumnNum().toString()); exportItem.getItemMap().put(columnName,item); - if (item.getOptionSourceType().equals("remote")&&item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ + if (Constant.OPITON_SOURCE_REMOTE.equals(item.getOptionSourceType())&&item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ //多个参数 String[] paramArr = item.getOptionSourceValue().split(StrConstant.QUESTION_MARK_TRANSFER)[NumConstant.ONE].split(StrConstant.AND_MARK); Arrays.stream(paramArr).forEach(o->{ @@ -346,7 +348,7 @@ public class IcResiUserController { .collect(Collectors.toList()); List