|
|
@ -1,21 +1,38 @@ |
|
|
|
package com.hnac.hzims.ticket.twoTicket.service.impl; |
|
|
|
package com.hnac.hzims.ticket.twoTicket.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.http.server.HttpServerResponse; |
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
import com.alibaba.excel.support.ExcelTypeEnum; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.style.WriteFont; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; |
|
|
|
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; |
|
|
|
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; |
|
|
|
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; |
|
|
|
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; |
|
|
|
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; |
|
|
|
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; |
|
|
|
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.twoTicket.handler.TicketCountSheetWriteHandler; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.mapper.TicketCountMapper; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.mapper.TicketCountMapper; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService; |
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo; |
|
|
|
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
|
|
|
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; |
|
|
|
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.BorderStyle; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.VerticalAlignment; |
|
|
|
import org.springblade.core.mp.base.BaseEntity; |
|
|
|
import org.springblade.core.mp.base.BaseEntity; |
|
|
|
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
@ -23,10 +40,12 @@ import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.List; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.util.Map; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Set; |
|
|
|
import java.io.OutputStream; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -40,7 +59,7 @@ import java.util.stream.Collectors; |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, TicketCount> implements TicketCountService { |
|
|
|
public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, TicketCount> implements TicketCountService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ThreadPoolExecutor executor; |
|
|
|
private final ThreadPoolExecutor executor; |
|
|
@ -113,15 +132,164 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
|
|
|
|
|
|
|
|
}, executor); |
|
|
|
}, executor); |
|
|
|
//执行线程操作
|
|
|
|
//执行线程操作
|
|
|
|
CompletableFuture.allOf(ticketCountsCompletableFuture, |
|
|
|
CompletableFuture.allOf(ticketCountsCompletableFuture, oneTicketCompletableFuture, twoTicketCompletableFuture, threeTicketCompletableFuture, standardCompletableFuture).get(); |
|
|
|
oneTicketCompletableFuture, |
|
|
|
|
|
|
|
twoTicketCompletableFuture, |
|
|
|
|
|
|
|
threeTicketCompletableFuture, |
|
|
|
|
|
|
|
standardCompletableFuture) |
|
|
|
|
|
|
|
.get(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 两票统计分析列表 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param ticketCountVo |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<TicketCountResponseVo> selectTicketCountLlist(TicketCountVo ticketCountVo) { |
|
|
|
|
|
|
|
//获取keyword
|
|
|
|
|
|
|
|
String keyword = ticketCountVo.getKeyword(); |
|
|
|
|
|
|
|
QueryWrapper<TicketCount> ticketCountQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
ticketCountQueryWrapper.like(StringUtils.isNotBlank(keyword), "dept_name", keyword); |
|
|
|
|
|
|
|
List<TicketCount> ticketCounts = baseMapper.selectList(ticketCountQueryWrapper); |
|
|
|
|
|
|
|
List<TicketCountResponseVo> result = getTicketCountResponseList(ticketCounts); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 两票统计分析导出 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void exportTicketCount(HttpServletResponse response) { |
|
|
|
|
|
|
|
String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx"); |
|
|
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + fileName); |
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|
|
|
|
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
|
|
|
|
List<TicketCount> ticketCounts = baseMapper.selectList(null); |
|
|
|
|
|
|
|
List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts); |
|
|
|
|
|
|
|
//导出
|
|
|
|
|
|
|
|
//内容样式策略
|
|
|
|
|
|
|
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
|
|
|
|
|
|
|
// //垂直居中,水平居中
|
|
|
|
|
|
|
|
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
|
|
|
|
|
|
|
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderTop(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderRight(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); |
|
|
|
|
|
|
|
// //设置 自动换行
|
|
|
|
|
|
|
|
contentWriteCellStyle.setWrapped(true); |
|
|
|
|
|
|
|
// // 字体策略
|
|
|
|
|
|
|
|
// WriteFont contentWriteFont = new WriteFont();
|
|
|
|
|
|
|
|
// // 字体大小
|
|
|
|
|
|
|
|
// contentWriteFont.setFontHeightInPoints((short) 12);
|
|
|
|
|
|
|
|
// contentWriteCellStyle.setWriteFont(contentWriteFont);
|
|
|
|
|
|
|
|
// //头策略使用默认
|
|
|
|
|
|
|
|
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//excel如需下载到本地,只需要将response.getOutputStream()换成File即可(注释掉以上response代码)
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
EasyExcel.write(response.getOutputStream(), TicketCountResponseVo.class) |
|
|
|
|
|
|
|
//设置输出excel版本,不设置默认为xlsx
|
|
|
|
|
|
|
|
.excelType(ExcelTypeEnum.XLSX).head(TicketCountResponseVo.class) |
|
|
|
|
|
|
|
//设置拦截器或自定义样式
|
|
|
|
|
|
|
|
.registerWriteHandler(new TicketCountSheetWriteHandler()) |
|
|
|
|
|
|
|
.registerWriteHandler(new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle)) |
|
|
|
|
|
|
|
.sheet("两票月报分析统计报表") |
|
|
|
|
|
|
|
//设置默认样式及写入头信息开始的行数
|
|
|
|
|
|
|
|
.useDefaultStyle(true).relativeHeadRowIndex(1) |
|
|
|
|
|
|
|
//这里的addsumColomn方法是个添加合计的方法,可删除
|
|
|
|
|
|
|
|
.doWrite(countResponseList); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 列表封装 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param ticketCounts |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<TicketCountResponseVo> getTicketCountResponseList(List<TicketCount> ticketCounts) { |
|
|
|
|
|
|
|
//先判断在存储
|
|
|
|
|
|
|
|
Map<String, TicketCountResponseVo> map = new HashMap<>(); |
|
|
|
|
|
|
|
for (TicketCount ticketCount : ticketCounts) { |
|
|
|
|
|
|
|
String deptName = ticketCount.getDeptName(); |
|
|
|
|
|
|
|
if (map.containsKey(deptName)) { |
|
|
|
|
|
|
|
TicketCountResponseVo ticketCountResponseVo = map.get(deptName); |
|
|
|
|
|
|
|
isExistsTicket(ticketCount, ticketCountResponseVo); |
|
|
|
|
|
|
|
map.put(deptName, ticketCountResponseVo); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
TicketCountResponseVo ticketCountResponseVo = new TicketCountResponseVo(); |
|
|
|
|
|
|
|
isExistsTicket(ticketCount, ticketCountResponseVo); |
|
|
|
|
|
|
|
map.put(deptName, ticketCountResponseVo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//map遍历
|
|
|
|
|
|
|
|
List<TicketCountResponseVo> result = new ArrayList<>(); |
|
|
|
|
|
|
|
if (MapUtils.isNotEmpty(map)) { |
|
|
|
|
|
|
|
Set<Map.Entry<String, TicketCountResponseVo>> entries = map.entrySet(); |
|
|
|
|
|
|
|
for (Map.Entry<String, TicketCountResponseVo> entry : entries) { |
|
|
|
|
|
|
|
TicketCountResponseVo value = entry.getValue(); |
|
|
|
|
|
|
|
value.setDeptName(entry.getKey()); |
|
|
|
|
|
|
|
result.add(value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 验证是否是是这几种牌局类型 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param ticketCount |
|
|
|
|
|
|
|
* @param ticketCountResponseVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void isExistsTicket(TicketCount ticketCount, TicketCountResponseVo ticketCountResponseVo) { |
|
|
|
|
|
|
|
String deptName = ticketCount.getDeptName(); |
|
|
|
|
|
|
|
ticketCountResponseVo.setDeptName(deptName); |
|
|
|
|
|
|
|
if ("3".equals(ticketCount.getTicketType())) { |
|
|
|
|
|
|
|
ticketCountResponseVo.setFourTicketNumber(this.getCount(ticketCount.getTicketNumber())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setFourTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setFourTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setFourTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("6".equals(ticketCount.getTicketType())) { |
|
|
|
|
|
|
|
ticketCountResponseVo.setOneTicketNumber(this.getCount(ticketCount.getTicketNumber())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setOneTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setOneTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setOneTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("7".equals(ticketCount.getTicketType())) { |
|
|
|
|
|
|
|
ticketCountResponseVo.setTwoTicketNumber(this.getCount(ticketCount.getTicketNumber())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setTwoTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setTwoTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setTwoTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("8".equals(ticketCount.getTicketType())) { |
|
|
|
|
|
|
|
ticketCountResponseVo.setThreeTicketNumber(this.getCount(ticketCount.getTicketNumber())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setThreeTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setThreeTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum())); |
|
|
|
|
|
|
|
ticketCountResponseVo.setThreeTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 验证是否为null |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private int getCount(Integer count) { |
|
|
|
|
|
|
|
return count == null ? 0 : count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 统计操作票功能 |
|
|
|
* 统计操作票功能 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param createDept 所属机构及下属机构 |
|
|
|
* @param createDept 所属机构及下属机构 |
|
|
@ -132,17 +300,16 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
List<StandardTicketInfoEntity> ticketInfoEntities = |
|
|
|
List<StandardTicketInfoEntity> ticketInfoEntities = standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
//根据站点分组
|
|
|
|
//根据站点分组
|
|
|
|
Map<Long, List<StandardTicketInfoEntity>> createDeptTickets = |
|
|
|
Map<Long, List<StandardTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept)); |
|
|
|
ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept)); |
|
|
|
|
|
|
|
//获取 操作票的id,删除
|
|
|
|
//获取 操作票的id,删除
|
|
|
|
if (CollectionUtils.isNotEmpty(items)) { |
|
|
|
if (CollectionUtils.isNotEmpty(items)) { |
|
|
|
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList()); |
|
|
|
List<Long> collect = |
|
|
|
|
|
|
|
items.stream().filter(item -> ticketType.equals(item.getTicketType()) && user.getUserId().equals(item.getCreateUser())).map(TicketCount::getId).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(collect)) { |
|
|
|
if (CollectionUtils.isNotEmpty(collect)) { |
|
|
|
baseMapper.deleteBatchIds(collect); |
|
|
|
baseMapper.deleteBatchIds(collect); |
|
|
|
} |
|
|
|
} |
|
|
@ -154,7 +321,8 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
ticketCount.setDateTime(dateTime); |
|
|
|
ticketCount.setDateTime(dateTime); |
|
|
|
ticketCount.setDeptId(entry.getKey()); |
|
|
|
ticketCount.setDeptId(entry.getKey()); |
|
|
|
ticketCount.setTenantId(user.getTenantId()); |
|
|
|
ticketCount.setTenantId(user.getTenantId()); |
|
|
|
ticketCount.setCreateDept(user.getDeptId()); |
|
|
|
ticketCount.setCreateDept(Long.valueOf(user.getDeptId())); |
|
|
|
|
|
|
|
ticketCount.setCreateUser(user.getUserId()); |
|
|
|
//根据id获取部门名称
|
|
|
|
//根据id获取部门名称
|
|
|
|
R<String> deptName = systemClient.getDeptName(entry.getKey()); |
|
|
|
R<String> deptName = systemClient.getDeptName(entry.getKey()); |
|
|
|
if (deptName.isSuccess()) { |
|
|
|
if (deptName.isSuccess()) { |
|
|
@ -163,19 +331,16 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
List<StandardTicketInfoEntity> values = entry.getValue(); |
|
|
|
List<StandardTicketInfoEntity> values = entry.getValue(); |
|
|
|
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getTicketType() : ticketType); |
|
|
|
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getTicketType() : ticketType); |
|
|
|
//1. 开票数量
|
|
|
|
//1. 开票数量
|
|
|
|
List<StandardTicketInfoEntity> ticketNumbers = |
|
|
|
List<StandardTicketInfoEntity> ticketNumbers = values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketCount.setTicketNumber(ticketNumbers.size()); |
|
|
|
ticketCount.setTicketNumber(ticketNumbers.size()); |
|
|
|
//2. 完成数量
|
|
|
|
//2. 完成数量
|
|
|
|
List<StandardTicketInfoEntity> ticketCompleteNums = |
|
|
|
List<StandardTicketInfoEntity> ticketCompleteNums = values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); |
|
|
|
ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); |
|
|
|
//3. 延期数据量
|
|
|
|
//3. 延期数据量
|
|
|
|
ticketCount.setTicketDelayNum(0); |
|
|
|
ticketCount.setTicketDelayNum(0); |
|
|
|
//4. 合格数量
|
|
|
|
//4. 合格数量
|
|
|
|
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = |
|
|
|
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); |
|
|
|
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); |
|
|
|
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); |
|
|
|
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); |
|
|
|
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); |
|
|
|
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); |
|
|
@ -197,8 +362,7 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<TicketCount> getTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
private List<TicketCount> getTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) { |
|
|
|
List<WorkTicketInfoEntity> ticketInfoEntities = |
|
|
|
List<WorkTicketInfoEntity> ticketInfoEntities = workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
if (CollectionUtils.isEmpty(ticketInfoEntities)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -206,7 +370,8 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
Map<Long, List<WorkTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(BaseEntity::getCreateDept)); |
|
|
|
Map<Long, List<WorkTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(BaseEntity::getCreateDept)); |
|
|
|
if (CollectionUtils.isNotEmpty(items)) { |
|
|
|
if (CollectionUtils.isNotEmpty(items)) { |
|
|
|
//获取工作票的id,删除
|
|
|
|
//获取工作票的id,删除
|
|
|
|
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList()); |
|
|
|
List<Long> collect = |
|
|
|
|
|
|
|
items.stream().filter(item -> (ticketType.equals(item.getTicketType()) && user.getUserId().equals(item.getCreateUser()))).map(TicketCount::getId).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(collect)) { |
|
|
|
if (CollectionUtils.isNotEmpty(collect)) { |
|
|
|
baseMapper.deleteBatchIds(collect); |
|
|
|
baseMapper.deleteBatchIds(collect); |
|
|
|
} |
|
|
|
} |
|
|
@ -226,23 +391,20 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke |
|
|
|
List<WorkTicketInfoEntity> values = entry.getValue(); |
|
|
|
List<WorkTicketInfoEntity> values = entry.getValue(); |
|
|
|
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType); |
|
|
|
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType); |
|
|
|
//1. 开票数量
|
|
|
|
//1. 开票数量
|
|
|
|
List<WorkTicketInfoEntity> ticketNumbers = |
|
|
|
List<WorkTicketInfoEntity> ticketNumbers = values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketCount.setTicketNumber(ticketNumbers.size()); |
|
|
|
ticketCount.setTicketNumber(ticketNumbers.size()); |
|
|
|
//2. 完成数量
|
|
|
|
//2. 完成数量
|
|
|
|
List<WorkTicketInfoEntity> ticketCompleteNums = |
|
|
|
List<WorkTicketInfoEntity> ticketCompleteNums = values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); |
|
|
|
ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); |
|
|
|
ticketCount.setTenantId(user.getTenantId()); |
|
|
|
ticketCount.setTenantId(user.getTenantId()); |
|
|
|
ticketCount.setCreateDept(user.getDeptId()); |
|
|
|
ticketCount.setCreateDept(Long.valueOf(user.getDeptId())); |
|
|
|
|
|
|
|
ticketCount.setCreateUser(user.getUserId()); |
|
|
|
//3. 延期数据量
|
|
|
|
//3. 延期数据量
|
|
|
|
List<WorkTicketInfoEntity> ticketDelayNums = |
|
|
|
List<WorkTicketInfoEntity> ticketDelayNums = values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList()); |
|
|
|
values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketCount.setTicketDelayNum(ticketDelayNums.size()); |
|
|
|
ticketCount.setTicketDelayNum(ticketDelayNums.size()); |
|
|
|
//4. 合格数量
|
|
|
|
//4. 合格数量
|
|
|
|
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList()); |
|
|
|
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = |
|
|
|
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); |
|
|
|
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); |
|
|
|
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); |
|
|
|
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); |
|
|
|
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); |
|
|
|
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); |
|
|
|