Browse Source

两票操作票已完成的app端

zhongwei
段飞宇 1 year ago
parent
commit
31377fa79b
  1. 54
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

54
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -36,6 +36,7 @@ import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -112,6 +113,10 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = this.getQueryWrapper(req);
queryWrapper.eq(Func.isNotEmpty(req.getCreateDept()), StandardTicketInfoEntity::getCreateDept, req.getCreateDept());
queryWrapper.orderByDesc(StandardTicketInfoEntity::getCreateTime);
//操作票已完成的数量
if (StringUtils.isNoneBlank(req.getFlowTaskName())) {
queryWrapper.eq(StandardTicketInfoEntity::getFlowTaskName, req.getFlowTaskName());
}
IPage pages = super.page(Condition.getPage(query), queryWrapper);
return R.data(pages.setRecords(StandardTicketInfoWrapper.build().listVO(pages.getRecords())));
}
@ -144,11 +149,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
}
/*开启工作流*/
String processInstanceId = this.startProcessInstance(standardFlowKey, req);
return R.status(this.update(
Wrappers.<StandardTicketInfoEntity>lambdaUpdate()
.set(StandardTicketInfoEntity::getProcessInstanceId, processInstanceId)
.eq(StandardTicketInfoEntity::getId, req.getId())
));
return R.status(this.update(Wrappers.<StandardTicketInfoEntity>lambdaUpdate().set(StandardTicketInfoEntity::getProcessInstanceId, processInstanceId).eq(StandardTicketInfoEntity::getId, req.getId())));
}
@Override
@ -244,9 +245,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
if (Func.isEmpty(ticketInfoEntity.getProcessInstanceId())) {
return R.fail("该操作票未开启工作流");
}
this.update(Wrappers.<StandardTicketInfoEntity>lambdaUpdate()
.set(StandardTicketInfoEntity::getStatus, TicketConstants.StandardTicketStatusEnum.TERMINATION.getStatus())
.eq(StandardTicketInfoEntity::getId, id));
this.update(Wrappers.<StandardTicketInfoEntity>lambdaUpdate().set(StandardTicketInfoEntity::getStatus, TicketConstants.StandardTicketStatusEnum.TERMINATION.getStatus()).eq(StandardTicketInfoEntity::getId, id));
/**删除工作流**/
R r = flowClient.delProcessInstanceById(ticketInfoEntity.getProcessInstanceId(), comment);
if (!r.isSuccess()) {
@ -335,23 +334,18 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
//1.查询
QueryWrapper<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
//开票来源
queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type",
areaVo.getTaskType());
queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType());
//编号
queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode());
//状态
queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status",
areaVo.getStatus());
queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus());
//开始时间
queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time",
areaVo.getStartTime());
queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime());
//结束时间
queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time",
areaVo.getEndTime());
queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime());
queryWrapper.eq("sti.CREATE_DEPT", areaVo.getAreaId());
queryWrapper.eq(areaVo.getYearMonth() != null,
"date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth());
queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth());
// queryWrapper.eq("tie.status",1);
Page<StandardTicketInfoEntity> standardTicketInfoEntityPage = baseMapper.selectPages(searchPage, queryWrapper);
@ -450,8 +444,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
private boolean isTicketPercentById(StandardTicketInfoEntity item) {
LambdaQueryWrapper<TicketInfoEvaluateEntity> ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId());
ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus,
TicketConstants.TicketQualifiedEnum.Qualified.getCode());
ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper);
return count > 0;
}
@ -580,9 +573,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
put("guardianUserIds", "taskUser_".concat(entity.getGuardian().toString()));
}};
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "standardTicket:task:" + entity.getId(), entity.getTitle(), params)
.getData()
.getProcessInstanceId();
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "standardTicket:task:" + entity.getId(), entity.getTitle(), params).getData().getProcessInstanceId();
}
/***
@ -680,21 +671,12 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
List<OperateTicketStatisticVO> operateTicketReportStatistic = this.baseMapper.getOperateTicketReportStatistic(startDate, endDate, deptIdList);
if (CollectionUtil.isNotEmpty(operateTicketReportStatistic)) {
//已完成数量
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(ticket -> TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(ticket.getStatus()))
.collect(Collectors.toList()).size();
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(ticket -> TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(ticket.getStatus())).collect(Collectors.toList()).size();
//合格数量
int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size();
//计算合格率
double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100)
.setScale(2, RoundingMode.HALF_DOWN).doubleValue();
result = TicketInfoStatisticVO.builder()
.ticketInfoType("操作票")
.ticketInfoNumber(operateTicketReportStatistic.size())
.ticketInfoCompleteNum(ticketInfoCompleteNum)
.ticketInfoQualifiedNum(ticketInfoQualifiedNum)
.ticketInfoStartNum(operateTicketReportStatistic.size() - ticketInfoCompleteNum)
.ticketInfoProportion(ticketInfoProportion)
.build();
double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue();
result = TicketInfoStatisticVO.builder().ticketInfoType("操作票").ticketInfoNumber(operateTicketReportStatistic.size()).ticketInfoCompleteNum(ticketInfoCompleteNum).ticketInfoQualifiedNum(ticketInfoQualifiedNum).ticketInfoStartNum(operateTicketReportStatistic.size() - ticketInfoCompleteNum).ticketInfoProportion(ticketInfoProportion).build();
}
return result;
}
@ -712,7 +694,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
public List<StandardTicketInfoEntity> selectStandardTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType, String dateTime) {
QueryWrapper<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(StandardTicketInfoEntity::getTicketType, ticketType);
if (CollectionUtils.isNotEmpty(createDept)){
if (CollectionUtils.isNotEmpty(createDept)) {
queryWrapper.lambda().in(StandardTicketInfoEntity::getCreateDept, createDept);
}
queryWrapper.apply("date_format(CREATE_TIME,'%Y-%m') = {0}", dateTime);

Loading…
Cancel
Save