|
|
@ -46,41 +46,41 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PageUtils list(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) { |
|
|
|
public PageUtils list(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) { |
|
|
|
if (page == null || size == null){ |
|
|
|
if (page == null || size == null) { |
|
|
|
page = 1; |
|
|
|
page = 1; |
|
|
|
size = 10; |
|
|
|
size = 10; |
|
|
|
} |
|
|
|
} |
|
|
|
// 时间筛选(固定时间)
|
|
|
|
// 时间筛选(固定时间)
|
|
|
|
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null){ |
|
|
|
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null) { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
switch (dgStatisticsRequest.getCreateFixedTime()){ |
|
|
|
switch (dgStatisticsRequest.getCreateFixedTime()) { |
|
|
|
case 0 : |
|
|
|
case 0: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1 : |
|
|
|
case 1: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2 : |
|
|
|
case 2: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3 : |
|
|
|
case 3: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4 : |
|
|
|
case 4: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
|
|
|
|
break; |
|
|
|
break; |
|
|
|
default : |
|
|
|
default: |
|
|
|
dgStatisticsRequest.setStartTime(null); |
|
|
|
dgStatisticsRequest.setStartTime(null); |
|
|
|
dgStatisticsRequest.setEndTime(null); |
|
|
|
dgStatisticsRequest.setEndTime(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 时间筛选(自定义时间)
|
|
|
|
// 时间筛选(自定义时间)
|
|
|
|
if (dgStatisticsRequest.getCreateCustomTime() != null){ |
|
|
|
if (dgStatisticsRequest.getCreateCustomTime() != null) { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
@ -88,23 +88,23 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
// 查询列表
|
|
|
|
// 查询列表
|
|
|
|
IPage<DgStatisticsPO> iPage = this.getBaseMapper().list(new Page(page, size), dgStatisticsRequest); |
|
|
|
IPage<DgStatisticsPO> iPage = this.getBaseMapper().list(new Page(page, size), dgStatisticsRequest); |
|
|
|
List<DgStatisticsPO> dgStatisticsPOList = iPage.getRecords(); |
|
|
|
List<DgStatisticsPO> dgStatisticsPOList = iPage.getRecords(); |
|
|
|
if (dgStatisticsPOList == null){ |
|
|
|
if (dgStatisticsPOList == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
// 部门筛选
|
|
|
|
// 部门筛选
|
|
|
|
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null){ |
|
|
|
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null) { |
|
|
|
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue()); |
|
|
|
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue()); |
|
|
|
if (result.getData() == null || result.getData().size() == 0){ |
|
|
|
if (result.getData() == null || result.getData().size() == 0) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i = 0;i < dgStatisticsPOList.size();i++){ |
|
|
|
for (int i = 0; i < dgStatisticsPOList.size(); i++) { |
|
|
|
boolean flag = false; |
|
|
|
boolean flag = false; |
|
|
|
for (EmployeeVO employeeVO : result.getData()) { |
|
|
|
for (EmployeeVO employeeVO : result.getData()) { |
|
|
|
if (Objects.equals(dgStatisticsPOList.get(i).getPresenterId().longValue(),employeeVO.getId())){ |
|
|
|
if (Objects.equals(dgStatisticsPOList.get(i).getPresenterId().longValue(), employeeVO.getId())) { |
|
|
|
flag = true; |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!flag){ |
|
|
|
if (!flag) { |
|
|
|
dgStatisticsPOList.remove(i); |
|
|
|
dgStatisticsPOList.remove(i); |
|
|
|
i--; // 索引要减一,不然会触发"快速失败"异常
|
|
|
|
i--; // 索引要减一,不然会触发"快速失败"异常
|
|
|
|
} |
|
|
|
} |
|
|
@ -113,9 +113,9 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1); |
|
|
|
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
// 提单人筛选
|
|
|
|
// 提单人筛选
|
|
|
|
if (dgStatisticsRequest.getEmpId() != null){ |
|
|
|
if (dgStatisticsRequest.getEmpId() != null) { |
|
|
|
for (int i = 0;i < dgStatisticsPOList.size();i++){ |
|
|
|
for (int i = 0; i < dgStatisticsPOList.size(); i++) { |
|
|
|
if (!Objects.equals(dgStatisticsPOList.get(i).getPresenterId(),dgStatisticsRequest.getEmpId())){ |
|
|
|
if (!Objects.equals(dgStatisticsPOList.get(i).getPresenterId(), dgStatisticsRequest.getEmpId())) { |
|
|
|
dgStatisticsPOList.remove(i); |
|
|
|
dgStatisticsPOList.remove(i); |
|
|
|
i--;// 索引要减一,不然会触发"快速失败"异常
|
|
|
|
i--;// 索引要减一,不然会触发"快速失败"异常
|
|
|
|
} |
|
|
|
} |
|
|
@ -125,23 +125,23 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取所有的提单人id
|
|
|
|
// 获取所有的提单人id
|
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
|
if (presenterIds.length != 0){ |
|
|
|
if (presenterIds.length != 0) { |
|
|
|
// 强制类型转换
|
|
|
|
// 强制类型转换
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
for (int i = 0;i < presenterIds.length;i++){ |
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
if (empAndDeptList.getData() != null){ |
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
IPage<DgStatisticsListResponse> iPages = new Page<>(); |
|
|
|
IPage<DgStatisticsListResponse> iPages = new Page<>(); |
|
|
|
BeanUtils.copyProperties(iPage,iPages); |
|
|
|
BeanUtils.copyProperties(iPage, iPages); |
|
|
|
iPages.setRecords(listResponse); |
|
|
|
iPages.setRecords(listResponse); |
|
|
|
return new PageUtils(iPages); |
|
|
|
return new PageUtils(iPages); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return new PageUtils(iPage); |
|
|
|
return new PageUtils(iPage); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return new PageUtils(iPage); |
|
|
|
return new PageUtils(iPage); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -154,7 +154,7 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
|
|
|
|
|
|
|
|
IPage<DgStatisticsPO> list = this.getBaseMapper().list(new Page(), new DgStatisticsRequest()); |
|
|
|
IPage<DgStatisticsPO> list = this.getBaseMapper().list(new Page(), new DgStatisticsRequest()); |
|
|
|
List<DgStatisticsPO> dgStatisticsPOList = list.getRecords(); |
|
|
|
List<DgStatisticsPO> dgStatisticsPOList = list.getRecords(); |
|
|
|
if (dgStatisticsPOList == null){ |
|
|
|
if (dgStatisticsPOList == null) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
|
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new); |
|
|
@ -168,13 +168,13 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
ExcelUtil.writeExcelWithSheets(response,listResponse,"业务统计信息一览表","statistics",new DgStatisticsListResponse()) |
|
|
|
ExcelUtil.writeExcelWithSheets(response, listResponse, "业务统计信息一览表", "statistics", new DgStatisticsListResponse()) |
|
|
|
.finish(); |
|
|
|
.finish(); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -186,41 +186,41 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PageUtils listRefuse(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) { |
|
|
|
public PageUtils listRefuse(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) { |
|
|
|
if (page == null || size == null){ |
|
|
|
if (page == null || size == null) { |
|
|
|
page = 1; |
|
|
|
page = 1; |
|
|
|
size = 10; |
|
|
|
size = 10; |
|
|
|
} |
|
|
|
} |
|
|
|
// 时间筛选(固定时间)
|
|
|
|
// 时间筛选(固定时间)
|
|
|
|
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null){ |
|
|
|
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null) { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
switch (dgStatisticsRequest.getCreateFixedTime()){ |
|
|
|
switch (dgStatisticsRequest.getCreateFixedTime()) { |
|
|
|
case 0 : |
|
|
|
case 0: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1 : |
|
|
|
case 1: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2 : |
|
|
|
case 2: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3 : |
|
|
|
case 3: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4 : |
|
|
|
case 4: |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear())); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear())); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
|
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
|
|
|
|
break; |
|
|
|
break; |
|
|
|
default : |
|
|
|
default: |
|
|
|
dgStatisticsRequest.setStartTime(null); |
|
|
|
dgStatisticsRequest.setStartTime(null); |
|
|
|
dgStatisticsRequest.setEndTime(null); |
|
|
|
dgStatisticsRequest.setEndTime(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 时间筛选(自定义时间)
|
|
|
|
// 时间筛选(自定义时间)
|
|
|
|
if (dgStatisticsRequest.getCreateCustomTime() != null){ |
|
|
|
if (dgStatisticsRequest.getCreateCustomTime() != null) { |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
|
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime()))); |
|
|
@ -229,23 +229,23 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
dgStatisticsRequest.setStatus(PromptSuccess.STATUS_REFUSE); |
|
|
|
dgStatisticsRequest.setStatus(PromptSuccess.STATUS_REFUSE); |
|
|
|
IPage<DgStatisticsRefusePO> iPage = this.getBaseMapper().listRefuse(new Page(page, size), dgStatisticsRequest); |
|
|
|
IPage<DgStatisticsRefusePO> iPage = this.getBaseMapper().listRefuse(new Page(page, size), dgStatisticsRequest); |
|
|
|
List<DgStatisticsRefusePO> dgStatisticsRefusePOList = iPage.getRecords(); |
|
|
|
List<DgStatisticsRefusePO> dgStatisticsRefusePOList = iPage.getRecords(); |
|
|
|
if (dgStatisticsRefusePOList == null){ |
|
|
|
if (dgStatisticsRefusePOList == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
// 部门筛选
|
|
|
|
// 部门筛选
|
|
|
|
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null){ |
|
|
|
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null) { |
|
|
|
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue()); |
|
|
|
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue()); |
|
|
|
if (result.getData() == null || result.getData().size() == 0){ |
|
|
|
if (result.getData() == null || result.getData().size() == 0) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i = 0;i < dgStatisticsRefusePOList.size();i++){ |
|
|
|
for (int i = 0; i < dgStatisticsRefusePOList.size(); i++) { |
|
|
|
boolean flag = false; |
|
|
|
boolean flag = false; |
|
|
|
for (EmployeeVO employeeVO : result.getData()) { |
|
|
|
for (EmployeeVO employeeVO : result.getData()) { |
|
|
|
if (Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId().longValue(),employeeVO.getId())){ |
|
|
|
if (Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId().longValue(), employeeVO.getId())) { |
|
|
|
flag = true; |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!flag){ |
|
|
|
if (!flag) { |
|
|
|
dgStatisticsRefusePOList.remove(i); |
|
|
|
dgStatisticsRefusePOList.remove(i); |
|
|
|
i--; // 索引要减一,不然会触发"快速失败"异常
|
|
|
|
i--; // 索引要减一,不然会触发"快速失败"异常
|
|
|
|
} |
|
|
|
} |
|
|
@ -254,9 +254,9 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1); |
|
|
|
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
// 提单人筛选
|
|
|
|
// 提单人筛选
|
|
|
|
if (dgStatisticsRequest.getEmpId() != null){ |
|
|
|
if (dgStatisticsRequest.getEmpId() != null) { |
|
|
|
for (int i = 0;i < dgStatisticsRefusePOList.size();i++){ |
|
|
|
for (int i = 0; i < dgStatisticsRefusePOList.size(); i++) { |
|
|
|
if (!Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId(),dgStatisticsRequest.getEmpId())){ |
|
|
|
if (!Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId(), dgStatisticsRequest.getEmpId())) { |
|
|
|
dgStatisticsRefusePOList.remove(i); |
|
|
|
dgStatisticsRefusePOList.remove(i); |
|
|
|
i--;// 索引要减一,不然会触发"快速失败"异常
|
|
|
|
i--;// 索引要减一,不然会触发"快速失败"异常
|
|
|
|
} |
|
|
|
} |
|
|
@ -266,23 +266,23 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取所有的提单人id
|
|
|
|
// 获取所有的提单人id
|
|
|
|
Integer[] presenterIds = dgStatisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
|
Integer[] presenterIds = dgStatisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
|
if (presenterIds.length != 0){ |
|
|
|
if (presenterIds.length != 0) { |
|
|
|
// 强制类型转换
|
|
|
|
// 强制类型转换
|
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
Long[] ids = new Long[presenterIds.length]; |
|
|
|
for (int i = 0;i < presenterIds.length;i++){ |
|
|
|
for (int i = 0; i < presenterIds.length; i++) { |
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
ids[i] = presenterIds[i].longValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); |
|
|
|
if (empAndDeptList.getData() != null){ |
|
|
|
if (empAndDeptList.getData() != null) { |
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(dgStatisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(dgStatisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
IPage<DgStatisticsListRefuseResponse> iPages = new Page<>(); |
|
|
|
IPage<DgStatisticsListRefuseResponse> iPages = new Page<>(); |
|
|
|
BeanUtils.copyProperties(iPage,iPages); |
|
|
|
BeanUtils.copyProperties(iPage, iPages); |
|
|
|
iPages.setRecords(listResponse); |
|
|
|
iPages.setRecords(listResponse); |
|
|
|
return new PageUtils(iPages); |
|
|
|
return new PageUtils(iPages); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return new PageUtils(iPage); |
|
|
|
return new PageUtils(iPage); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return new PageUtils(iPage); |
|
|
|
return new PageUtils(iPage); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -297,7 +297,7 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
// 列表查询
|
|
|
|
// 列表查询
|
|
|
|
IPage<DgStatisticsRefusePO> listRefuse = this.getBaseMapper().listRefuse(new Page(), dgStatisticsRequest); |
|
|
|
IPage<DgStatisticsRefusePO> listRefuse = this.getBaseMapper().listRefuse(new Page(), dgStatisticsRequest); |
|
|
|
List<DgStatisticsRefusePO> statisticsRefusePOList = listRefuse.getRecords(); |
|
|
|
List<DgStatisticsRefusePO> statisticsRefusePOList = listRefuse.getRecords(); |
|
|
|
if (statisticsRefusePOList == null){ |
|
|
|
if (statisticsRefusePOList == null) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
Integer[] presenterIds = statisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
|
Integer[] presenterIds = statisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new); |
|
|
@ -312,20 +312,20 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
// 提单人姓名、部门拼装
|
|
|
|
// 提单人姓名、部门拼装
|
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
ExcelUtil.writeExcelWithSheets(response,listResponse,"业务统计拒绝信息一览表","statisticsRefuse",new DgStatisticsListRefuseResponse()) |
|
|
|
ExcelUtil.writeExcelWithSheets(response, listResponse, "业务统计拒绝信息一览表", "statisticsRefuse", new DgStatisticsListRefuseResponse()) |
|
|
|
.finish(); |
|
|
|
.finish(); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<DgStatisticsListResponse> jointStatistics(List<DgStatisticsPO> dgStatisticsPOList,List<EmployeeTO> empAndDeptList){ |
|
|
|
private List<DgStatisticsListResponse> jointStatistics(List<DgStatisticsPO> dgStatisticsPOList, List<EmployeeTO> empAndDeptList) { |
|
|
|
// 用于拼装业务统计列表
|
|
|
|
// 用于拼装业务统计列表
|
|
|
|
List<DgStatisticsListResponse> listResponse = new ArrayList<>(); |
|
|
|
List<DgStatisticsListResponse> listResponse = new ArrayList<>(); |
|
|
|
DgStatisticsListResponse dgStatisticsListResponse; |
|
|
|
DgStatisticsListResponse dgStatisticsListResponse; |
|
|
@ -333,22 +333,22 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
dgStatisticsListResponse = new DgStatisticsListResponse(); |
|
|
|
dgStatisticsListResponse = new DgStatisticsListResponse(); |
|
|
|
for (EmployeeTO employeeTO : empAndDeptList) { |
|
|
|
for (EmployeeTO employeeTO : empAndDeptList) { |
|
|
|
if (Objects.equals(dgStatisticsPO.getPresenterId().longValue(),employeeTO.getId())){ |
|
|
|
if (Objects.equals(dgStatisticsPO.getPresenterId().longValue(), employeeTO.getId())) { |
|
|
|
BeanUtils.copyProperties(dgStatisticsPO,dgStatisticsListResponse); |
|
|
|
BeanUtils.copyProperties(dgStatisticsPO, dgStatisticsListResponse); |
|
|
|
dgStatisticsListResponse.setEmployeeName(employeeTO.getEmpName()); |
|
|
|
dgStatisticsListResponse.setEmployeeName(employeeTO.getEmpName()); |
|
|
|
dgStatisticsListResponse.setDepartment(employeeTO.getDeptNames()); |
|
|
|
dgStatisticsListResponse.setDepartment(employeeTO.getDeptNames()); |
|
|
|
listResponse.add(dgStatisticsListResponse); |
|
|
|
listResponse.add(dgStatisticsListResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (dgStatisticsListResponse.getEmployeeName() == null || dgStatisticsListResponse.getEmployeeName().length() == 0){ |
|
|
|
if (dgStatisticsListResponse.getEmployeeName() == null || dgStatisticsListResponse.getEmployeeName().length() == 0) { |
|
|
|
BeanUtils.copyProperties(dgStatisticsPO,dgStatisticsListResponse); |
|
|
|
BeanUtils.copyProperties(dgStatisticsPO, dgStatisticsListResponse); |
|
|
|
listResponse.add(dgStatisticsListResponse); |
|
|
|
listResponse.add(dgStatisticsListResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return listResponse; |
|
|
|
return listResponse; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<DgStatisticsListRefuseResponse> jointRefuseStatistics(List<DgStatisticsRefusePO> dgStatisticsRefusePOList, List<EmployeeTO> empAndDeptList){ |
|
|
|
private List<DgStatisticsListRefuseResponse> jointRefuseStatistics(List<DgStatisticsRefusePO> dgStatisticsRefusePOList, List<EmployeeTO> empAndDeptList) { |
|
|
|
// 用于拼装业务统计列表
|
|
|
|
// 用于拼装业务统计列表
|
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = new ArrayList<>(); |
|
|
|
List<DgStatisticsListRefuseResponse> listResponse = new ArrayList<>(); |
|
|
|
DgStatisticsListRefuseResponse dgStatisticsListRefuseResponse; |
|
|
|
DgStatisticsListRefuseResponse dgStatisticsListRefuseResponse; |
|
|
@ -356,15 +356,15 @@ public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgA |
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
// 每一个客户对应一个不同的对象
|
|
|
|
dgStatisticsListRefuseResponse = new DgStatisticsListRefuseResponse(); |
|
|
|
dgStatisticsListRefuseResponse = new DgStatisticsListRefuseResponse(); |
|
|
|
for (EmployeeTO employeeTO : empAndDeptList) { |
|
|
|
for (EmployeeTO employeeTO : empAndDeptList) { |
|
|
|
if (Objects.equals(dgStatisticsRefusePO.getPresenterId().longValue(),employeeTO.getId())){ |
|
|
|
if (Objects.equals(dgStatisticsRefusePO.getPresenterId().longValue(), employeeTO.getId())) { |
|
|
|
BeanUtils.copyProperties(dgStatisticsRefusePO,dgStatisticsListRefuseResponse); |
|
|
|
BeanUtils.copyProperties(dgStatisticsRefusePO, dgStatisticsListRefuseResponse); |
|
|
|
dgStatisticsListRefuseResponse.setEmployeeName(employeeTO.getEmpName()); |
|
|
|
dgStatisticsListRefuseResponse.setEmployeeName(employeeTO.getEmpName()); |
|
|
|
dgStatisticsListRefuseResponse.setDepartment(employeeTO.getDeptNames()); |
|
|
|
dgStatisticsListRefuseResponse.setDepartment(employeeTO.getDeptNames()); |
|
|
|
listResponse.add(dgStatisticsListRefuseResponse); |
|
|
|
listResponse.add(dgStatisticsListRefuseResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (dgStatisticsListRefuseResponse.getEmployeeName() == null || dgStatisticsListRefuseResponse.getEmployeeName().length() == 0){ |
|
|
|
if (dgStatisticsListRefuseResponse.getEmployeeName() == null || dgStatisticsListRefuseResponse.getEmployeeName().length() == 0) { |
|
|
|
BeanUtils.copyProperties(dgStatisticsRefusePO,dgStatisticsListRefuseResponse); |
|
|
|
BeanUtils.copyProperties(dgStatisticsRefusePO, dgStatisticsListRefuseResponse); |
|
|
|
listResponse.add(dgStatisticsListRefuseResponse); |
|
|
|
listResponse.add(dgStatisticsListRefuseResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|