From 9aef0d4b86cdaca63dc905c2189769a9e2eb90a1 Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Tue, 2 Sep 2025 17:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E8=B5=84=E9=A2=86=E6=96=99=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9=20app=E4=BA=BA=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/SubConstructionUserAppController.java | 13 +++ .../SubConstructionUserFileAppController.java | 38 ++++++++ .../SubConstructionUserFileQueryReq.java | 10 --- .../SubConstructionUserVo.java | 5 ++ .../SubConstructionUserFileServiceImpl.java | 28 +++--- .../impl/SubConstructionUserServiceImpl.java | 10 ++- .../domain/MatMaterialsInventory.java | 5 ++ ...atMaterialsInventoryReceiveStatusEnum.java | 23 +++++ .../vo/materials/MatMaterialsNumberVo.java | 13 +++ .../MatMaterialsInventoryOutVo.java | 34 +++++++ .../impl/MatMaterialIssueServiceImpl.java | 7 +- .../service/impl/MatMaterialsServiceImpl.java | 89 ++++++++++++------- .../BusConstructionBlacklistQueryReq.java | 5 -- .../BusConstructionUserExitCreateReq.java | 4 +- .../impl/BusAttendanceServiceImpl.java | 39 ++++---- .../BusConstructionBlacklistServiceImpl.java | 4 +- .../BusConstructionUserExitServiceImpl.java | 61 ++++++++++++- .../impl/BusProjectTeamMemberServiceImpl.java | 2 +- 18 files changed, 287 insertions(+), 103 deletions(-) create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/enums/MatMaterialsInventoryReceiveStatusEnum.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialsinventory/MatMaterialsInventoryOutVo.java diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java index e5333663..9385d1ab 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java @@ -50,6 +50,19 @@ public class SubConstructionUserAppController { return R.ok(constructionUserService.getVo(constructionUser)); } + /** + * 根据用户id查询施工人员信息 + */ + @GetMapping("/user/{userId}") + public R queryByUserId(@NotNull(message = "用户主键不能为空") + @PathVariable Long userId) { + SubConstructionUser constructionUser = constructionUserService.getBySysUserId(userId); + if (constructionUser == null) { + return R.fail("查询施工人员不存在"); + } + return R.ok(constructionUserService.getVo(constructionUser)); + } + /** * 根据id查询施工人员信息 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java new file mode 100644 index 00000000..9b798fa1 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java @@ -0,0 +1,38 @@ +package org.dromara.contractor.controller.app; + +import jakarta.annotation.Resource; +import org.dromara.common.core.domain.R; +import org.dromara.common.web.core.BaseController; +import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq; +import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo; +import org.dromara.contractor.service.ISubConstructionUserFileService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 施工人员文件存储 app 接口 + * + * @author lilemy + * @date 2025-09-02 17:20 + */ +@Validated +@RestController +@RequestMapping("/app/contractor/constructionUserFile") +public class SubConstructionUserFileAppController extends BaseController { + + @Resource + private ISubConstructionUserFileService constructionUserFileService; + + /** + * 查询施工人员文件存储列表 + */ + @GetMapping("/list") + public R> list(SubConstructionUserFileQueryReq req) { + return R.ok(constructionUserFileService.queryList(req)); + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileQueryReq.java index 8b6d048d..4c0966c9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/dto/constructionuserfile/SubConstructionUserFileQueryReq.java @@ -15,11 +15,6 @@ public class SubConstructionUserFileQueryReq implements Serializable { @Serial private static final long serialVersionUID = 552027602186820020L; - /** - * 主键id - */ - private Long id; - /** * 用户id */ @@ -30,9 +25,4 @@ public class SubConstructionUserFileQueryReq implements Serializable { */ private String fileType; - /** - * 备注 - */ - private String remark; - } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java index d717dbd6..cb0c0168 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java @@ -58,6 +58,11 @@ public class SubConstructionUserVo implements Serializable { @ExcelProperty(value = "项目id") private Long projectId; + /** + * 项目名称 + */ + private String projectName; + /** * 分包公司id */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java index aaf73548..a27973c2 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java @@ -17,21 +17,20 @@ import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.file.FileUtils; -import org.dromara.common.satoken.utils.LoginHelper; -import org.dromara.contractor.domain.SubConstructionUserFile; import org.dromara.contractor.constant.SubConstructionUserConstant; -import org.dromara.project.domain.BusConstructionBlacklist; import org.dromara.contractor.domain.SubConstructionUser; -import org.dromara.project.domain.BusProject; +import org.dromara.contractor.domain.SubConstructionUserFile; import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq; import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileReq; import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileSaveReq; import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileTemplateReq; import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo; import org.dromara.contractor.mapper.SubConstructionUserFileMapper; -import org.dromara.project.service.IBusConstructionBlacklistService; import org.dromara.contractor.service.ISubConstructionUserFileService; import org.dromara.contractor.service.ISubConstructionUserService; +import org.dromara.project.domain.BusConstructionBlacklist; +import org.dromara.project.domain.BusProject; +import org.dromara.project.service.IBusConstructionBlacklistService; import org.dromara.project.service.IBusProjectService; import org.dromara.system.domain.vo.SysDictDataVo; import org.dromara.system.domain.vo.SysOssVo; @@ -132,7 +131,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl lqw = Wrappers.lambdaQuery(SubConstructionUserFile.class) .eq(SubConstructionUserFile::getUserId, userId); - List constructionUserFileList = this.list(lqw); + List constructionUserFileList = this.lambdaQuery() + .eq(SubConstructionUserFile::getUserId, userId) + .list(); // 3. 构建 Map 方便查找 Map existingFileMap = constructionUserFileList.stream() .collect(Collectors.toMap(SubConstructionUserFile::getFileType, Function.identity())); @@ -392,14 +389,9 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId); // 查询结果移除黑名单人员 if (CollUtil.isNotEmpty(blackUserIdList)) { - lqw.notIn(SubConstructionUser::getId, blackUserIdList); + lqw.notIn(SubConstructionUser::getSysUserId, blackUserIdList); } } lqw.ne(StringUtils.isNotBlank(notUserRole), SubConstructionUser::getUserRole, notUserRole); @@ -887,7 +891,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId); // 查询结果移除黑名单人员 if (CollUtil.isNotEmpty(blackUserIdList)) { - lqw.notIn(SubConstructionUser::getId, blackUserIdList); + lqw.notIn(SubConstructionUser::getSysUserId, blackUserIdList); } // 分页查询获取数据 Page constructionUserPage = this.page(pageQuery.build(), lqw); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialsInventory.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialsInventory.java index 68985d51..29a2fa15 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialsInventory.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/MatMaterialsInventory.java @@ -84,6 +84,11 @@ public class MatMaterialsInventory extends BaseEntity { */ private String shipper; + /** + * 是否领用(0未领用 1已领用) + */ + private String isReceive; + /** * 备注 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/enums/MatMaterialsInventoryReceiveStatusEnum.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/enums/MatMaterialsInventoryReceiveStatusEnum.java new file mode 100644 index 00000000..48c8e7bf --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/enums/MatMaterialsInventoryReceiveStatusEnum.java @@ -0,0 +1,23 @@ +package org.dromara.materials.domain.enums; + +import lombok.Getter; + +/** + * @author lilemy + * @date 2025-09-02 15:47 + */ +@Getter +public enum MatMaterialsInventoryReceiveStatusEnum { + + NOT("未领用", "0"), + USED("已领用", "1"); + + private final String text; + + private final String value; + + MatMaterialsInventoryReceiveStatusEnum(String text, String value) { + this.text = text; + this.value = value; + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materials/MatMaterialsNumberVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materials/MatMaterialsNumberVo.java index eaa71060..594382ee 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materials/MatMaterialsNumberVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materials/MatMaterialsNumberVo.java @@ -1,10 +1,13 @@ package org.dromara.materials.domain.vo.materials; import lombok.Data; +import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryOutVo; import java.io.Serial; import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; +import java.util.List; /** * @author lilemy @@ -40,4 +43,14 @@ public class MatMaterialsNumberVo implements Serializable { * 库存数量 */ private BigDecimal inventoryNumber; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 出库列表 + */ + private List outList; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialsinventory/MatMaterialsInventoryOutVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialsinventory/MatMaterialsInventoryOutVo.java new file mode 100644 index 00000000..3119dec6 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/domain/vo/materialsinventory/MatMaterialsInventoryOutVo.java @@ -0,0 +1,34 @@ +package org.dromara.materials.domain.vo.materialsinventory; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + +/** + * @author lilemy + * @date 2025-09-02 15:29 + */ +@Data +public class MatMaterialsInventoryOutVo implements Serializable { + + @Serial + private static final long serialVersionUID = -5887469045010555290L; + + /** + * 出/入库的数量 + */ + private Long number; + + /** + * 剩余库存数量(记录最后一次操作留下的库存数) + */ + private Long residue; + + /** + * 创建时间 + */ + private Date createTime; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java index ecf2b052..dc39cd46 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/materials/service/impl/MatMaterialIssueServiceImpl.java @@ -36,7 +36,6 @@ import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueUpdateReq; import org.dromara.materials.domain.dto.materialissue.MatMaterialIssueWordDto; import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemDto; import org.dromara.materials.domain.dto.materialissueitem.MatMaterialIssueItemWordDto; -import org.dromara.materials.domain.enums.MatMaterialsInventoryOutPutEnum; import org.dromara.materials.domain.vo.materialissue.MatMaterialIssueVo; import org.dromara.materials.domain.vo.materialsinventory.MatMaterialsInventoryListVo; import org.dromara.materials.mapper.MatMaterialIssueMapper; @@ -260,13 +259,15 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl inventoryList = itemList.stream().map(item -> { MatMaterialsInventory inventory = new MatMaterialsInventory(); inventory.setNumber(item.getIssuedQuantity().longValue()); @@ -284,7 +285,7 @@ public class MatMaterialIssueServiceImpl extends ServiceImpl materialIds = materials.stream() - .filter(material -> StringUtils.isNotBlank(material.getFormCode())) + .filter(m -> StringUtils.isNotBlank(m.getFormCode())) .map(MatMaterials::getId) .toList(); - List materialsInventories = materialsInventoryService.selectLatestByMaterialIds(materialIds); - Map inventoryMap = materialsInventories.stream().collect(Collectors.toMap( - MatMaterialsInventory::getMaterialsId, - Function.identity(), - (a, b) -> a)); + // 查询最新库存 + Map inventoryMap = materialsInventoryService + .selectLatestByMaterialIds(materialIds) + .stream() + .collect(Collectors.toMap(MatMaterialsInventory::getMaterialsId, Function.identity(), (a, b) -> a)); + // 查询出库记录 + List outList = materialsInventoryService.lambdaQuery() + .in(MatMaterialsInventory::getMaterialsId, materialIds) + .eq(MatMaterialsInventory::getOutPut, MatMaterialsInventoryOutPutEnum.OUT.getValue()) + .eq(MatMaterialsInventory::getIsReceive, MatMaterialsInventoryReceiveStatusEnum.NOT.getValue()) + .list(); + Map> outMap = new HashMap<>(); + if (CollUtil.isNotEmpty(outList)) { + outMap = outList.stream() + .collect(Collectors.groupingBy(MatMaterialsInventory::getMaterialsId)); + } + Map> finalOutMap = outMap; + // 按 formCode 分组 Map> formCodeMap = materials.stream() .collect(Collectors.groupingBy(MatMaterials::getFormCode)); - Set formCodeList = materials.stream().map(MatMaterials::getFormCode).collect(Collectors.toSet()); - List receiveList = materialReceiveService.lambdaQuery() + // 查询入库单 + Set formCodeList = formCodeMap.keySet(); + Map receiveMap = materialReceiveService.lambdaQuery() .in(MatMaterialReceive::getFormCode, formCodeList) - .list(); - Map receiveMap = receiveList.stream().collect(Collectors.toMap( - MatMaterialReceive::getFormCode, - Function.identity(), - (a, b) -> a)); + .list() + .stream() + .collect(Collectors.toMap(MatMaterialReceive::getFormCode, Function.identity(), (a, b) -> a)); List resultList = new ArrayList<>(); for (Map.Entry> entry : formCodeMap.entrySet()) { - String key = entry.getKey(); - List value = entry.getValue(); - List list = value.stream().filter(material -> { - Long materialId = material.getId(); - if (inventoryMap.containsKey(materialId)) { - MatMaterialsInventory inventory = inventoryMap.get(materialId); - Long residue = inventory.getResidue(); - return residue > 0; - } - return false; - }).toList(); - if (CollUtil.isEmpty(list)) { + String formCode = entry.getKey(); + // 过滤库存为 0 的材料 + List validMaterials = entry.getValue().stream() + .filter(m -> { + MatMaterialsInventory inv = inventoryMap.get(m.getId()); + return inv != null && inv.getResidue() > 0; + }) + .toList(); + if (CollUtil.isEmpty(validMaterials)) { continue; } + // 组装结果 MatMaterialsByFormCodeVo vo = new MatMaterialsByFormCodeVo(); - vo.setFormCode(key); - if (receiveMap.containsKey(key)) { - MatMaterialReceive receive = receiveMap.get(key); + vo.setFormCode(formCode); + MatMaterialReceive receive = receiveMap.get(formCode); + if (receive != null) { BeanUtils.copyProperties(receive, vo); } - List numberVos = value.stream().map(material -> { + List numberVos = validMaterials.stream().map(m -> { MatMaterialsNumberVo numberVo = new MatMaterialsNumberVo(); - BeanUtils.copyProperties(material, numberVo); - Long materialId = material.getId(); - if (inventoryMap.containsKey(materialId)) { - numberVo.setInventoryNumber(BigDecimal.valueOf(inventoryMap.get(materialId).getNumber())); + BeanUtils.copyProperties(m, numberVo); + MatMaterialsInventory inv = inventoryMap.get(m.getId()); + if (inv != null) { + numberVo.setInventoryNumber(BigDecimal.valueOf(inv.getNumber())); + } + if (CollUtil.isNotEmpty(finalOutMap) && finalOutMap.containsKey(m.getId())) { + List outs = finalOutMap.get(m.getId()); + numberVo.setOutList(outs.stream().map(out -> { + MatMaterialsInventoryOutVo outVo = new MatMaterialsInventoryOutVo(); + BeanUtils.copyProperties(out, outVo); + return outVo; + }).toList()); } return numberVo; }).toList(); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionblacklist/BusConstructionBlacklistQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionblacklist/BusConstructionBlacklistQueryReq.java index c4cd3e28..b28ab2f8 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionblacklist/BusConstructionBlacklistQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionblacklist/BusConstructionBlacklistQueryReq.java @@ -15,11 +15,6 @@ public class BusConstructionBlacklistQueryReq implements Serializable { @Serial private static final long serialVersionUID = 5638694783769399209L; - /** - * 主键id - */ - private Long id; - /** * 项目id */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitCreateReq.java index fca27027..056a2096 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitCreateReq.java @@ -1,5 +1,6 @@ package org.dromara.project.domain.dto.constructionuserexit; +import jakarta.validation.constraints.NotNull; import lombok.Data; import java.io.Serial; @@ -16,8 +17,9 @@ public class BusConstructionUserExitCreateReq implements Serializable { private static final long serialVersionUID = -722474400854585360L; /** - * 主键id + * 用户id */ + @NotNull(message = "用户id不能为空") private Long userId; /** 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 83ac5234..cee99543 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 @@ -4,50 +4,41 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.json.JSONArray; 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; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import jakarta.annotation.Resource; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.dromara.common.core.domain.R; -import org.dromara.common.core.enums.FormatsType; +import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; -import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.domain.GeoPoint; -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.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.utils.JSTUtil; import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.project.domain.*; -import org.dromara.project.domain.bo.BusProjectPunchrangeBo; +import org.dromara.project.domain.bo.BusAttendanceBo; import org.dromara.project.domain.dto.attendance.BusAttendancePunchCardByFaceReq; import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum; import org.dromara.project.domain.enums.BusAttendanceCommuterEnum; import org.dromara.project.domain.vo.BusAttendanceRuleVo; +import org.dromara.project.domain.vo.BusAttendanceVo; import org.dromara.project.domain.vo.BusMonthAttendanceVo; -import org.dromara.project.domain.vo.BusProjectPunchrangeVo; +import org.dromara.project.mapper.BusAttendanceMapper; import org.dromara.project.service.*; import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.service.ISysOssService; import org.springframework.stereotype.Service; -import org.dromara.project.domain.bo.BusAttendanceBo; -import org.dromara.project.domain.vo.BusAttendanceVo; -import org.dromara.project.mapper.BusAttendanceMapper; import org.springframework.web.multipart.MultipartFile; -import org.dromara.common.core.constant.HttpStatus; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -231,7 +222,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList); - return matchingRange != null; + return matchingRange != null; } @Override - public List getTodayAttendance( Long projectId) { + public List getTodayAttendance(Long projectId) { Long userId = LoginHelper.getUserId(); BusAttendanceRuleVo busAttendanceRuleVo = attendanceRuleService.queryByProjectId(projectId); @@ -397,8 +388,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl() - .eq(BusAttendance::getUserId, userId) - .eq(BusAttendance::getClockDate, localDate) + .eq(BusAttendance::getUserId, userId) + .eq(BusAttendance::getClockDate, localDate) ); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionBlacklistServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionBlacklistServiceImpl.java index ac385706..f1fc635b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionBlacklistServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionBlacklistServiceImpl.java @@ -157,7 +157,7 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl buildQueryWrapper(BusConstructionBlacklistQueryReq req) { LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); - Long id = req.getId(); Long userId = req.getUserId(); Long projectId = req.getProjectId(); String userName = req.getUserName(); @@ -250,7 +249,6 @@ public class BusConstructionBlacklistServiceImpl extends ServiceImpl constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class) + .eq(SubConstructionUser::getId, constructionUser.getId()) + .set(SubConstructionUser::getTeamId, null) + .set(SubConstructionUser::getLeaveDate, new Date()); + boolean update = constructionUserService.update(constructionUserLuw); + if (!update) { + throw new ServiceException("施工人员退场失败,数据库异常", HttpStatus.ERROR); + } + return true; } } 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 2f1bbf04..c685de72 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 @@ -133,7 +133,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl() .eq(BusProjectTeamMember::getMemberId, memberId)