|
@@ -4,16 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.core.util.StringUtils;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.PatrolInspectionAttendance;
|
|
|
import com.usky.fire.mapper.PatrolInspectionAttendanceMapper;
|
|
|
import com.usky.fire.service.PatrolInspectionAttendanceService;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.service.PatrolInspectionTypeService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -26,14 +31,17 @@ import java.time.LocalDateTime;
|
|
|
*/
|
|
|
@Service
|
|
|
public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<PatrolInspectionAttendanceMapper, PatrolInspectionAttendance> implements PatrolInspectionAttendanceService {
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionTypeService patrolInspectionTypeService;
|
|
|
+
|
|
|
@Override
|
|
|
- public CommonPage<PatrolInspectionAttendance> pageList(Integer pageNum, Integer pageSize, Integer typeId, String operator, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
- IPage<PatrolInspectionAttendance> page = new Page<>(pageNum,pageSize);
|
|
|
+ public IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, Integer typeId, String operator, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
+ IPage<PatrolInspectionAttendance> page = new Page<>(pageNum, pageSize);
|
|
|
LambdaQueryWrapper<PatrolInspectionAttendance> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(PatrolInspectionAttendance::getTenantId,SecurityUtils.getTenantId());
|
|
|
+ queryWrapper.eq(PatrolInspectionAttendance::getTenantId, SecurityUtils.getTenantId());
|
|
|
|
|
|
- if (typeId!=null){
|
|
|
- queryWrapper.eq(PatrolInspectionAttendance::getTypeId,typeId);
|
|
|
+ if (typeId != null) {
|
|
|
+ queryWrapper.eq(PatrolInspectionAttendance::getTypeId, typeId);
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(operator)) {
|
|
@@ -42,15 +50,39 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
|
|
|
if (startTime != null && endTime != null) {
|
|
|
queryWrapper.between(PatrolInspectionAttendance::getOperateDate, startTime, endTime);
|
|
|
- } else if(startTime == null && endTime !=null){
|
|
|
+ } else if (startTime == null && endTime != null) {
|
|
|
queryWrapper.le(PatrolInspectionAttendance::getOperateDate, endTime);
|
|
|
}
|
|
|
-
|
|
|
queryWrapper.orderByDesc(PatrolInspectionAttendance::getId);
|
|
|
- page = this.page(page,queryWrapper);
|
|
|
- return new CommonPage<>(page.getRecords(),page.getTotal(),pageNum,pageSize);
|
|
|
- }
|
|
|
|
|
|
+ IPage<PatrolInspectionAttendance> attendancePage = baseMapper.selectPage(page, queryWrapper);
|
|
|
+
|
|
|
+ List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
+ for (PatrolInspectionAttendance attendance : attendancePage.getRecords()) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", attendance.getId());
|
|
|
+ map.put("deptId", attendance.getDeptId());
|
|
|
+ map.put("tenantId", attendance.getTenantId());
|
|
|
+ map.put("operator", attendance.getOperator());
|
|
|
+ map.put("operatorId", attendance.getOperatorId());
|
|
|
+ map.put("operateDate", attendance.getOperateDate());
|
|
|
+ map.put("operateType", attendance.getOperateType());
|
|
|
+ map.put("typeName", patrolInspectionTypeService.getName(attendance.getTypeId()));
|
|
|
+ map.put("deviceCode", attendance.getDeviceCode());
|
|
|
+ map.put("imagePath", attendance.getImagePath());
|
|
|
+ map.put("longitude", attendance.getLongitude());
|
|
|
+ map.put("latitude", attendance.getLatitude());
|
|
|
+ map.put("remarks", attendance.getRemarks());
|
|
|
+ map.put("identificationNumber", attendance.getIdentificationNumber());
|
|
|
+ resultList.add(map);
|
|
|
+ }
|
|
|
+ IPage<Map<String, Object>> resultPage = new Page<>();
|
|
|
+ resultPage.setRecords(resultList);
|
|
|
+ resultPage.setTotal(attendancePage.getTotal());
|
|
|
+ resultPage.setCurrent(attendancePage.getCurrent());
|
|
|
+ resultPage.setSize(attendancePage.getSize());
|
|
|
+ return resultPage;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void add(PatrolInspectionAttendance patrolInspectionAttendance) {
|