diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockInStatisticsResponseDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockInStatisticsResponseDTO.java new file mode 100644 index 0000000..c2464ee --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockInStatisticsResponseDTO.java @@ -0,0 +1,30 @@ +package com.hnac.hzinfo.inspect.ai.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @author ysj + */ +@Data +@ApiModel(value = "巡检打卡统计分页响应对象", description = "巡检打卡统计分页响应对象") +public class ClockInStatisticsResponseDTO implements Serializable { + + private static final long serialVersionUID = 8445346022067680992L; + + @ApiModelProperty(value = "打卡人") + private Long clockPerson; + + @ApiModelProperty(value = "打卡人名称") + private String clockPersonName; + + @ApiModelProperty(value = "未完成打卡次数") + private Integer incomplete; + + @ApiModelProperty(value = "完成打卡次数") + private Integer complete; +} \ No newline at end of file diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/ClockInController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/ClockInController.java index 42e26d9..529cb10 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/ClockInController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/ClockInController.java @@ -8,6 +8,7 @@ import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.ai.vo.ClockInRequestDTO; import com.hnac.hzinfo.inspect.ai.vo.ClockInResponseDTO; +import com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO; import com.hnac.hzinfo.inspect.task.service.IClockInService; import com.hnac.hzinfo.log.annotation.Business; import io.swagger.annotations.Api; @@ -33,12 +34,16 @@ public class ClockInController extends BladeController { private final IClockInService clockInService; @GetMapping("/page") - @ApiOperationSupport(order = 4) - @OperationAnnotation(moduleName = "巡检打卡", - title = "打卡记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, - action = "分页查询打卡记录") - @ApiOperation(value = "分页") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "打卡记录") public R> list(ClockInRequestDTO param, Query query) { return R.data(clockInService.pageCondition(param, query)); } + + @GetMapping("/statistics") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "打卡统计") + public R> statistics(ClockInRequestDTO param, Query query) { + return R.data(clockInService.statistics(param, query)); + } } \ No newline at end of file diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java index 3954988..fa5dbb1 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java @@ -1,8 +1,13 @@ package com.hnac.hzinfo.inspect.task.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzinfo.inspect.ai.vo.ClockInRequestDTO; +import com.hnac.hzinfo.inspect.ai.vo.ClockInResponseDTO; +import com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO; import com.hnac.hzinfo.inspect.task.entity.ClockInEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** @@ -11,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ClockInMapper extends BaseMapper { + IPage statistics(@Param("param") ClockInRequestDTO param, IPage page); } \ No newline at end of file diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml index 575ea7e..a864e37 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml @@ -2,4 +2,26 @@ + \ No newline at end of file diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/IClockInService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/IClockInService.java index 4c9a065..954ce7a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/IClockInService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/IClockInService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzinfo.inspect.ai.vo.ClockInRequestDTO; import com.hnac.hzinfo.inspect.ai.vo.ClockInResponseDTO; +import com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO; import com.hnac.hzinfo.inspect.task.entity.ClockInEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import org.springblade.core.mp.support.Query; @@ -18,5 +19,7 @@ public interface IClockInService extends IService { IPage pageCondition(ClockInRequestDTO param, Query query); + IPage statistics(ClockInRequestDTO param, Query query); + List pendingObjects(Long taskId); } \ No newline at end of file diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java index 3dbd728..5c3033c 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzinfo.inspect.ai.vo.ClockInRequestDTO; import com.hnac.hzinfo.inspect.ai.vo.ClockInResponseDTO; +import com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO; import com.hnac.hzinfo.inspect.task.entity.ClockInEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import com.hnac.hzinfo.inspect.task.mapper.ClockInMapper; @@ -17,11 +18,15 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * @author ysj @@ -61,6 +66,27 @@ public class ClockInServiceImpl extends ServiceImpl statistics(ClockInRequestDTO param, Query query) { + IPage page = this.baseMapper.statistics(param,Condition.getPage(query)); + if(CollectionUtil.isEmpty(page.getRecords())){ + return page; + } + page.setRecords(page.getRecords().stream().peek(record->{ + User user = UserCache.getUser(record.getClockPerson()); + if(ObjectUtil.isNotEmpty(user)){ + record.setClockPersonName(user.getRealName()); + } + }).collect(Collectors.toList())); + return page; + } + + /** * 待生成打卡记录巡检对象 * @param id * @return