feat(system): 客户结算信息增加统计功能并优化相关数据结构
- 新增客户结算信息统计接口和相关数据结构 -为 CustomerSettlementDO 和 SettlementItemDO 添加新的财务相关字段 - 优化 CustomerSettlementPageReqVO 结构,支持日期范围查询- 为 LoanMapper 添加新的查询条件,提高贷款查询的灵活性
This commit is contained in:
parent
f1b88b349a
commit
72254590dc
@ -9,10 +9,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementRespVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.SettlementItemVO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
@ -136,7 +133,7 @@ public class CustomerSettlementController {
|
|||||||
item.setSettlementItems(BeanUtils.toBean(itemMap.get(item.getId()), SettlementItemVO.class));
|
item.setSettlementItems(BeanUtils.toBean(itemMap.get(item.getId()), SettlementItemVO.class));
|
||||||
}
|
}
|
||||||
// 设置工厂名称
|
// 设置工厂名称
|
||||||
item.setCustomerName(factoryMap.get(item.getCustomerId()).getName());
|
item.setCustomerName(factoryMap.get(item.getCustomerId()).getShortName());
|
||||||
// 设置创建人名称
|
// 设置创建人名称
|
||||||
item.setCreatorName(userMap.get(item.getCreator()) == null ? "" : userMap.get(item.getCreator()).getNickname());
|
item.setCreatorName(userMap.get(item.getCreator()) == null ? "" : userMap.get(item.getCreator()).getNickname());
|
||||||
});
|
});
|
||||||
@ -145,6 +142,14 @@ public class CustomerSettlementController {
|
|||||||
return success(respVO);
|
return success(respVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/total")
|
||||||
|
@Operation(summary = "获得结算统计信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:customer-settlement:query')")
|
||||||
|
public CommonResult<StatisticsVO> getCustomerSettlementTotal(@Valid CustomerSettlementPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
return success(customerSettlementService.getCustomerSettlementTotal(pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出客户结算信息 Excel")
|
@Operation(summary = "导出客户结算信息 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('system:customer-settlement:export')")
|
@PreAuthorize("@ss.hasPermission('system:customer-settlement:export')")
|
||||||
|
@ -19,7 +19,7 @@ public class CustomerSettlementPageReqVO extends PageParam {
|
|||||||
private Integer businessType;
|
private Integer businessType;
|
||||||
|
|
||||||
@Schema(description = "结算月份")
|
@Schema(description = "结算月份")
|
||||||
private String settlementMonth;
|
private String[] settlementMonth;
|
||||||
|
|
||||||
@Schema(description = "结算公司id", example = "3044")
|
@Schema(description = "结算公司id", example = "3044")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
@ -6,6 +6,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -35,6 +36,9 @@ public class CustomerSettlementRespVO {
|
|||||||
@Schema(description = "收款明细")
|
@Schema(description = "收款明细")
|
||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
|
@Schema(description = "收款金额")
|
||||||
|
private BigDecimal paymentAmount;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String notes;
|
private String notes;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 客户结算信息新增/修改 Request VO")
|
@Schema(description = "管理后台 - 客户结算信息新增/修改 Request VO")
|
||||||
@ -29,6 +30,9 @@ public class CustomerSettlementSaveReqVO {
|
|||||||
@Schema(description = "收款明细")
|
@Schema(description = "收款明细")
|
||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
|
@Schema(description = "收款金额")
|
||||||
|
private BigDecimal paymentAmount;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String notes;
|
private String notes;
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@ public class SettlementItemVO {
|
|||||||
@Schema(description = "扣款明细")
|
@Schema(description = "扣款明细")
|
||||||
private List<OtherDeductionsVO> deductionItems;
|
private List<OtherDeductionsVO> deductionItems;
|
||||||
|
|
||||||
|
@Schema(description = "扣款金额")
|
||||||
|
private BigDecimal deductionAmount;
|
||||||
|
|
||||||
@Schema(description = "结算金额")
|
@Schema(description = "结算金额")
|
||||||
private BigDecimal settlementAmount;
|
private BigDecimal settlementAmount;
|
||||||
|
|
||||||
|
@Schema(description = "已收款金额")
|
||||||
|
private BigDecimal receivedTotal;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客户结算信息统计 Response VO")
|
||||||
|
@Data
|
||||||
|
public class StatisticsVO {
|
||||||
|
|
||||||
|
@Schema(description = "预结算金额")
|
||||||
|
private BigDecimal preSettlementTotal;
|
||||||
|
|
||||||
|
@Schema(description = "应结算金额")
|
||||||
|
private BigDecimal shouldSettlementTotal;
|
||||||
|
|
||||||
|
@Schema(description = "扣款金额")
|
||||||
|
private BigDecimal deductionTotal;
|
||||||
|
|
||||||
|
@Schema(description = "结算金额")
|
||||||
|
private BigDecimal settlementTotal;
|
||||||
|
|
||||||
|
@Schema(description = "已收款金额")
|
||||||
|
private BigDecimal receivedTotal;
|
||||||
|
}
|
@ -23,8 +23,10 @@ public class LoanPageReqVO extends PageParam {
|
|||||||
@Schema(description = "借支用户部门编号", example = "128")
|
@Schema(description = "借支用户部门编号", example = "128")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "借支类型")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
private Integer loanType;
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
@Schema(description = "查询方式 | 是否查询全部借支 0否 1是 为0时查询 剩余金额不为0的借支")
|
||||||
|
private Integer model = 0;
|
||||||
|
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,6 +49,11 @@ public class CustomerSettlementDO extends BaseDO {
|
|||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<PaymentItem> paymentItem;
|
private List<PaymentItem> paymentItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal paymentAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -57,6 +57,11 @@ public class SettlementItemDO extends BaseDO {
|
|||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<OtherDeductionsVO> deductionItems;
|
private List<OtherDeductionsVO> deductionItems;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扣款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal deductionAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算金额
|
* 结算金额
|
||||||
*/
|
*/
|
||||||
|
@ -4,8 +4,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户结算信息 Mapper
|
* 客户结算信息 Mapper
|
||||||
@ -18,8 +20,9 @@ public interface CustomerSettlementMapper extends BaseMapperX<CustomerSettlement
|
|||||||
default PageResult<CustomerSettlementDO> selectPage(CustomerSettlementPageReqVO reqVO) {
|
default PageResult<CustomerSettlementDO> selectPage(CustomerSettlementPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerSettlementDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerSettlementDO>()
|
||||||
.eqIfPresent(CustomerSettlementDO::getCustomerId, reqVO.getCustomerId())
|
.eqIfPresent(CustomerSettlementDO::getCustomerId, reqVO.getCustomerId())
|
||||||
.eqIfPresent(CustomerSettlementDO::getSettlementMonth, reqVO.getSettlementMonth())
|
.betweenIfPresent(CustomerSettlementDO::getSettlementMonth, reqVO.getSettlementMonth())
|
||||||
.orderByDesc(CustomerSettlementDO::getId));
|
.orderByDesc(CustomerSettlementDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatisticsVO selectTotal(@Param("reqVO") CustomerSettlementPageReqVO pageReqVO);
|
||||||
}
|
}
|
@ -23,7 +23,9 @@ public interface LoanMapper extends BaseMapperX<LoanDO> {
|
|||||||
return selectPage(reqVO, new LambdaQueryWrapperX<LoanDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<LoanDO>()
|
||||||
.eqIfPresent(LoanDO::getUserId, reqVO.getUserId())
|
.eqIfPresent(LoanDO::getUserId, reqVO.getUserId())
|
||||||
.eqIfPresent(LoanDO::getDeptId, reqVO.getDeptId())
|
.eqIfPresent(LoanDO::getDeptId, reqVO.getDeptId())
|
||||||
.betweenIfPresent(LoanDO::getCreateTime, reqVO.getCreateTime())
|
.eqIfPresent(LoanDO::getLoanType, reqVO.getLoanType())
|
||||||
|
.ne(reqVO.getModel() == 0, LoanDO::getRemainingAmount, 0)
|
||||||
|
.orderByDesc(LoanDO::getRemainingAmount)
|
||||||
.orderByDesc(LoanDO::getUserId));
|
.orderByDesc(LoanDO::getUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.customersettlement;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
||||||
|
|
||||||
@ -67,7 +68,14 @@ public interface CustomerSettlementService {
|
|||||||
* 更新结算信息确认状态
|
* 更新结算信息确认状态
|
||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @param status
|
* @param status 状态
|
||||||
*/
|
*/
|
||||||
void updateConfirm(Long id, Integer status);
|
void updateConfirm(Long id, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得结算统计信息
|
||||||
|
* @param pageReqVO 查询信息
|
||||||
|
* @return 统计信息
|
||||||
|
*/
|
||||||
|
StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO);
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
||||||
@ -162,4 +163,10 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
|||||||
.setId(id)
|
.setId(id)
|
||||||
.setStatus(status));
|
.setStatus(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
return customerSettlementMapper.selectTotal(pageReqVO);
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
<?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="cn.iocoder.yudao.module.system.dal.mysql.customersettlement.CustomerSettlementMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<select id="selectTotal" resultType="cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO">
|
||||||
|
SELECT
|
||||||
|
SUM(b.pre_settlement_amount) AS preSettlementTotal,
|
||||||
|
SUM(b.should_settlement_amount) AS shouldSettlementTotal,
|
||||||
|
SUM(b.deduction_amount) AS deductionTotal,
|
||||||
|
SUM(b.settlement_amount) AS settlementTotal,
|
||||||
|
SUM(a.payment_amount) AS receivedTotal
|
||||||
|
FROM
|
||||||
|
system_customer_settlement a
|
||||||
|
LEFT JOIN system_settlement_item b ON b.settlement_id = a.id
|
||||||
|
WHERE
|
||||||
|
a.deleted = 0
|
||||||
|
AND b.deleted = 0
|
||||||
|
<if test="reqVO.customerId != null">
|
||||||
|
AND a.customer_id = #{reqVO.customerId}
|
||||||
|
</if>
|
||||||
|
<if test="reqVO.businessType != null">
|
||||||
|
AND b.business_type = #{reqVO.businessType}
|
||||||
|
</if>
|
||||||
|
<if test="reqVO.settlementMonth != null and reqVO.settlementMonth.length > 0">
|
||||||
|
<if test="reqVO.settlementMonth[0] != null">
|
||||||
|
and a.settlement_month >= #{reqVO.settlementMonth[0]}
|
||||||
|
</if>
|
||||||
|
<if test="reqVO.settlementMonth[1] != null">
|
||||||
|
and a.settlement_month <= #{reqVO.settlementMonth[1]}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -1,12 +0,0 @@
|
|||||||
<?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="cn.iocoder.yudao.module.system.dal.mysql.linefixedassetstemporarytable.LineFixedAssetsTemporaryTableMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue
Block a user