提交 73567f49 作者: 17607474349

Merge remote-tracking branch 'origin/dev_tzl' into dev_lijing

# Conflicts:
#	app/src/main/java/com/yiring/app/domain/location/LocationTurnoverRepository.java
...@@ -35,11 +35,9 @@ public class WorkAreaParam implements Serializable { ...@@ -35,11 +35,9 @@ public class WorkAreaParam implements Serializable {
String workAreaName; String workAreaName;
@ApiModelProperty(value = "消抖阈值(秒)", example = "1", required = true) @ApiModelProperty(value = "消抖阈值(秒)", example = "1", required = true)
@NotEmpty(message = "消抖阈值(秒)不能为空")
Integer threshold; Integer threshold;
@ApiModelProperty(value = "超时时间(秒)", example = "1", required = true) @ApiModelProperty(value = "超时时间(秒)", example = "1", required = true)
@NotEmpty(message = "超时时间(秒)不能为空")
Integer timeout; Integer timeout;
@ApiModelProperty(value = "负责人", example = "1") @ApiModelProperty(value = "负责人", example = "1")
......
...@@ -25,7 +25,7 @@ public class WorkAreaQueryParam implements Serializable { ...@@ -25,7 +25,7 @@ public class WorkAreaQueryParam implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -8037877534751243885L; private static final long serialVersionUID = -8037877534751243885L;
@ApiModelProperty(value = "工区名称", example = "工业区", required = true) @ApiModelProperty(value = "工区名称", example = "工业区")
String workAreaName; String workAreaName;
@ApiModelProperty(value = "每页记录数", example = "10") @ApiModelProperty(value = "每页记录数", example = "10")
......
...@@ -3,6 +3,7 @@ package com.yiring.app.service.location.turnover; ...@@ -3,6 +3,7 @@ package com.yiring.app.service.location.turnover;
import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam; import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
...@@ -26,6 +27,14 @@ public interface LocationTurnoverService { ...@@ -26,6 +27,14 @@ public interface LocationTurnoverService {
PageParam pageParam PageParam pageParam
); );
/** /**
* 首页图标
* @author tzl
* @date 2022/5/25 10:02
* @return com.yiring.common.core.Result<com.yiring.common.vo.PageVo<com.yiring.app.vo.perstatistics.PersonnelStatisticsVo>>
*/
Result<PageVo<PersonnelStatisticsEchartsVo>> listInfo();
/**
* 下拉框 * 下拉框
* @author tzl * @author tzl
* @date 2022/5/16 13:59 * @date 2022/5/16 13:59
......
...@@ -11,6 +11,7 @@ import com.yiring.app.excel.perstatistics.PersonnelStatisticsExportExcel; ...@@ -11,6 +11,7 @@ import com.yiring.app.excel.perstatistics.PersonnelStatisticsExportExcel;
import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam; import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam;
import com.yiring.app.service.location.turnover.LocationTurnoverService; import com.yiring.app.service.location.turnover.LocationTurnoverService;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo;
import com.yiring.app.vo.perstatistics.TurnoverResultVo; import com.yiring.app.vo.perstatistics.TurnoverResultVo;
import com.yiring.auth.domain.dept.Department; import com.yiring.auth.domain.dept.Department;
...@@ -76,6 +77,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -76,6 +77,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
cq.multiselect(num, sourceId, enter).groupBy(sourceId, enter); cq.multiselect(num, sourceId, enter).groupBy(sourceId, enter);
List<Predicate> list = new ArrayList<>(); List<Predicate> list = new ArrayList<>();
//查询条件
list.add(cb.equal(root.get(LocationTurnover.Fields.type), LocationTurnover.Type.DISTRICT)); list.add(cb.equal(root.get(LocationTurnover.Fields.type), LocationTurnover.Type.DISTRICT));
if (ObjectUtil.isNotNull(personnelStatisticsQueryParam.getSourceId())) { if (ObjectUtil.isNotNull(personnelStatisticsQueryParam.getSourceId())) {
list.add(cb.equal(root.get(LocationTurnover.Fields.sourceId), personnelStatisticsQueryParam.getSourceId())); list.add(cb.equal(root.get(LocationTurnover.Fields.sourceId), personnelStatisticsQueryParam.getSourceId()));
...@@ -115,6 +117,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -115,6 +117,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo.setRegion(maps.get(id)); personnelStatisticsVo.setRegion(maps.get(id));
personnelStatisticsVo.setAdmissionNumber(0L); personnelStatisticsVo.setAdmissionNumber(0L);
personnelStatisticsVo.setAttendance(0L); personnelStatisticsVo.setAttendance(0L);
if ( if (
ObjectUtil.isNotNull(personnelStatisticsQueryParam.getStartTime()) && ObjectUtil.isNotNull(personnelStatisticsQueryParam.getStartTime()) &&
ObjectUtil.isNotNull(personnelStatisticsQueryParam.getEndTime()) ObjectUtil.isNotNull(personnelStatisticsQueryParam.getEndTime())
...@@ -125,6 +128,8 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -125,6 +128,8 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo.setStartTime(LocalDateTime.of(LocalDate.now(), LocalTime.MIN)); personnelStatisticsVo.setStartTime(LocalDateTime.of(LocalDate.now(), LocalTime.MIN));
personnelStatisticsVo.setEndTime(LocalDateTime.of(LocalDate.now(), LocalTime.MAX)); personnelStatisticsVo.setEndTime(LocalDateTime.of(LocalDate.now(), LocalTime.MAX));
} }
//处理数据结构
for (TurnoverResultVo turnoverResultVo : resultList) { for (TurnoverResultVo turnoverResultVo : resultList) {
if (id.equals(turnoverResultVo.getSourceId())) { if (id.equals(turnoverResultVo.getSourceId())) {
if (turnoverResultVo.getEnter()) { if (turnoverResultVo.getEnter()) {
...@@ -141,6 +146,62 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -141,6 +146,62 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
} }
@Override @Override
public Result<PageVo<PersonnelStatisticsEchartsVo>> listInfo() {
List<District> all = districtRepository.findAll();
Map<Long, String> maps = all.stream().collect(Collectors.toMap(District::getId, District::getName));
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<TurnoverResultVo> cq = cb.createQuery(TurnoverResultVo.class);
Root<LocationTurnover> root = cq.from(LocationTurnover.class);
Path<Object> sourceId = root.get(LocationTurnover.Fields.sourceId);
Path<Object> enter = root.get(LocationTurnover.Fields.enter);
Expression<Long> num = cb.count(root.get(BasicEntity.Fields.id));
cq.multiselect(num, sourceId, enter).groupBy(sourceId, enter);
List<Predicate> list = new ArrayList<>();
//查询类型为区域
list.add(cb.equal(root.get(LocationTurnover.Fields.type), LocationTurnover.Type.DISTRICT));
//当天内
list.add(
cb.between(
root.get(LocationTurnover.Fields.time),
LocalDateTime.of(LocalDate.now(), LocalTime.MIN),
LocalDateTime.of(LocalDate.now(), LocalTime.MAX)
)
);
cq.where(list.toArray(new Predicate[0]));
List<TurnoverResultVo> resultList = em.createQuery(cq).getResultList();
List<Long> collect = resultList
.stream()
.map(TurnoverResultVo::getSourceId)
.distinct()
.collect(Collectors.toList());
List<PersonnelStatisticsEchartsVo> pageList = new ArrayList<>();
for (Long id : collect) {
PersonnelStatisticsEchartsVo personnelStatisticsVo = new PersonnelStatisticsEchartsVo();
personnelStatisticsVo.setRegion(maps.get(id));
for (TurnoverResultVo turnoverResultVo : resultList) {
if (id.equals(turnoverResultVo.getSourceId())) {
//查询相关人数
List<LocationTurnover> all1 = locationTurnoverRepository.findAll(
condition(PersonnelStatisticsQueryParam.builder().sourceId(id).build())
);
List<User> collect1 = all1
.stream()
.map(LocationTurnover::getUser)
.distinct()
.collect(Collectors.toList());
personnelStatisticsVo.setNumOfPeo(collect1.size());
}
}
pageList.add(personnelStatisticsVo);
}
PageVo<PersonnelStatisticsEchartsVo> build = PageVo.build(pageList, pageList.size());
return Result.ok(build);
}
@Override
public Result<PageVo<PersonnelStatisticsVo>> indexInfo( public Result<PageVo<PersonnelStatisticsVo>> indexInfo(
PersonnelStatisticsQueryParam personnelStatisticsQueryParam PersonnelStatisticsQueryParam personnelStatisticsQueryParam
) { ) {
...@@ -189,6 +250,17 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -189,6 +250,17 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo.setAttendance(0L); personnelStatisticsVo.setAttendance(0L);
for (TurnoverResultVo turnoverResultVo : resultList) { for (TurnoverResultVo turnoverResultVo : resultList) {
if (id.equals(turnoverResultVo.getSourceId())) { if (id.equals(turnoverResultVo.getSourceId())) {
//查询相关人数
personnelStatisticsQueryParam.setSourceId(id);
List<LocationTurnover> all1 = locationTurnoverRepository.findAll(
condition(personnelStatisticsQueryParam)
);
List<User> collect1 = all1
.stream()
.map(LocationTurnover::getUser)
.distinct()
.collect(Collectors.toList());
personnelStatisticsVo.setNumOfPeo(collect1.size());
if (turnoverResultVo.getEnter()) { if (turnoverResultVo.getEnter()) {
personnelStatisticsVo.setAdmissionNumber(turnoverResultVo.getNum()); personnelStatisticsVo.setAdmissionNumber(turnoverResultVo.getNum());
} else { } else {
...@@ -310,11 +382,13 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService { ...@@ -310,11 +382,13 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
condition(personnelStatisticsQueryParam), condition(personnelStatisticsQueryParam),
PageParam.toPageable(pageParam) PageParam.toPageable(pageParam)
); );
List<PersonnelStatisticsDetailVo> data = all List<PersonnelStatisticsDetailVo> data = all
.get() .get()
.map(locationTurnover -> { .map(locationTurnover -> {
PersonnelStatisticsDetailVo vo = new PersonnelStatisticsDetailVo(); PersonnelStatisticsDetailVo vo = new PersonnelStatisticsDetailVo();
BeanUtils.copyProperties(locationTurnover, vo); BeanUtils.copyProperties(locationTurnover, vo);
PersonnelStatisticsDetailVo.UserVo build = PersonnelStatisticsDetailVo.UserVo PersonnelStatisticsDetailVo.UserVo build = PersonnelStatisticsDetailVo.UserVo
.builder() .builder()
.realName(locationTurnover.getUser().getRealName()) .realName(locationTurnover.getUser().getRealName())
......
...@@ -3,6 +3,7 @@ package com.yiring.app.service.workArea.impl; ...@@ -3,6 +3,7 @@ package com.yiring.app.service.workArea.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder; import com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder;
import com.yiring.app.domain.video.Video;
import com.yiring.app.domain.workArea.WorkArea; import com.yiring.app.domain.workArea.WorkArea;
import com.yiring.app.domain.workArea.WorkAreaRepository; import com.yiring.app.domain.workArea.WorkAreaRepository;
import com.yiring.app.excel.workArea.WorkAreaExportExcel; import com.yiring.app.excel.workArea.WorkAreaExportExcel;
...@@ -58,6 +59,7 @@ public class WorkAreaServiceImpl implements WorkAreaService { ...@@ -58,6 +59,7 @@ public class WorkAreaServiceImpl implements WorkAreaService {
} }
WorkArea workArea = new WorkArea(); WorkArea workArea = new WorkArea();
BeanUtils.copyProperties(workAreaParam, workArea); BeanUtils.copyProperties(workAreaParam, workArea);
workArea.setVideo(Video.builder().id(workAreaParam.getVideoId()).build());
workAreaRepository.saveAndFlush(workArea); workAreaRepository.saveAndFlush(workArea);
return Result.ok(); return Result.ok();
} }
...@@ -76,6 +78,7 @@ public class WorkAreaServiceImpl implements WorkAreaService { ...@@ -76,6 +78,7 @@ public class WorkAreaServiceImpl implements WorkAreaService {
} }
} }
BeanUtils.copyProperties(workAreaParam, workArea); BeanUtils.copyProperties(workAreaParam, workArea);
workArea.setVideo(Video.builder().id(workAreaParam.getVideoId()).build());
workAreaRepository.saveAndFlush(workArea); workAreaRepository.saveAndFlush(workArea);
return Result.ok(); return Result.ok();
} }
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.perstatistics;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/15 9:15
*/
@ApiModel("PersonnelStatisticsEchartsVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class PersonnelStatisticsEchartsVo implements Serializable {
@Serial
private static final long serialVersionUID = -5973651085056867803L;
@ApiModelProperty(value = "区域", example = "化工区")
String region;
@ApiModelProperty(value = "相关人数")
long numOfPeo;
}
...@@ -46,4 +46,7 @@ public class PersonnelStatisticsVo implements Serializable { ...@@ -46,4 +46,7 @@ public class PersonnelStatisticsVo implements Serializable {
@ApiModelProperty(value = "结束时间") @ApiModelProperty(value = "结束时间")
LocalDateTime endTime; LocalDateTime endTime;
@ApiModelProperty(value = "相关人数")
long numOfPeo;
} }
...@@ -4,6 +4,7 @@ package com.yiring.app.web.location.turnover; ...@@ -4,6 +4,7 @@ package com.yiring.app.web.location.turnover;
import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam; import com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam;
import com.yiring.app.service.location.turnover.LocationTurnoverService; import com.yiring.app.service.location.turnover.LocationTurnoverService;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo;
import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo; import com.yiring.app.vo.perstatistics.PersonnelStatisticsVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
...@@ -47,6 +48,12 @@ public class LocationTurnoverController { ...@@ -47,6 +48,12 @@ public class LocationTurnoverController {
return locationTurnoverService.pageInfo(personnelStatisticsQueryParam, pageParam); return locationTurnoverService.pageInfo(personnelStatisticsQueryParam, pageParam);
} }
@ApiOperation(value = "查询人员统计图表")
@GetMapping("listInfo")
public Result<PageVo<PersonnelStatisticsEchartsVo>> listInfo() {
return locationTurnoverService.listInfo();
}
@ApiOperation(value = "下拉框") @ApiOperation(value = "下拉框")
@GetMapping("indexInfo") @GetMapping("indexInfo")
public Result<PageVo<PersonnelStatisticsVo>> indexInfo( public Result<PageVo<PersonnelStatisticsVo>> indexInfo(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论