报表基础模块:新增支持生产单报表 (配件汇总/明细)导出

This commit is contained in:
gaoqr
2024-07-30 10:33:00 +08:00
parent c961547fc8
commit bfcc070b94
7 changed files with 232 additions and 10 deletions
@@ -0,0 +1,33 @@
package com.cf.imes.module.executor.api.datasource;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.executor.api.datasource.dto.PartGoodsRespDTO;
import com.cf.imes.module.executor.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
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;
/**
* @author Gqr
* @since 2024/7/30 9:22
*/
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 配件报表数据源")
public interface OrderPartDatasourceApi {
String PREFIX = ApiConstants.PREFIX + "/order-part";
@GetMapping(PREFIX + "/detail")
@Operation(summary = "配件明细")
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
CommonResult<List<PartGoodsRespDTO>> selectPartDetail(@RequestParam("orderId") Long orderId);
@GetMapping(PREFIX + "/summary")
@Operation(summary = "配件汇总")
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
CommonResult<List<PartGoodsRespDTO>> selectPartAll(@RequestParam("orderId") Long orderId);
}
@@ -0,0 +1,80 @@
package com.cf.imes.module.executor.api.datasource.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "管理后台 - 配件对应板材信息 Resp DTO")
public class PartGoodsRespDTO {
@Schema(description = "柜体号", example = "11087")
private Long bodyId;
@Schema(description = "柜体名称", example = "11087")
private String bodyName;
@Schema(description = "房间号", example = "11087")
private Long roomId;
@Schema(description = "房间名称", example = "11087")
private String roomName;
@Schema(description = "配件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29347")
private Long id;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long orderId;
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
private String goodsId;
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
private String name;
@Schema(description = "材质", requiredMode = Schema.RequiredMode.REQUIRED)
private String material;
@Schema(description = "配件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private String type;
@Schema(description = "型号", requiredMode = Schema.RequiredMode.REQUIRED)
private String model;
@Schema(description = "规格", requiredMode = Schema.RequiredMode.REQUIRED)
private String spec;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
private String brand;
@Schema(description = "厂家", requiredMode = Schema.RequiredMode.REQUIRED)
private String factory;
@Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED)
private String unit;
@Schema(description = "价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
private Double price;
@Schema(description = "是否复合部件:0 否 1 是", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean isComposite;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
private Double num;
@Schema(description = "金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "29507")
private Double totalPrice;
}
@@ -0,0 +1,42 @@
package com.cf.imes.module.executor.api.datasource;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.api.datasource.dto.PartGoodsRespDTO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO;
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author Gqr
* @since 2024/7/30 9:21
*/
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class OrderPartDatasourceApiImpl implements OrderPartDatasourceApi {
@Resource
private OrderPartsMapper orderPartsMapper;
@Override
public CommonResult<List<PartGoodsRespDTO>> selectPartDetail(Long orderId) {
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
// 查询明细列表
List<PartGoodsRespVO> partGoodsRespVOS = orderPartsMapper.selectPartDetail(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
return CommonResult.success(BeanUtils.toBean(partGoodsRespVOS, PartGoodsRespDTO.class));
}
@Override
public CommonResult<List<PartGoodsRespDTO>> selectPartAll(Long orderId) {
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
// 查询明细列表
List<PartGoodsRespVO> partGoodsRespVOS = orderPartsMapper.selectPartAll(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
return CommonResult.success(BeanUtils.toBean(partGoodsRespVOS, PartGoodsRespDTO.class));
}
}
@@ -34,7 +34,7 @@ public class OrderPlateDatasourceApiImpl implements OrderPlateDatasourceApi {
@Override
public CommonResult<List<PlateGoodsRespDTO>> selectPlateGoodsList(Long orderId) {
// 查询分组统计
// 查询分组列表
Integer notDeletedStatus = OrderDeletedEnum.NOT_DELETED.getStatus();
List<PlateGoodsRespVO> plateGoodsRespVOS = plateMapper.selectPlateGoodsList(orderId, SecurityFrameworkUtils.getLoginUser().getOrganId(), notDeletedStatus);
return CommonResult.success(BeanUtils.toBean(plateGoodsRespVOS, PlateGoodsRespDTO.class));
@@ -357,7 +357,6 @@
left join order_goods ogs on op.goods_id = ogs.id
left join order_item its on op.id = its.plate_id
left join order_body bdy on bdy.id = its.body_id
left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId}
and op.organ_id = #{organId}
and op.deleted = #{deleted}
@@ -385,7 +384,6 @@
left join order_goods ogs on op.goods_id = ogs.id
left join order_item its on op.id = its.plate_id
left join order_body bdy on bdy.id = its.body_id
left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId}
and op.organ_id = #{organId}
and op.deleted = #{deleted}