凭证详情

new
JiilingLee 1 year ago
parent 48b265a850
commit a43ccbf1da

@ -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();

@ -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<VoucherDO> 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<VoucherDO> voucherDOS = voucherMapper.selectList(voucherExportReqVO);
if (voucherDOS.size()>0){
updateReqVO.setVoucherId(voucherDOS.get(0).getId());
}
}
voucherDetailsMapper.updateById(updateObj);
}

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

Loading…
Cancel
Save