diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml index 4106a417..64b0ccdc 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml @@ -41,10 +41,10 @@ snail-job: spring: ai: dashscope: - api-key: xxx + api-key: sk-8d8df92fcbac4bd2922edba30b0bb8fa chat: options: - model: qwen-plus + model: qwen3-max datasource: type: com.zaxxer.hikari.HikariDataSource # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml index a69eabd8..9b5259f3 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml @@ -76,9 +76,9 @@ spring: servlet: multipart: # 单个文件大小 - max-file-size: 200MB + max-file-size: 1024MB # 设置总上传的文件大小 - max-request-size: 200MB + max-request-size: 1024MB mvc: # 设置静态资源路径 防止所有请求都去查静态资源 static-path-pattern: /static/** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/AsyncUtil.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/AsyncUtil.java index 9671d607..2c501a3b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/AsyncUtil.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/AsyncUtil.java @@ -1,5 +1,6 @@ package org.dromara.common.utils; +import cn.hutool.core.collection.CollectionUtil; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.utils.MessageUtils; @@ -9,6 +10,8 @@ import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.mobileAttendanceMachine.DeviceMessageSender; import org.dromara.mobileAttendanceMachine.KqjEntity; import org.dromara.project.domain.BusAttendanceMachine; +import org.dromara.project.domain.BusAttendanceMachineRepeat; +import org.dromara.project.service.IBusAttendanceMachineRepeatService; import org.dromara.project.service.IBusAttendanceMachineService; import org.dromara.sms4j.api.SmsBlend; import org.dromara.sms4j.api.entity.SmsResponse; @@ -19,6 +22,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -36,6 +40,9 @@ public class AsyncUtil { @Lazy private IBusAttendanceMachineService attendanceMachineService; + @Resource + private IBusAttendanceMachineRepeatService busAttendanceMachineRepeatService; + //发送短信 @Async public void sendSms(List mobileList, String config) { @@ -63,22 +70,107 @@ public class AsyncUtil { public void sendPersonnel(Long teamId, SubConstructionUser constructionUser) { SysOssVo byId = ossService.getById(Long.valueOf(constructionUser.getFacePic())); List list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", teamId).list(); + + ArrayList repeats = new ArrayList<>(); for (BusAttendanceMachine machine : list) { - deviceMessageSender.sendPersonnelInformation(machine.getSn(), constructionUser.getSysUserId().toString(), constructionUser.getUserName(), byId.getUrl()); + Boolean b = deviceMessageSender.sendPersonnelInformation(machine.getSn(), + constructionUser.getSysUserId().toString(), constructionUser.getUserName(), byId.getUrl()); + if (!b) { + //记录下来重连时下发 + BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat(); + repeat.setSn(machine.getSn()); + repeat.setUserId(constructionUser.getSysUserId().toString()); + repeat.setUserName(constructionUser.getUserName()); + repeat.setUrl(byId.getUrl()); + repeat.setType("1"); + repeats.add(repeat); + } + } + if (CollectionUtil.isNotEmpty(repeats)) { + busAttendanceMachineRepeatService.saveBatch(repeats); } } //删除考勤人员 @Async public void deletePersonnel(SubConstructionUser constructionUser) { + ArrayList repeats = new ArrayList<>(); List list = attendanceMachineService.lambdaQuery().apply("FIND_IN_SET({0}, teams)", constructionUser.getTeamId()).list(); for (BusAttendanceMachine machine : list) { try { - deviceMessageSender.deleteUser(machine.getSn(), constructionUser.getSysUserId().toString()); + KqjEntity.CommonResponse commonResponse = deviceMessageSender.deleteUser(machine.getSn(), constructionUser.getSysUserId().toString()); + int code = commonResponse.getData().getCode(); + if (code != 0) { + //记录下来重连时下发 + BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat(); + repeat.setSn(machine.getSn()); + repeat.setUserId(constructionUser.getSysUserId().toString()); + repeat.setUserName(constructionUser.getUserName()); + repeat.setUrl(null); + repeat.setType("2"); + repeats.add(repeat); + } + } catch (Exception e) { + log.error("删除考勤人员异常", e); + BusAttendanceMachineRepeat repeat = new BusAttendanceMachineRepeat(); + repeat.setSn(machine.getSn()); + repeat.setUserId(constructionUser.getSysUserId().toString()); + repeat.setUserName(constructionUser.getUserName()); + repeat.setUrl(null); + repeat.setType("2"); + repeats.add(repeat); + } + } + if (CollectionUtil.isNotEmpty(repeats)) { + busAttendanceMachineRepeatService.saveBatch(repeats); + } + } + + + //重新下发人员 + @Async + public void repeatSend(String sn) { + List list = busAttendanceMachineRepeatService.lambdaQuery() + .eq(BusAttendanceMachineRepeat::getSn, sn) + .eq(BusAttendanceMachineRepeat::getType, "1") + .list(); + List repeatIds = new ArrayList<>(); + for (BusAttendanceMachineRepeat repeat : list) { + Boolean b = deviceMessageSender.sendPersonnelInformation(repeat.getSn(), repeat.getUserId(), repeat.getUserName(), repeat.getUrl()); + if (b) { + //成功删除记录 + repeatIds.add(repeat.getId()); + } + } + if (CollectionUtil.isNotEmpty(repeatIds)) { + busAttendanceMachineRepeatService.removeByIds(repeatIds); + } + } + + //重新删除人员 + @Async + public void repeatDelete(String sn) { + List list = busAttendanceMachineRepeatService.lambdaQuery() + .eq(BusAttendanceMachineRepeat::getSn, sn) + .eq(BusAttendanceMachineRepeat::getType, "2") + .list(); + List repeatIds = new ArrayList<>(); + for (BusAttendanceMachineRepeat repeat : list) { + try { + KqjEntity.CommonResponse commonResponse = deviceMessageSender.deleteUser(repeat.getSn(), repeat.getUserId()); + int code = commonResponse.getData().getCode(); + if (code == 0) { + //成功删除记录 + repeatIds.add(repeat.getId()); + } } catch (Exception e) { log.error("删除考勤人员异常", e); } } + if (CollectionUtil.isNotEmpty(repeatIds)) { + busAttendanceMachineRepeatService.removeByIds(repeatIds); + } } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java index 77aff5fd..1ae52ec8 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java @@ -257,6 +257,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl */ Boolean compressPicture(String ossIds, List compressPicIds); + /** + * 异步合成大图 + * + * @param businessName 业务名称 + * @param imageUrls 图片URL列表 + * @return 任务id + */ + CompletableFuture asyncAddBigPicture(String businessName, List imageUrls); + /** * 异步添加压缩图片 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/drone/service/impl/DroDroneBigPictureServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/drone/service/impl/DroDroneBigPictureServiceImpl.java index ae484fab..43e07de3 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/drone/service/impl/DroDroneBigPictureServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/drone/service/impl/DroDroneBigPictureServiceImpl.java @@ -2,6 +2,7 @@ package org.dromara.drone.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -27,7 +28,9 @@ import org.dromara.drone.service.IDroDroneBigPictureService; import org.dromara.manager.dronemanager.DroneManager; import org.dromara.manager.dronemanager.vo.DroneImgMergeProgressVo; import org.dromara.manager.dronemanager.vo.DroneImgMergeUrlVo; +import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailAINumberReq; +import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailRecognizerVo; import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.service.ISysOssService; @@ -90,11 +93,34 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl recognizerList = + JSONUtil.toList(pictureVo.getRecognizeResult(), PgsProgressPlanDetailRecognizerVo.class); + if (CollUtil.isNotEmpty(recognizerList)) { + // 1. 按类型名称分组 + Map> groupMap = recognizerList.stream() + .collect(Collectors.groupingBy(r -> { + RecognizerTypeEnum typeEnum = RecognizerTypeEnum.fromValue(r.getType()); + return typeEnum != null ? typeEnum.getText() : "未知类型"; + })); + // 2. 将每组转换为 “类型:name1, name2” + String recognizerStr = groupMap.entrySet().stream() + .map(entry -> { + String type = entry.getKey(); + String names = entry.getValue().stream() + .map(PgsProgressPlanDetailRecognizerVo::getName) + .collect(Collectors.joining(", ")); + return type + ":" + names; + }) + .collect(Collectors.joining(";")); // 组之间用分号分隔 + pictureVo.setRecognizeResultStr(recognizerStr); + } + } } return pictureVo; } @@ -123,13 +149,36 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl recognizerList = + JSONUtil.toList(pictureVo.getRecognizeResult(), PgsProgressPlanDetailRecognizerVo.class); + if (CollUtil.isNotEmpty(recognizerList)) { + // 1. 按类型名称分组 + Map> groupMap = recognizerList.stream() + .collect(Collectors.groupingBy(r -> { + RecognizerTypeEnum typeEnum = RecognizerTypeEnum.fromValue(r.getType()); + return typeEnum != null ? typeEnum.getText() : "未知类型"; + })); + // 2. 将每组转换为 “类型:name1, name2” + String recognizerStr = groupMap.entrySet().stream() + .map(entry -> { + String type = entry.getKey(); + String names = entry.getValue().stream() + .map(PgsProgressPlanDetailRecognizerVo::getName) + .collect(Collectors.joining(", ")); + return type + ":" + names; + }) + .collect(Collectors.joining(";")); // 组之间用分号分隔 + pictureVo.setRecognizeResultStr(recognizerStr); + } + } } } result.setRecords(records); @@ -173,10 +222,14 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl { @@ -196,6 +249,26 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl picIds = StringUtils.splitTo(smallPic, Convert::toLong); + List ossVos = ossService.listByIds(picIds); + List picUrls = ossVos.stream().map(SysOssVo::getUrl).toList(); + // 异步执行大图合并 + self.asyncAddBigPicture(add.getTaskName(), picUrls) + .thenAccept(result -> { + DroDroneBigPicture update = new DroDroneBigPicture(); + update.setId(id); + update.setStatus("2"); + update.setTaskId(result); + this.updateById(update); + }).exceptionally(ex -> { + log.error("无人机大图信息[{}]异步执行合成图片失败", add.getTaskName(), ex); + return null; + }); + } + if (StringUtils.isNotBlank(add.getBigPic()) && StringUtils.isNotBlank(add.getTifFile())) { + return this.createProgressRecognize(id); + } return true; } @@ -254,8 +327,26 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl asyncAddBigPicture(String businessName, List imageUrls) { + return CompletableFuture.completedFuture(droneManager.createImageMergeTask(businessName, imageUrls)); + } + /** * 异步添加压缩图片 * @@ -516,4 +620,19 @@ public class DroDroneBigPictureServiceImpl extends ServiceImpl imageUrls) { return DroneRequestUtils.createImgMergeTask(droneProperties.getUrl(), businessName, imageUrls); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/dronemanager/DroneRequestUtils.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/dronemanager/DroneRequestUtils.java index 4c5c9f07..8cfb39e2 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/dronemanager/DroneRequestUtils.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/manager/dronemanager/DroneRequestUtils.java @@ -67,6 +67,7 @@ public class DroneRequestUtils { * * @param businessName 业务名称 * @param imageUrls 图片URL列表 + * @return 任务ID */ public static String createImgMergeTask(String url, String businessName, List imageUrls) { if (StringUtils.isBlank(businessName) || CollUtil.isEmpty(imageUrls)) { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusAttendanceMachineRepeatController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusAttendanceMachineRepeatController.java new file mode 100644 index 00000000..354c77ee --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/controller/BusAttendanceMachineRepeatController.java @@ -0,0 +1,105 @@ +package org.dromara.project.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.project.domain.vo.BusAttendanceMachineRepeatVo; +import org.dromara.project.domain.bo.BusAttendanceMachineRepeatBo; +import org.dromara.project.service.IBusAttendanceMachineRepeatService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 考勤重新下发 + * + * @author Lion Li + * @date 2025-11-24 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/project/attendanceMachineRepeat") +public class BusAttendanceMachineRepeatController extends BaseController { + + private final IBusAttendanceMachineRepeatService busAttendanceMachineRepeatService; + + /** + * 查询考勤重新下发列表 + */ + @SaCheckPermission("project:attendanceMachineRepeat:list") + @GetMapping("/list") + public TableDataInfo list(BusAttendanceMachineRepeatBo bo, PageQuery pageQuery) { + return busAttendanceMachineRepeatService.queryPageList(bo, pageQuery); + } + + /** + * 导出考勤重新下发列表 + */ + @SaCheckPermission("project:attendanceMachineRepeat:export") + @Log(title = "考勤重新下发", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BusAttendanceMachineRepeatBo bo, HttpServletResponse response) { + List list = busAttendanceMachineRepeatService.queryList(bo); + ExcelUtil.exportExcel(list, "考勤重新下发", BusAttendanceMachineRepeatVo.class, response); + } + + /** + * 获取考勤重新下发详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("project:attendanceMachineRepeat:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(busAttendanceMachineRepeatService.queryById(id)); + } + + /** + * 新增考勤重新下发 + */ + @SaCheckPermission("project:attendanceMachineRepeat:add") + @Log(title = "考勤重新下发", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BusAttendanceMachineRepeatBo bo) { + return toAjax(busAttendanceMachineRepeatService.insertByBo(bo)); + } + + /** + * 修改考勤重新下发 + */ + @SaCheckPermission("project:attendanceMachineRepeat:edit") + @Log(title = "考勤重新下发", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BusAttendanceMachineRepeatBo bo) { + return toAjax(busAttendanceMachineRepeatService.updateByBo(bo)); + } + + /** + * 删除考勤重新下发 + * + * @param ids 主键串 + */ + @SaCheckPermission("project:attendanceMachineRepeat:remove") + @Log(title = "考勤重新下发", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(busAttendanceMachineRepeatService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusAttendanceMachineRepeat.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusAttendanceMachineRepeat.java new file mode 100644 index 00000000..2b53e3e5 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/BusAttendanceMachineRepeat.java @@ -0,0 +1,61 @@ +package org.dromara.project.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 考勤重新下发对象 bus_attendance_machine_repeat + * + * @author Lion Li + * @date 2025-11-24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("bus_attendance_machine_repeat") +public class BusAttendanceMachineRepeat extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "id") + private Long id; + + /** + * 设备sn + */ + private String sn; + + /** + * 用户id + */ + private String userId; + + /** + * 用户名 + */ + private String userName; + + /** + * 人脸地址 + */ + private String url; + + /** + * (1-新增 2-删除) + */ + private String type; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/bo/BusAttendanceMachineRepeatBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/bo/BusAttendanceMachineRepeatBo.java new file mode 100644 index 00000000..27a9793e --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/bo/BusAttendanceMachineRepeatBo.java @@ -0,0 +1,61 @@ +package org.dromara.project.domain.bo; + +import org.dromara.project.domain.BusAttendanceMachineRepeat; +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.*; + +/** + * 考勤重新下发业务对象 bus_attendance_machine_repeat + * + * @author Lion Li + * @date 2025-11-24 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BusAttendanceMachineRepeat.class, reverseConvertGenerate = false) +public class BusAttendanceMachineRepeatBo extends BaseEntity { + + /** + * 主键ID + */ + @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 设备sn + */ + @NotBlank(message = "设备sn不能为空", groups = { AddGroup.class, EditGroup.class }) + private String sn; + + /** + * 用户id + */ + private String userId; + + /** + * 用户名 + */ + private String userName; + + /** + * 人脸地址 + */ + private String url; + + /** + * (1-新增 2-删除) + */ + private String type; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusAttendanceMachineRepeatVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusAttendanceMachineRepeatVo.java new file mode 100644 index 00000000..0a5a8eae --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/vo/BusAttendanceMachineRepeatVo.java @@ -0,0 +1,75 @@ +package org.dromara.project.domain.vo; + +import org.dromara.project.domain.BusAttendanceMachineRepeat; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.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; + + + +/** + * 考勤重新下发视图对象 bus_attendance_machine_repeat + * + * @author Lion Li + * @date 2025-11-24 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BusAttendanceMachineRepeat.class) +public class BusAttendanceMachineRepeatVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long id; + + /** + * 设备sn + */ + @ExcelProperty(value = "设备sn") + private String sn; + + /** + * 用户id + */ + @ExcelProperty(value = "用户id") + private String userId; + + /** + * 用户名 + */ + @ExcelProperty(value = "用户名") + private String userName; + + /** + * 人脸地址 + */ + @ExcelProperty(value = "人脸地址") + private String url; + + /** + * (1-新增 2-删除) + */ + @ExcelProperty(value = "", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "1=-新增,2=-删除") + private String type; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusAttendanceMachineRepeatMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusAttendanceMachineRepeatMapper.java new file mode 100644 index 00000000..013957e8 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/mapper/BusAttendanceMachineRepeatMapper.java @@ -0,0 +1,15 @@ +package org.dromara.project.mapper; + +import org.dromara.project.domain.BusAttendanceMachineRepeat; +import org.dromara.project.domain.vo.BusAttendanceMachineRepeatVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 考勤重新下发Mapper接口 + * + * @author Lion Li + * @date 2025-11-24 + */ +public interface BusAttendanceMachineRepeatMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceMachineRepeatService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceMachineRepeatService.java new file mode 100644 index 00000000..47624197 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/IBusAttendanceMachineRepeatService.java @@ -0,0 +1,70 @@ +package org.dromara.project.service; + +import org.dromara.project.domain.vo.BusAttendanceMachineRepeatVo; +import org.dromara.project.domain.bo.BusAttendanceMachineRepeatBo; +import org.dromara.project.domain.BusAttendanceMachineRepeat; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; +import java.util.List; + +/** + * 考勤重新下发Service接口 + * + * @author Lion Li + * @date 2025-11-24 + */ +public interface IBusAttendanceMachineRepeatService extends IService{ + + /** + * 查询考勤重新下发 + * + * @param id 主键 + * @return 考勤重新下发 + */ + BusAttendanceMachineRepeatVo queryById(Long id); + + /** + * 分页查询考勤重新下发列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 考勤重新下发分页列表 + */ + TableDataInfo queryPageList(BusAttendanceMachineRepeatBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的考勤重新下发列表 + * + * @param bo 查询条件 + * @return 考勤重新下发列表 + */ + List queryList(BusAttendanceMachineRepeatBo bo); + + /** + * 新增考勤重新下发 + * + * @param bo 考勤重新下发 + * @return 是否新增成功 + */ + Boolean insertByBo(BusAttendanceMachineRepeatBo bo); + + /** + * 修改考勤重新下发 + * + * @param bo 考勤重新下发 + * @return 是否修改成功 + */ + Boolean updateByBo(BusAttendanceMachineRepeatBo bo); + + /** + * 校验并批量删除考勤重新下发信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceMachineRepeatServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceMachineRepeatServiceImpl.java new file mode 100644 index 00000000..c5e9e859 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceMachineRepeatServiceImpl.java @@ -0,0 +1,136 @@ +package org.dromara.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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 org.springframework.stereotype.Service; +import org.dromara.project.domain.bo.BusAttendanceMachineRepeatBo; +import org.dromara.project.domain.vo.BusAttendanceMachineRepeatVo; +import org.dromara.project.domain.BusAttendanceMachineRepeat; +import org.dromara.project.mapper.BusAttendanceMachineRepeatMapper; +import org.dromara.project.service.IBusAttendanceMachineRepeatService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 考勤重新下发Service业务层处理 + * + * @author Lion Li + * @date 2025-11-24 + */ +@RequiredArgsConstructor +@Service +public class BusAttendanceMachineRepeatServiceImpl extends ServiceImpl + implements IBusAttendanceMachineRepeatService { + + private final BusAttendanceMachineRepeatMapper baseMapper; + + /** + * 查询考勤重新下发 + * + * @param id 主键 + * @return 考勤重新下发 + */ + @Override + public BusAttendanceMachineRepeatVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询考勤重新下发列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 考勤重新下发分页列表 + */ + @Override + public TableDataInfo queryPageList(BusAttendanceMachineRepeatBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的考勤重新下发列表 + * + * @param bo 查询条件 + * @return 考勤重新下发列表 + */ + @Override + public List queryList(BusAttendanceMachineRepeatBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BusAttendanceMachineRepeatBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByDesc(BusAttendanceMachineRepeat::getId); + lqw.eq(StringUtils.isNotBlank(bo.getSn()), BusAttendanceMachineRepeat::getSn, bo.getSn()); + lqw.eq(StringUtils.isNotBlank(bo.getUserId()), BusAttendanceMachineRepeat::getUserId, bo.getUserId()); + lqw.like(StringUtils.isNotBlank(bo.getUserName()), BusAttendanceMachineRepeat::getUserName, bo.getUserName()); + lqw.eq(StringUtils.isNotBlank(bo.getUrl()), BusAttendanceMachineRepeat::getUrl, bo.getUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getType()), BusAttendanceMachineRepeat::getType, bo.getType()); + return lqw; + } + + /** + * 新增考勤重新下发 + * + * @param bo 考勤重新下发 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BusAttendanceMachineRepeatBo bo) { + BusAttendanceMachineRepeat add = MapstructUtils.convert(bo, BusAttendanceMachineRepeat.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改考勤重新下发 + * + * @param bo 考勤重新下发 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BusAttendanceMachineRepeatBo bo) { + BusAttendanceMachineRepeat update = MapstructUtils.convert(bo, BusAttendanceMachineRepeat.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BusAttendanceMachineRepeat entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除考勤重新下发信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java index bd9d6e2a..025a7f5f 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusAttendanceServiceImpl.java @@ -478,10 +478,10 @@ public class BusAttendanceServiceImpl extends ServiceImpl constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class) .eq(SubConstructionUser::getId, constructionUser.getId()) .set(SubConstructionUser::getTeamId, null) + .set(SubConstructionUser::getStatus, "1") .set(SubConstructionUser::getLeaveDate, new Date()); if (StringUtils.isNotBlank(salaryVoucherFile) && StringUtils.isNotBlank(salaryConfirmationFile)) { constructionUserLuw.set(SubConstructionUser::getExitStatus, "2"); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java index b5b70347..ef5bf1d5 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java @@ -190,6 +190,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl + + + +