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. 24
      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 com.hnac.hzinfo.inspect.task.entity.ClockInEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -16,4 +17,12 @@ public class ClockInResponseDTO extends ClockInEntity {
private static final long serialVersionUID = 8445346022067680992L; 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 @Mapper
public interface ClockInMapper extends BaseMapper<ClockInEntity> { 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); 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" > <!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"> <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 id="statistics" resultType="com.hnac.hzinfo.inspect.ai.vo.ClockInStatisticsResponseDTO">
SELECT CLOCK_PERSON, SELECT CLOCK_PERSON,
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS incomplete, SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS incomplete,

24
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 @Override
public IPage<ClockInResponseDTO> pageCondition(ClockInRequestDTO param, Query query) { public IPage<ClockInResponseDTO> pageCondition(ClockInRequestDTO param, Query query) {
QueryWrapper<ClockInEntity> queryWrapper = new QueryWrapper<ClockInEntity>() {{ IPage<ClockInResponseDTO> page = this.baseMapper.pageCondition(param,Condition.getPage(query));
if(ObjectUtil.isNotEmpty(param.getClockPerson())){ if(CollectionUtil.isEmpty(page.getRecords())){
eq("CLOCK_PERSON",param.getClockPerson()); return page;
}
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())){ page.setRecords(page.getRecords().stream().peek(record->{
le("PLAN_END_TIME",param.getEndTime()); User user = UserCache.getUser(record.getClockPerson());
if(ObjectUtil.isNotEmpty(user)){
record.setClockPersonName(user.getRealName());
} }
}}; }).collect(Collectors.toList()));
IPage pages = super.page(Condition.getPage(query), queryWrapper); return page;
List list = ClockInWrapper.build().listVO(pages.getRecords());
return pages.setRecords(list);
} }
/** /**

Loading…
Cancel
Save