|  | @@ -5,6 +5,8 @@ import cn.hutool.core.collection.ListUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.date.DateTime;
 | 
	
		
			
				|  |  |  import cn.hutool.core.date.DateUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.ObjectUtil;
 | 
	
		
			
				|  |  | +import com.alibaba.excel.EasyExcel;
 | 
	
		
			
				|  |  | +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 | 
	
	
		
			
				|  | @@ -18,6 +20,7 @@ import com.xunmei.common.core.domain.OrgTreeResp;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.enums.OrgTypeEnum;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.exception.ServiceException;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.utils.bean.BeanUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.page.TableDataInfo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.redis.utils.RedisUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.security.utils.DictUtils;
 | 
	
	
		
			
				|  | @@ -30,9 +33,7 @@ import com.xunmei.system.dto.SysOrgDto;
 | 
	
		
			
				|  |  |  import com.xunmei.system.mapper.SysOrgMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.system.mapper.SysUserMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.system.service.ISysOrgService;
 | 
	
		
			
				|  |  | -import com.xunmei.system.util.ConstructionDetailExport;
 | 
	
		
			
				|  |  | -import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
 | 
	
		
			
				|  |  | -import com.xunmei.system.util.SecurityWorkExport;
 | 
	
		
			
				|  |  | +import com.xunmei.system.util.*;
 | 
	
		
			
				|  |  |  import io.netty.util.internal.StringUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -41,8 +42,12 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.annotation.PostConstruct;
 | 
	
		
			
				|  |  | +import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  | +import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.net.URLEncoder;
 | 
	
		
			
				|  |  |  import java.time.LocalDate;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.concurrent.atomic.AtomicInteger;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -1100,4 +1105,132 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 | 
	
		
			
				|  |  |          List<SysOrg> sysOrgs = baseMapper.selectOrgs(org);
 | 
	
		
			
				|  |  |          return sysOrgs;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void exportOrgExtend(SysOrg dept, HttpServletResponse response) throws IOException {
 | 
	
		
			
				|  |  | +        List<Integer> typeList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        if (dept.getType() != null){
 | 
	
		
			
				|  |  | +            typeList.add(dept.getType());
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            typeList.add(4);//营业网点
 | 
	
		
			
				|  |  | +            typeList.add(5);//离行式自助银行
 | 
	
		
			
				|  |  | +            typeList.add(6);//中心业务库
 | 
	
		
			
				|  |  | +            typeList.add(10);//监控中心
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        Long parentId = dept.getParentId();
 | 
	
		
			
				|  |  | +        if (parentId == null) {
 | 
	
		
			
				|  |  | +            parentId = SecurityUtils.getLoginUser().getSysUser().getOrgId();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        SysOrg sysOrg = sysOrgMapper.selectById(parentId);
 | 
	
		
			
				|  |  | +        //查询条件
 | 
	
		
			
				|  |  | +        if (sysOrg != null) {
 | 
	
		
			
				|  |  | +            //下穿
 | 
	
		
			
				|  |  | +            if (dept.getCheckSub()) {
 | 
	
		
			
				|  |  | +                dept.setParentId(null);
 | 
	
		
			
				|  |  | +                dept.setPath(sysOrg.getPath());
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                dept.setPath(sysOrg.getPath());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<OrgExtendExport> orgExtendExports= null;
 | 
	
		
			
				|  |  | +        orgExtendExports = baseMapper.exportOrgExtend(dept, typeList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (dept.getType() != null){
 | 
	
		
			
				|  |  | +            switch (dept.getType()){
 | 
	
		
			
				|  |  | +                case 4:
 | 
	
		
			
				|  |  | +                    List<OrgExtendYYWDExport> yywdList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    for (OrgExtendExport export : orgExtendExports) {
 | 
	
		
			
				|  |  | +                        OrgExtendYYWDExport yywdExport = new OrgExtendYYWDExport();
 | 
	
		
			
				|  |  | +                        BeanUtils.copyProperties(export, yywdExport);
 | 
	
		
			
				|  |  | +                        yywdList.add(yywdExport);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    AtomicInteger yywdxh = new AtomicInteger();
 | 
	
		
			
				|  |  | +                    yywdxh.getAndIncrement();
 | 
	
		
			
				|  |  | +                    yywdList.forEach(e -> {
 | 
	
		
			
				|  |  | +                        e.setXh(String.valueOf(yywdxh.getAndIncrement()));
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    // 设置响应头
 | 
	
		
			
				|  |  | +                    response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("机构补充信息-营业网点", "utf-8"));
 | 
	
		
			
				|  |  | +                    response.setContentType("application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +                    response.setCharacterEncoding("utf-8");
 | 
	
		
			
				|  |  | +                    // 数据导出
 | 
	
		
			
				|  |  | +                    EasyExcel.write(response.getOutputStream(), OrgExtendYYWDExport.class)
 | 
	
		
			
				|  |  | +                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息-营业网点").doWrite(yywdList);
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  | +                case 5:
 | 
	
		
			
				|  |  | +                    List<OrgExtendLHSZZExport> lhzzsList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    for (OrgExtendExport export : orgExtendExports) {
 | 
	
		
			
				|  |  | +                        OrgExtendLHSZZExport lhszzExport = new OrgExtendLHSZZExport();
 | 
	
		
			
				|  |  | +                        BeanUtils.copyProperties(export, lhszzExport);
 | 
	
		
			
				|  |  | +                        lhzzsList.add(lhszzExport);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    AtomicInteger lhzzsxh = new AtomicInteger();
 | 
	
		
			
				|  |  | +                    lhzzsxh.getAndIncrement();
 | 
	
		
			
				|  |  | +                    lhzzsList.forEach(e -> {
 | 
	
		
			
				|  |  | +                        e.setXh(String.valueOf(lhzzsxh.getAndIncrement()));
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    // 设置响应头
 | 
	
		
			
				|  |  | +                    response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("机构补充信息-离行式自助银行", "utf-8"));
 | 
	
		
			
				|  |  | +                    response.setContentType("application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +                    response.setCharacterEncoding("utf-8");
 | 
	
		
			
				|  |  | +                    // 数据导出
 | 
	
		
			
				|  |  | +                    EasyExcel.write(response.getOutputStream(), OrgExtendLHSZZExport.class)
 | 
	
		
			
				|  |  | +                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息-离行式自助银行").doWrite(lhzzsList);
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  | +                case 6:
 | 
	
		
			
				|  |  | +                    List<OrgExtendZXYWKExport> zxywkList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    for (OrgExtendExport export : orgExtendExports) {
 | 
	
		
			
				|  |  | +                        OrgExtendZXYWKExport zxywkExport = new OrgExtendZXYWKExport();
 | 
	
		
			
				|  |  | +                        BeanUtils.copyProperties(export, zxywkExport);
 | 
	
		
			
				|  |  | +                        zxywkList.add(zxywkExport);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    AtomicInteger zxywkxh = new AtomicInteger();
 | 
	
		
			
				|  |  | +                    zxywkxh.getAndIncrement();
 | 
	
		
			
				|  |  | +                    zxywkList.forEach(e -> {
 | 
	
		
			
				|  |  | +                        e.setXh(String.valueOf(zxywkxh.getAndIncrement()));
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    // 设置响应头
 | 
	
		
			
				|  |  | +                    response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("机构补充信息-中心业务库", "utf-8"));
 | 
	
		
			
				|  |  | +                    response.setContentType("application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +                    response.setCharacterEncoding("utf-8");
 | 
	
		
			
				|  |  | +                    // 数据导出
 | 
	
		
			
				|  |  | +                    EasyExcel.write(response.getOutputStream(), OrgExtendZXYWKExport.class)
 | 
	
		
			
				|  |  | +                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息-中心业务库").doWrite(zxywkList);
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  | +                case 10:
 | 
	
		
			
				|  |  | +                    List<OrgExtendJKZXExport> jkzxList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    for (OrgExtendExport export : orgExtendExports) {
 | 
	
		
			
				|  |  | +                        OrgExtendJKZXExport jkzxExport = new OrgExtendJKZXExport();
 | 
	
		
			
				|  |  | +                        BeanUtils.copyProperties(export, jkzxExport);
 | 
	
		
			
				|  |  | +                        jkzxList.add(jkzxExport);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    AtomicInteger jkzxxh = new AtomicInteger();
 | 
	
		
			
				|  |  | +                    jkzxxh.getAndIncrement();
 | 
	
		
			
				|  |  | +                    jkzxList.forEach(e -> {
 | 
	
		
			
				|  |  | +                        e.setXh(String.valueOf(jkzxxh.getAndIncrement()));
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    // 设置响应头
 | 
	
		
			
				|  |  | +                    response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("机构补充信息-监控中心", "utf-8"));
 | 
	
		
			
				|  |  | +                    response.setContentType("application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +                    response.setCharacterEncoding("utf-8");
 | 
	
		
			
				|  |  | +                    // 数据导出
 | 
	
		
			
				|  |  | +                    EasyExcel.write(response.getOutputStream(), OrgExtendJKZXExport.class)
 | 
	
		
			
				|  |  | +                            .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息-监控中心").doWrite(jkzxList);
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            // 设置响应头
 | 
	
		
			
				|  |  | +            response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("机构补充信息", "utf-8"));
 | 
	
		
			
				|  |  | +            response.setContentType("application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +            response.setCharacterEncoding("utf-8");
 | 
	
		
			
				|  |  | +            AtomicInteger xh = new AtomicInteger();
 | 
	
		
			
				|  |  | +            xh.getAndIncrement();
 | 
	
		
			
				|  |  | +            orgExtendExports.forEach(e -> {
 | 
	
		
			
				|  |  | +                e.setXh(String.valueOf(xh.getAndIncrement()));
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            // 数据导出
 | 
	
		
			
				|  |  | +            EasyExcel.write(response.getOutputStream(), OrgExtendExport.class)
 | 
	
		
			
				|  |  | +                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息").doWrite(orgExtendExports);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |