Browse Source

#双票统计

zhongwei
yang_shj 1 year ago
parent
commit
ab71acd750
  1. 5
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensParamVo.java
  2. 9
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensVo.java
  3. 12
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearParamVo.java
  4. 3
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearVo.java
  5. 153
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

5
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensParamVo.java

@ -18,6 +18,9 @@ public class CensParamVo {
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss") @ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss")
private String endTime; private String endTime;
@ApiModelProperty("状态 : 0-未完成 1-完成") @ApiModelProperty("状态 : 0-全部 1-完成")
private Integer state; private Integer state;
@ApiModelProperty("结束")
private String flowTaskName;
} }

9
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensVo.java

@ -15,12 +15,15 @@ public class CensVo {
@ApiModelProperty("机构名称") @ApiModelProperty("机构名称")
private String deptName; private String deptName;
@ApiModelProperty("月份")
private Integer mon;
@ApiModelProperty("工作票数量") @ApiModelProperty("工作票数量")
private Integer workCount; private Long workCount;
@ApiModelProperty("操作票数量") @ApiModelProperty("操作票数量")
private Integer operateCount; private Long operateCount;
@ApiModelProperty("工作任务数量") @ApiModelProperty("工作任务数量")
private Integer workTaskCount; private Long workTaskCount;
} }

12
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearParamVo.java

@ -14,4 +14,16 @@ public class CensYearParamVo {
@ApiModelProperty("年度 : yyyy") @ApiModelProperty("年度 : yyyy")
private String year; private String year;
@ApiModelProperty("状态 : 0-全部 1-完成")
private Integer state;
@ApiModelProperty("流程描述")
private String flowTaskName;
@ApiModelProperty("开始时间 : yyyy-MM-dd HH:mm:ss")
private String startTime;
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss")
private String endTime;
} }

3
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearVo.java

@ -17,9 +17,6 @@ public class CensYearVo {
@ApiModelProperty("机构名称") @ApiModelProperty("机构名称")
private String deptName; private String deptName;
@ApiModelProperty("月份")
private Integer mon;
@ApiModelProperty("统计数量") @ApiModelProperty("统计数量")
private List<CensVo> censs; private List<CensVo> censs;
} }

153
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

@ -1,15 +1,29 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo; import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensVo; import com.hnac.hzims.ticket.standardTicket.vo.CensVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo; import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo; import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo;
import com.hnac.hzims.ticket.twoTicket.service.CensService; import com.hnac.hzims.ticket.twoTicket.service.CensService;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.*;
import java.util.stream.Collectors;
/** /**
@ -20,14 +34,147 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CensServiceImpl implements CensService { public class CensServiceImpl implements CensService {
private final IStandardTicketInfoService operateTicketService;
private final IWorkTicketInfoService workTicketInfoService;
private final ISysClient sysClient;
@Override @Override
public List<CensVo> cens(CensParamVo param) { public List<CensVo> cens(CensParamVo param) {
return null; if(StringUtil.isEmpty(param.getStartTime())){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
}
if(StringUtil.isEmpty(param.getEndTime())){
param.setStartTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){
param.setFlowTaskName("结束");
}
// 获取权限区域机构
List<Dept> depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>();
}
// 操作票查询
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper);
// 工作票查询
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper);
// 工作任务单
return depts.stream().map(dept->{
CensVo cens = new CensVo();
cens.setDeptId(dept.getId());
cens.setDeptName(dept.getDeptName());
if(CollectionUtil.isEmpty(operates)){
cens.setOperateCount(0L);
}else{
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId())).count());
}
if(CollectionUtil.isEmpty(works)){
cens.setWorkCount(0L);
}else{
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId())).count());
}
cens.setWorkTaskCount((long)new Random().nextInt(10));
return cens;
}).collect(Collectors.toList());
}
/**
* 获取权限区域机构
* @return
*/
private List<Dept> authArea() {
R<List<Dept>> resut = sysClient.getDeptByCurrentUser();
if(!resut.isSuccess() || CollectionUtil.isEmpty(resut.getData())){
return new ArrayList<>();
}
return resut.getData().stream().filter(dept->dept.getDeptCategory().equals(HomePageConstant.AREA)).collect(Collectors.toList());
} }
@Override @Override
public List<CensYearVo> censYear(CensYearParamVo param) { public List<CensYearVo> censYear(CensYearParamVo param) {
return null; if(StringUtil.isEmpty(param.getYear())){
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH));
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
param.setEndTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}else{
param.setStartTime(param.getYear() + "-01-01 00:00:00");
param.setEndTime(param.getYear() + "-12-31 23:59:59");
}
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){
param.setFlowTaskName("结束");
}
// 获取权限区域机构
List<Dept> depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>();
}
// 操作票查询
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper);
// 工作票查询
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper);
return depts.stream().map(dept -> {
CensYearVo censYear = new CensYearVo();
censYear.setDeptId(dept.getId());
censYear.setDeptName(dept.getDeptName());
for(int mon = 1 ; mon <= 12 ;mon++){
String strMon = param.getYear() + "-" + (mon > 9 ? mon : "0" + mon);
CensVo cens = new CensVo();
cens.setMon(mon);
if(CollectionUtil.isEmpty(operates)){
cens.setOperateCount(0L);
}else{
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId()) && DateUtil.format(operate.getCreateTime(),"yyyy-MM").equals(strMon)).count());
}
if(CollectionUtil.isEmpty(works)){
cens.setWorkCount(0L);
}else{
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId()) && DateUtil.format(work.getCreateTime(),"yyyy-MM").equals(strMon)).count());
}
cens.setWorkTaskCount((long)new Random().nextInt(10));
}
return censYear;
}).collect(Collectors.toList());
} }
} }
Loading…
Cancel
Save