From 9a50fa9697dcfe69a237ff32c0b007290e9f1050 Mon Sep 17 00:00:00 2001 From: furongxin <419481438@qq.com> Date: Sun, 1 Jun 2025 10:07:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(system):=20=E6=B7=BB=E5=8A=A0=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=89=A3=E6=AC=BE=E6=98=8E=E7=BB=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 SettlementApi接口,提供获取结算扣款明细的功能 - 添加 SettlementItemDTO 数据传输对象,用于结算项的传输 - 在 CustomerSettlementMapper 中实现结算扣款明细的查询方法 - 在 CustomerSettlementService 接口中添加获取结算扣款明细的方法 - 实现 CustomerSettlementServiceImpl 中的结算扣款明细查询逻辑 - 添加 SettlementApiImpl 类,实现 SettlementApi 接口 --- .../api/customersettlement/SettlementApi.java | 26 ++++++++++++++ .../dto/SettlementItemDTO.java | 35 +++++++++++++++++++ .../customersettlement/SettlementApiImpl.java | 26 ++++++++++++++ .../CustomerSettlementMapper.java | 19 ++++++++++ .../CustomerSettlementService.java | 9 +++++ .../CustomerSettlementServiceImpl.java | 6 ++++ 6 files changed, 121 insertions(+) create mode 100644 yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApi.java create mode 100644 yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/dto/SettlementItemDTO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApiImpl.java diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApi.java new file mode 100644 index 00000000..01167100 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApi.java @@ -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> getDeductionItems(@RequestParam(value = "factoryId", required = false) Long factoryId, + @RequestParam(value = "month", required = false) String month); + + +} diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/dto/SettlementItemDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/dto/SettlementItemDTO.java new file mode 100644 index 00000000..3a003576 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/dto/SettlementItemDTO.java @@ -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 deductionItems; + + /** + * 扣款明细 + */ + @Data + public static class Deduction { + + private String key; + + private BigDecimal value; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApiImpl.java new file mode 100644 index 00000000..60605375 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/customersettlement/SettlementApiImpl.java @@ -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> getDeductionItems(Long factoryId, String month) { + return success( customerSettlementService.getDeductionItems(factoryId, month)); + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/customersettlement/CustomerSettlementMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/customersettlement/CustomerSettlementMapper.java index 1aa94d77..4f44b137 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/customersettlement/CustomerSettlementMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/customersettlement/CustomerSettlementMapper.java @@ -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 selectDeductionItems(Long factoryId, String month) { + + MPJLambdaWrapperX queryWrapper = new MPJLambdaWrapperX(); + 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); + } } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementService.java index a448dee3..f249d82c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementService.java @@ -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 getDeductionItems(Long factoryId, String month); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementServiceImpl.java index c36a80e0..21e373d6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/customersettlement/CustomerSettlementServiceImpl.java @@ -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 getDeductionItems(Long factoryId, String month) { + return customerSettlementMapper.selectDeductionItems(factoryId, month); + } } \ No newline at end of file