凭证详情

new
JiilingLee 1 year ago
parent 48b265a850
commit a43ccbf1da

@ -1,11 +1,15 @@
package cn.iocoder.yudao.module.accounting.service.voucher; 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.depot.DepotDO;
import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; 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.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper; 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.depotcabinet.DepotCabinetMapper;
import cn.iocoder.yudao.module.setting.dal.mysql.organization.OrganizationMapper; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -38,6 +42,8 @@ public class VoucherServiceImpl implements VoucherService {
private DepotMapper depotMapper; private DepotMapper depotMapper;
@Resource @Resource
private DepotCabinetMapper depotCabinetMapper; private DepotCabinetMapper depotCabinetMapper;
@Resource
private AdminUserMapper userMapper;
@Override @Override
public Long createVoucher(VoucherCreateReqVO createReqVO) { public Long createVoucher(VoucherCreateReqVO createReqVO) {
@ -64,6 +70,10 @@ public class VoucherServiceImpl implements VoucherService {
} }
} }
voucher.setPosition(position); voucher.setPosition(position);
//制单人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
AdminUserDO adminUserDO = userMapper.selectById(loginUser.getId());
voucher.setCreateBy(adminUserDO.getUsername());
voucherMapper.insert(voucher); voucherMapper.insert(voucher);
// 返回 // 返回
return voucher.getId(); return voucher.getId();

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.accounting.service.voucherdetails; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -31,10 +34,24 @@ public class VoucherDetailsServiceImpl implements VoucherDetailsService {
@Resource @Resource
private VoucherDetailsMapper voucherDetailsMapper; private VoucherDetailsMapper voucherDetailsMapper;
@Resource
private VoucherMapper voucherMapper;
@Override @Override
public Long createVoucherDetails(VoucherDetailsCreateReqVO createReqVO) { public Long createVoucherDetails(VoucherDetailsCreateReqVO createReqVO) {
// 插入 // 插入
VoucherDetailsDO voucherDetails = VoucherDetailsConvert.INSTANCE.convert(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<VoucherDO> voucherDOS = voucherMapper.selectList(voucherExportReqVO);
if (voucherDOS.size()>0){
voucherDetails.setVoucherId(voucherDOS.get(0).getId());
}
}
voucherDetailsMapper.insert(voucherDetails); voucherDetailsMapper.insert(voucherDetails);
// 返回 // 返回
return voucherDetails.getId(); return voucherDetails.getId();
@ -46,6 +63,16 @@ public class VoucherDetailsServiceImpl implements VoucherDetailsService {
validateVoucherDetailsExists(updateReqVO.getId()); validateVoucherDetailsExists(updateReqVO.getId());
// 更新 // 更新
VoucherDetailsDO updateObj = VoucherDetailsConvert.INSTANCE.convert(updateReqVO); VoucherDetailsDO updateObj = VoucherDetailsConvert.INSTANCE.convert(updateReqVO);
//寻找凭证id通过voucherNum
if (updateReqVO.getVoucherNum() != null) {
String voucherNum = updateReqVO.getVoucherNum();
VoucherExportReqVO voucherExportReqVO = new VoucherExportReqVO();
voucherExportReqVO.setVoucherNum(voucherNum);
List<VoucherDO> voucherDOS = voucherMapper.selectList(voucherExportReqVO);
if (voucherDOS.size()>0){
updateReqVO.setVoucherId(voucherDOS.get(0).getId());
}
}
voucherDetailsMapper.updateById(updateObj); voucherDetailsMapper.updateById(updateObj);
} }

@ -96,7 +96,7 @@ public class RecordController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得归档分页") @Operation(summary = "获得归档分页")
@PreAuthorize("@ss.hasPermission('archives:record:query')") @PreAuthorize("@ss.hasPermission('archives:record:query')")
@DataPermission //@DataPermission 用来限制部门数据
public CommonResult<PageResult<RecordRespVO>> getRecordPage(@Valid RecordPageReqVO pageVO) { public CommonResult<PageResult<RecordRespVO>> getRecordPage(@Valid RecordPageReqVO pageVO) {
PageResult<RecordDO> pageResult = recordService.getRecordPage(pageVO); PageResult<RecordDO> pageResult = recordService.getRecordPage(pageVO);
return success(RecordConvert.INSTANCE.convertPage(pageResult)); return success(RecordConvert.INSTANCE.convertPage(pageResult));

Loading…
Cancel
Save