diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java index 95f6e544..0f034f25 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucher/VoucherServiceImpl.java @@ -1,11 +1,15 @@ package cn.iocoder.yudao.module.accounting.service.voucher; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; import cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper; import cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet.DepotCabinetMapper; import cn.iocoder.yudao.module.setting.dal.mysql.organization.OrganizationMapper; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -38,6 +42,8 @@ public class VoucherServiceImpl implements VoucherService { private DepotMapper depotMapper; @Resource private DepotCabinetMapper depotCabinetMapper; + @Resource + private AdminUserMapper userMapper; @Override public Long createVoucher(VoucherCreateReqVO createReqVO) { @@ -64,6 +70,10 @@ public class VoucherServiceImpl implements VoucherService { } } voucher.setPosition(position); + //制单人 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId()); + voucher.setCreateBy(adminUserDO.getUsername()); voucherMapper.insert(voucher); // 返回 return voucher.getId(); diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java index 9dbd9eea..86d7cfc7 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/voucherdetails/VoucherDetailsServiceImpl.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.module.accounting.service.voucherdetails; +import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.VoucherExportReqVO; +import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO; +import cn.iocoder.yudao.module.accounting.dal.mysql.voucher.VoucherMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -31,10 +34,24 @@ public class VoucherDetailsServiceImpl implements VoucherDetailsService { @Resource private VoucherDetailsMapper voucherDetailsMapper; + @Resource + private VoucherMapper voucherMapper; + + @Override public Long createVoucherDetails(VoucherDetailsCreateReqVO createReqVO) { // 插入 VoucherDetailsDO voucherDetails = VoucherDetailsConvert.INSTANCE.convert(createReqVO); + //寻找凭证id通过voucherNum + if (createReqVO.getVoucherNum() != null) { + String voucherNum = createReqVO.getVoucherNum(); + VoucherExportReqVO voucherExportReqVO = new VoucherExportReqVO(); + voucherExportReqVO.setVoucherNum(voucherNum); + List voucherDOS = voucherMapper.selectList(voucherExportReqVO); + if (voucherDOS.size()>0){ + voucherDetails.setVoucherId(voucherDOS.get(0).getId()); + } + } voucherDetailsMapper.insert(voucherDetails); // 返回 return voucherDetails.getId(); @@ -46,6 +63,16 @@ public class VoucherDetailsServiceImpl implements VoucherDetailsService { validateVoucherDetailsExists(updateReqVO.getId()); // 更新 VoucherDetailsDO updateObj = VoucherDetailsConvert.INSTANCE.convert(updateReqVO); + //寻找凭证id通过voucherNum + if (updateReqVO.getVoucherNum() != null) { + String voucherNum = updateReqVO.getVoucherNum(); + VoucherExportReqVO voucherExportReqVO = new VoucherExportReqVO(); + voucherExportReqVO.setVoucherNum(voucherNum); + List voucherDOS = voucherMapper.selectList(voucherExportReqVO); + if (voucherDOS.size()>0){ + updateReqVO.setVoucherId(voucherDOS.get(0).getId()); + } + } voucherDetailsMapper.updateById(updateObj); } diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/record/RecordController.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/record/RecordController.java index 2943656a..7e06cbec 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/record/RecordController.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/record/RecordController.java @@ -96,7 +96,7 @@ public class RecordController { @GetMapping("/page") @Operation(summary = "获得归档分页") @PreAuthorize("@ss.hasPermission('archives:record:query')") - @DataPermission + //@DataPermission 用来限制部门数据 public CommonResult> getRecordPage(@Valid RecordPageReqVO pageVO) { PageResult pageResult = recordService.getRecordPage(pageVO); return success(RecordConvert.INSTANCE.convertPage(pageResult));