Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package org.dromara.property.api;
|
||||
|
||||
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||
|
||||
/**
|
||||
* 物业楼层远程服务
|
||||
* @author lxj
|
||||
*/
|
||||
public interface RemoteBuildingService {
|
||||
|
||||
RemoteBuildingVo queryBuildingById(Long id);
|
||||
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package org.dromara.property.api;
|
||||
|
||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
||||
|
||||
/**
|
||||
* 物业楼层远程服务
|
||||
* @author lxj
|
||||
*/
|
||||
public interface RemoteUnitService {
|
||||
|
||||
RemoteUnitVo queryUnitById(Long id);
|
||||
|
||||
}
|
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
* @author lxj
|
||||
*/
|
||||
@Data
|
||||
public class RemoteUnitVo implements Serializable {
|
||||
public class RemoteBuildingVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -11L;
|
||||
@@ -21,31 +21,19 @@ public class RemoteUnitVo implements Serializable {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 园区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
private Long buildingId;
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
* 总层数
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 单元层数
|
||||
*/
|
||||
private Integer floorCount;
|
||||
|
||||
/**
|
||||
* 单元户数
|
||||
*/
|
||||
private Integer householdCount;
|
||||
|
||||
/**
|
||||
* 楼梯数量
|
||||
*/
|
||||
private Integer stairCount;
|
||||
private Long floorCount;
|
||||
|
||||
}
|
@@ -27,7 +27,7 @@ public interface RemoteFileService {
|
||||
* @return 结果
|
||||
* @throws ServiceException
|
||||
*/
|
||||
RemoteFile upload(byte[] file) throws ServiceException;
|
||||
RemoteFile uploadImg(byte[] file) throws ServiceException;
|
||||
|
||||
/**
|
||||
* 通过ossId查询对应的url
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.resource.api;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
|
||||
@@ -28,6 +29,18 @@ public class RemoteFileServiceMock implements RemoteFileService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param file 文件信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public RemoteFile uploadImg(byte[] file) {
|
||||
log.warn("服务调用异常 -> 降级处理");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ossId查询对应的url
|
||||
*
|
||||
|
@@ -30,7 +30,13 @@ public enum ContentTypeEnum {
|
||||
/**
|
||||
* GIF图片类型
|
||||
*/
|
||||
GIF("gif", "image/gif");
|
||||
GIF("gif", "image/gif"),
|
||||
|
||||
WEBP("webp", "image/webp"),
|
||||
|
||||
SVG("svg", "image/svg+xml"),
|
||||
|
||||
;
|
||||
|
||||
private final String extension;
|
||||
private final String contentType;
|
||||
@@ -41,13 +47,13 @@ public enum ContentTypeEnum {
|
||||
* @param extension 文件扩展名
|
||||
* @return 对应的内容类型,如果未找到则返回null
|
||||
*/
|
||||
public static String getContentType(String extension) {
|
||||
public static ContentTypeEnum ContentTypeEnum(String extension) {
|
||||
for (ContentTypeEnum type : values()) {
|
||||
if (type.extension.equalsIgnoreCase(extension)) {
|
||||
return type.contentType;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return JPG;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -75,16 +75,20 @@ public class AttendanceArrangementVo implements Serializable {
|
||||
@ExcelProperty(value = "状态:0-未生效,1-已生效")
|
||||
private Long status;
|
||||
|
||||
//考勤组
|
||||
private AttendanceGroup attendanceGroup;
|
||||
|
||||
//用户组
|
||||
private List<AttendanceUserGroup> userGroupList;
|
||||
|
||||
//固定排班
|
||||
private AttendanceWeekSet weekSet;
|
||||
|
||||
//班次
|
||||
private AttendanceShift shift;
|
||||
|
||||
private AttendanceScheduleCycle cycle;
|
||||
//排班制
|
||||
private AttendanceScheduleCycle scheduleCycle;
|
||||
|
||||
private AttendanceUserGroup userGroup;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package org.dromara.property.dubbo;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.property.api.RemoteBuildingService;
|
||||
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.service.ITbBuildingService;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
|
||||
/**
|
||||
* 对外提供的远程服务调用
|
||||
*
|
||||
* @author lxj
|
||||
*/
|
||||
@DubboService
|
||||
@RequiredArgsConstructor
|
||||
public class RemoteBuildingServiceImpl implements RemoteBuildingService {
|
||||
|
||||
private final ITbBuildingService iTbBuildingService;
|
||||
|
||||
|
||||
@Override
|
||||
public RemoteBuildingVo queryBuildingById(Long id) {
|
||||
TbBuildingVo tbBuildingVo = iTbBuildingService.queryById(id);
|
||||
if(tbBuildingVo == null) {
|
||||
return null;
|
||||
}
|
||||
RemoteBuildingVo remoteBuildingVo = new RemoteBuildingVo();
|
||||
remoteBuildingVo.setId(tbBuildingVo.getId());
|
||||
remoteBuildingVo.setCommunityId(tbBuildingVo.getCommunityId());
|
||||
remoteBuildingVo.setBuildingName(tbBuildingVo.getBuildingName());
|
||||
remoteBuildingVo.setFloorCount(tbBuildingVo.getFloorCount());
|
||||
return remoteBuildingVo;
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
package org.dromara.property.dubbo;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.property.api.RemoteUnitService;
|
||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
|
||||
/**
|
||||
* 对外提供的远程服务调用
|
||||
*
|
||||
* @author lxj
|
||||
*/
|
||||
@DubboService
|
||||
@RequiredArgsConstructor
|
||||
public class RemoteUnitServiceImpl implements RemoteUnitService {
|
||||
|
||||
private final ITbUnitService tbUnitService;
|
||||
|
||||
|
||||
@Override
|
||||
public RemoteUnitVo queryUnitById(Long id) {
|
||||
TbUnitVo tbUnitVo = tbUnitService.queryById(id);
|
||||
if(tbUnitVo == null) {
|
||||
return null;
|
||||
}
|
||||
RemoteUnitVo remoteUnitVo = new RemoteUnitVo();
|
||||
remoteUnitVo.setId(tbUnitVo.getId());
|
||||
remoteUnitVo.setCommunityId(tbUnitVo.getCommunityId());
|
||||
remoteUnitVo.setBuildingId(tbUnitVo.getBuildingId());
|
||||
remoteUnitVo.setUnitName(tbUnitVo.getUnitName());
|
||||
remoteUnitVo.setFloorCount(tbUnitVo.getFloorCount());
|
||||
remoteUnitVo.setHouseholdCount(tbUnitVo.getHouseholdCount());
|
||||
remoteUnitVo.setStairCount(tbUnitVo.getStairCount());
|
||||
return remoteUnitVo;
|
||||
}
|
||||
}
|
@@ -20,8 +20,10 @@ import org.dromara.property.service.IAttendanceArrangementService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -78,90 +80,170 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
||||
@Override
|
||||
public TableDataInfo<AttendanceArrangementVo> queryPageList(AttendanceArrangementBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AttendanceArrangement> lqw = buildQueryWrapper(bo);
|
||||
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
|
||||
//查询当前日期在哪些排班中,当前日期大于等于排班开始日期,小于等于排班结束日期
|
||||
LambdaQueryWrapper<AttendanceArrangement> ge = lqw
|
||||
.le(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
.ge(AttendanceArrangement::getEndDate, bo.getCurrentDate());
|
||||
|
||||
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), ge);
|
||||
|
||||
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().map(vo -> {
|
||||
//根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
//从前端查询出来的当前日期,判断是否在排班时间内
|
||||
if (bo.getCurrentDate().isAfter(vo.getStartDate()) && bo.getCurrentDate().isBefore(vo.getEndDate())) {
|
||||
//1.查询人员表信息
|
||||
//根据查询出来的result取出shceduleId
|
||||
Long scheduleId = vo.getId();
|
||||
//根据排班的id查询出排班的人员详细信息
|
||||
List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleId));
|
||||
vo.setUserGroupList(userGroupList);
|
||||
|
||||
//2.查询考勤组信息
|
||||
//根据查询出来的信息取出考勤组的id
|
||||
Long groupId = vo.getGroupId();
|
||||
//根据考勤组的id查询出考勤组的详细信息
|
||||
AttendanceGroup attendanceGroup = attendanceGroupMapper.selectById(groupId);
|
||||
//将考勤组的信息存到vo中
|
||||
vo.setAttendanceGroup(attendanceGroup);
|
||||
|
||||
//3.查询班制信息
|
||||
//判断当前考勤组的班制是固定班制还是排班制
|
||||
if (Objects.equals(attendanceGroup.getAttendanceType(), StatusConstant.FIXEDSCHEDULE)) {
|
||||
//3.1固定班制
|
||||
//根据考勤组id查询出班制信息的dayOfWeek
|
||||
List<AttendanceWeekSet> weekSetList = weekSetMapper.selectList(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId));
|
||||
//将当前日期转换为周几
|
||||
int weekNumber = bo.getCurrentDate().getDayOfWeek().getValue();
|
||||
//匹配weekNumber和weekSetList中的dayOfWeek,匹配成功则将weekSet存到vo中
|
||||
AttendanceWeekSet attendanceWeekSet = weekSetList.stream().filter(weekSet -> weekSet.getDayOfWeek() == weekNumber).findFirst().orElse(null);
|
||||
//根据过滤出来的attendanceWeekSet的weekSetId查询出shiftId
|
||||
Long shiftId = attendanceWeekSet.getShiftId();
|
||||
//根据shiftId查询出班次的详细信息
|
||||
AttendanceShift attendanceShift = attendanceShiftMapper.selectById(shiftId);
|
||||
//将attendanceShift存到vo中
|
||||
vo.setShift(attendanceShift);
|
||||
|
||||
|
||||
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> {
|
||||
//1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
//查询指定日期查询在哪些排班中,并返回arrangementList
|
||||
List<AttendanceArrangement> arrangementList = baseMapper.selectList(
|
||||
Wrappers.<AttendanceArrangement>lambdaQuery()
|
||||
.ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
.le(AttendanceArrangement::getEndDate, bo.getCurrentDate())
|
||||
);
|
||||
//根据排班查询出考勤组id
|
||||
List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
||||
}else if (Objects.equals(attendanceGroup.getAttendanceType(), StatusConstant.SHIFTSCHEDULE)) {
|
||||
//3.2排班制
|
||||
|
||||
// 2.循环将所有的考勤组id设置到考勤组中
|
||||
//循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据
|
||||
groupIds.forEach(
|
||||
groupId -> {
|
||||
//从数据库查询出当前考勤组的所有数据
|
||||
AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.<AttendanceGroup>lambdaQuery().eq(AttendanceGroup::getId, groupId));
|
||||
|
||||
// 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制
|
||||
if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) {
|
||||
// 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
//将传来的日期参数转为周几
|
||||
// int week = DateUtil.dayOfWeek(bo.getCurrentDate());
|
||||
int week = 1;
|
||||
//取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week));
|
||||
//将weekSet存到结果中
|
||||
vo.setWeekSet(weekSet);
|
||||
//根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId
|
||||
Long shiftId = weekSet.getId();
|
||||
//根据shiftId查询attendanceShift表中对应的id的数据
|
||||
AttendanceShift shift = attendanceShiftMapper.selectById(shiftId);
|
||||
//将shift存到结果中
|
||||
vo.setShift(shift);
|
||||
} else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) {
|
||||
// 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。
|
||||
//取出排班中的开始时间和结束时间
|
||||
LocalDate startDate = bo.getStartDate();
|
||||
LocalDate endDate = bo.getEndDate();
|
||||
//将startDate作为第一天,endDate作为最后一天,循环判断当前日期是第几天,取出当前天数的班次信息。
|
||||
LocalDate startDate = vo.getStartDate();
|
||||
LocalDate endDate = vo.getEndDate();
|
||||
LocalDate currentDate = bo.getCurrentDate();
|
||||
//统计当前考勤组有多少条数据
|
||||
int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
|
||||
|
||||
//todo: 匹配天数
|
||||
|
||||
// //统计当前考勤组有多少条数据
|
||||
// int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
|
||||
//取出attendanceScheduleCycle表中的天数
|
||||
Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber();
|
||||
List<Integer> cycleDaysList = scheduleCycleMapper.selectList(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).stream().map(AttendanceScheduleCycle::getDayNumber).collect(Collectors.toList());
|
||||
// 在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天
|
||||
int cycleDay = 0;
|
||||
while (startDate.isBefore(currentDate) || endDate.isAfter(currentDate)) {
|
||||
cycleDay++;
|
||||
// startDate = DateUtil.offsetDay(startDate, 1);
|
||||
//判断当前日期是clcleDays中的第几天
|
||||
if (cycleDay > cycleDays) {
|
||||
cycleDay = 1;
|
||||
}
|
||||
int cycleDay = 1; // 初始化 cycleDay 为 1
|
||||
for (LocalDate date = startDate; date.isBefore(endDate) || date.isEqual(endDate); date = date.plusDays(1)) {
|
||||
if (date.isEqual(currentDate)) {
|
||||
// 判断当前日期是cycleDays中的第几天
|
||||
int dayNumber = date.getDayOfYear() - startDate.getDayOfYear() + 1;
|
||||
cycleDay = dayNumber % cycleDaysList.size();
|
||||
if (cycleDay == 0) {
|
||||
cycleDay = cycleDaysList.size();
|
||||
}
|
||||
// 根据cycleDay查询出当前日期的班次信息
|
||||
AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery()
|
||||
.eq(AttendanceScheduleCycle::getGroupId, groupId)
|
||||
.eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
//将cycle存到vo中
|
||||
vo.setScheduleCycle(cycle);
|
||||
//根据cycleId查询出shiftId
|
||||
Long cycleId = cycle.getId();
|
||||
AttendanceShift shift = attendanceShiftMapper.selectOne(Wrappers.<AttendanceShift>lambdaQuery().eq(AttendanceShift::getId, cycle.getShiftId()));
|
||||
//将shift存到vo中
|
||||
vo.setShift(shift);
|
||||
break; // 找到当前日期后跳出循环
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//根据cycleDay查询出当前日期的班次信息
|
||||
AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
//将cycle存到结果中
|
||||
vo.setCycle(cycle);
|
||||
//将cycle存到vo中
|
||||
vo.setScheduleCycle(cycle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
TableDataInfo.build();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// AttendanceArrangementVo arrangementvo = baseMapper.selectVoByTime(bo.getCurrentDate());
|
||||
// //2.查询人员组的信息
|
||||
// //根据开始时间查询出所有的排班id
|
||||
// List<Long> scheduleIdList = baseMapper.selectList(Wrappers.<AttendanceArrangement>lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())).stream().map(AttendanceArrangement::getId).collect(Collectors.toList());
|
||||
// //根据排班的id查询出排班的人员详细信息
|
||||
// List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||
// //将排班人员信息添加到排班信息中
|
||||
// arrangementvo.setUserGroupList(userGroupList);
|
||||
// //1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||
// //查询指定日期查询在哪些排班中,并返回arrangementList
|
||||
// List<AttendanceArrangement> arrangementList = baseMapper.selectList(
|
||||
// Wrappers.<AttendanceArrangement>lambdaQuery()
|
||||
// .ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||
// .le(AttendanceArrangement::getEndDate, bo.getCurrentDate())
|
||||
// );
|
||||
// //根据排班查询出考勤组id
|
||||
// List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
||||
//
|
||||
// //3.根据排班的id查询出排班的考勤组id
|
||||
// List<Long> groupIds = baseMapper.selectList(Wrappers.<AttendanceArrangement>lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())).stream().map(AttendanceArrangement::getGroupId).distinct().collect(Collectors.toList());
|
||||
// //判断考勤组是排班制还是固定班制
|
||||
// // 2.循环将所有的考勤组id设置到考勤组中
|
||||
// //循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据
|
||||
// groupIds.forEach(
|
||||
// groupId -> {
|
||||
// //从数据库查询出当前考勤组的所有数据
|
||||
// AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.<AttendanceGroup>lambdaQuery().eq(AttendanceGroup::getId, groupId));
|
||||
//
|
||||
// // 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制
|
||||
// if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) {
|
||||
// // 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
// //将传来的日期参数转为周几
|
||||
//// int week = DateUtil.dayOfWeek(bo.getCurrentDate());
|
||||
// int week = 1;
|
||||
// //取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息
|
||||
// AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week));
|
||||
// //将weekSet存到结果中
|
||||
// vo.setWeekSet(weekSet);
|
||||
// //根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId
|
||||
// Long shiftId = weekSet.getId();
|
||||
// //根据shiftId查询attendanceShift表中对应的id的数据
|
||||
// AttendanceShift shift = attendanceShiftMapper.selectById(shiftId);
|
||||
// //将shift存到结果中
|
||||
// vo.setShift(shift);
|
||||
// } else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) {
|
||||
// // 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。
|
||||
// //取出排班中的开始时间和结束时间
|
||||
// LocalDate startDate = bo.getStartDate();
|
||||
// LocalDate endDate = bo.getEndDate();
|
||||
// LocalDate currentDate = bo.getCurrentDate();
|
||||
// //统计当前考勤组有多少条数据
|
||||
// int count = Math.toIntExact(scheduleCycleMapper.selectCount(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)));
|
||||
//
|
||||
//
|
||||
// //todo: 匹配天数
|
||||
//
|
||||
//
|
||||
// //取出attendanceScheduleCycle表中的天数
|
||||
// Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber();
|
||||
// //在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天
|
||||
// int cycleDay = 0;
|
||||
// while (startDate.isBefore(currentDate) || endDate.isAfter(currentDate)) {
|
||||
// cycleDay++;
|
||||
//// startDate = DateUtil.offsetDay(startDate, 1);
|
||||
// //判断当前日期是clcleDays中的第几天
|
||||
// if (cycleDay > cycleDays) {
|
||||
// cycleDay = 1;
|
||||
// }
|
||||
// }
|
||||
// //根据cycleDay查询出当前日期的班次信息
|
||||
// AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay));
|
||||
// //将cycle存到结果中
|
||||
// vo.setCycle(cycle);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
|
||||
@@ -202,7 +284,6 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
||||
// List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||
|
||||
|
||||
|
||||
// 根据排班查询出考勤组id
|
||||
List<Long> groupIds = arrangementList.stream()
|
||||
.map(AttendanceArrangement::getGroupId)
|
||||
|
@@ -36,7 +36,7 @@ public class SisAlarmEventAttachments extends TenantEntity {
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -77,4 +77,7 @@ public class SisDeviceManage extends BaseEntity {
|
||||
* 设备组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,51 @@
|
||||
package org.dromara.sis.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联对象 sis_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_elevator_floor_channel_ref")
|
||||
public class SisElevatorFloorChannelRef extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -35,7 +35,7 @@ public class SisAlarmEventAttachmentsBo extends BaseEntity {
|
||||
/**
|
||||
* 时间图片id
|
||||
*/
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -0,0 +1,52 @@
|
||||
package org.dromara.sis.domain.bo;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联业务对象 sis_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisElevatorFloorChannelRef.class, reverseConvertGenerate = false)
|
||||
public class SisElevatorFloorChannelRefBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
@NotNull(message = "楼层id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
@NotNull(message = "电梯id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -135,12 +135,12 @@ public class SisElevatorInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 建筑id
|
||||
*/
|
||||
@NotNull(message = "建筑不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
@@ -153,6 +153,19 @@ public class SisElevatorInfoBo extends BaseEntity {
|
||||
*/
|
||||
private DeviceInfo elevatorControlDeviceId;
|
||||
|
||||
/**
|
||||
* 通道信息
|
||||
*/
|
||||
private List<ChannelInfo> channels;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ChannelInfo {
|
||||
private Long floorId;
|
||||
private Long inChannel;
|
||||
private Long outChannel;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class DeviceInfo {
|
||||
|
@@ -40,7 +40,7 @@ public class SisAlarmEventAttachmentsVo implements Serializable {
|
||||
* 时间图片id
|
||||
*/
|
||||
@ExcelProperty(value = "时间图片id")
|
||||
private String ossId;
|
||||
private Long ossId;
|
||||
|
||||
/**
|
||||
* 1:图片,2:文件;3视频
|
||||
|
@@ -0,0 +1,62 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联视图对象 sis_elevator_floor_channel_ref
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisElevatorFloorChannelRef.class)
|
||||
public class SisElevatorFloorChannelRefVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
@ExcelProperty(value = "楼层id")
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 电梯id
|
||||
*/
|
||||
@ExcelProperty(value = "电梯id")
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 内部通道号
|
||||
*/
|
||||
@ExcelProperty(value = "内部通道号")
|
||||
private Long inChannel;
|
||||
|
||||
/**
|
||||
* 外部通道号
|
||||
*/
|
||||
@ExcelProperty(value = "外部通道号")
|
||||
private Long outChannel;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Mapper接口
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface SisElevatorFloorChannelRefMapper extends BaseMapperPlus<SisElevatorFloorChannelRef, SisElevatorFloorChannelRefVo> {
|
||||
|
||||
}
|
@@ -2,6 +2,7 @@ package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventAttachmentsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventAttachmentsVo;
|
||||
|
||||
@@ -65,4 +66,13 @@ public interface ISisAlarmEventAttachmentsService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量写入事件附件表
|
||||
*
|
||||
* @param ls 附件数据
|
||||
* @return 返回写入数量
|
||||
*/
|
||||
Boolean batchInsert(List<SisAlarmEventAttachments> ls);
|
||||
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ public interface ISisDeviceManageService {
|
||||
*/
|
||||
SisDeviceManageVo queryVoByDeviceIp(String deviceIp);
|
||||
|
||||
SisDeviceManage queryByDeviceIp(String deviceId);
|
||||
/**
|
||||
* 查询设备数
|
||||
*
|
||||
|
@@ -0,0 +1,78 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorChannelRefBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Service接口
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-08-04
|
||||
*/
|
||||
public interface ISisElevatorFloorChannelRefService {
|
||||
|
||||
/**
|
||||
* 查询电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 电梯⇄楼层⇄通道关联
|
||||
*/
|
||||
SisElevatorFloorChannelRefVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 电梯⇄楼层⇄通道关联分页列表
|
||||
*/
|
||||
TableDataInfo<SisElevatorFloorChannelRefVo> queryPageList(SisElevatorFloorChannelRefBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 电梯⇄楼层⇄通道关联列表
|
||||
*/
|
||||
List<SisElevatorFloorChannelRefVo> queryList(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 新增电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 修改电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisElevatorFloorChannelRefBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量增加电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
Boolean batchInsert(Long elevatorId, Collection<SisElevatorFloorChannelRef> bo);
|
||||
}
|
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
@@ -75,7 +74,7 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
LambdaQueryWrapper<SisAlarmEventAttachments> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAlarmEventAttachments::getId);
|
||||
lqw.eq(bo.getEventId() != null, SisAlarmEventAttachments::getEventId, bo.getEventId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOssId()), SisAlarmEventAttachments::getOssId, bo.getOssId());
|
||||
lqw.eq(bo.getOssId() != null, SisAlarmEventAttachments::getOssId, bo.getOssId());
|
||||
lqw.eq(bo.getType() != null, SisAlarmEventAttachments::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
@@ -131,4 +130,9 @@ public class SisAlarmEventAttachmentsServiceImpl implements ISisAlarmEventAttach
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchInsert(List<SisAlarmEventAttachments> ls) {
|
||||
return baseMapper.insertBatch(ls);
|
||||
}
|
||||
}
|
||||
|
@@ -11,19 +11,21 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.resource.api.domain.RemoteFile;
|
||||
import org.dromara.sis.domain.SisAlarmEventAttachments;
|
||||
import org.dromara.sis.domain.SisAlarmEvents;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.bo.SisAlarmEventsBo;
|
||||
import org.dromara.sis.domain.vo.SisAlarmEventsVo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.mapper.SisAlarmEventsMapper;
|
||||
import org.dromara.sis.service.ISisAlarmEventAttachmentsService;
|
||||
import org.dromara.sis.service.ISisAlarmEventsService;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 告警Service业务层处理
|
||||
@@ -38,9 +40,11 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
|
||||
private final SisAlarmEventsMapper baseMapper;
|
||||
private final ISisDeviceManageService deviceManageService;
|
||||
private final ISisAlarmEventAttachmentsService alarmEventAttachmentsService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 查询告警
|
||||
*
|
||||
@@ -146,19 +150,49 @@ public class SisAlarmEventsServiceImpl implements ISisAlarmEventsService {
|
||||
|
||||
@Async
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAlarmRecord(String deviceIp, Integer level, Integer type, byte[] smallImg, byte[] bigImg) {
|
||||
// 校验设备信息
|
||||
SisDeviceManageVo sisDeviceManageVo = deviceManageService.queryVoByDeviceIp(deviceIp);
|
||||
if(sisDeviceManageVo == null){
|
||||
SisDeviceManage sisDeviceManage = deviceManageService.queryByDeviceIp(deviceIp);
|
||||
if (sisDeviceManage == null) {
|
||||
log.error("设备信息不存在,放弃此条告警记录。");
|
||||
return;
|
||||
}
|
||||
// 生成时间信息
|
||||
SisAlarmEvents alarmEvents = new SisAlarmEvents();
|
||||
alarmEvents.setType(1L);
|
||||
alarmEvents.setLevel(Long.valueOf(level));
|
||||
alarmEvents.setDeviceIp(deviceIp);
|
||||
alarmEvents.setDeviceName(sisDeviceManage.getDeviceName());
|
||||
alarmEvents.setDeviceGroupId(sisDeviceManage.getId());
|
||||
alarmEvents.setReportTime(new Date());
|
||||
alarmEvents.setState(1);
|
||||
alarmEvents.setTenantId(sisDeviceManage.getTenantId());
|
||||
alarmEvents.setCreateDept(sisDeviceManage.getCreateDept());
|
||||
int insert = this.baseMapper.insert(alarmEvents);
|
||||
log.info("写入报警事件表完成,num={}", insert);
|
||||
// 写入附件表
|
||||
// 上传图片
|
||||
remoteFileService.upload(smallImg);
|
||||
|
||||
|
||||
|
||||
|
||||
List<SisAlarmEventAttachments> ls = new ArrayList<>();
|
||||
if (smallImg != null && smallImg.length > 0) {
|
||||
ls.add(createEventAttachments(smallImg, alarmEvents, sisDeviceManage));
|
||||
}
|
||||
if (bigImg != null && bigImg.length > 0) {
|
||||
ls.add(createEventAttachments(bigImg, alarmEvents, sisDeviceManage));
|
||||
}
|
||||
Boolean flag = alarmEventAttachmentsService.batchInsert(ls);
|
||||
log.info("写入告警事件附件表完成, reslut={}, size={}", flag, ls.size());
|
||||
|
||||
}
|
||||
|
||||
public SisAlarmEventAttachments createEventAttachments(byte[] img, SisAlarmEvents alarmEvents, SisDeviceManage sisDeviceManage) {
|
||||
RemoteFile result = remoteFileService.uploadImg(img);
|
||||
SisAlarmEventAttachments attachments = new SisAlarmEventAttachments();
|
||||
attachments.setEventId(alarmEvents.getId());
|
||||
attachments.setOssId(result.getOssId());
|
||||
attachments.setType(1L);
|
||||
attachments.setTenantId(sisDeviceManage.getTenantId());
|
||||
attachments.setCreateDept(sisDeviceManage.getCreateDept());
|
||||
return attachments;
|
||||
}
|
||||
}
|
||||
|
@@ -178,7 +178,14 @@ public class SisDeviceManageServiceImpl implements ISisDeviceManageService {
|
||||
public SisDeviceManageVo queryVoByDeviceIp(String deviceIp) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceIp);
|
||||
return baseMapper.selectVoById(lqw);
|
||||
return baseMapper.selectVoOne(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SisDeviceManage queryByDeviceIp(String deviceId) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisDeviceManage::getDeviceIp, deviceId);
|
||||
return baseMapper.selectOne(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -0,0 +1,157 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorChannelRefBo;
|
||||
import org.dromara.sis.domain.vo.SisElevatorFloorChannelRefVo;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.mapper.SisElevatorFloorChannelRefMapper;
|
||||
import org.dromara.sis.service.ISisElevatorFloorChannelRefService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 电梯⇄楼层⇄通道关联Service业务层处理
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisElevatorFloorChannelRefServiceImpl implements ISisElevatorFloorChannelRefService {
|
||||
|
||||
private final SisElevatorFloorChannelRefMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 电梯⇄楼层⇄通道关联
|
||||
*/
|
||||
@Override
|
||||
public SisElevatorFloorChannelRefVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 电梯⇄楼层⇄通道关联分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisElevatorFloorChannelRefVo> queryPageList(SisElevatorFloorChannelRefBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = buildQueryWrapper(bo);
|
||||
Page<SisElevatorFloorChannelRefVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的电梯⇄楼层⇄通道关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 电梯⇄楼层⇄通道关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisElevatorFloorChannelRefVo> queryList(SisElevatorFloorChannelRefBo bo) {
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisElevatorFloorChannelRef> buildQueryWrapper(SisElevatorFloorChannelRefBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisElevatorFloorChannelRef::getId);
|
||||
lqw.eq(bo.getFloorId() != null, SisElevatorFloorChannelRef::getFloorId, bo.getFloorId());
|
||||
lqw.eq(bo.getElevatorId() != null, SisElevatorFloorChannelRef::getElevatorId, bo.getElevatorId());
|
||||
lqw.eq(bo.getInChannel() != null, SisElevatorFloorChannelRef::getInChannel, bo.getInChannel());
|
||||
lqw.eq(bo.getOutChannel() != null, SisElevatorFloorChannelRef::getOutChannel, bo.getOutChannel());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisElevatorFloorChannelRefBo bo) {
|
||||
SisElevatorFloorChannelRef add = MapstructUtils.convert(bo, SisElevatorFloorChannelRef.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电梯⇄楼层⇄通道关联
|
||||
*
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisElevatorFloorChannelRefBo bo) {
|
||||
SisElevatorFloorChannelRef update = MapstructUtils.convert(bo, SisElevatorFloorChannelRef.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisElevatorFloorChannelRef entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量增加电梯⇄楼层⇄通道关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param bo 电梯⇄楼层⇄通道关联
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean batchInsert(Long elevatorId, Collection<SisElevatorFloorChannelRef> bo) {
|
||||
// 先删除通道关系
|
||||
LambdaQueryWrapper<SisElevatorFloorChannelRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisElevatorFloorChannelRef::getElevatorId, elevatorId);
|
||||
baseMapper.delete(lqw);
|
||||
|
||||
boolean flag = baseMapper.insertBatch(bo);
|
||||
Assert.isTrue(flag, "批量增加电梯⇄楼层⇄通道关联信息失败");
|
||||
return flag;
|
||||
}
|
||||
}
|
@@ -13,15 +13,17 @@ import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.api.RemoteUnitService;
|
||||
import org.dromara.property.api.domain.vo.RemoteUnitVo;
|
||||
import org.dromara.property.api.RemoteBuildingService;
|
||||
import org.dromara.property.api.domain.vo.RemoteBuildingVo;
|
||||
import org.dromara.sis.domain.SisDeviceBindRef;
|
||||
import org.dromara.sis.domain.SisElevatorFloorChannelRef;
|
||||
import org.dromara.sis.domain.SisElevatorInfo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorInfoBo;
|
||||
import org.dromara.sis.domain.enums.ControlTypeEnum;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.sis.mapper.SisElevatorInfoMapper;
|
||||
import org.dromara.sis.service.ISisDeviceBindRefService;
|
||||
import org.dromara.sis.service.ISisElevatorFloorChannelRefService;
|
||||
import org.dromara.sis.service.ISisElevatorInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -43,9 +45,10 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
|
||||
private final SisElevatorInfoMapper baseMapper;
|
||||
private final ISisDeviceBindRefService deviceBindRefService;
|
||||
private final ISisElevatorFloorChannelRefService elevatorFloorChannelRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteUnitService remoteUnitService;
|
||||
private RemoteBuildingService remoteBuildingService;
|
||||
|
||||
/**
|
||||
* 查询电梯基本信息
|
||||
@@ -137,17 +140,23 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SisElevatorInfoBo bo) {
|
||||
// 验证单元是否存在
|
||||
RemoteUnitVo remoteUnitVo = remoteUnitService.queryUnitById(bo.getUnitId());
|
||||
Assert.notNull(remoteUnitVo, "社区单元信息不存在。");
|
||||
// 验证建筑是否存在
|
||||
RemoteBuildingVo remoteBuildingVo = remoteBuildingService.queryBuildingById(bo.getBuildingId());
|
||||
Assert.notNull(remoteBuildingVo, "建筑信息不存在。");
|
||||
|
||||
// 数据转换
|
||||
SisElevatorInfo add = MapstructUtils.convert(bo, SisElevatorInfo.class);
|
||||
Assert.notNull(add, "电梯信息处理失败。");
|
||||
add.setCommunityId(remoteUnitVo.getCommunityId());
|
||||
add.setBuildingId(remoteUnitVo.getBuildingId());
|
||||
|
||||
assert add != null;
|
||||
add.setCommunityId(remoteBuildingVo.getCommunityId());
|
||||
add.setBuildingId(remoteBuildingVo.getId());
|
||||
// 生成电梯编码
|
||||
String code = ELEVATOR_CONTROL_CODE_PREFIX + IdUtil.getSnowflakeNextIdStr();
|
||||
add.setElevatorCode(code);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增电梯信息失败。");
|
||||
|
||||
if (flag) {
|
||||
bo.setElevatorId(add.getElevatorId());
|
||||
List<SisDeviceBindRef> ls = new ArrayList<>();
|
||||
@@ -176,6 +185,22 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
Boolean b = deviceBindRefService.batchInsert(ls);
|
||||
Assert.isTrue(b, "设备绑定关联关系写入失败!");
|
||||
}
|
||||
|
||||
// 写入电梯⇄楼层⇄通道关联表
|
||||
if(!bo.getChannels().isEmpty()){
|
||||
Collection<SisElevatorFloorChannelRef> channelRefs = new ArrayList<>();
|
||||
for (SisElevatorInfoBo.ChannelInfo channelInfo : bo.getChannels()) {
|
||||
SisElevatorFloorChannelRef ref = new SisElevatorFloorChannelRef();
|
||||
ref.setElevatorId(add.getElevatorId());
|
||||
ref.setFloorId(channelInfo.getFloorId());
|
||||
ref.setInChannel(channelInfo.getInChannel());
|
||||
ref.setOutChannel(channelInfo.getOutChannel());
|
||||
channelRefs.add(ref);
|
||||
}
|
||||
Boolean b = elevatorFloorChannelRefService.batchInsert(add.getElevatorId(), channelRefs);
|
||||
Assert.isTrue(b, "电梯楼层通道关联关系写入失败!");
|
||||
}
|
||||
|
||||
// hik sdk 登录
|
||||
// short port = bo.getControlPort().shortValue();
|
||||
// Boolean isLogin = HikApiService.getInstance().login(bo.getControlIp(), port, bo.getControlAccount(), bo.getControlPwd());
|
||||
@@ -224,6 +249,21 @@ public class SisElevatorInfoServiceImpl implements ISisElevatorInfoService {
|
||||
Boolean b = deviceBindRefService.batchInsert(ls);
|
||||
Assert.isTrue(b, "设备绑定关联关系写入失败!");
|
||||
}
|
||||
|
||||
// 写入电梯⇄楼层⇄通道关联表
|
||||
if(!bo.getChannels().isEmpty()){
|
||||
Collection<SisElevatorFloorChannelRef> channelRefs = new ArrayList<>();
|
||||
for (SisElevatorInfoBo.ChannelInfo channelInfo : bo.getChannels()) {
|
||||
SisElevatorFloorChannelRef ref = new SisElevatorFloorChannelRef();
|
||||
ref.setElevatorId(update.getElevatorId());
|
||||
ref.setFloorId(channelInfo.getFloorId());
|
||||
ref.setInChannel(channelInfo.getInChannel());
|
||||
ref.setOutChannel(channelInfo.getOutChannel());
|
||||
channelRefs.add(ref);
|
||||
}
|
||||
Boolean b = elevatorFloorChannelRefService.batchInsert(update.getElevatorId(), channelRefs);
|
||||
Assert.isTrue(b, "电梯楼层通道关联关系写入失败!");
|
||||
}
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.common.core.enums.ContentTypeEnum;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.Base64Utils;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
@@ -68,16 +69,33 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteFile upload(byte[] file) throws ServiceException {
|
||||
public RemoteFile uploadImg(byte[] file) throws ServiceException {
|
||||
try {
|
||||
// 计算文件类型
|
||||
String type = Base64Utils.getType(file);
|
||||
// 获contentType
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
ContentTypeEnum contentTypeEnum = ContentTypeEnum.ContentTypeEnum(type);
|
||||
OssClient storage = OssFactory.instance();
|
||||
UploadResult uploadResult = storage.uploadSuffix(file, type, contentTypeEnum.getContentType());
|
||||
// 保存文件信息
|
||||
SysOssBo oss = new SysOssBo();
|
||||
oss.setUrl(uploadResult.getUrl());
|
||||
oss.setFileSuffix(type);
|
||||
oss.setFileName(uploadResult.getFilename());
|
||||
oss.setOriginalName(uploadResult.getFilename());
|
||||
oss.setService(storage.getConfigKey());
|
||||
sysOssService.insertByBo(oss);
|
||||
RemoteFile sysFile = new RemoteFile();
|
||||
sysFile.setOssId(oss.getOssId());
|
||||
sysFile.setName(uploadResult.getFilename());
|
||||
sysFile.setUrl(uploadResult.getUrl());
|
||||
sysFile.setOriginalName(uploadResult.getFilename());
|
||||
sysFile.setFileSuffix(type);
|
||||
return sysFile;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
throw new ServiceException("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user