|
@@ -5,13 +5,14 @@ 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;
|
|
|
import com.usky.fire.mapper.PatrolInspectionAttendanceMapper;
|
|
|
import com.usky.fire.service.PatrolInspectionAttendanceService;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.service.PatrolInspectionPersonnelService;
|
|
|
import com.usky.fire.service.PatrolInspectionTypeService;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -41,14 +42,16 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
@Autowired
|
|
|
private RemoteDeptService remoteDeptService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
|
|
|
@Override
|
|
|
- public IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, Integer typeId, String operator, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
+ public IPage<Map<String, Object>> pageList(Integer pageNum, Integer pageSize, String operateCode, String operator, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
IPage<PatrolInspectionAttendance> page = new Page<>(pageNum, pageSize);
|
|
|
LambdaQueryWrapper<PatrolInspectionAttendance> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(PatrolInspectionAttendance::getTenantId, SecurityUtils.getTenantId());
|
|
|
|
|
|
- if (typeId != null) {
|
|
|
- queryWrapper.eq(PatrolInspectionAttendance::getTypeId, typeId);
|
|
|
+ if (StringUtils.isNotBlank(operateCode)) {
|
|
|
+ queryWrapper.eq(PatrolInspectionAttendance::getOperateCode, operateCode);
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(operator)) {
|
|
@@ -56,10 +59,11 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
}
|
|
|
|
|
|
if (startTime != null) {
|
|
|
- queryWrapper.between(endTime != null, PatrolInspectionAttendance::getOperateDate, startTime, endTime);
|
|
|
- } else {
|
|
|
- queryWrapper.le(endTime != null, PatrolInspectionAttendance::getOperateDate, endTime);
|
|
|
+ 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);
|
|
@@ -74,8 +78,8 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
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("signInType", attendance.getSignInType());
|
|
|
+ map.put("operateName", patrolInspectionTypeService.getName(attendance.getOperateCode()));
|
|
|
map.put("deviceCode", attendance.getDeviceCode());
|
|
|
map.put("imagePath", attendance.getImagePath());
|
|
|
map.put("longitude", attendance.getLongitude());
|
|
@@ -94,20 +98,39 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
|
|
|
|
|
|
@Override
|
|
|
public void add(PatrolInspectionAttendance patrolInspectionAttendance) {
|
|
|
+ patrolInspectionAttendance.setTenantId(SecurityUtils.getTenantId());
|
|
|
+ patrolInspectionAttendance.setOperator(SecurityUtils.getUsername());
|
|
|
+ patrolInspectionAttendance.setOperatorId(SecurityUtils.getUserId());
|
|
|
+ patrolInspectionAttendance.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
|
|
+ patrolInspectionAttendance.setOperateDate(LocalDateTime.now());
|
|
|
+ patrolInspectionAttendance.setRemarks(patrolInspectionAttendance.getRemarks());
|
|
|
+ patrolInspectionAttendance.setSignInType(patrolInspectionAttendance.getSignInType());
|
|
|
+ patrolInspectionAttendance.setOperateCode(patrolInspectionAttendance.getOperateCode());
|
|
|
+ patrolInspectionAttendance.setImagePath(patrolInspectionAttendance.getImagePath());
|
|
|
+ patrolInspectionAttendance.setLatitude(patrolInspectionAttendance.getLatitude());
|
|
|
+ patrolInspectionAttendance.setLongitude(patrolInspectionAttendance.getLongitude());
|
|
|
+ patrolInspectionAttendance.setIdentificationNumber(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
|
|
|
+ patrolInspectionAttendance.setDeviceCode(patrolInspectionAttendance.getDeviceCode());
|
|
|
baseMapper.insert(patrolInspectionAttendance);
|
|
|
+ patrolInspectionPersonnelService.updateSignStatus(patrolInspectionAttendance.getSignInType());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取部门名
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@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();
|
|
|
+ public String getDeptName(Long 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;
|
|
|
}
|
|
|
- return name;
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|