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

Loading…
Cancel
Save