Browse Source

[feat]财务管理:

应收账款
新增销售订单创建收款凭证功能
新增销售订单创建收款凭证addReceivablesVoucher.html页面
新增应收账款记录domain
新增应收账款记录controller
新增应收账款记录service
新增应收账款记录serviceImpl
新增应收账款记录mapper
新增应收账款记录VO类
dev
liuxiaoxu 10 months ago
parent
commit
a85c6c5aa5
  1. 48
      ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java
  2. 28
      ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivables.java
  3. 155
      ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivablesRecords.java
  4. 49
      ruoyi-admin/src/main/java/com/ruoyi/financial/domain/VO/FinancialReceivablesRecordsVO.java
  5. 85
      ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesRecordsMapper.java
  6. 80
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesRecordsService.java
  7. 145
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesRecordsServiceImpl.java
  8. 26
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java
  9. 114
      ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesRecordsMapper.xml
  10. 2
      ruoyi-admin/src/main/resources/templates/financial/receivables/addFinancialReceivables.html
  11. 350
      ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucher.html
  12. 20
      ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

48
ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java

@ -1,15 +1,14 @@
package com.ruoyi.financial.controller;
import java.util.List;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.financial.service.IFinancialReceivablesRecordsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.financial.domain.FinancialReceivables;
@ -34,6 +33,9 @@ public class FinancialReceivablesController extends BaseController
@Autowired
private IFinancialReceivablesService financialReceivablesService;
@Autowired
private IFinancialReceivablesRecordsService receivablesRecordsService;
@RequiresPermissions("financial:receivables:view")
@GetMapping()
public String receivables()
@ -112,6 +114,30 @@ public class FinancialReceivablesController extends BaseController
}
/**
* 新增销售订单创建收款凭证
*/
@GetMapping("/addReceivablesVoucher/{financialReceivablesId}")
public String addReceivablesVoucher(@PathVariable("financialReceivablesId") Long financialReceivablesId, ModelMap mmap)
{
FinancialReceivables financialReceivables = financialReceivablesService.selectFinancialReceivablesById(financialReceivablesId);
mmap.put("financialReceivables", financialReceivables);
return prefix + "/addReceivablesVoucher";
}
/**
* 新增保存销售订单创建收款凭证
*/
@RequiresPermissions("financial:receivables:addReceivablesVoucher")
@Log(title = "财务应收账款", businessType = BusinessType.UPDATE)
@PostMapping("/addReceivablesVoucher")
@ResponseBody
public AjaxResult addReceivablesVoucherSave(@RequestBody FinancialReceivables financialReceivables)
{
return toAjax(financialReceivablesService.updateFinancialReceivables(financialReceivables));
}
/**
* 修改财务应收账款
*/
@ -170,5 +196,15 @@ public class FinancialReceivablesController extends BaseController
return toAjax(financialReceivablesService.restoreFinancialReceivablesById(id));
}
/**
* 查找收款记录列表
*/
@PostMapping("/getReceivablesRecords")
@ResponseBody
public TableDataInfo getReceivablesRecords(FinancialReceivables financialReceivables){
startPage();
String financialReceivablesCode = financialReceivables.getFinancialReceivablesCode();
List<FinancialReceivablesRecords> financialReceivablesRecords =receivablesRecordsService.selectFinancialReceivablesRecordsListByCode(financialReceivablesCode);
return getDataTable(financialReceivablesRecords);
}
}

28
ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivables.java

@ -2,7 +2,10 @@ package com.ruoyi.financial.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.financial.domain.VO.FinancialReceivablesRecordsVO;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -114,7 +117,12 @@ public class FinancialReceivables extends BaseEntity
@Excel(name = "收款备注")
private String receivablesRemark;
public void setFinancialReceivablesId(Long financialReceivablesId)
/** 收款记录集合 */
List<FinancialReceivablesRecords> receivablesRecordsList;
/** 收款记录VO集合 */
List<FinancialReceivablesRecordsVO> receivablesRecordsVOList;
public void setFinancialReceivablesId(Long financialReceivablesId)
{
this.financialReceivablesId = financialReceivablesId;
}
@ -331,6 +339,22 @@ public class FinancialReceivables extends BaseEntity
return receivablesRemark;
}
public List<FinancialReceivablesRecords> getReceivablesRecordsList() {
return receivablesRecordsList;
}
public void setReceivablesRecordsList(List<FinancialReceivablesRecords> receivablesRecordsList) {
this.receivablesRecordsList = receivablesRecordsList;
}
public List<FinancialReceivablesRecordsVO> getReceivablesRecordsVOList() {
return receivablesRecordsVOList;
}
public void setReceivablesRecordsVOList(List<FinancialReceivablesRecordsVO> receivablesRecordsVOList) {
this.receivablesRecordsVOList = receivablesRecordsVOList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -362,6 +386,8 @@ public class FinancialReceivables extends BaseEntity
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("receivablesRecordsList",getReceivablesRecordsList())
.append("receivablesRecordsVOList",getReceivablesRecordsVOList())
.toString();
}
}

155
ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivablesRecords.java

@ -0,0 +1,155 @@
package com.ruoyi.financial.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 财务应收账款记录对象 financial_receivables_records
*
* @author 刘晓旭
* @date 2024-05-08
*/
public class FinancialReceivablesRecords extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 财务应收账款记录id */
private Long receivablesRecordsId;
/** 应收单号 */
private String financialReceivablesCode;
/** 收款结案状态 */
private String receivablesClosingStatus;
/** 关联销售订单号 */
private String salesOrderCode;
/** 收款日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "收款日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date receivablesDate;
/** 收款金额 */
@Excel(name = "收款金额")
private BigDecimal receivablesPrice;
/** 收款摘要 */
@Excel(name = "收款摘要")
private String receivablesAbstract;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operatingTime;
/** 收款备注 */
@Excel(name = "收款备注")
private String receivablesRemark;
public void setReceivablesRecordsId(Long receivablesRecordsId)
{
this.receivablesRecordsId = receivablesRecordsId;
}
public Long getReceivablesRecordsId()
{
return receivablesRecordsId;
}
public void setFinancialReceivablesCode(String financialReceivablesCode)
{
this.financialReceivablesCode = financialReceivablesCode;
}
public String getFinancialReceivablesCode()
{
return financialReceivablesCode;
}
public void setReceivablesClosingStatus(String receivablesClosingStatus)
{
this.receivablesClosingStatus = receivablesClosingStatus;
}
public String getReceivablesClosingStatus()
{
return receivablesClosingStatus;
}
public void setSalesOrderCode(String salesOrderCode)
{
this.salesOrderCode = salesOrderCode;
}
public String getSalesOrderCode()
{
return salesOrderCode;
}
public void setReceivablesDate(Date receivablesDate)
{
this.receivablesDate = receivablesDate;
}
public Date getReceivablesDate()
{
return receivablesDate;
}
public void setReceivablesPrice(BigDecimal receivablesPrice)
{
this.receivablesPrice = receivablesPrice;
}
public BigDecimal getReceivablesPrice()
{
return receivablesPrice;
}
public void setReceivablesAbstract(String receivablesAbstract)
{
this.receivablesAbstract = receivablesAbstract;
}
public String getReceivablesAbstract()
{
return receivablesAbstract;
}
public void setOperatingTime(Date operatingTime)
{
this.operatingTime = operatingTime;
}
public Date getOperatingTime()
{
return operatingTime;
}
public void setReceivablesRemark(String receivablesRemark)
{
this.receivablesRemark = receivablesRemark;
}
public String getReceivablesRemark()
{
return receivablesRemark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("receivablesRecordsId", getReceivablesRecordsId())
.append("financialReceivablesCode", getFinancialReceivablesCode())
.append("receivablesClosingStatus", getReceivablesClosingStatus())
.append("salesOrderCode", getSalesOrderCode())
.append("receivablesDate", getReceivablesDate())
.append("receivablesPrice", getReceivablesPrice())
.append("receivablesAbstract", getReceivablesAbstract())
.append("operatingTime", getOperatingTime())
.append("receivablesRemark", getReceivablesRemark())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

49
ruoyi-admin/src/main/java/com/ruoyi/financial/domain/VO/FinancialReceivablesRecordsVO.java

@ -0,0 +1,49 @@
package com.ruoyi.financial.domain.VO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 财务应收账款记录对象 financial_receivables_records
*
* @author 刘晓旭
* @date 2024-05-09
*/
@Data
public class FinancialReceivablesRecordsVO extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 财务应收账款记录id */
private Long receivablesRecordsId;
/** 应收单号 */
private String financialReceivablesCode;
/** 收款日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "收款日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date receivablesDate;
/** 收款金额 */
@Excel(name = "收款金额")
private BigDecimal receivablesPrice;
/** 收款摘要 */
@Excel(name = "收款摘要")
private String receivablesAbstract;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operatingTime;
/** 收款备注 */
@Excel(name = "收款备注")
private String receivablesRemark;
}

