|
|
|
@ -120,49 +120,49 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
|
|
|
|
|
|
IPage<DgStatisticsPO> list = this.getBaseMapper().list(new Page(), new DgStatisticsRequest()); |
|
|
|
|
List<DgStatisticsPO> dgStatisticsPOList = list.getRecords(); |
|
|
|
|
if (dgStatisticsPOList == null) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
|
|
if (presenterIds.length != 0) { |
|
|
|
|
// 强制类型转换
|
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
|
} |
|
|
|
|
//ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
|
|
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); |
|
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
|
List<DgStatisticsExcelResponse> excelResponse = new ArrayList<>(); |
|
|
|
|
for (DgStatisticsListResponse dgStatisticsListResponse : listResponse) { |
|
|
|
|
DgStatisticsExcelResponse dgStatisticsExcelResponse = new DgStatisticsExcelResponse(); |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (dgStatisticsListResponse.getDepartment() != null && dgStatisticsListResponse.getDepartment().size() != 0) { |
|
|
|
|
for (int i = 0; i < dgStatisticsListResponse.getDepartment().size(); i++) { |
|
|
|
|
if (i == dgStatisticsListResponse.getDepartment().size() - 1) { |
|
|
|
|
stringBuilder.append(dgStatisticsListResponse.getDepartment().get(i)); |
|
|
|
|
} else { |
|
|
|
|
stringBuilder.append(dgStatisticsListResponse.getDepartment().get(i)).append(","); |
|
|
|
|
List<DgStatisticsExcelResponse> excelResponse = new ArrayList<>(); |
|
|
|
|
if (dgStatisticsPOList.size()>0) { |
|
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
|
|
if (presenterIds.length != 0) { |
|
|
|
|
// 强制类型转换
|
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
|
} |
|
|
|
|
//ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
|
|
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); |
|
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
|
|
|
|
|
|
for (DgStatisticsListResponse dgStatisticsListResponse : listResponse) { |
|
|
|
|
DgStatisticsExcelResponse dgStatisticsExcelResponse = new DgStatisticsExcelResponse(); |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (dgStatisticsListResponse.getDepartment() != null && dgStatisticsListResponse.getDepartment().size() != 0) { |
|
|
|
|
for (int i = 0; i < dgStatisticsListResponse.getDepartment().size(); i++) { |
|
|
|
|
if (i == dgStatisticsListResponse.getDepartment().size() - 1) { |
|
|
|
|
stringBuilder.append(dgStatisticsListResponse.getDepartment().get(i)); |
|
|
|
|
} else { |
|
|
|
|
stringBuilder.append(dgStatisticsListResponse.getDepartment().get(i)).append(","); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dgStatisticsExcelResponse.setDepartment(stringBuilder.toString()); |
|
|
|
|
BeanUtils.copyProperties(dgStatisticsListResponse, dgStatisticsExcelResponse); |
|
|
|
|
excelResponse.add(dgStatisticsExcelResponse); |
|
|
|
|
} |
|
|
|
|
dgStatisticsExcelResponse.setDepartment(stringBuilder.toString()); |
|
|
|
|
BeanUtils.copyProperties(dgStatisticsListResponse, dgStatisticsExcelResponse); |
|
|
|
|
excelResponse.add(dgStatisticsExcelResponse); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, excelResponse, "业务统计信息一览表", "statistics", new DgStatisticsExcelResponse()) |
|
|
|
|
.finish(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
try { |
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, excelResponse, "业务统计信息一览表", "statistics", new DgStatisticsExcelResponse()) |
|
|
|
|
.finish(); |
|
|
|
|
return true; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -263,47 +263,48 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
|
// 列表查询
|
|
|
|
|
IPage<DgStatisticsRefusePO> listRefuse = this.getBaseMapper().listRefuse(new Page(), new DgStatisticsRequest()); |
|
|
|
|
List<DgStatisticsRefusePO> statisticsRefusePOList = listRefuse.getRecords(); |
|
|
|
|
if (statisticsRefusePOList == null) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
Integer[] presenterIds = statisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
|
|
if (presenterIds.length != 0) { |
|
|
|
|
// 强制类型转换
|
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
|
} |
|
|
|
|
//ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
|
|
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); |
|
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
|
// 提单人姓名、部门拼装
|
|
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
|
List<DgStatisticsExcelRefuseResponse> excelResponse = new ArrayList<>(); |
|
|
|
|
for (DgStatisticsListRefuseResponse listRefuseResponse : listResponse) { |
|
|
|
|
DgStatisticsExcelRefuseResponse excelRefuseResponse = new DgStatisticsExcelRefuseResponse(); |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (listRefuseResponse.getDepartment() != null && listRefuseResponse.getDepartment().size() != 0) { |
|
|
|
|
for (int i = 0; i < listRefuseResponse.getDepartment().size(); i++) { |
|
|
|
|
if (i == listRefuseResponse.getDepartment().size() - 1) { |
|
|
|
|
stringBuilder.append(listRefuseResponse.getDepartment().get(i)); |
|
|
|
|
} else { |
|
|
|
|
stringBuilder.append(listRefuseResponse.getDepartment().get(i)).append(","); |
|
|
|
|
List<DgStatisticsExcelRefuseResponse> excelResponse = new ArrayList<>(); |
|
|
|
|
if (statisticsRefusePOList.size()>0) { |
|
|
|
|
|
|
|
|
|
Integer[] presenterIds = statisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
|
|
if (presenterIds.length != 0) { |
|
|
|
|
// 强制类型转换
|
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
|
} |
|
|
|
|
//ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
|
|
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); |
|
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
|
// 提单人姓名、部门拼装
|
|
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
|
|
|
|
|
|
for (DgStatisticsListRefuseResponse listRefuseResponse : listResponse) { |
|
|
|
|
DgStatisticsExcelRefuseResponse excelRefuseResponse = new DgStatisticsExcelRefuseResponse(); |
|
|
|
|
StringBuilder stringBuilder = new StringBuilder(); |
|
|
|
|
if (listRefuseResponse.getDepartment() != null && listRefuseResponse.getDepartment().size() != 0) { |
|
|
|
|
for (int i = 0; i < listRefuseResponse.getDepartment().size(); i++) { |
|
|
|
|
if (i == listRefuseResponse.getDepartment().size() - 1) { |
|
|
|
|
stringBuilder.append(listRefuseResponse.getDepartment().get(i)); |
|
|
|
|
} else { |
|
|
|
|
stringBuilder.append(listRefuseResponse.getDepartment().get(i)).append(","); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
excelRefuseResponse.setDepartment(stringBuilder.toString()); |
|
|
|
|
BeanUtils.copyProperties(listRefuseResponse, excelRefuseResponse); |
|
|
|
|
excelResponse.add(excelRefuseResponse); |
|
|
|
|
} |
|
|
|
|
excelRefuseResponse.setDepartment(stringBuilder.toString()); |
|
|
|
|
BeanUtils.copyProperties(listRefuseResponse, excelRefuseResponse); |
|
|
|
|
excelResponse.add(excelRefuseResponse); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, excelResponse, "业务统计拒绝信息一览表", "statisticsRefuse", new DgStatisticsExcelRefuseResponse()) |
|
|
|
|
.finish(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, excelResponse, "业务统计拒绝信息一览表", "statisticsRefuse", new DgStatisticsExcelRefuseResponse()) |
|
|
|
|
.finish(); |
|
|
|
|
return true; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|