|
|
@ -1,5 +1,11 @@
|
|
|
|
package cn.iocoder.yudao.module.accounting.service.voucher;
|
|
|
|
package cn.iocoder.yudao.module.accounting.service.voucher;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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;
|
|
|
@ -26,11 +32,38 @@ public class VoucherServiceImpl implements VoucherService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private VoucherMapper voucherMapper;
|
|
|
|
private VoucherMapper voucherMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private OrganizationMapper organizationMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private DepotMapper depotMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private DepotCabinetMapper depotCabinetMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Long createVoucher(VoucherCreateReqVO createReqVO) {
|
|
|
|
public Long createVoucher(VoucherCreateReqVO createReqVO) {
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
VoucherDO voucher = VoucherConvert.INSTANCE.convert(createReqVO);
|
|
|
|
VoucherDO voucher = VoucherConvert.INSTANCE.convert(createReqVO);
|
|
|
|
|
|
|
|
Long organizationId = createReqVO.getOrganizationId();
|
|
|
|
|
|
|
|
Long depotId = createReqVO.getDepotId();
|
|
|
|
|
|
|
|
Long cabinetId = createReqVO.getCabinetId();
|
|
|
|
|
|
|
|
OrganizationDO organizationDO = organizationMapper.selectById(organizationId);
|
|
|
|
|
|
|
|
DepotDO depotDO = depotMapper.selectById(depotId);
|
|
|
|
|
|
|
|
DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId);
|
|
|
|
|
|
|
|
String position="";
|
|
|
|
|
|
|
|
if (organizationDO != null){
|
|
|
|
|
|
|
|
position=position+"/"+organizationDO.getOrganizationName();
|
|
|
|
|
|
|
|
if (depotDO != null){
|
|
|
|
|
|
|
|
position=position+"/"+depotDO.getName();
|
|
|
|
|
|
|
|
if (depotCabinetDO != null){
|
|
|
|
|
|
|
|
position= position+"/"+depotCabinetDO.getName();
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
position= position+"/默认档案柜";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
position=position+"/默认库房/默认档案柜";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
voucher.setPosition(position);
|
|
|
|
voucherMapper.insert(voucher);
|
|
|
|
voucherMapper.insert(voucher);
|
|
|
|
// 返回
|
|
|
|
// 返回
|
|
|
|
return voucher.getId();
|
|
|
|
return voucher.getId();
|
|
|
@ -42,6 +75,27 @@ public class VoucherServiceImpl implements VoucherService {
|
|
|
|
validateVoucherExists(updateReqVO.getId());
|
|
|
|
validateVoucherExists(updateReqVO.getId());
|
|
|
|
// 更新
|
|
|
|
// 更新
|
|
|
|
VoucherDO updateObj = VoucherConvert.INSTANCE.convert(updateReqVO);
|
|
|
|
VoucherDO updateObj = VoucherConvert.INSTANCE.convert(updateReqVO);
|
|
|
|
|
|
|
|
Long organizationId = updateObj.getOrganizationId();
|
|
|
|
|
|
|
|
Long depotId = updateObj.getDepotId();
|
|
|
|
|
|
|
|
Long cabinetId = updateObj.getCabinetId();
|
|
|
|
|
|
|
|
OrganizationDO organizationDO = organizationMapper.selectById(organizationId);
|
|
|
|
|
|
|
|
DepotDO depotDO = depotMapper.selectById(depotId);
|
|
|
|
|
|
|
|
DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId);
|
|
|
|
|
|
|
|
String position="";
|
|
|
|
|
|
|
|
if (organizationDO != null){
|
|
|
|
|
|
|
|
position=position+organizationDO.getOrganizationName();
|
|
|
|
|
|
|
|
if (depotDO != null){
|
|
|
|
|
|
|
|
position=position+"/"+depotDO.getName();
|
|
|
|
|
|
|
|
if (depotCabinetDO != null){
|
|
|
|
|
|
|
|
position= position+"/"+depotCabinetDO.getName();
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
position= position+"/默认档案柜";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
position=position+"/默认库房/默认档案柜";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
updateObj.setPosition(position);
|
|
|
|
voucherMapper.updateById(updateObj);
|
|
|
|
voucherMapper.updateById(updateObj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|