85
ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesRecordsMapper.java

@ -0,0 +1,85 @@
package com.ruoyi.financial.mapper;
import java.util.List;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
/**
* 财务应收账款记录Mapper接口
*
* @author 刘晓旭
* @date 2024-05-08
*/
public interface FinancialReceivablesRecordsMapper
{
/**
* 查询财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 财务应收账款记录
*/
public FinancialReceivablesRecords selectFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 查询财务应收账款记录列表
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 财务应收账款记录集合
*/
public List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsList(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 新增财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
public int insertFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 修改财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
public int updateFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 删除财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
public int deleteFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 批量删除财务应收账款记录
*
* @param receivablesRecordsIds 需要删除的数据ID
* @return 结果
*/
public int deleteFinancialReceivablesRecordsByIds(String[] receivablesRecordsIds);
/**
* 作废财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
public int cancelFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 恢复财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
public int restoreFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 查询财务应收账款记录列表
*
* @param financialReceivablesCode 财务应收单号
* @return 财务应收账款记录集合
*/
List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsListByCode(String financialReceivablesCode);
}

80
ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesRecordsService.java

@ -0,0 +1,80 @@
package com.ruoyi.financial.service;
import java.util.List;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
/**
* 财务应收账款记录Service接口
*
* @author 刘晓旭
* @date 2024-05-08
*/
public interface IFinancialReceivablesRecordsService
{
/**
* 查询财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 财务应收账款记录
*/
public FinancialReceivablesRecords selectFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 查询财务应收账款记录列表
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 财务应收账款记录集合
*/
public List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsList(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 新增财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
public int insertFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 修改财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
public int updateFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords);
/**
* 批量删除财务应收账款记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteFinancialReceivablesRecordsByIds(String ids);
/**
* 删除财务应收账款记录信息
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
public int deleteFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 作废财务应收账款记录
* @param receivablesRecordsId 财务应收账款记录ID
* @return
*/
int cancelFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 恢复财务应收账款记录
* @param receivablesRecordsId 财务应收账款记录ID
* @return
*/
int restoreFinancialReceivablesRecordsById(Long receivablesRecordsId);
/**
* 根据应收单号查找对应的收款记录
* */
List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsListByCode(String financialReceivablesCode);
}

145
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesRecordsServiceImpl.java

@ -0,0 +1,145 @@
package com.ruoyi.financial.service.impl;
import java.util.List;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.financial.mapper.FinancialReceivablesRecordsMapper;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.financial.service.IFinancialReceivablesRecordsService;
import com.ruoyi.common.core.text.Convert;
/**
* 财务应收账款记录Service业务层处理
*
* @author 刘晓旭
* @date 2024-05-08
*/
@Slf4j
@Service
public class FinancialReceivablesRecordsServiceImpl implements IFinancialReceivablesRecordsService
{
@Autowired
private FinancialReceivablesRecordsMapper financialReceivablesRecordsMapper;
/**
* 查询财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 财务应收账款记录
*/
@Override
public FinancialReceivablesRecords selectFinancialReceivablesRecordsById(Long receivablesRecordsId)
{
return financialReceivablesRecordsMapper.selectFinancialReceivablesRecordsById(receivablesRecordsId);
}
/**
* 查询财务应收账款记录列表
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 财务应收账款记录
*/
@Override
public List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsList(FinancialReceivablesRecords financialReceivablesRecords)
{
return financialReceivablesRecordsMapper.selectFinancialReceivablesRecordsList(financialReceivablesRecords);
}
/**
* 新增财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
@Override
public int insertFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords)
{
financialReceivablesRecords.setCreateTime(DateUtils.getNowDate());
String loginName = ShiroUtils.getLoginName();
financialReceivablesRecords.setCreateBy(loginName);
return financialReceivablesRecordsMapper.insertFinancialReceivablesRecords(financialReceivablesRecords);
}
/**
* 修改财务应收账款记录
*
* @param financialReceivablesRecords 财务应收账款记录
* @return 结果
*/
@Override
public int updateFinancialReceivablesRecords(FinancialReceivablesRecords financialReceivablesRecords)
{
String loginName = ShiroUtils.getLoginName();
financialReceivablesRecords.setUpdateBy(loginName);
financialReceivablesRecords.setUpdateTime(DateUtils.getNowDate());
return financialReceivablesRecordsMapper.updateFinancialReceivablesRecords(financialReceivablesRecords);
}
/**
* 删除财务应收账款记录对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteFinancialReceivablesRecordsByIds(String ids)
{
return financialReceivablesRecordsMapper.deleteFinancialReceivablesRecordsByIds(Convert.toStrArray(ids));
}
/**
* 删除财务应收账款记录信息
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
@Override
public int deleteFinancialReceivablesRecordsById(Long receivablesRecordsId)
{
return financialReceivablesRecordsMapper.deleteFinancialReceivablesRecordsById(receivablesRecordsId);
}
/**
* 作废财务应收账款记录
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
@Override
public int cancelFinancialReceivablesRecordsById(Long receivablesRecordsId)
{
return financialReceivablesRecordsMapper.cancelFinancialReceivablesRecordsById(receivablesRecordsId);
}
/**
* 恢复财务应收账款记录信息
*
* @param receivablesRecordsId 财务应收账款记录ID
* @return 结果
*/
@Override
public int restoreFinancialReceivablesRecordsById(Long receivablesRecordsId)
{
return financialReceivablesRecordsMapper.restoreFinancialReceivablesRecordsById(receivablesRecordsId);
}
/**
* 查找收款记录列表
*/
@Override
public List<FinancialReceivablesRecords> selectFinancialReceivablesRecordsListByCode(String financialReceivablesCode) {
List<FinancialReceivablesRecords> financialReceivablesRecordsList = financialReceivablesRecordsMapper.selectFinancialReceivablesRecordsListByCode(financialReceivablesCode);
if (StringUtils.isEmpty(financialReceivablesRecordsList)){
log.warn("未查找到收款记录信息:{}",financialReceivablesCode);
throw new BusinessException("未查找到收款记录信息");
}
return financialReceivablesRecordsList;
}
}

26
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java

@ -9,12 +9,17 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.financial.domain.VO.FinancialReceivablesRecordsVO;
import com.ruoyi.financial.mapper.FinancialReceivablesRecordsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.financial.mapper.FinancialReceivablesMapper;
import com.ruoyi.financial.domain.FinancialReceivables;
import com.ruoyi.financial.service.IFinancialReceivablesService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* 财务应收账款Service业务层处理
@ -22,12 +27,15 @@ import com.ruoyi.common.core.text.Convert;
* @author 刘晓旭
* @date 2024-05-08
*/
@Slf4j
@Service
public class FinancialReceivablesServiceImpl implements IFinancialReceivablesService
{
@Autowired
private FinancialReceivablesMapper financialReceivablesMapper;
@Autowired
private FinancialReceivablesRecordsMapper receivablesRecordsMapper;
/**
* 查询财务应收账款
*
@ -86,12 +94,30 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
* @param financialReceivables 财务应收账款
* @return 结果
*/
@Transactional
@Override
public int updateFinancialReceivables(FinancialReceivables financialReceivables)
{
String loginName = ShiroUtils.getLoginName();
financialReceivables.setUpdateBy(loginName);
financialReceivables.setUpdateTime(DateUtils.getNowDate());
List<FinancialReceivablesRecordsVO> receivablesRecordsVOList = financialReceivables.getReceivablesRecordsVOList();
if (StringUtils.isEmpty(receivablesRecordsVOList)){
log.warn("收款记录数据为空");
}
for (FinancialReceivablesRecordsVO financialReceivablesRecordsVO : receivablesRecordsVOList) {
FinancialReceivablesRecords receivablesRecords = new FinancialReceivablesRecords();
receivablesRecords.setCreateBy(loginName);
receivablesRecords.setCreateTime(new Date());
//拿到应收账款的code
receivablesRecords.setFinancialReceivablesCode(financialReceivables.getFinancialReceivablesCode());
receivablesRecords.setOperatingTime(new Date());
receivablesRecords.setReceivablesRemark(financialReceivablesRecordsVO.getReceivablesRemark());
receivablesRecords.setReceivablesDate(financialReceivablesRecordsVO.getReceivablesDate());
receivablesRecords.setReceivablesPrice(financialReceivablesRecordsVO.getReceivablesPrice());
receivablesRecords.setReceivablesAbstract(financialReceivablesRecordsVO.getReceivablesAbstract());
receivablesRecordsMapper.insertFinancialReceivablesRecords(receivablesRecords);
}
return financialReceivablesMapper.updateFinancialReceivables(financialReceivables);
}

114
ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesRecordsMapper.xml

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.financial.mapper.FinancialReceivablesRecordsMapper">
<resultMap type="FinancialReceivablesRecords" id="FinancialReceivablesRecordsResult">
<result property="receivablesRecordsId" column="receivables_records_id" />
<result property="financialReceivablesCode" column="financial_receivables_code" />
<result property="receivablesClosingStatus" column="receivables_closing_status" />
<result property="salesOrderCode" column="sales_order_code" />
<result property="receivablesDate" column="receivables_date" />
<result property="receivablesPrice" column="receivables_price" />
<result property="receivablesAbstract" column="receivables_abstract" />
<result property="operatingTime" column="operating_time" />
<result property="receivablesRemark" column="receivables_remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectFinancialReceivablesRecordsVo">
select receivables_records_id, financial_receivables_code, receivables_closing_status, sales_order_code, receivables_date, receivables_price, receivables_abstract, operating_time, receivables_remark, create_time, create_by, update_by, update_time from financial_receivables_records
</sql>
<select id="selectFinancialReceivablesRecordsList" parameterType="FinancialReceivablesRecords" resultMap="FinancialReceivablesRecordsResult">
<include refid="selectFinancialReceivablesRecordsVo"/>
<where>
</where>
</select>
<select id="selectFinancialReceivablesRecordsListByCode" parameterType="String" resultMap="FinancialReceivablesRecordsResult">
<include refid="selectFinancialReceivablesRecordsVo"/>
where financial_receivables_code = #{financialReceivablesCode}
</select>
<select id="selectFinancialReceivablesRecordsById" parameterType="Long" resultMap="FinancialReceivablesRecordsResult">
<include refid="selectFinancialReceivablesRecordsVo"/>
where receivables_records_id = #{receivablesRecordsId}
</select>
<insert id="insertFinancialReceivablesRecords" parameterType="FinancialReceivablesRecords" useGeneratedKeys="true" keyProperty="receivablesRecordsId">
insert into financial_receivables_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="financialReceivablesCode != null">financial_receivables_code,</if>
<if test="receivablesClosingStatus != null">receivables_closing_status,</if>
<if test="salesOrderCode != null">sales_order_code,</if>
<if test="receivablesDate != null">receivables_date,</if>
<if test="receivablesPrice != null">receivables_price,</if>
<if test="receivablesAbstract != null">receivables_abstract,</if>
<if test="operatingTime != null">operating_time,</if>
<if test="receivablesRemark != null">receivables_remark,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="financialReceivablesCode != null">#{financialReceivablesCode},</if>
<if test="receivablesClosingStatus != null">#{receivablesClosingStatus},</if>
<if test="salesOrderCode != null">#{salesOrderCode},</if>
<if test="receivablesDate != null">#{receivablesDate},</if>
<if test="receivablesPrice != null">#{receivablesPrice},</if>
<if test="receivablesAbstract != null">#{receivablesAbstract},</if>
<if test="operatingTime != null">#{operatingTime},</if>
<if test="receivablesRemark != null">#{receivablesRemark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateFinancialReceivablesRecords" parameterType="FinancialReceivablesRecords">
update financial_receivables_records
<trim prefix="SET" suffixOverrides=",">
<if test="financialReceivablesCode != null">financial_receivables_code = #{financialReceivablesCode},</if>
<if test="receivablesClosingStatus != null">receivables_closing_status = #{receivablesClosingStatus},</if>
<if test="salesOrderCode != null">sales_order_code = #{salesOrderCode},</if>
<if test="receivablesDate != null">receivables_date = #{receivablesDate},</if>
<if test="receivablesPrice != null">receivables_price = #{receivablesPrice},</if>
<if test="receivablesAbstract != null">receivables_abstract = #{receivablesAbstract},</if>
<if test="operatingTime != null">operating_time = #{operatingTime},</if>
<if test="receivablesRemark != null">receivables_remark = #{receivablesRemark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where receivables_records_id = #{receivablesRecordsId}
</update>
<delete id="deleteFinancialReceivablesRecordsById" parameterType="Long">
delete from financial_receivables_records where receivables_records_id = #{receivablesRecordsId}
</delete>
<delete id="deleteFinancialReceivablesRecordsByIds" parameterType="String">
delete from financial_receivables_records where receivables_records_id in
<foreach item="receivablesRecordsId" collection="array" open="(" separator="," close=")">
#{receivablesRecordsId}
</foreach>
</delete>
<update id="cancelFinancialReceivablesRecordsById" parameterType="Long">
update financial_receivables_records set del_flag = '1' where receivables_records_id = #{receivablesRecordsId}
</update>
<update id="restoreFinancialReceivablesRecordsById" parameterType="Long">
update financial_receivables_records set del_flag = '0' where receivables_records_id = #{receivablesRecordsId}
</update>
</mapper>

2
ruoyi-admin/src/main/resources/templates/financial/receivables/addFinancialReceivables.html

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增财务应收账款')" />
<th:block th:include="include :: header('添加应收账款')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">

350
ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucher.html

@ -0,0 +1,350 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改财务应收账款')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-receivables-edit" th:object="${financialReceivables}">
<input name="financialReceivablesId" th:field="*{financialReceivablesId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">应收单号:</label>
<div class="col-sm-8">
<input name="financialReceivablesCode" th:field="*{financialReceivablesCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收款状态:</label>
<div class="col-sm-8">
<select name="receivablesClosingStatus" class="form-control m-b" th:with="type=${@dict.getType('receivables_closing_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{receivablesClosingStatus}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<div class="col-sm-8">
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">贷方科目:</label>
<div class="col-sm-8">
<input name="creditAccount" th:field="*{creditAccount}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">贷方明细:</label>
<div class="col-sm-8">
<input name="creditDetail" th:field="*{creditDetail}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开户银行:</label>
<div class="col-sm-8">
<input name="openBank" th:field="*{openBank}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开户账号:</label>
<div class="col-sm-8">
<input name="openAccount" th:field="*{openAccount}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8">
<input name="customerId" th:field="*{customerId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同编号:</label>
<div class="col-sm-8">
<input name="contractNumber" th:field="*{contractNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">币种:</label>
<div class="col-sm-8">
<select name="currencyType" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{currencyType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税金额:</label>
<div class="col-sm-8">
<input name="priceExcludingTax" th:field="*{priceExcludingTax}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税金额:</label>
<div class="col-sm-8">
<input name="priceIncludesTax" th:field="*{priceIncludesTax}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">付款条件:</label>
<div class="col-sm-8">
<input name="paymentCondition" th:field="*{paymentCondition}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">发货状态:</label>
<div class="col-sm-8">
<select name="financialDeliverStatus" class="form-control m-b" th:with="type=${@dict.getType('financial_deliver_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{financialDeliverStatus}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">业务员:</label>
<div class="col-sm-8">
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text">
</div>
</div>
</form>
<div class="container">
<!-- 收款记录 -->
<div class="row">
<div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">收款记录</h3>
<table id="bootstrap-receivablesRecords-table"></table>
</div>
</div>
<!-- 间隔行,用于分隔 -->
<div class="row">
<div class="col-sm-12 mt-5"><!-- 使用mt-* 类来增加上边距,例如 mt-5 对应 Bootstrap 的 margin-top: 3rem; --></div>
</div>
<!-- 收款凭证 -->
<div class="row">
<div class="col-sm-12 d-flex align-items-center">
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;">收款凭证</span>
<a class="btn btn-success ml-auto" onclick="addReceivablesRecordsDetail()">
<i class="fa fa-plus"></i> 添加收款明细
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-receivablesVoucher-table"></table>
</div>
</div>
<div id="totalReceivablesAmount" class="col-sm-12 d-flex align-items-center mt-3">
<span style="font-family: Arial, sans-serif; font-size: 10px;">收款合计:</span>
<span id="totalAmountDisplay">0.00</span>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var financialReceivables = [[${financialReceivables}]];
var prefix = ctx + "financial/receivables";
$("#form-receivables-edit").validate({
focusCleanup: true
});
function submitHandler() {
// 获取表单数据
const financialReceivablesData = $("#form-receivables-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-receivablesVoucher-table').bootstrapTable('getData');
// 检查表格数据是否为空
if (table.length===0){
$.modal.alertWarning("请至少添加一条收款明细后再保存!");
return;
}
// 将表数据转换成与complaintNoticeData格式一致的数组
var financialReceivablesRecordsList = table.map(function(item) {
// 根据实际字段名调整
return {
"receivablesDate": item.receivablesDate,
"receivablesPrice": item.receivablesPrice,
"receivablesAbstract": item.receivablesAbstract,
"receivablesRemark": item.receivablesRemark,
// ...其他字段
};
});
// 合并表单数据和表格数据
const combinedData = Object.assign({}, financialReceivablesData, { receivablesRecordsVOList: financialReceivablesRecordsList });
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addReceivablesVoucher", jsonData);
}
$("input[name='receivablesDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='operatingTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
/*根据收款编号对应的收款明细*/
$(function() {
var options = {
id:"bootstrap-receivablesRecords-table",
url: prefix + "/getReceivablesRecords",
modalName: "收款记录",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '财务应收账款记录id',
field: 'receivablesRecordsId',
visible: false
},
{
title: '收款日期',
field: 'receivablesDate',
},
{
title: '收款金额',
field: 'receivablesPrice',
formatter: function(value, row, index) {
// 格式化收款金额为保留两位小数的字符串
return parseFloat(value).toFixed(2);
}
},
{
title: '收款摘要',
field: 'receivablesAbstract',
},
{
title: '操作时间',
field: 'operatingTime',
},
{
title: '收款备注',
field: 'receivablesRemark',
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
financialReceivablesCode: financialReceivables.financialReceivablesCode
};
return curParams;
}
//添加收款明细
function addReceivablesRecordsDetail() {
// 生成一个简单的唯一标识,这里使用时间戳作为示例
var uniqueId = new Date().getTime();
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义
var newRow = {
receivablesRecordsId:uniqueId,
receivablesDate: "",
receivablesPrice: "",
receivablesAbstract: "",
operatingTime: "",
receivablesRemark: ""
};
// 使用Bootstrap Table的API插入新行
$('#bootstrap-receivablesVoucher-table').bootstrapTable('append', newRow);
}
//收款凭证table列表
$(function() {
var options = {
id:"bootstrap-receivablesVoucher-table",
modalName: "收款凭证",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [{
checkbox: false
},
{
title: '财务应收账款记录id',
field: 'receivablesRecordsId',
visible: false
},
{
title: '收款日期',
field: 'receivablesDate',
editable : {
type: 'date',
clear: false,
title: '请选择日期:'
}
},
{
title: '收款金额',
field: 'receivablesPrice',
editable: {
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '收款摘要',
field: 'receivablesAbstract',
editable: {
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '收款备注',
field: 'receivablesRemark',
editable: {
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
})
// 逻辑删除收款凭证前端的一行数据
function removeRow(receivablesRecordsId){
console.log(receivablesRecordsId);
// 直接使用 receivablesRecordsId 值进行删除操作
$("#bootstrap-receivablesVoucher-table").bootstrapTable('remove', {
field: 'receivablesRecordsId',
values: receivablesRecordsId
});
}
</script>
</body>
</html>

20
ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

@ -101,9 +101,7 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('financial:receivables:edit')}]];
var removeFlag = [[${@permission.hasPermi('financial:receivables:remove')}]];
var cancelFlag = [[${@permission.hasPermi('financial:receivables:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('financial:receivables:restore')}]];
var addReceivablesVoucherFlag=[[${@permission.hasPermi('financial:receivables:addReceivablesVoucher')}]];
var receivablesClosingStatusDatas = [[${@dict.getType('receivables_closing_status')}]];
var currencyTypeDatas = [[${@dict.getType('sys_common_currency')}]];
var financialDeliverStatusDatas = [[${@dict.getType('financial_deliver_status')}]];
@ -221,13 +219,9 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.financialReceivablesId + '\')"><i class="fa fa-remove"></i>删除</a> ');
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a> ');
}else{
actions.push('<a class="btn btn-success btn-xs ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i>恢复</a> ');
}
//actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> ');
return actions.join('');
}
}]
@ -240,6 +234,12 @@
var url=ctx+'financial/receivables/addFinancialReceivables';
$.modal.open("添加应收账款",url);
}
//创建收款凭证
function addReceivablesVoucher(financialReceivablesId){
var url = ctx+'financial/receivables/addReceivablesVoucher/'+financialReceivablesId;
$.modal.open("创建收款凭证",url);
}
</script>
</body>
</html>
Loading…
Cancel
Save