|
@@ -4,6 +4,8 @@ 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.exception.BusinessException;
|
|
|
import com.usky.common.core.util.StringUtils;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.PatrolInspectionAttendance;
|
|
@@ -11,8 +13,10 @@ 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 com.usky.system.RemoteDeptService;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
@@ -34,6 +38,9 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
@Autowired
|
|
|
private PatrolInspectionTypeService patrolInspectionTypeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteDeptService remoteDeptService;
|
|
|
+
|
|
|
@Override
|
|
|
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);
|
|
@@ -48,20 +55,21 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
queryWrapper.eq(PatrolInspectionAttendance::getOperator, operator);
|
|
|
}
|
|
|
|
|
|
- if (startTime != null && endTime != null) {
|
|
|
- queryWrapper.between(PatrolInspectionAttendance::getOperateDate, startTime, endTime);
|
|
|
- } else if (startTime == null && endTime != null) {
|
|
|
- queryWrapper.le(PatrolInspectionAttendance::getOperateDate, endTime);
|
|
|
+ if (startTime != null) {
|
|
|
+ queryWrapper.between(endTime != null, PatrolInspectionAttendance::getOperateDate, startTime, endTime);
|
|
|
+ } else {
|
|
|
+ queryWrapper.le(endTime != null, PatrolInspectionAttendance::getOperateDate, endTime);
|
|
|
}
|
|
|
queryWrapper.orderByDesc(PatrolInspectionAttendance::getId);
|
|
|
|
|
|
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("deptName", getDeptName(attendance.getDeptId()));
|
|
|
map.put("tenantId", attendance.getTenantId());
|
|
|
map.put("operator", attendance.getOperator());
|
|
|
map.put("operatorId", attendance.getOperatorId());
|
|
@@ -89,5 +97,17 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
baseMapper.insert(patrolInspectionAttendance);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String getDeptName(Integer id) {
|
|
|
+ String name = "";
|
|
|
+ List<Map<String, Object>> deptList = remoteDeptService.getDeptList(SecurityUtils.getTenantId());
|
|
|
+ for (int i = 0; i < deptList.size(); i++) {
|
|
|
+ if (id.equals(deptList.get(i).get("dept_id"))){
|
|
|
+ name = deptList.get(i).get("dept_name").toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return name;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
+
|