|
|
|
@ -45,6 +45,7 @@ import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.OutputStream; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
@ -90,7 +91,6 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
//根据登录人查询所属机构及下属机构
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
List<Long> createDept = userClient.getDataScope(user.getUserId()); |
|
|
|
|
System.out.println("createDept = " + createDept); |
|
|
|
|
//根据月份查询统计的数据
|
|
|
|
|
CompletableFuture<List<TicketCount>> ticketCountsCompletableFuture = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
LambdaQueryWrapper<TicketCount> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -132,7 +132,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
|
|
|
|
|
}, executor); |
|
|
|
|
//执行线程操作
|
|
|
|
|
CompletableFuture.allOf(ticketCountsCompletableFuture, oneTicketCompletableFuture, twoTicketCompletableFuture, threeTicketCompletableFuture, standardCompletableFuture).get(); |
|
|
|
|
CompletableFuture.allOf(ticketCountsCompletableFuture, oneTicketCompletableFuture, twoTicketCompletableFuture |
|
|
|
|
, threeTicketCompletableFuture, standardCompletableFuture).get(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -145,8 +146,10 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
public List<TicketCountResponseVo> selectTicketCountLlist(TicketCountVo ticketCountVo) { |
|
|
|
|
//获取keyword
|
|
|
|
|
String keyword = ticketCountVo.getKeyword(); |
|
|
|
|
String dateTime = ticketCountVo.getDateTime(); |
|
|
|
|
QueryWrapper<TicketCount> ticketCountQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
ticketCountQueryWrapper.like(StringUtils.isNotBlank(keyword), "dept_name", keyword); |
|
|
|
|
ticketCountQueryWrapper.eq(StringUtils.isNotBlank(dateTime), "date_time", dateTime); |
|
|
|
|
List<TicketCount> ticketCounts = baseMapper.selectList(ticketCountQueryWrapper); |
|
|
|
|
List<TicketCountResponseVo> result = getTicketCountResponseList(ticketCounts); |
|
|
|
|
return result; |
|
|
|
@ -300,7 +303,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
|
List<StandardTicketInfoEntity> ticketInfoEntities = standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
|
List<StandardTicketInfoEntity> ticketInfoEntities = |
|
|
|
|
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); |
|
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
@ -361,8 +365,13 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
* @param user |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<TicketCount> getTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
|
List<WorkTicketInfoEntity> ticketInfoEntities = workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
|
private List<TicketCount> getTicketCountList(List<Long> createDept, |
|
|
|
|
List<TicketCount> items, |
|
|
|
|
String ticketType, |
|
|
|
|
String dateTime, |
|
|
|
|
BladeUser user) { |
|
|
|
|
List<WorkTicketInfoEntity> ticketInfoEntities = |
|
|
|
|
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); |
|
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
@ -391,16 +400,19 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
List<WorkTicketInfoEntity> values = entry.getValue(); |
|
|
|
|
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType); |
|
|
|
|
//1. 开票数量
|
|
|
|
|
List<WorkTicketInfoEntity> ticketNumbers = values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
|
List<WorkTicketInfoEntity> ticketNumbers = |
|
|
|
|
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
|
ticketCount.setTicketNumber(ticketNumbers.size()); |
|
|
|
|
//2. 完成数量
|
|
|
|
|
List<WorkTicketInfoEntity> ticketCompleteNums = values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
|
List<WorkTicketInfoEntity> ticketCompleteNums = |
|
|
|
|
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
|
ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); |
|
|
|
|
ticketCount.setTenantId(user.getTenantId()); |
|
|
|
|
ticketCount.setCreateDept(Long.valueOf(user.getDeptId())); |
|
|
|
|
ticketCount.setCreateUser(user.getUserId()); |
|
|
|
|
//3. 延期数据量
|
|
|
|
|
List<WorkTicketInfoEntity> ticketDelayNums = values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList()); |
|
|
|
|
List<WorkTicketInfoEntity> ticketDelayNums = |
|
|
|
|
values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList()); |
|
|
|
|
ticketCount.setTicketDelayNum(ticketDelayNums.size()); |
|
|
|
|
//4. 合格数量
|
|
|
|
|
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList()); |
|
|
|
@ -413,4 +425,16 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
|
|
|
|
|
} |
|
|
|
|
return ticketCountList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* date转string |
|
|
|
|
* |
|
|
|
|
* @param dateTime |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private String getTimeString(Date dateTime) { |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
return sdf.format(dateTime); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|