|
|
@ -4,21 +4,18 @@ import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
|
import com.epmet.commons.tools.annotation.MaskResponse; |
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|
|
@ -33,14 +30,15 @@ import com.epmet.dto.form.IcPartyMemberListFormDTO; |
|
|
|
import com.epmet.dto.result.ImportTaskCommonResultDTO; |
|
|
|
import com.epmet.dto.result.PartyMemberAgeResultDTO; |
|
|
|
import com.epmet.dto.result.PartyMemberEducationResultDTO; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyOrgService; |
|
|
|
import com.epmet.modules.partymember.excel.IcPartyMemberExcel; |
|
|
|
import com.epmet.modules.partymember.service.IcPartyMemberService; |
|
|
|
import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; |
|
|
|
import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO; |
|
|
|
import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; |
|
|
|
import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO; |
|
|
|
import com.epmet.resi.partymember.dto.partymember.result.PartymemberPortraitResultDTO; |
|
|
|
import com.epmet.utils.ImportTaskUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
@ -59,10 +57,7 @@ import java.io.InputStream; |
|
|
|
import java.io.PrintWriter; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
|
|
|
@ -79,8 +74,10 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IcPartyMemberService icPartyMemberService; |
|
|
|
// @Autowired
|
|
|
|
// private IcPartyOrgDao icPartyOrgDao;
|
|
|
|
@Autowired |
|
|
|
private IcPartyOrgDao icPartyOrgDao; |
|
|
|
private IcPartyOrgService icPartyOrgService; |
|
|
|
|
|
|
|
@RequestMapping("page") |
|
|
|
@MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) |
|
|
@ -230,6 +227,26 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @describe: 统计分析-党员年龄范围统计 |
|
|
|
* @author wangtong |
|
|
|
* @date 2022/5/23 10:19 |
|
|
|
* @params [formDTO] |
|
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.commons.tools.dto.result.OptionDataResultDTO>> |
|
|
|
*/ |
|
|
|
@PostMapping("partymemberagestatistics") |
|
|
|
public Result<List<OptionDataResultDTO>> partyMemberAgeStatistics(@LoginUser TokenDto tokenDto,@RequestBody IcPartyMemberFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getOrgId())){ |
|
|
|
IcPartyOrgEntity org =icPartyOrgService.getIcPartyOrg(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
if (null == org) { |
|
|
|
return new Result<List<OptionDataResultDTO>>().ok(new ArrayList<>()); |
|
|
|
} |
|
|
|
formDTO.setOrgId(org.getId()); |
|
|
|
} |
|
|
|
return new Result<List<OptionDataResultDTO>>().ok(icPartyMemberService.partyMemberAgeStatistics(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @describe: 统计分析-党员学历统计 |
|
|
|
* @author wangtong |
|
|
@ -240,7 +257,7 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
@PostMapping("partymembereducationstatistics") |
|
|
|
public Result<List<OptionDataResultDTO>> partyMemberEducationStatistics(@LoginUser TokenDto tokenDto, @RequestBody IcPartyMemberFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getOrgId())){ |
|
|
|
IcPartyOrgEntity org = setOrgId(tokenDto); |
|
|
|
IcPartyOrgEntity org= icPartyOrgService.getIcPartyOrg(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
if (null == org) { |
|
|
|
return new Result<List<OptionDataResultDTO>>().ok(new ArrayList<>()); |
|
|
|
} |
|
|
@ -260,7 +277,7 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
@MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) |
|
|
|
public Result<PageData<PartyMemberAgeResultDTO>> partyMemberAgelist(@LoginUser TokenDto tokenDto,@RequestBody IcPartyMemberListFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getOrgId())){ |
|
|
|
IcPartyOrgEntity org = setOrgId(tokenDto); |
|
|
|
IcPartyOrgEntity org= icPartyOrgService.getIcPartyOrg(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
if (null == org) { |
|
|
|
return new Result<PageData<PartyMemberAgeResultDTO>>().ok(new PageData<>(Collections.emptyList(), 0)); |
|
|
|
} |
|
|
@ -280,7 +297,7 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
@MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) |
|
|
|
public Result<PageData<PartyMemberEducationResultDTO>> partyMemberEducationlist(@LoginUser TokenDto tokenDto,@RequestBody IcPartyMemberListFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getOrgId())){ |
|
|
|
IcPartyOrgEntity org = setOrgId(tokenDto); |
|
|
|
IcPartyOrgEntity org= icPartyOrgService.getIcPartyOrg(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
if (null == org) { |
|
|
|
return new Result<PageData<PartyMemberEducationResultDTO>>().ok(new PageData<>(Collections.emptyList(), 0)); |
|
|
|
} |
|
|
@ -289,43 +306,116 @@ public class IcPartyMemberController implements ResultDataResolver { |
|
|
|
return new Result<PageData<PartyMemberEducationResultDTO>>().ok(icPartyMemberService.getPartyMemberEducationList(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @describe: 统计分析-党员年龄范围统计 |
|
|
|
* @author wangtong |
|
|
|
* @date 2022/5/23 10:19 |
|
|
|
* @params [formDTO] |
|
|
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.commons.tools.dto.result.OptionDataResultDTO>> |
|
|
|
*/ |
|
|
|
@PostMapping("partymemberagestatistics") |
|
|
|
public Result<List<OptionDataResultDTO>> partyMemberAgeStatistics(@LoginUser TokenDto tokenDto,@RequestBody IcPartyMemberFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getOrgId())){ |
|
|
|
IcPartyOrgEntity org = setOrgId(tokenDto); |
|
|
|
if (null == org) { |
|
|
|
return new Result<List<OptionDataResultDTO>>().ok(new ArrayList<>()); |
|
|
|
* 烟台党员画像列表接口,将上方两个接口,合为一个 |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("partymember-portrait-list") |
|
|
|
@MaskResponse(fieldNames = {"mobile","idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE,MaskResponse.MASK_TYPE_ID_CARD}) |
|
|
|
public Result<PageData<PartymemberPortraitResultDTO>> queryPartyMemberPortraitList(@RequestBody IcPartyMemberListFormDTO formDTO) { |
|
|
|
return new Result<PageData<PartymemberPortraitResultDTO>>().ok(icPartyMemberService.queryPartyMemberPortraitList(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 烟台党员画像列表-导出 |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@NoRepeatSubmit |
|
|
|
@PostMapping("partymember-portrait-export") |
|
|
|
public void partymemberPortraitExport(@RequestBody IcPartyMemberListFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|
|
|
formDTO.setIsPage(true); |
|
|
|
String fileName=getPartymemberPortraitFileName(formDTO.getCodeType(),formDTO.getCode()); |
|
|
|
try { |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), PartymemberPortraitResultDTO.class).build(); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|
|
|
PageData<PartymemberPortraitResultDTO> data = null; |
|
|
|
List<PartymemberPortraitResultDTO> list = null; |
|
|
|
do { |
|
|
|
data = icPartyMemberService.queryPartyMemberPortraitList(formDTO); |
|
|
|
list = data.getList(); |
|
|
|
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|
|
|
excelWriter.write(list, writeSheet); |
|
|
|
} while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); |
|
|
|
} catch (EpmetException e) { |
|
|
|
response.reset(); |
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|
|
|
PrintWriter printWriter = response.getWriter(); |
|
|
|
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); |
|
|
|
printWriter.write(JSON.toJSONString(result)); |
|
|
|
printWriter.close(); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("党员画像列表导出exception", e); |
|
|
|
} finally { |
|
|
|
if (excelWriter != null) { |
|
|
|
excelWriter.finish(); |
|
|
|
} |
|
|
|
formDTO.setOrgId(org.getId()); |
|
|
|
} |
|
|
|
return new Result<List<OptionDataResultDTO>>().ok(icPartyMemberService.partyMemberAgeStatistics(formDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @describe: 组装党组织信息 |
|
|
|
* @author wangtong |
|
|
|
* @date 2022/7/8 16:46 |
|
|
|
* @params [tokenDto, formDTO] |
|
|
|
* @return com.epmet.modules.partyOrg.entity.IcPartyOrgEntity |
|
|
|
*/ |
|
|
|
public IcPartyOrgEntity setOrgId(TokenDto tokenDto){ |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException("获取工作人员信息失败"); |
|
|
|
* 烟台党员画像列表-导出 |
|
|
|
* @return 返回导出excel的文件名 |
|
|
|
*/ |
|
|
|
private String getPartymemberPortraitFileName(String codeType, String code) { |
|
|
|
String name = "党员画像"; |
|
|
|
if ("age".equals(codeType)) { |
|
|
|
switch (code) { |
|
|
|
case NumConstant.ZERO_STR: |
|
|
|
name = "50岁以下党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.ONE_STR: |
|
|
|
name = "50-59岁党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.TWO_STR: |
|
|
|
name = "60-69岁党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.THREE_STR: |
|
|
|
name = "70-79岁党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.FOUR_STR: |
|
|
|
name = "80岁以上党员信息"; |
|
|
|
break; |
|
|
|
default: |
|
|
|
name = ""; |
|
|
|
break; |
|
|
|
} |
|
|
|
}else if ("education".equals(codeType)) { |
|
|
|
switch (code) { |
|
|
|
case NumConstant.ZERO_STR: |
|
|
|
name = "小学及文盲党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.ONE_STR: |
|
|
|
name = "初中学历党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.TWO_STR: |
|
|
|
name = "高中学历党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.THREE_STR: |
|
|
|
name = "大专学历党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.FOUR_STR: |
|
|
|
name = "本科学历党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.FIVE_STR: |
|
|
|
name = "硕士学历党员信息"; |
|
|
|
break; |
|
|
|
case NumConstant.SIX_STR: |
|
|
|
name = "博士学历党员信息"; |
|
|
|
break; |
|
|
|
default: |
|
|
|
name = "党员画像"; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
//获取工作人员所属组织同级的党组织
|
|
|
|
LambdaQueryWrapper<IcPartyOrgEntity> orgWrapper = new LambdaQueryWrapper<>(); |
|
|
|
orgWrapper.eq(IcPartyOrgEntity::getCustomerId, tokenDto.getCustomerId()); |
|
|
|
orgWrapper.eq(IcPartyOrgEntity::getAgencyId, staffInfo.getAgencyId()); |
|
|
|
orgWrapper.ne(IcPartyOrgEntity::getPartyOrgType, NumConstant.FIVE_STR); |
|
|
|
return icPartyOrgDao.selectOne(orgWrapper); |
|
|
|
String fileName=name+DateUtils.format(new Date()) + ".xlsx"; |
|
|
|
return fileName; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|