生成账单费用合并;

This commit is contained in:
王奎兴
2026-03-16 18:29:33 +08:00
parent 0d61ae880b
commit 9dafdfc051
27 changed files with 254 additions and 47 deletions
@@ -33,4 +33,9 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getNcUrl(@Param("interfaceType") String interfaceType,@Param("organizationName") String organizationName,@Param("organizationId") Long organizationId);
String getCustomerUserDept(@Param("userId") String userId);
String getDeptValue(@Param("dictCode") String dictCode);
String getDeptName(@Param("dictCode") String dictCode);
}
@@ -201,6 +201,9 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
throw new ServiceException("未找到该组织的推送地址!");
}
String salesmanId = reconciliation.getSalesmanId();
String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
String deptValue = billManageMapper.getDeptValue(customerUserDept);
String deptName = billManageMapper.getDeptName(customerUserDept);
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
String salesmanCodeNc=salespersonNcCode;
String appointShipper=make.getActualInvoiceCustomerName();
@@ -218,7 +221,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){
Ysitem item=new Ysitem();
item.setSo_deptid("NG0408");
item.setPk_deptid("NG0408");
if (deptValue != null && !deptValue.isEmpty()) {
item.setPk_deptid(deptValue);
} else {
item.setPk_deptid("NG0408");
}
//业务员nc
item.setPk_psndoc(salesmanCodeNc);
//客户nc
@@ -236,7 +243,11 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
}
String invoiceItemName = String.join(",", names);
//item.setDef29(invoiceItemName);
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
if (deptName != null && !deptName.isEmpty()) {
item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber);
} else {
item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber);
}
// item.setPk_currtype("CNY");
item.setPk_currtype(settlementCurrencyNcCode);
item.setPurchaseorder("");
@@ -454,6 +465,9 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
.filter(java.util.Objects::nonNull)
.reduce(BigDecimal.ZERO, BigDecimal::add);
String salesmanId = reconciliation.getSalesmanId();
String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId);
String deptValue = billManageMapper.getDeptValue(customerUserDept);
String deptName = billManageMapper.getDeptName(customerUserDept);
String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId);
String salesmanCodeNc=salespersonNcCode;
String appointShipper=make.getActualInvoiceCustomerName();
@@ -465,14 +479,22 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
makerCodeNc=documentPreparerNcCode;
SKitem item=new SKitem();
item.setSo_deptid("NG0408");
item.setPk_deptid("NG0408");
if (deptValue != null && !deptValue.isEmpty()) {
item.setPk_deptid(deptValue);
} else {
item.setPk_deptid("NG0408");
}
item.setCheckdirection("ar");
item.setPk_psndoc(salesmanCodeNc);
item.setCustomer(customerCodeNc);
item.setPurchaseorder("");
item.setObjtype("0");
item.setDirection("1");
item.setScomment("业务部:"+appointShipper+"物流费");
if (deptName != null && !deptName.isEmpty()) {
item.setScomment(deptName+""+appointShipper+"物流费");
} else {
item.setScomment("业务部:"+appointShipper+"物流费");
}
item.setPk_currtype(settlementCurrencyNcCode);
item.setMoney_cr(String.valueOf(totalInvoiceValue));
item.setMoney_bal(String.valueOf(totalInvoiceValue));
@@ -14,6 +14,8 @@ import java.util.List;
import com.mhd.common.core.web.domain.BaseVOEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
/**
* 账单管理对象 bill_manage
@@ -78,6 +80,10 @@ public class BillManagePO extends BaseVOEntity{
@Excel(name = "结算对象")
private String settlementEntity;
@ApiModelProperty("结算主体id")
@NotNull(message = "结算主体不能为空")
private Long settlementEntityId;
@ApiModelProperty("账单总金额")
@Excel(name = "账单总金额")
private BigDecimal billTotalAmount;
@@ -178,6 +178,7 @@ public class BillManageDomainService {
billManage.setBillAmount(billManage.getBillTotalAmount());
billManage.setBillAmountUnsettled(billManage.getBillTotalAmount());
boolean flag = billManageService.save(billManage);
billingStatementDTO.setBillManageId(billManage.getBillManageId());
List<BillDetail> billDetailList = new ArrayList<>();
for (BillingStatementPO billingStatementPO : billingStatementPOS) {
//生成对账单详情
@@ -203,4 +203,6 @@ public class BillingStatement extends BaseVOEntity{
@ApiModelProperty("业务员ID")
private String salesmanName;
@ApiModelProperty("账单管理id")
private Long billManageId;
}
@@ -215,5 +215,7 @@ public class BillingStatementPO extends BaseVOEntity{
@ApiModelProperty(value = "费用类别")
private String feeType;
private String billingStatementIdStr;
@ApiModelProperty("账单管理id")
private Long billManageId;
}
@@ -264,7 +264,7 @@ public class BillingStatementDomainService {
updateWrapper.set(BillingStatement::getUpdateBy,loginUser.getUserPo().getUserId());
updateWrapper.set(BillingStatement::getUpdateTime,new Date());
updateWrapper.set(BillingStatement::getUpdateByName,loginUser.getUserPo().getUserName());
updateWrapper.set(BillingStatement::getBillManageId,billingStatementDTO.getBillManageId());
return billingStatementService.update(updateWrapper);
}
@@ -32,6 +32,8 @@ public interface IBmsInvoiceListService extends IService<BmsInvoiceList> {
BmsInvoiceListDetailsVO details(String id);
BmsInvoiceListDetailsVO detailsByApplyNumber(String id);
void invoice(BmsInvoiceListInvoiceStateDTO tmsInvoiceListInvoiceStateDTO);
Integer reject(BmsInvoiceListInvoiceStateDTO tmsInvoiceListInvoiceStateDTO);
@@ -34,6 +34,8 @@ public interface BmsInvoiceListMapper extends BaseMapper<BmsInvoiceList> {
/* 根据id 查询 */
public BmsInvoiceListDetailsVO getById(String id);
public BmsInvoiceListDetailsVO getByApplyNumber(@Param("applyNumber") String applyNumber);
/* 根据id 查询 */
@Select("SELECT * FROM bms_invoice_list WHERE id=#{id} and is_delete = 0")
BmsInvoiceList selectById(String id);
@@ -308,6 +308,30 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
return bmsInvoiceListDetailsVO;
}
/**
* 发票详情
*
* @param id
* @return
*/
@Override
public BmsInvoiceListDetailsVO detailsByApplyNumber(String applyNumber) {
BmsInvoiceListDetailsVO bmsInvoiceListDetailsVO = bmsInvoiceListMapper.getByApplyNumber(applyNumber);
if (null == bmsInvoiceListDetailsVO) {
throw new ServiceException("未查询到该发票信息!");
}
List<BmsMakeOutInvoice> bmsMakeOutInvoiceList=bmsMakeOutInvoiceMapper.selectList(new QueryWrapper<BmsMakeOutInvoice>().lambda()
.eq(BmsMakeOutInvoice::getInvoiceId,bmsInvoiceListDetailsVO.getId())
.eq(BmsMakeOutInvoice::getIsDelete,0));
for (BmsMakeOutInvoice bmsMakeOutInvoice : bmsMakeOutInvoiceList) {
Long makeid = bmsMakeOutInvoice.getId();
List<BmsMakeOutInvoiceItem> bmsMakeOutInvoiceItemList = bmsMakeOutInvoiceItemMapper.selectList(new QueryWrapper<BmsMakeOutInvoiceItem>().lambda().eq(BmsMakeOutInvoiceItem::getMakeId, makeid));
bmsMakeOutInvoice.setBmsMakeOutInvoiceItems(bmsMakeOutInvoiceItemList);
}
bmsInvoiceListDetailsVO.setBmsMakeOutInvoices(bmsMakeOutInvoiceList);
return bmsInvoiceListDetailsVO;
}
/**
* 开票
*
@@ -832,7 +856,7 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
bmsInvoiceList.setApplicantId(sysUser.getId());
bmsInvoiceList.setRealCreateBy(sysUser.getId());
bmsInvoiceList.setRealCreateName(sysUser.getRealname());
bmsInvoiceList.setCompanyName(bmsInvoiceListAddDTO.getSettlementEntity());
// 设置组织相关字段:从当前登录用户获取组织信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
@@ -73,6 +73,8 @@ public class BmsInvoiceListAddDTO implements Serializable {
@ApiModelProperty("结算币种")
private String settlementCurrency;
private String settlementEntity;
private List<BmsMakeOutInvoice> bmsMakeOutInvoices;
}
@@ -185,6 +185,12 @@ public class BmsInvoiceListVO implements Serializable {
@ApiModelProperty(value = "一级组织ID")
private Long topOrganizationId;
@ApiModelProperty(value = "账单管理编号")
private String billNumber;
@ApiModelProperty(value = "账单管理id")
private String billManageId;
public void setTransportationIds(String transportationIds) {
this.transportationIds = transportationIds;
@@ -170,4 +170,11 @@ public class BusinessDocument extends BaseVOEntity{
@ApiModelProperty("结算方式(1-现金,2-油卡)")
private Integer settlementWay;
}
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
}
@@ -174,4 +174,11 @@ public class BusinessDocumentPO extends BaseVOEntity{
@ApiModelProperty("重算失败原因")
private String recalculateCostFailRemark;
}
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
}
@@ -194,4 +194,11 @@ public class BusinessDocumentDO extends BaseVOEntity{
@ApiModelProperty("结算主体id")
private Long settlementEntityId;
}
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
}
@@ -110,6 +110,13 @@ public class ReceiptDetailPO extends BaseVOEntity{
@Excel(name = "收款卡号")
private String paymentCard;
//打印户名
private String mainName;
//打印开户银行
private String bankDeposi;
//打印账号
private String phone;
@ApiModelProperty("交易流水")
@Excel(name = "交易流水")
private String transactionFlow;
@@ -139,4 +146,4 @@ public class ReceiptDetailPO extends BaseVOEntity{
@ApiModelProperty("收款来源(1-人工付款,2-线上支付)")
private Integer collectionSource;
}
}
@@ -1,5 +1,7 @@
package com.mhd.bms.interfaces.dto.billingStatement;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementADDVO;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
@@ -200,4 +200,11 @@ public class BusinessDocumentDTO extends BaseVOEntity{
@ApiModelProperty("结算主体id")
private Long settlementEntityId;
}
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
}
@@ -136,6 +136,32 @@ public class BmsInvoiceListApi extends BaseController {
}
return result;
}
/**
* 发票详情
*
* @param id
* @return
*/
@ApiOperation(value = "销项发票表-发票详情", notes = "销项发票表-发票详情")
@GetMapping(value = "/detailsByApplyNumber")
public Result<BmsInvoiceListDetailsVO> detailsByApplyNumber(@RequestParam(name="applyNumber",required=true) String applyNumber) {
Result<BmsInvoiceListDetailsVO> result = new Result<BmsInvoiceListDetailsVO>();
try {
BmsInvoiceListDetailsVO bmsInvoiceListDetailsVO = bmsInvoiceListService.detailsByApplyNumber(applyNumber);
result.setResult(bmsInvoiceListDetailsVO);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
} catch (ServiceException e) {
log.error(e.getErrorMessage());
result.error500(e.getErrorMessage());
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
*