Browse Source

#打卡巡检

zhongwei
yang_shj 6 days ago
parent
commit
cb933de955
  1. 9
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockInResponseDTO.java
  2. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java
  3. 23
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml
  4. 26
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java

9
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockInResponseDTO.java

@ -2,6 +2,7 @@ package com.hnac.hzinfo.inspect.ai.vo;
import com.hnac.hzinfo.inspect.task.entity.ClockInEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -16,4 +17,12 @@ public class ClockInResponseDTO extends ClockInEntity {
private static final long serialVersionUID = 8445346022067680992L;
@ApiModelProperty(value = "打卡人名称")
private String clockPersonName;
@ApiModelProperty(value = "巡检任务名称")
private String taskName;
@ApiModelProperty(value = "巡检对象名称")
private String objectName;
}

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.java

@ -16,5 +16,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface ClockInMapper extends BaseMapper<ClockInEntity> {
IPage<ClockInResponseDTO> pageCondition(@Param("param") ClockInRequestDTO param, IPage<Object> page);
IPage<ClockInStatisticsResponseDTO> statistics(@Param("param") ClockInRequestDTO param, IPage<ClockInResponseDTO> page);
}

23
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/ClockInMapper.xml

@ -2,6 +2,29 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzinfo.inspect.task.mapper.ClockInMapper">
<select id="pageCondition" resultType="com.hnac.hzinfo.inspect.ai.vo.ClockInResponseDTO">
SELECT CLOCK.*,TASK.PLAN_NAME AS taskName,OBJECT.`NAME` AS objectName FROM HZ_ST_EX_CLOCK_IN CLOCK
LEFT JOIN HZ_ST_EX_TASK TASK ON CLOCK.TASK_ID = TASK.ID
LEFT JOIN HZ_ST_EX_OBJECT OBJECT ON CLOCK.OBJECT_ID = OBJECT.ID
<where>
CLOCK.IS_DELETED = 0
<if test="param.clockPerson != null">
AND CLOCK.CLOCK_PERSON = #{param.clockPerson}
</if>
<if test="param.startTime != null">
AND CLOCK.PLAN_START_TIME &gt;= #{param.startTime}
</if>
<if test="param.endTime != null">
AND CLOCK.PLAN_END_TIME &lt;= #{param.endTime}
</if>
<if test="param.status != null">
AND CLOCK.STATUS = #{param.status}
</if>
</where>
ORDER BY CLOCK.CREATE_TIME,CLOCK.TASK_ID DESC
</select>
<select id="statistics" resultType="com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO">
SELECT CLOCK_PERSON,
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS incomplete,

26
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/ClockInServiceImpl.java

@ -46,23 +46,17 @@ public class ClockInServiceImpl extends ServiceImpl<ClockInMapper, ClockInEntity
*/
@Override
public IPage<ClockInResponseDTO> pageCondition(ClockInRequestDTO param, Query query) {
QueryWrapper<ClockInEntity> queryWrapper = new QueryWrapper<ClockInEntity>() {{
if(ObjectUtil.isNotEmpty(param.getClockPerson())){
eq("CLOCK_PERSON",param.getClockPerson());
}
if(ObjectUtil.isNotEmpty(param.getStatus())){
eq("STATUS",param.getStatus());
}
if(StringUtils.isNotEmpty(param.getStartTime())){
ge("PLAN_START_TIME",param.getStartTime());
}
if(StringUtils.isNotEmpty(param.getEndTime())){
le("PLAN_END_TIME",param.getEndTime());
IPage<ClockInResponseDTO> page = this.baseMapper.pageCondition(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());
}
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = ClockInWrapper.build().listVO(pages.getRecords());
return pages.setRecords(list);
}).collect(Collectors.toList()));
return page;
}
/**

Loading…
Cancel
Save