feat(system): 添加结算扣款明细接口

- 新增 SettlementApi接口,提供获取结算扣款明细的功能
- 添加 SettlementItemDTO 数据传输对象,用于结算项的传输
- 在 CustomerSettlementMapper 中实现结算扣款明细的查询方法
- 在 CustomerSettlementService 接口中添加获取结算扣款明细的方法
- 实现 CustomerSettlementServiceImpl 中的结算扣款明细查询逻辑
- 添加 SettlementApiImpl 类,实现 SettlementApi 接口
This commit is contained in:
furongxin 2025-06-01 10:07:02 +08:00
parent 4829400ae2
commit 9a50fa9697
6 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.system.api.customersettlement;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
import cn.iocoder.yudao.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 结算")
public interface SettlementApi {
String PREFIX = ApiConstants.PREFIX + "/customer-settlement";
@GetMapping(PREFIX + "/get-deductionItems")
@Operation(summary = "获得结算扣款明细")
CommonResult<List<SettlementItemDTO>> getDeductionItems(@RequestParam(value = "factoryId", required = false) Long factoryId,
@RequestParam(value = "month", required = false) String month);
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.system.api.customersettlement.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Schema(description = "管理后台 - 工厂结算项VO")
@Data
public class SettlementItemDTO {
@Schema(description = "工厂编号")
private Long factoryId;
@Schema(description = "结算月份")
private String month;
@Schema(description = "业务类型")
private Integer businessType;
@Schema(description = "扣款明细")
private List<Deduction> deductionItems;
/**
* 扣款明细
*/
@Data
public static class Deduction {
private String key;
private BigDecimal value;
}
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.system.api.customersettlement;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
import cn.iocoder.yudao.module.system.service.customersettlement.CustomerSettlementService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口 Feign 调用
@Validated
public class SettlementApiImpl implements SettlementApi {
@Resource
private CustomerSettlementService customerSettlementService;
@Override
public CommonResult<List<SettlementItemDTO>> getDeductionItems(Long factoryId, String month) {
return success( customerSettlementService.getDeductionItems(factoryId, month));
}
}

View File

@ -3,12 +3,17 @@ package cn.iocoder.yudao.module.system.dal.mysql.customersettlement;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.MPJLambdaWrapperX;
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
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.SettlementItemDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户结算信息 Mapper
*
@ -25,4 +30,18 @@ public interface CustomerSettlementMapper extends BaseMapperX<CustomerSettlement
}
StatisticsVO selectTotal(@Param("reqVO") CustomerSettlementPageReqVO pageReqVO);
default List<SettlementItemDTO> selectDeductionItems(Long factoryId, String month) {
MPJLambdaWrapperX<CustomerSettlementDO> queryWrapper = new MPJLambdaWrapperX<CustomerSettlementDO>();
queryWrapper.selectAs(CustomerSettlementDO::getCustomerId, SettlementItemDTO::getFactoryId);
queryWrapper.selectAs(CustomerSettlementDO::getSettlementMonth, SettlementItemDTO::getMonth);
queryWrapper.selectAs(SettlementItemDO::getBusinessType, SettlementItemDTO::getBusinessType);
queryWrapper.selectAs(SettlementItemDO::getDeductionItems, SettlementItemDTO::getDeductionItems);
queryWrapper.leftJoin(SettlementItemDO.class, SettlementItemDO::getSettlementId, CustomerSettlementDO::getId);
queryWrapper.eqIfPresent(CustomerSettlementDO::getCustomerId, factoryId);
queryWrapper.eqIfPresent(CustomerSettlementDO::getSettlementMonth, month);
return selectJoinList(SettlementItemDTO.class, queryWrapper);
}
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.service.customersettlement;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
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.StatisticsVO;
@ -78,4 +79,12 @@ public interface CustomerSettlementService {
* @return 统计信息
*/
StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO);
/**
* 获得结算扣款明细
* @param factoryId 工厂id
* @param month 月份
* @return 结算扣款明细
*/
List<SettlementItemDTO> getDeductionItems(Long factoryId, String month);
}

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
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.StatisticsVO;
@ -170,4 +171,9 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
return customerSettlementMapper.selectTotal(pageReqVO);
}
@Override
public List<SettlementItemDTO> getDeductionItems(Long factoryId, String month) {
return customerSettlementMapper.selectDeductionItems(factoryId, month);
}
}