feat(system): 客户结算信息页面增加工厂名称、公司名称和创建人名称
- 在 CustomerSettlementRespVO 中添加客户名称、公司名称和创建人名称字段- 在 CustomerSettlementController 中实现工厂信息、公司信息和用户信息的获取及设置 - 更新相关 API 接口,增加获取工厂信息 Map 的方法refactor(system): 优化客户结算信息相关代码 - 移除了未使用的 DeptApi 导入- 删除了 CustomerSettlementRespV
This commit is contained in:
parent
79644208cc
commit
215a6c8028
@ -19,6 +19,7 @@ public enum DeptTypeEnum {
|
|||||||
FINANCE_DEPT("FINANCE_DEPT", "财务部门"),
|
FINANCE_DEPT("FINANCE_DEPT", "财务部门"),
|
||||||
HR_DEPT("HR_DEPT", "人力部门"),
|
HR_DEPT("HR_DEPT", "人力部门"),
|
||||||
PURCHASING_DEPT("PURCHASING_DEPT", "采购部门"),
|
PURCHASING_DEPT("PURCHASING_DEPT", "采购部门"),
|
||||||
|
PROJECT_DEPT("PROJECT_DEPT", "项目部门"),
|
||||||
OTHER("OTHER", "其他部门");
|
OTHER("OTHER", "其他部门");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.customersettlement;
|
package cn.iocoder.yudao.module.system.controller.admin.customersettlement;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
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.dto.FactoryInfoDTO;
|
||||||
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.CustomerSettlementRespVO;
|
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.CustomerSettlementSaveReqVO;
|
||||||
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.dept.DeptDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import cn.iocoder.yudao.module.system.service.customersettlement.CustomerSettlementService;
|
import cn.iocoder.yudao.module.system.service.customersettlement.CustomerSettlementService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -23,8 +30,13 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 客户结算信息")
|
@Tag(name = "管理后台 - 客户结算信息")
|
||||||
@ -36,6 +48,15 @@ public class CustomerSettlementController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CustomerSettlementService customerSettlementService;
|
private CustomerSettlementService customerSettlementService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService userService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeptService deptService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FactoryInfoApi factoryInfoApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建客户结算信息")
|
@Operation(summary = "创建客户结算信息")
|
||||||
@PreAuthorize("@ss.hasPermission('system:customer-settlement:create')")
|
@PreAuthorize("@ss.hasPermission('system:customer-settlement:create')")
|
||||||
@ -74,7 +95,39 @@ public class CustomerSettlementController {
|
|||||||
@PreAuthorize("@ss.hasPermission('system:customer-settlement:query')")
|
@PreAuthorize("@ss.hasPermission('system:customer-settlement:query')")
|
||||||
public CommonResult<PageResult<CustomerSettlementRespVO>> getCustomerSettlementPage(@Valid CustomerSettlementPageReqVO pageReqVO) {
|
public CommonResult<PageResult<CustomerSettlementRespVO>> getCustomerSettlementPage(@Valid CustomerSettlementPageReqVO pageReqVO) {
|
||||||
PageResult<CustomerSettlementDO> pageResult = customerSettlementService.getCustomerSettlementPage(pageReqVO);
|
PageResult<CustomerSettlementDO> pageResult = customerSettlementService.getCustomerSettlementPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, CustomerSettlementRespVO.class));
|
PageResult<CustomerSettlementRespVO> respVO = BeanUtils.toBean(pageResult, CustomerSettlementRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(respVO.getList())) {
|
||||||
|
|
||||||
|
// 获取所有创建者信息
|
||||||
|
Set<Long> creatorIds = respVO.getList().stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(CustomerSettlementRespVO::getCreator)
|
||||||
|
.map(Long::valueOf)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Map<String, AdminUserDO> userMap = userService.getUserList(creatorIds).stream()
|
||||||
|
.collect(Collectors.toMap(user ->
|
||||||
|
String.valueOf(user.getId()), // 将 Long 类型的 id 转换为 String 类型
|
||||||
|
v -> v));
|
||||||
|
|
||||||
|
// 获取工厂信息
|
||||||
|
Set<Long> factoryIds = convertSet(respVO.getList(), CustomerSettlementRespVO::getCustomerId);
|
||||||
|
Map<Long, FactoryInfoDTO> factoryMap = factoryInfoApi.getFactoryMap(factoryIds);
|
||||||
|
|
||||||
|
// 获取公司信息
|
||||||
|
Set<Long> companyIds = convertSet(respVO.getList(), CustomerSettlementRespVO::getCompanyId);
|
||||||
|
Map<Long, DeptDO> companyMap = deptService.getDeptMap(companyIds);
|
||||||
|
|
||||||
|
respVO.getList().forEach(item -> {
|
||||||
|
// 设置工厂名称
|
||||||
|
item.setCustomerName(factoryMap.get(item.getCustomerId()).getName());
|
||||||
|
// 设置公司名称
|
||||||
|
item.setCompanyName(companyMap.get(item.getCompanyId()).getName());
|
||||||
|
// 设置创建人名称
|
||||||
|
item.setCreatorName(userMap.get(item.getCreator()) == null ? "" : userMap.get(item.getCreator()).getNickname());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(respVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -89,5 +142,4 @@ public class CustomerSettlementController {
|
|||||||
ExcelUtils.write(response, "客户结算信息.xls", "数据", CustomerSettlementRespVO.class,
|
ExcelUtils.write(response, "客户结算信息.xls", "数据", CustomerSettlementRespVO.class,
|
||||||
BeanUtils.toBean(list, CustomerSettlementRespVO.class));
|
BeanUtils.toBean(list, CustomerSettlementRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,32 +4,33 @@ import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadU
|
|||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
import java.util.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.alibaba.excel.annotation.*;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 客户结算信息 Response VO")
|
@Schema(description = "管理后台 - 客户结算信息 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class CustomerSettlementRespVO {
|
public class CustomerSettlementRespVO {
|
||||||
|
|
||||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16752")
|
@Schema(description = "主键ID")
|
||||||
@ExcelProperty("主键ID")
|
@ExcelProperty("序号")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11477")
|
@Schema(description = "客户id")
|
||||||
@ExcelProperty("客户id")
|
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
@Schema(description = "业务类型(1:物流辅助服务、2:设备销售、 3:设备维护、4:系统集成、5:叉车改造)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "厂区名称")
|
||||||
@ExcelProperty("业务类型(1:物流辅助服务、2:设备销售、 3:设备维护、4:系统集成、5:叉车改造)")
|
@ExcelProperty("厂区名称")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型(1:物流辅助服务、2:设备销售、 3:设备维护、4:系统集成、5:叉车改造)")
|
||||||
|
@ExcelProperty("业务类型")
|
||||||
private Integer businessType;
|
private Integer businessType;
|
||||||
|
|
||||||
@Schema(description = "结算月份", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "结算月份")
|
||||||
@ExcelProperty("结算月份")
|
@ExcelProperty("结算月份")
|
||||||
private String settlementMonth;
|
private String settlementMonth;
|
||||||
|
|
||||||
@ -41,20 +42,28 @@ public class CustomerSettlementRespVO {
|
|||||||
@ExcelProperty("扣款金额")
|
@ExcelProperty("扣款金额")
|
||||||
private BigDecimal deductionAmount;
|
private BigDecimal deductionAmount;
|
||||||
|
|
||||||
@Schema(description = "结算金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "结算金额")
|
||||||
@ExcelProperty("结算金额")
|
@ExcelProperty("结算金额")
|
||||||
private BigDecimal settlementAmount;
|
private BigDecimal settlementAmount;
|
||||||
|
|
||||||
@Schema(description = "结算公司id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3044")
|
@Schema(description = "结算公司id")
|
||||||
@ExcelProperty("结算公司id")
|
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
@Schema(description = "上传附件", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
@Schema(description = "结算公司名称")
|
||||||
@ExcelProperty("上传附件")
|
@ExcelProperty("结算公司名称")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Schema(description = "附件")
|
||||||
private List<UploadUserFile> url;
|
private List<UploadUserFile> url;
|
||||||
|
|
||||||
|
@Schema(description = "创建人")
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建人名称")
|
||||||
|
@ExcelProperty("创建人名称")
|
||||||
|
private String creatorName;
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ public class CustomerSettlementSaveReqVO {
|
|||||||
@NotNull(message = "结算公司id不能为空")
|
@NotNull(message = "结算公司id不能为空")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
@Schema(description = "上传附件", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
|
@Schema(description = "上传附件", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "https://www.iocoder.cn")
|
||||||
@NotEmpty(message = "上传附件不能为空")
|
@NotEmpty(message = "上传附件不能为空")
|
||||||
private List<UploadUserFile> url;
|
private List<UploadUserFile> url;
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - 考勤设备")
|
@Tag(name = "RPC 服务 - 考勤设备")
|
||||||
@ -26,4 +29,14 @@ public interface FactoryInfoApi {
|
|||||||
@GetMapping(PREFIX + "/get-list")
|
@GetMapping(PREFIX + "/get-list")
|
||||||
@Operation(summary = "获得工厂信息列表")
|
@Operation(summary = "获得工厂信息列表")
|
||||||
CommonResult<List<FactoryInfoDTO>> getFactoryInfoList(@RequestParam("factoryId") Collection<Long> factoryId);
|
CommonResult<List<FactoryInfoDTO>> getFactoryInfoList(@RequestParam("factoryId") Collection<Long> factoryId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得工厂信息 Map
|
||||||
|
* @param factoryId 工厂编号集合
|
||||||
|
* @return 工厂信息 Map
|
||||||
|
*/
|
||||||
|
default Map<Long, FactoryInfoDTO> getFactoryMap(Collection<Long> factoryId) {
|
||||||
|
List<FactoryInfoDTO> factoryInfoDOS = getFactoryInfoList(factoryId).getCheckedData();
|
||||||
|
return convertMap(factoryInfoDOS, FactoryInfoDTO::getId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user