Commit 20f154b3ff893b16c948ab9de3d8780f2976686c

Authored by 房远帅
1 parent f2c66bb2

统计报表:订单明细

... ... @@ -1323,3 +1323,55 @@ CREATE TABLE `product_sample_confirmation_slip_detail` (
1323 1323 `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
1324 1324 PRIMARY KEY (`id`)
1325 1325 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='产品试样确认单明细'
  1326 +
  1327 +CREATE TABLE `order_detail_report` (
  1328 + `id` varchar(32) NOT NULL COMMENT 'ID',
  1329 + `purchase_order_line_id` varchar(32) DEFAULT NULL COMMENT '订货单物料行ID',
  1330 + `order_no` varchar(100) DEFAULT NULL COMMENT '订单编号',
  1331 + `order_date` date default null COMMENT '订货日期',
  1332 + `workshop_id` varchar(50) DEFAULT NULL COMMENT '生产厂',
  1333 + `dept_name` varchar(50) comment '科办',
  1334 + `region_name` varchar(50) comment '区域',
  1335 + `ordering_unit_name` varchar(200) comment '订货单位名称',
  1336 + `industry` varchar(50) comment '行业',
  1337 + `brand` varchar(50) comment '牌号',
  1338 + `thickness` decimal(10, 4) default null comment '厚度',
  1339 + `thickness_tol_pos` decimal(10, 4) default null comment '厚度公差正',
  1340 + `thickness_tol_neg` decimal(10, 4) default null comment '厚度公差负',
  1341 + `width` decimal(10, 4) default null comment '宽度',
  1342 + `width_tol_pos` decimal(10, 4) default null comment '宽度公差正',
  1343 + `width_tol_neg` decimal(10, 4) default null comment '宽度公差负',
  1344 + `length` decimal(10, 4) default null comment '长度',
  1345 + `length_tol_pos` decimal(10, 4) default null comment '长度公差正',
  1346 + `length_tol_neg` decimal(10, 4) default null comment '长度公差负',
  1347 + `status` varchar(50) comment '状态',
  1348 + `quantity` decimal(15, 4) COMMENT '数量',
  1349 + `suggested_price` varchar(50) comment '指导价',
  1350 + `delivery_date` date default null comment '发货日期',
  1351 + `assessment_exceeds_agreement` varchar(50) comment '超协价',
  1352 + `sales_price` varchar(50) comment '销售价',
  1353 + `price_list_no` varchar(50) comment '价格表编号',
  1354 + `packaging_fee` varchar(50) comment '包装费',
  1355 + `invoicing_status` varchar(50) comment '开票情况',
  1356 + `piece_weight_header` text comment '件重条头',
  1357 + `surface` text comment '表面',
  1358 + `tolerance` text comment '公差',
  1359 + `performance` text comment '性能',
  1360 + `packaging` text comment '包装',
  1361 + `remarks` text comment '备注',
  1362 + `shipping_cost` varchar(50) comment '运费',
  1363 + `return_shipping_cost` varchar(50) comment '回程运费',
  1364 + `customer_type` varchar(50) comment '客户类型',
  1365 + `quality` varchar(100) comment '标准行业',
  1366 + `contract_type` varchar(100) comment '加工经销',
  1367 + `stock_up_company_name` varchar(200) comment '备货单位',
  1368 + `order_type` varchar(50) comment '订单类型',
  1369 + `show_order` int DEFAULT '0' COMMENT '排序,订货单:0,撤销单:1,规格变更单:2',
  1370 + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID',
  1371 + `create_by` varchar(20) NOT NULL COMMENT '创建人',
  1372 + `update_by_id` varchar(32) NOT NULL COMMENT '更新人ID',
  1373 + `update_by` varchar(20) NOT NULL COMMENT '更新人',
  1374 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1375 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  1376 + PRIMARY KEY (`id`)
  1377 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='订单明细报表'
... ...
  1 +package com.lframework.xingyun.sc.bo.statistics.orderDetail;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import java.math.BigDecimal;
  5 +import com.lframework.starter.common.constants.StringPool;
  6 +import com.lframework.starter.web.core.bo.BaseBo;
  7 +import java.time.LocalDate;
  8 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +
  11 +import lombok.Data;
  12 +
  13 +/**
  14 + * <p>
  15 + * 订单明细 GetBo
  16 + * </p>
  17 + *
  18 + */
  19 +@Data
  20 +public class GetOrderDetailReportBo extends BaseBo<OrderDetailReport> {
  21 +
  22 + /**
  23 + * ID
  24 + */
  25 + @ApiModelProperty("ID")
  26 + private String id;
  27 +
  28 + /**
  29 + * 订货单物料行ID
  30 + */
  31 + @ApiModelProperty("订货单物料行ID")
  32 + private String purchaseOrderLineId;
  33 +
  34 + /**
  35 + * 订单编号
  36 + */
  37 + @ApiModelProperty("订单编号")
  38 + private String orderNo;
  39 +
  40 + /**
  41 + * 订货日期
  42 + */
  43 + @ApiModelProperty("订货日期")
  44 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  45 + private LocalDate orderDate;
  46 +
  47 + /**
  48 + * 生产厂
  49 + */
  50 + @ApiModelProperty("生产厂")
  51 + private String workshopId;
  52 +
  53 + /**
  54 + * 生产厂
  55 + */
  56 + @ApiModelProperty("生产厂")
  57 + private String workshopName;
  58 +
  59 + /**
  60 + * 科办
  61 + */
  62 + @ApiModelProperty("科办")
  63 + private String deptName;
  64 +
  65 + /**
  66 + * 区域
  67 + */
  68 + @ApiModelProperty("区域")
  69 + private String regionName;
  70 +
  71 + /**
  72 + * 订货单位名称
  73 + */
  74 + @ApiModelProperty("订货单位名称")
  75 + private String orderingUnitName;
  76 +
  77 + /**
  78 + * 行业
  79 + */
  80 + @ApiModelProperty("行业")
  81 + private String industry;
  82 +
  83 + /**
  84 + * 牌号
  85 + */
  86 + @ApiModelProperty("牌号")
  87 + private String brand;
  88 +
  89 + /**
  90 + * 厚度
  91 + */
  92 + @ApiModelProperty("厚度")
  93 + private BigDecimal thickness;
  94 +
  95 + /**
  96 + * 厚度公差正
  97 + */
  98 + @ApiModelProperty("厚度公差正")
  99 + private BigDecimal thicknessTolPos;
  100 +
  101 + /**
  102 + * 厚度公差负
  103 + */
  104 + @ApiModelProperty("厚度公差负")
  105 + private BigDecimal thicknessTolNeg;
  106 +
  107 + /**
  108 + * 宽度
  109 + */
  110 + @ApiModelProperty("宽度")
  111 + private BigDecimal width;
  112 +
  113 + /**
  114 + * 宽度公差正
  115 + */
  116 + @ApiModelProperty("宽度公差正")
  117 + private BigDecimal widthTolPos;
  118 +
  119 + /**
  120 + * 宽度公差负
  121 + */
  122 + @ApiModelProperty("宽度公差负")
  123 + private BigDecimal widthTolNeg;
  124 +
  125 + /**
  126 + * 长度
  127 + */
  128 + @ApiModelProperty("长度")
  129 + private BigDecimal length;
  130 +
  131 + /**
  132 + * 长度公差正
  133 + */
  134 + @ApiModelProperty("长度公差正")
  135 + private BigDecimal lengthTolPos;
  136 +
  137 + /**
  138 + * 长度公差负
  139 + */
  140 + @ApiModelProperty("长度公差负")
  141 + private BigDecimal lengthTolNeg;
  142 +
  143 + /**
  144 + * 状态
  145 + */
  146 + @ApiModelProperty("状态")
  147 + private String status;
  148 +
  149 + /**
  150 + * 数量
  151 + */
  152 + @ApiModelProperty("数量")
  153 + private BigDecimal quantity;
  154 +
  155 + /**
  156 + * 指导价
  157 + */
  158 + @ApiModelProperty("指导价")
  159 + private String suggestedPrice;
  160 +
  161 + /**
  162 + * 发货日期
  163 + */
  164 + @ApiModelProperty("发货日期")
  165 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  166 + private LocalDate deliveryDate;
  167 +
  168 + /**
  169 + * 超协价
  170 + */
  171 + @ApiModelProperty("超协价")
  172 + private String assessmentExceedsAgreement;
  173 +
  174 + /**
  175 + * 销售价
  176 + */
  177 + @ApiModelProperty("销售价")
  178 + private String salesPrice;
  179 +
  180 + /**
  181 + * 价格表编号
  182 + */
  183 + @ApiModelProperty("价格表编号")
  184 + private String priceListNo;
  185 +
  186 + /**
  187 + * 包装费
  188 + */
  189 + @ApiModelProperty("包装费")
  190 + private String packagingFee;
  191 +
  192 + /**
  193 + * 开票情况
  194 + */
  195 + @ApiModelProperty("开票情况")
  196 + private String invoicingStatus;
  197 +
  198 + /**
  199 + * 件重条头
  200 + */
  201 + @ApiModelProperty("件重条头")
  202 + private String pieceWeightHeader;
  203 +
  204 + /**
  205 + * 表面
  206 + */
  207 + @ApiModelProperty("表面")
  208 + private String surface;
  209 +
  210 + /**
  211 + * 公差
  212 + */
  213 + @ApiModelProperty("公差")
  214 + private String tolerance;
  215 +
  216 + /**
  217 + * 性能
  218 + */
  219 + @ApiModelProperty("性能")
  220 + private String performance;
  221 +
  222 + /**
  223 + * 包装
  224 + */
  225 + @ApiModelProperty("包装")
  226 + private String packaging;
  227 +
  228 + /**
  229 + * 备注
  230 + */
  231 + @ApiModelProperty("备注")
  232 + private String remarks;
  233 +
  234 + /**
  235 + * 运费
  236 + */
  237 + @ApiModelProperty("运费")
  238 + private String shippingCost;
  239 +
  240 + /**
  241 + * 回程运费
  242 + */
  243 + @ApiModelProperty("回程运费")
  244 + private String returnShippingCost;
  245 +
  246 + /**
  247 + * 客户类型
  248 + */
  249 + @ApiModelProperty("客户类型")
  250 + private String customerType;
  251 +
  252 + /**
  253 + * 标准行业
  254 + */
  255 + @ApiModelProperty("标准行业")
  256 + private String quality;
  257 +
  258 + /**
  259 + * 加工经销
  260 + */
  261 + @ApiModelProperty("加工经销")
  262 + private String contractType;
  263 +
  264 + /**
  265 + * 备货单位
  266 + */
  267 + @ApiModelProperty("备货单位")
  268 + private String stockUpCompanyName;
  269 +
  270 + /**
  271 + * 订单类型
  272 + */
  273 + @ApiModelProperty("订单类型")
  274 + private String orderType;
  275 +
  276 + /**
  277 + * 排序,订货单:0,撤销单:1,规格变更单:2
  278 + */
  279 + @ApiModelProperty("排序,订货单:0,撤销单:1,规格变更单:2")
  280 + private Integer showOrder;
  281 +
  282 + public GetOrderDetailReportBo() {
  283 +
  284 + }
  285 +
  286 + public GetOrderDetailReportBo(OrderDetailReport dto) {
  287 +
  288 + super(dto);
  289 + }
  290 +
  291 + @Override
  292 + public BaseBo<OrderDetailReport> convert(OrderDetailReport dto) {
  293 + return super.convert(dto);
  294 + }
  295 +
  296 + @Override
  297 + protected void afterInit(OrderDetailReport dto) {
  298 +
  299 + }
  300 +}
... ...
  1 +package com.lframework.xingyun.sc.bo.statistics.orderDetail;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import java.math.BigDecimal;
  5 +import com.lframework.starter.common.constants.StringPool;
  6 +import com.lframework.starter.web.core.bo.BaseBo;
  7 +import java.time.LocalDate;
  8 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +
  11 +import lombok.Data;
  12 +
  13 +/**
  14 + * <p>
  15 + * 订单明细 QueryBo
  16 + * </p>
  17 + *
  18 + */
  19 +@Data
  20 +public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
  21 +
  22 + /**
  23 + * ID
  24 + */
  25 + @ApiModelProperty("ID")
  26 + private String id;
  27 +
  28 + /**
  29 + * 订货单物料行ID
  30 + */
  31 + @ApiModelProperty("订货单物料行ID")
  32 + private String purchaseOrderLineId;
  33 +
  34 + /**
  35 + * 订单编号
  36 + */
  37 + @ApiModelProperty("订单编号")
  38 + private String orderNo;
  39 +
  40 + /**
  41 + * 订货日期
  42 + */
  43 + @ApiModelProperty("订货日期")
  44 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  45 + private LocalDate orderDate;
  46 +
  47 + /**
  48 + * 生产厂
  49 + */
  50 + @ApiModelProperty("生产厂")
  51 + private String workshopId;
  52 +
  53 + /**
  54 + * 生产厂
  55 + */
  56 + @ApiModelProperty("生产厂")
  57 + private String workshopName;
  58 +
  59 + /**
  60 + * 科办
  61 + */
  62 + @ApiModelProperty("科办")
  63 + private String deptName;
  64 +
  65 + /**
  66 + * 区域
  67 + */
  68 + @ApiModelProperty("区域")
  69 + private String regionName;
  70 +
  71 + /**
  72 + * 订货单位名称
  73 + */
  74 + @ApiModelProperty("订货单位名称")
  75 + private String orderingUnitName;
  76 +
  77 + /**
  78 + * 行业
  79 + */
  80 + @ApiModelProperty("行业")
  81 + private String industry;
  82 +
  83 + /**
  84 + * 牌号
  85 + */
  86 + @ApiModelProperty("牌号")
  87 + private String brand;
  88 +
  89 + /**
  90 + * 厚度
  91 + */
  92 + @ApiModelProperty("厚度")
  93 + private BigDecimal thickness;
  94 +
  95 + /**
  96 + * 厚度公差正
  97 + */
  98 + @ApiModelProperty("厚度公差正")
  99 + private BigDecimal thicknessTolPos;
  100 +
  101 + /**
  102 + * 厚度公差负
  103 + */
  104 + @ApiModelProperty("厚度公差负")
  105 + private BigDecimal thicknessTolNeg;
  106 +
  107 + /**
  108 + * 宽度
  109 + */
  110 + @ApiModelProperty("宽度")
  111 + private BigDecimal width;
  112 +
  113 + /**
  114 + * 宽度公差正
  115 + */
  116 + @ApiModelProperty("宽度公差正")
  117 + private BigDecimal widthTolPos;
  118 +
  119 + /**
  120 + * 宽度公差负
  121 + */
  122 + @ApiModelProperty("宽度公差负")
  123 + private BigDecimal widthTolNeg;
  124 +
  125 + /**
  126 + * 长度
  127 + */
  128 + @ApiModelProperty("长度")
  129 + private BigDecimal length;
  130 +
  131 + /**
  132 + * 长度公差正
  133 + */
  134 + @ApiModelProperty("长度公差正")
  135 + private BigDecimal lengthTolPos;
  136 +
  137 + /**
  138 + * 长度公差负
  139 + */
  140 + @ApiModelProperty("长度公差负")
  141 + private BigDecimal lengthTolNeg;
  142 +
  143 + /**
  144 + * 状态
  145 + */
  146 + @ApiModelProperty("状态")
  147 + private String status;
  148 +
  149 + /**
  150 + * 数量
  151 + */
  152 + @ApiModelProperty("数量")
  153 + private BigDecimal quantity;
  154 +
  155 + /**
  156 + * 指导价
  157 + */
  158 + @ApiModelProperty("指导价")
  159 + private String suggestedPrice;
  160 +
  161 + /**
  162 + * 发货日期
  163 + */
  164 + @ApiModelProperty("发货日期")
  165 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  166 + private LocalDate deliveryDate;
  167 +
  168 + /**
  169 + * 超协价
  170 + */
  171 + @ApiModelProperty("超协价")
  172 + private String assessmentExceedsAgreement;
  173 +
  174 + /**
  175 + * 销售价
  176 + */
  177 + @ApiModelProperty("销售价")
  178 + private String salesPrice;
  179 +
  180 + /**
  181 + * 价格表编号
  182 + */
  183 + @ApiModelProperty("价格表编号")
  184 + private String priceListNo;
  185 +
  186 + /**
  187 + * 包装费
  188 + */
  189 + @ApiModelProperty("包装费")
  190 + private String packagingFee;
  191 +
  192 + /**
  193 + * 开票情况
  194 + */
  195 + @ApiModelProperty("开票情况")
  196 + private String invoicingStatus;
  197 +
  198 + /**
  199 + * 件重条头
  200 + */
  201 + @ApiModelProperty("件重条头")
  202 + private String pieceWeightHeader;
  203 +
  204 + /**
  205 + * 表面
  206 + */
  207 + @ApiModelProperty("表面")
  208 + private String surface;
  209 +
  210 + /**
  211 + * 公差
  212 + */
  213 + @ApiModelProperty("公差")
  214 + private String tolerance;
  215 +
  216 + /**
  217 + * 性能
  218 + */
  219 + @ApiModelProperty("性能")
  220 + private String performance;
  221 +
  222 + /**
  223 + * 包装
  224 + */
  225 + @ApiModelProperty("包装")
  226 + private String packaging;
  227 +
  228 + /**
  229 + * 备注
  230 + */
  231 + @ApiModelProperty("备注")
  232 + private String remarks;
  233 +
  234 + /**
  235 + * 运费
  236 + */
  237 + @ApiModelProperty("运费")
  238 + private String shippingCost;
  239 +
  240 + /**
  241 + * 回程运费
  242 + */
  243 + @ApiModelProperty("回程运费")
  244 + private String returnShippingCost;
  245 +
  246 + /**
  247 + * 客户类型
  248 + */
  249 + @ApiModelProperty("客户类型")
  250 + private String customerType;
  251 +
  252 + /**
  253 + * 标准行业
  254 + */
  255 + @ApiModelProperty("标准行业")
  256 + private String quality;
  257 +
  258 + /**
  259 + * 加工经销
  260 + */
  261 + @ApiModelProperty("加工经销")
  262 + private String contractType;
  263 +
  264 + /**
  265 + * 备货单位
  266 + */
  267 + @ApiModelProperty("备货单位")
  268 + private String stockUpCompanyName;
  269 +
  270 + /**
  271 + * 订单类型
  272 + */
  273 + @ApiModelProperty("订单类型")
  274 + private String orderType;
  275 +
  276 + /**
  277 + * 排序,订货单:0,撤销单:1,规格变更单:2
  278 + */
  279 + @ApiModelProperty("排序,订货单:0,撤销单:1,规格变更单:2")
  280 + private Integer showOrder;
  281 +
  282 + public QueryOrderDetailReportBo() {
  283 +
  284 + }
  285 +
  286 + public QueryOrderDetailReportBo(OrderDetailReport dto) {
  287 +
  288 + super(dto);
  289 + }
  290 +
  291 + @Override
  292 + public BaseBo<OrderDetailReport> convert(OrderDetailReport dto) {
  293 + return super.convert(dto);
  294 + }
  295 +
  296 + @Override
  297 + protected void afterInit(OrderDetailReport dto) {
  298 +
  299 + }
  300 +}
... ...
  1 +package com.lframework.xingyun.sc.controller.statistics;
  2 +
  3 +import com.lframework.starter.mq.core.utils.ExportTaskUtil;
  4 +import com.lframework.starter.web.core.annotations.security.HasPermission;
  5 +import com.lframework.starter.web.core.controller.DefaultBaseController;
  6 +import com.lframework.starter.web.core.utils.PageResultUtil;
  7 +import com.lframework.starter.web.core.components.resp.PageResult;
  8 +import com.lframework.starter.web.core.components.resp.InvokeResult;
  9 +import javax.validation.constraints.NotBlank;
  10 +import com.lframework.xingyun.sc.bo.statistics.orderDetail.GetOrderDetailReportBo;
  11 +import com.lframework.xingyun.sc.bo.statistics.orderDetail.QueryOrderDetailReportBo;
  12 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  13 +import com.lframework.xingyun.sc.enums.ExportType;
  14 +import com.lframework.xingyun.sc.excel.statistics.OrderDetailReportExportTaskWorker;
  15 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  16 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
  17 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  18 +import io.swagger.annotations.ApiImplicitParam;
  19 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  20 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  21 +import io.swagger.annotations.ApiOperation;
  22 +import com.lframework.starter.common.utils.CollectionUtil;
  23 +import io.swagger.annotations.Api;
  24 +import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.validation.annotation.Validated;
  26 +import org.springframework.web.bind.annotation.*;
  27 +import javax.validation.Valid;
  28 +import java.util.List;
  29 +import java.util.stream.Collectors;
  30 +
  31 +/**
  32 + * 订单明细 Controller
  33 + *
  34 + */
  35 +@Api(tags = "订单明细")
  36 +@Validated
  37 +@RestController
  38 +@RequestMapping("/orderDetailReport")
  39 +public class OrderDetailReportController extends DefaultBaseController {
  40 +
  41 + @Autowired
  42 + private OrderDetailReportService orderDetailReportService;
  43 +
  44 + /**
  45 + * 查询列表
  46 + */
  47 + @ApiOperation("查询列表")
  48 + @HasPermission({"statistical-report:order-detail:query"})
  49 + @GetMapping("/query")
  50 + public InvokeResult<PageResult<QueryOrderDetailReportBo>> query(@Valid QueryOrderDetailReportVo vo) {
  51 +
  52 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(getPageIndex(vo), getPageSize(vo), vo);
  53 +
  54 + List<OrderDetailReport> datas = pageResult.getDatas();
  55 + List<QueryOrderDetailReportBo> results = null;
  56 +
  57 + if (!CollectionUtil.isEmpty(datas)) {
  58 + results = datas.stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  59 + }
  60 +
  61 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  62 + }
  63 +
  64 + /**
  65 + * 根据ID查询
  66 + */
  67 + @ApiOperation("根据ID查询")
  68 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  69 + @HasPermission({"statistical-report:order-detail:query"})
  70 + @GetMapping
  71 + public InvokeResult<GetOrderDetailReportBo> get(@NotBlank(message = "id不能为空!") String id) {
  72 +
  73 + OrderDetailReport data = orderDetailReportService.findById(id);
  74 + if (data == null) {
  75 + throw new DefaultClientException("订单明细不存在!");
  76 + }
  77 +
  78 + GetOrderDetailReportBo result = new GetOrderDetailReportBo(data);
  79 +
  80 + return InvokeResultBuilder.success(result);
  81 + }
  82 +
  83 + /**
  84 + * 新增
  85 + */
  86 + @ApiOperation("新增")
  87 + @PostMapping
  88 + public InvokeResult<Void> create(@Valid CreateOrderDetailReportVo vo) {
  89 +
  90 + orderDetailReportService.create(vo);
  91 +
  92 + return InvokeResultBuilder.success();
  93 + }
  94 +
  95 + /**
  96 + * 订单明细导出
  97 + */
  98 + @ApiOperation("订单明细导出")
  99 + @HasPermission({"statistical-report:order-detail:export"})
  100 + @GetMapping("/export")
  101 + public InvokeResult<Void> export(@Valid QueryOrderDetailReportVo vo) {
  102 + vo.setExportType(ExportType.ORDER_DETAIL_REPORT.getCode());
  103 + ExportTaskUtil.exportTask("订单明细报表", OrderDetailReportExportTaskWorker.class, vo);
  104 + return InvokeResultBuilder.success();
  105 + }
  106 +
  107 + /**
  108 + * 处理历史数据
  109 + */
  110 + @ApiOperation("处理历史数据")
  111 + @GetMapping("/processHistoricalData")
  112 + public InvokeResult<Void> processHistoricalData() {
  113 +
  114 + orderDetailReportService.processHistoricalData();
  115 +
  116 + return InvokeResultBuilder.success();
  117 + }
  118 +}
... ...
  1 +package com.lframework.xingyun.sc.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +import java.math.BigDecimal;
  5 +import com.lframework.starter.web.core.dto.BaseDto;
  6 +import java.time.LocalDate;
  7 +import java.time.LocalDateTime;
  8 +import com.baomidou.mybatisplus.annotation.FieldFill;
  9 +import com.lframework.starter.web.core.entity.BaseEntity;
  10 +import com.baomidou.mybatisplus.annotation.TableField;
  11 +import lombok.Data;
  12 +
  13 +/**
  14 + * <p>
  15 + * 订单明细
  16 + * </p>
  17 + *
  18 + */
  19 +@Data
  20 +@TableName("order_detail_report")
  21 +public class OrderDetailReport extends BaseEntity implements BaseDto {
  22 +
  23 + private static final long serialVersionUID = 1L;
  24 +
  25 + public static final String CACHE_NAME = "OrderDetailReport";
  26 +
  27 + /**
  28 + * ID
  29 + */
  30 + private String id;
  31 +
  32 + /**
  33 + * 订货单物料行ID
  34 + */
  35 + private String purchaseOrderLineId;
  36 +
  37 + /**
  38 + * 订单编号
  39 + */
  40 + private String orderNo;
  41 +
  42 + /**
  43 + * 订货日期
  44 + */
  45 + private LocalDate orderDate;
  46 +
  47 + /**
  48 + * 生产厂
  49 + */
  50 + private String workshopId;
  51 +
  52 + /**
  53 + * 生产厂
  54 + */
  55 + @TableField(exist = false)
  56 + private String workshopName;
  57 +
  58 + /**
  59 + * 科办
  60 + */
  61 + private String deptName;
  62 +
  63 + /**
  64 + * 区域
  65 + */
  66 + private String regionName;
  67 +
  68 + /**
  69 + * 订货单位名称
  70 + */
  71 + private String orderingUnitName;
  72 +
  73 + /**
  74 + * 行业
  75 + */
  76 + private String industry;
  77 +
  78 + /**
  79 + * 牌号
  80 + */
  81 + private String brand;
  82 +
  83 + /**
  84 + * 厚度
  85 + */
  86 + private BigDecimal thickness;
  87 +
  88 + /**
  89 + * 厚度公差正
  90 + */
  91 + private BigDecimal thicknessTolPos;
  92 +
  93 + /**
  94 + * 厚度公差负
  95 + */
  96 + private BigDecimal thicknessTolNeg;
  97 +
  98 + /**
  99 + * 宽度
  100 + */
  101 + private BigDecimal width;
  102 +
  103 + /**
  104 + * 宽度公差正
  105 + */
  106 + private BigDecimal widthTolPos;
  107 +
  108 + /**
  109 + * 宽度公差负
  110 + */
  111 + private BigDecimal widthTolNeg;
  112 +
  113 + /**
  114 + * 长度
  115 + */
  116 + private BigDecimal length;
  117 +
  118 + /**
  119 + * 长度公差正
  120 + */
  121 + private BigDecimal lengthTolPos;
  122 +
  123 + /**
  124 + * 长度公差负
  125 + */
  126 + private BigDecimal lengthTolNeg;
  127 +
  128 + /**
  129 + * 状态
  130 + */
  131 + private String status;
  132 +
  133 + /**
  134 + * 数量
  135 + */
  136 + private BigDecimal quantity;
  137 +
  138 + /**
  139 + * 指导价
  140 + */
  141 + private String suggestedPrice;
  142 +
  143 + /**
  144 + * 发货日期
  145 + */
  146 + private LocalDate deliveryDate;
  147 +
  148 + /**
  149 + * 超协价
  150 + */
  151 + private String assessmentExceedsAgreement;
  152 +
  153 + /**
  154 + * 销售价
  155 + */
  156 + private String salesPrice;
  157 +
  158 + /**
  159 + * 价格表编号
  160 + */
  161 + private String priceListNo;
  162 +
  163 + /**
  164 + * 包装费
  165 + */
  166 + private String packagingFee;
  167 +
  168 + /**
  169 + * 开票情况
  170 + */
  171 + private String invoicingStatus;
  172 +
  173 + /**
  174 + * 件重条头
  175 + */
  176 + private String pieceWeightHeader;
  177 +
  178 + /**
  179 + * 表面
  180 + */
  181 + private String surface;
  182 +
  183 + /**
  184 + * 公差
  185 + */
  186 + private String tolerance;
  187 +
  188 + /**
  189 + * 性能
  190 + */
  191 + private String performance;
  192 +
  193 + /**
  194 + * 包装
  195 + */
  196 + private String packaging;
  197 +
  198 + /**
  199 + * 备注
  200 + */
  201 + private String remarks;
  202 +
  203 + /**
  204 + * 运费
  205 + */
  206 + private String shippingCost;
  207 +
  208 + /**
  209 + * 回程运费
  210 + */
  211 + private String returnShippingCost;
  212 +
  213 + /**
  214 + * 客户类型
  215 + */
  216 + private String customerType;
  217 +
  218 + /**
  219 + * 标准行业
  220 + */
  221 + private String quality;
  222 +
  223 + /**
  224 + * 加工经销
  225 + */
  226 + private String contractType;
  227 +
  228 + /**
  229 + * 备货单位
  230 + */
  231 + private String stockUpCompanyName;
  232 +
  233 + /**
  234 + * 订单类型
  235 + */
  236 + private String orderType;
  237 +
  238 + /**
  239 + * 排序,订货单:0,撤销单:1,规格变更单:2
  240 + */
  241 + private Integer showOrder;
  242 +
  243 + /**
  244 + * 创建人ID
  245 + */
  246 + @TableField(fill = FieldFill.INSERT)
  247 + private String createById;
  248 +
  249 + /**
  250 + * 创建人
  251 + */
  252 + @TableField(fill = FieldFill.INSERT)
  253 + private String createBy;
  254 +
  255 + /**
  256 + * 更新人ID
  257 + */
  258 + @TableField(fill = FieldFill.INSERT_UPDATE)
  259 + private String updateById;
  260 +
  261 + /**
  262 + * 更新人
  263 + */
  264 + @TableField(fill = FieldFill.INSERT_UPDATE)
  265 + private String updateBy;
  266 +
  267 + /**
  268 + * 创建时间
  269 + */
  270 + @TableField(fill = FieldFill.INSERT)
  271 + private LocalDateTime createTime;
  272 +
  273 + /**
  274 + * 更新时间
  275 + */
  276 + @TableField(fill = FieldFill.INSERT_UPDATE)
  277 + private LocalDateTime updateTime;
  278 +
  279 +}
... ...
... ... @@ -11,6 +11,7 @@ public enum ExportType implements BaseEnum<String> {
11 11 CONTRACT_FRAMEWORK("CONTRACT_FRAMEWORK", "合同框架"),
12 12 RECEIVABLE_LEDGER_REPORT("RECEIVABLE_LEDGER_REPORT", "应收款台账报表"),
13 13 SHIPMENT_DETAIL_REPORT("SHIPMENT_DETAIL_REPORT", "发货明细报表"),
  14 + ORDER_DETAIL_REPORT("ORDER_DETAIL_REPORT", "订单明细报表"),
14 15
15 16
16 17 ;
... ...
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.lframework.starter.common.utils.CollectionUtil;
  4 +import com.lframework.starter.mq.core.components.export.ExportTaskWorker;
  5 +import com.lframework.starter.web.core.components.resp.PageResult;
  6 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  7 +import com.lframework.starter.web.core.utils.JsonUtil;
  8 +import com.lframework.starter.web.core.utils.PageResultUtil;
  9 +import com.lframework.xingyun.sc.bo.statistics.orderDetail.QueryOrderDetailReportBo;
  10 +import com.lframework.xingyun.sc.bo.statistics.shipmentDetail.QueryShipmentDetailStatisticsBo;
  11 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  12 +import com.lframework.xingyun.sc.entity.ShipmentDetailStatistics;
  13 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  14 +import com.lframework.xingyun.sc.service.statistics.ShipmentDetailStatisticsService;
  15 +import com.lframework.xingyun.sc.utils.CommonUtil;
  16 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  17 +import com.lframework.xingyun.sc.vo.statistics.shipmentDetail.QueryShipmentDetailStatisticsVo;
  18 +
  19 +import java.util.List;
  20 +import java.util.stream.Collectors;
  21 +
  22 +
  23 +public class OrderDetailReportExportTaskWorker implements
  24 + ExportTaskWorker<QueryOrderDetailReportVo, QueryOrderDetailReportBo, OrderDetailStatisticsModel> {
  25 +
  26 +
  27 + @Override
  28 + public QueryOrderDetailReportVo parseParams(String json) {
  29 + return JsonUtil.parseObject(json, QueryOrderDetailReportVo.class);
  30 + }
  31 +
  32 + @Override
  33 + public PageResult<QueryOrderDetailReportBo> getDataList(int pageIndex, int pageSize, QueryOrderDetailReportVo params) {
  34 + OrderDetailReportService orderDetailReportService = ApplicationUtil.getBean(OrderDetailReportService.class);
  35 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(pageIndex, pageSize, params);
  36 + List<QueryOrderDetailReportBo> results = null;
  37 + if (!CollectionUtil.isEmpty(pageResult.getDatas())) {
  38 + results = pageResult.getDatas().stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  39 + }
  40 + return PageResultUtil.rebuild(pageResult, results);
  41 + }
  42 +
  43 + @Override
  44 + public OrderDetailStatisticsModel exportData(QueryOrderDetailReportBo data) {
  45 + // 公差数据处理
  46 + String thicknessTol = CommonUtil.handleTolData(
  47 + data.getThicknessTolPos() != null ? data.getThicknessTolPos().doubleValue() : null,
  48 + data.getThicknessTolNeg() != null ? data.getThicknessTolNeg().doubleValue() : null);
  49 + String widthTol = CommonUtil.handleTolData(
  50 + data.getWidthTolPos() != null ? data.getWidthTolPos().doubleValue() : null,
  51 + data.getWidthTolNeg() != null ? data.getWidthTolNeg().doubleValue() : null);
  52 + String lengthTol = CommonUtil.handleTolData(
  53 + data.getLengthTolPos() != null ? data.getLengthTolPos().doubleValue() : null,
  54 + data.getLengthTolNeg() != null ? data.getLengthTolNeg().doubleValue() : null);
  55 +
  56 + OrderDetailStatisticsModel model = JsonUtil.parseObject(JsonUtil.toJsonString(data), OrderDetailStatisticsModel.class);
  57 + model.setThicknessTol(thicknessTol);
  58 + model.setWidthTol(widthTol);
  59 + model.setLengthTol(lengthTol);
  60 + return model;
  61 + }
  62 +
  63 + @Override
  64 + public Class<OrderDetailStatisticsModel> getModelClass() {
  65 + return OrderDetailStatisticsModel.class;
  66 + }
  67 +}
... ...
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  5 +import lombok.Data;
  6 +import java.math.BigDecimal;
  7 +
  8 +/**
  9 + * <p>
  10 + * 发货明细Excel Model
  11 + * </p>
  12 + *
  13 + */
  14 +@Data
  15 +public class OrderDetailStatisticsModel implements ExcelModel {
  16 +
  17 + /**
  18 + * 订货金额
  19 + */
  20 + @ExcelProperty("订货金额")
  21 + private String amount;
  22 +
  23 + /**
  24 + * 超协金额
  25 + */
  26 + @ExcelProperty("超协金额")
  27 + private String superCoordinationAmount;
  28 +
  29 + /**
  30 + * 折65金额
  31 + */
  32 + @ExcelProperty("折65金额")
  33 + private String discountAmount;
  34 +
  35 + /**
  36 + * 订货日期
  37 + */
  38 + @ExcelProperty("订货日期")
  39 + private String orderDate1;
  40 +
  41 + /**
  42 + * 订单编号
  43 + */
  44 + @ExcelProperty("订单编号")
  45 + private String orderNo;
  46 +
  47 + /**
  48 + * 包装金额
  49 + */
  50 + @ExcelProperty("包装金额")
  51 + private String packagingAmount;
  52 +
  53 + /**
  54 + * 当日电铜
  55 + */
  56 + @ExcelProperty("当日电铜")
  57 + private String sameDayCopper;
  58 +
  59 + /**
  60 + * 订货日期
  61 + */
  62 + @ExcelProperty("订货日期")
  63 + private String orderDate;
  64 +
  65 + /**
  66 + * 生产厂
  67 + */
  68 + @ExcelProperty("生产厂")
  69 + private String workshopName;
  70 +
  71 + /**
  72 + * 科办
  73 + */
  74 + @ExcelProperty("科办")
  75 + private String deptName;
  76 +
  77 + /**
  78 + * 片
  79 + */
  80 + @ExcelProperty("片")
  81 + private String regionName;
  82 +
  83 + /**
  84 + * 订货单位名称
  85 + */
  86 + @ExcelProperty("订货单位名称")
  87 + private String orderingUnitName;
  88 +
  89 + /**
  90 + * 行业(用途)
  91 + */
  92 + @ExcelProperty("行业(用途)")
  93 + private String industry;
  94 +
  95 + /**
  96 + * 高新标识
  97 + */
  98 + @ExcelProperty("高新标识")
  99 + private String highTechLogo;
  100 +
  101 + /**
  102 + * 牌号
  103 + */
  104 + @ExcelProperty("牌号")
  105 + private String brand;
  106 +
  107 + /**
  108 + * 厚
  109 + */
  110 + @ExcelProperty("厚")
  111 + private BigDecimal thickness;
  112 +
  113 + /**
  114 + * 厚差
  115 + */
  116 + @ExcelProperty("厚差")
  117 + private String thicknessTol;
  118 +
  119 + /**
  120 + * 宽
  121 + */
  122 + @ExcelProperty("宽")
  123 + private BigDecimal width;
  124 +
  125 + /**
  126 + * 宽差
  127 + */
  128 + @ExcelProperty("宽差")
  129 + private String widthTol;
  130 +
  131 + /**
  132 + * 长
  133 + */
  134 + @ExcelProperty("长")
  135 + private BigDecimal length;
  136 +
  137 + /**
  138 + * 长差
  139 + */
  140 + @ExcelProperty("长差")
  141 + private String lengthTol;
  142 +
  143 + /**
  144 + * 状态
  145 + */
  146 + @ExcelProperty("状态")
  147 + private String status;
  148 +
  149 + /**
  150 + * 数量
  151 + */
  152 + @ExcelProperty("数量")
  153 + private BigDecimal quantity;
  154 +
  155 + /**
  156 + * 指导价
  157 + */
  158 + @ExcelProperty("指导价")
  159 + private String suggestedPrice;
  160 +
  161 + /**
  162 + * 发货日期
  163 + */
  164 + @ExcelProperty("发货日期")
  165 + private String deliveryDate;
  166 +
  167 + /**
  168 + * 超协价
  169 + */
  170 + @ExcelProperty("超协价")
  171 + private String assessmentExceedsAgreement;
  172 +
  173 + /**
  174 + * 当日南海H65
  175 + */
  176 + @ExcelProperty("当日南海H65")
  177 + private String H65;
  178 +
  179 + /**
  180 + * 销售价
  181 + */
  182 + @ExcelProperty("销售价")
  183 + private String salesPrice;
  184 +
  185 + /**
  186 + * 价格表编号
  187 + */
  188 + @ExcelProperty("价格表编号")
  189 + private String priceListNo;
  190 +
  191 + /**
  192 + * 包装费
  193 + */
  194 + @ExcelProperty("包装费")
  195 + private String packagingFee;
  196 +
  197 + /**
  198 + * 开票情况
  199 + */
  200 + @ExcelProperty("开票情况")
  201 + private String invoicingStatus;
  202 +
  203 + /**
  204 + * 件重条头
  205 + */
  206 + @ExcelProperty("件重条头")
  207 + private String pieceWeightHeader;
  208 +
  209 + /**
  210 + * 表面
  211 + */
  212 + @ExcelProperty("表面")
  213 + private String surface;
  214 +
  215 + /**
  216 + * 公差
  217 + */
  218 + @ExcelProperty("公差")
  219 + private String tolerance;
  220 +
  221 + /**
  222 + * 性能
  223 + */
  224 + @ExcelProperty("性能")
  225 + private String performance;
  226 +
  227 + /**
  228 + * 包装
  229 + */
  230 + @ExcelProperty("包装")
  231 + private String packaging;
  232 +
  233 + /**
  234 + * 特别注重要求
  235 + */
  236 + @ExcelProperty("特别注重要求")
  237 + private String specialRequirements;
  238 +
  239 + /**
  240 + * 备注
  241 + */
  242 + @ExcelProperty("备注")
  243 + private String remarks;
  244 +
  245 + /**
  246 + * 当日锌锭
  247 + */
  248 + @ExcelProperty("当日锌锭")
  249 + private String zincDay;
  250 +
  251 + /**
  252 + * 运费
  253 + */
  254 + @ExcelProperty("运费")
  255 + private String shippingCost;
  256 +
  257 + /**
  258 + * 回程运费
  259 + */
  260 + @ExcelProperty("回程运费")
  261 + private String returnShippingCost;
  262 +
  263 + /**
  264 + * 客户类型
  265 + */
  266 + @ExcelProperty("客户类型")
  267 + private String customerType;
  268 +
  269 + /**
  270 + * 标准行业
  271 + */
  272 + @ExcelProperty("标准行业")
  273 + private String quality;
  274 +
  275 + /**
  276 + * 加工经销
  277 + */
  278 + @ExcelProperty("加工经销")
  279 + private String contractType;
  280 +
  281 + /**
  282 + * 备货单位/人(生产标准)
  283 + */
  284 + @ExcelProperty("备货单位/人(生产标准)")
  285 + private String stockUpCompanyName;
  286 +
  287 + /**
  288 + * 订单类型
  289 + */
  290 + @ExcelProperty("订单类型")
  291 + private String orderType;
  292 +
  293 +}
... ...
... ... @@ -15,29 +15,29 @@ import com.lframework.starter.web.core.components.resp.PageResult;
15 15 import com.lframework.starter.web.core.utils.OpLogUtil;
16 16 import com.lframework.starter.common.utils.StringUtil;
17 17 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
18   -
19 18 import java.io.Serializable;
20   -
21 19 import com.lframework.starter.web.core.utils.IdUtil;
22 20 import com.lframework.starter.common.utils.ObjectUtil;
23 21 import com.lframework.starter.web.core.annotations.oplog.OpLog;
24 22 import com.lframework.starter.web.core.utils.PageHelperUtil;
25 23 import com.lframework.starter.common.utils.Assert;
26 24 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  25 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  26 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
27 27 import com.lframework.xingyun.basedata.entity.Workshop;
28 28 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
29   -import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
30   -import com.lframework.xingyun.sc.entity.CustomerCredit;
31   -import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
32   -import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
  29 +import com.lframework.xingyun.sc.entity.*;
33 30 import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;
34 31 import com.lframework.xingyun.sc.mappers.PurchaseOrderInfoMapper;
35 32 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  33 +import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
36 34 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
37 35 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
38 36 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
  37 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
39 38 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
40 39 import com.lframework.xingyun.sc.vo.order.*;
  40 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
41 41 import org.apache.commons.collections.CollectionUtils;
42 42 import org.apache.commons.lang3.StringUtils;
43 43 import org.springframework.transaction.annotation.Transactional;
... ... @@ -66,6 +66,12 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
66 66 private WorkshopService workshopService;
67 67 @Resource
68 68 private ContractDistributorStandardService contractDistributorStandardService;
  69 + @Resource
  70 + private SysDataDicItemService sysDataDicItemService;
  71 + @Resource
  72 + private ContractStdProcessingLineService contractStdProcessingLineService;
  73 + @Resource
  74 + private OrderDetailReportService orderDetailReportService;
69 75
70 76 @Override
71 77 public PageResult<PurchaseOrderInfo> query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
... ... @@ -267,10 +273,120 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
267 273 if (!vo.isNoFlowInstance()) {
268 274 flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
269 275 }
  276 + //生成订单明细报表
  277 + createOrderDetailReport(data.getId());
270 278
271 279 return data.getId();
272 280 }
273 281
  282 + private void createOrderDetailReport(String businessId) {
  283 + PurchaseOrderInfo purchaseOrderInfo = this.findById(businessId);
  284 + ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId());
  285 + CustomerCredit customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId());
  286 + QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo();
  287 + vo1.setPurchaseOrderId(purchaseOrderInfo.getId());
  288 + List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1);
  289 + if (CollectionUtils.isNotEmpty(lineVoList)) {
  290 + for (PurchaseOrderLine line : lineVoList) {
  291 + CreateOrderDetailReportVo vo = new CreateOrderDetailReportVo();
  292 + vo.setPurchaseOrderLineId(line.getId());
  293 + vo.setOrderNo(purchaseOrderInfo.getOrderNo());
  294 + vo.setOrderDate(purchaseOrderInfo.getOrderDate());
  295 + vo.setWorkshopId(purchaseOrderInfo.getWorkshopId());
  296 + vo.setDeptName(purchaseOrderInfo.getDeptName());
  297 + vo.setRegionName(purchaseOrderInfo.getRegionName());
  298 + vo.setOrderingUnitName(purchaseOrderInfo.getOrderingUnitName());
  299 + vo.setIndustry(line.getIndustry());
  300 + vo.setBrand(line.getBrand());
  301 + vo.setThickness(line.getThickness());
  302 + vo.setThicknessTolPos(line.getThicknessTolPos());
  303 + vo.setThicknessTolNeg(line.getThicknessTolNeg());
  304 + vo.setWidth(line.getWidth());
  305 + vo.setWidthTolPos(line.getWidthTolPos());
  306 + vo.setWidthTolNeg(line.getWidthTolNeg());
  307 + vo.setLength(line.getLength());
  308 + vo.setLengthTolPos(line.getLengthTolPos());
  309 + vo.setLengthTolNeg(line.getLengthTolNeg());
  310 + vo.setStatus(line.getStatus());
  311 + vo.setQuantity(line.getQuantity());
  312 + String assessmentExceedsAgreement;
  313 + BigDecimal salesPrice = line.getSalesPrice();
  314 + if (line.getSalesPrice() != null && StringUtils.isNotEmpty(line.getAssessmentExceedsAgreement())) {
  315 + assessmentExceedsAgreement = line.getAssessmentExceedsAgreement().trim();
  316 + try {
  317 + BigDecimal exceedsAgreement = new BigDecimal(assessmentExceedsAgreement);
  318 + BigDecimal divisor = new BigDecimal("1000");
  319 + BigDecimal adjustment = exceedsAgreement.divide(divisor, 4, RoundingMode.HALF_UP); // 保留4位小数
  320 + BigDecimal subtract = salesPrice.subtract(adjustment);
  321 + vo.setSuggestedPrice(subtract.toPlainString());
  322 + } catch (NumberFormatException e) {
  323 + // 日志记录或按业务处理:超协价格式无效,忽略计算
  324 + log.error("超协价格式错误,使用原始销售价。value=" + assessmentExceedsAgreement);
  325 + }
  326 + }
  327 + vo.setDeliveryDate(line.getDeliveryDate());
  328 + vo.setAssessmentExceedsAgreement(line.getAssessmentExceedsAgreement());
  329 + vo.setSalesPrice(line.getSalesPrice().toPlainString());
  330 + vo.setPriceListNo(purchaseOrderInfo.getPriceListNo());
  331 + vo.setPackagingFee(line.getPackagingFee().toPlainString());
  332 + vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus());
  333 + vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader());
  334 + vo.setSurface(purchaseOrderInfo.getSurface());
  335 + vo.setTolerance(purchaseOrderInfo.getTolerance());
  336 + vo.setPerformance(purchaseOrderInfo.getPerformance());
  337 + vo.setPackaging(purchaseOrderInfo.getPackaging());
  338 + vo.setRemarks(purchaseOrderInfo.getRemarks());
  339 + //加工合同就是回程运费
  340 + String type = standard.getType();
  341 + if ("PROCESS_STD_AGMT".equals(type)) {
  342 + vo.setReturnShippingCost(purchaseOrderInfo.getShippingCost());
  343 + } else {
  344 + vo.setShippingCost(purchaseOrderInfo.getShippingCost());
  345 + }
  346 + if (customerCredit != null) {
  347 + SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", customerCredit.getEnterpriseType());
  348 + if (dataDicItem != null) {
  349 + vo.setCustomerType(dataDicItem.getName());
  350 + }
  351 + }
  352 + vo.setQuality(line.getQuality());
  353 + String contractType = handleContractType(type);
  354 + vo.setContractType(contractType);
  355 + if ("加工".equals(contractType)) {
  356 + String contractDistributorLineId = line.getContractDistributorLineId();
  357 + ContractStdProcessingLine processingLine = contractStdProcessingLineService.findById(contractDistributorLineId);
  358 +
  359 + if (processingLine != null) {
  360 + String materialProductRatio = processingLine.getMaterialProductRatio();
  361 + SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("RAW_TO_PROD_RATIO", materialProductRatio);
  362 +
  363 + if (dataDicItem != null) {
  364 + vo.setContractType(dataDicItem.getName() + contractType);
  365 + }
  366 + }
  367 + }
  368 + vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName());
  369 +// vo.setOrderType();
  370 + vo.setShowOrder(0);
  371 + orderDetailReportService.create(vo);
  372 + }
  373 + }
  374 + }
  375 +
  376 + private String handleContractType(String contractType) {
  377 + String result = "";
  378 + if ("DISTRIB_STD".equals(contractType) || "DIST_STOCK_CONTRACT".equals(contractType)
  379 + || "DRAFT_DIST_AGMT".equals(contractType)) {
  380 + result = "经销";
  381 + } else if ("INTL_STD_CONTRACT".equals(contractType) || "INTL_INVENTORY_AGMT".equals(contractType)
  382 + || "INTL_OPEN_SPEC_AGMT".equals(contractType)) {
  383 + result = "外贸";
  384 + } else if ("PROCESS_STD_AGMT".equals(contractType)) {
  385 + result = "加工";
  386 + }
  387 + return result;
  388 + }
  389 +
274 390 @OpLog(type = OtherOpLogType.class, name = "修改订货单表,ID:{}", params = {"#id"})
275 391 @Transactional(rollbackFor = Exception.class)
276 392 @Override
... ...
  1 +package com.lframework.xingyun.sc.impl.statistics;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  5 +import com.lframework.starter.web.core.utils.PageResultUtil;
  6 +import com.lframework.starter.web.core.components.resp.PageResult;
  7 +import com.lframework.starter.web.core.utils.OpLogUtil;
  8 +import com.lframework.starter.common.utils.StringUtil;
  9 +import java.io.Serializable;
  10 +import com.lframework.starter.web.core.utils.IdUtil;
  11 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  12 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  13 +import com.lframework.starter.common.utils.Assert;
  14 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  15 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  16 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
  17 +import com.lframework.xingyun.sc.entity.*;
  18 +import com.lframework.xingyun.sc.mappers.OrderDetailReportMapper;
  19 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  20 +import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
  21 +import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
  22 +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
  23 +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
  24 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  25 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
  26 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
  27 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
  28 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  29 +import org.apache.commons.collections.CollectionUtils;
  30 +import org.apache.commons.lang3.StringUtils;
  31 +import org.springframework.stereotype.Service;
  32 +import org.springframework.transaction.annotation.Transactional;
  33 +
  34 +import javax.annotation.Resource;
  35 +import java.math.BigDecimal;
  36 +import java.math.RoundingMode;
  37 +import java.util.List;
  38 +
  39 +@Service
  40 +public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailReportMapper, OrderDetailReport> implements OrderDetailReportService {
  41 + @Resource
  42 + private PurchaseOrderInfoService purchaseOrderInfoService;
  43 + @Resource
  44 + private ContractDistributorStandardService contractDistributorStandardService;
  45 + @Resource
  46 + private CustomerCreditService customerCreditService;
  47 + @Resource
  48 + private PurchaseOrderLineService purchaseOrderLineService;
  49 + @Resource
  50 + private SysDataDicItemService sysDataDicItemService;
  51 + @Resource
  52 + private ContractStdProcessingLineService contractStdProcessingLineService;
  53 + @Resource
  54 + private OrderDetailReportService orderDetailReportService;
  55 +
  56 + @Override
  57 + public PageResult<OrderDetailReport> query(Integer pageIndex, Integer pageSize, QueryOrderDetailReportVo vo) {
  58 +
  59 + Assert.greaterThanZero(pageIndex);
  60 + Assert.greaterThanZero(pageSize);
  61 +
  62 + PageHelperUtil.startPage(pageIndex, pageSize);
  63 + List<OrderDetailReport> datas = this.query(vo);
  64 +
  65 + return PageResultUtil.convert(new PageInfo<>(datas));
  66 + }
  67 +
  68 + @Override
  69 + public List<OrderDetailReport> query(QueryOrderDetailReportVo vo) {
  70 +
  71 + return getBaseMapper().query(vo);
  72 + }
  73 +
  74 + @Override
  75 + public OrderDetailReport findById(String id) {
  76 +
  77 + return getBaseMapper().selectById(id);
  78 + }
  79 +
  80 + @OpLog(type = OtherOpLogType.class, name = "新增订单明细,ID:{}", params = {"#id"})
  81 + @Transactional(rollbackFor = Exception.class)
  82 + @Override
  83 + public String create(CreateOrderDetailReportVo vo) {
  84 +
  85 + OrderDetailReport data = new OrderDetailReport();
  86 + data.setId(IdUtil.getId());
  87 + if (!StringUtil.isBlank(vo.getPurchaseOrderLineId())) {
  88 + data.setPurchaseOrderLineId(vo.getPurchaseOrderLineId());
  89 + }
  90 + if (!StringUtil.isBlank(vo.getOrderNo())) {
  91 + data.setOrderNo(vo.getOrderNo());
  92 + }
  93 + if (vo.getOrderDate() != null) {
  94 + data.setOrderDate(vo.getOrderDate());
  95 + }
  96 + if (!StringUtil.isBlank(vo.getWorkshopId())) {
  97 + data.setWorkshopId(vo.getWorkshopId());
  98 + }
  99 + if (!StringUtil.isBlank(vo.getDeptName())) {
  100 + data.setDeptName(vo.getDeptName());
  101 + }
  102 + if (!StringUtil.isBlank(vo.getRegionName())) {
  103 + data.setRegionName(vo.getRegionName());
  104 + }
  105 + if (!StringUtil.isBlank(vo.getOrderingUnitName())) {
  106 + data.setOrderingUnitName(vo.getOrderingUnitName());
  107 + }
  108 + if (!StringUtil.isBlank(vo.getIndustry())) {
  109 + data.setIndustry(vo.getIndustry());
  110 + }
  111 + if (!StringUtil.isBlank(vo.getBrand())) {
  112 + data.setBrand(vo.getBrand());
  113 + }
  114 + if (vo.getThickness() != null) {
  115 + data.setThickness(vo.getThickness());
  116 + }
  117 + if (vo.getThicknessTolPos() != null) {
  118 + data.setThicknessTolPos(vo.getThicknessTolPos());
  119 + }
  120 + if (vo.getThicknessTolNeg() != null) {
  121 + data.setThicknessTolNeg(vo.getThicknessTolNeg());
  122 + }
  123 + if (vo.getWidth() != null) {
  124 + data.setWidth(vo.getWidth());
  125 + }
  126 + if (vo.getWidthTolPos() != null) {
  127 + data.setWidthTolPos(vo.getWidthTolPos());
  128 + }
  129 + if (vo.getWidthTolNeg() != null) {
  130 + data.setWidthTolNeg(vo.getWidthTolNeg());
  131 + }
  132 + if (vo.getLength() != null) {
  133 + data.setLength(vo.getLength());
  134 + }
  135 + if (vo.getLengthTolPos() != null) {
  136 + data.setLengthTolPos(vo.getLengthTolPos());
  137 + }
  138 + if (vo.getLengthTolNeg() != null) {
  139 + data.setLengthTolNeg(vo.getLengthTolNeg());
  140 + }
  141 + if (!StringUtil.isBlank(vo.getStatus())) {
  142 + data.setStatus(vo.getStatus());
  143 + }
  144 + if (vo.getQuantity() != null) {
  145 + data.setQuantity(vo.getQuantity());
  146 + }
  147 + if (!StringUtil.isBlank(vo.getSuggestedPrice())) {
  148 + data.setSuggestedPrice(vo.getSuggestedPrice());
  149 + }
  150 + if (vo.getDeliveryDate() != null) {
  151 + data.setDeliveryDate(vo.getDeliveryDate());
  152 + }
  153 + if (!StringUtil.isBlank(vo.getAssessmentExceedsAgreement())) {
  154 + data.setAssessmentExceedsAgreement(vo.getAssessmentExceedsAgreement());
  155 + }
  156 + if (!StringUtil.isBlank(vo.getSalesPrice())) {
  157 + data.setSalesPrice(vo.getSalesPrice());
  158 + }
  159 + if (!StringUtil.isBlank(vo.getPriceListNo())) {
  160 + data.setPriceListNo(vo.getPriceListNo());
  161 + }
  162 + if (!StringUtil.isBlank(vo.getPackagingFee())) {
  163 + data.setPackagingFee(vo.getPackagingFee());
  164 + }
  165 + if (!StringUtil.isBlank(vo.getInvoicingStatus())) {
  166 + data.setInvoicingStatus(vo.getInvoicingStatus());
  167 + }
  168 + if (!StringUtil.isBlank(vo.getPieceWeightHeader())) {
  169 + data.setPieceWeightHeader(vo.getPieceWeightHeader());
  170 + }
  171 + if (!StringUtil.isBlank(vo.getSurface())) {
  172 + data.setSurface(vo.getSurface());
  173 + }
  174 + if (!StringUtil.isBlank(vo.getTolerance())) {
  175 + data.setTolerance(vo.getTolerance());
  176 + }
  177 + if (!StringUtil.isBlank(vo.getPerformance())) {
  178 + data.setPerformance(vo.getPerformance());
  179 + }
  180 + if (!StringUtil.isBlank(vo.getPackaging())) {
  181 + data.setPackaging(vo.getPackaging());
  182 + }
  183 + if (!StringUtil.isBlank(vo.getRemarks())) {
  184 + data.setRemarks(vo.getRemarks());
  185 + }
  186 + if (!StringUtil.isBlank(vo.getShippingCost())) {
  187 + data.setShippingCost(vo.getShippingCost());
  188 + }
  189 + if (!StringUtil.isBlank(vo.getReturnShippingCost())) {
  190 + data.setReturnShippingCost(vo.getReturnShippingCost());
  191 + }
  192 + if (!StringUtil.isBlank(vo.getCustomerType())) {
  193 + data.setCustomerType(vo.getCustomerType());
  194 + }
  195 + if (!StringUtil.isBlank(vo.getQuality())) {
  196 + data.setQuality(vo.getQuality());
  197 + }
  198 + if (!StringUtil.isBlank(vo.getContractType())) {
  199 + data.setContractType(vo.getContractType());
  200 + }
  201 + if (!StringUtil.isBlank(vo.getStockUpCompanyName())) {
  202 + data.setStockUpCompanyName(vo.getStockUpCompanyName());
  203 + }
  204 + if (!StringUtil.isBlank(vo.getOrderType())) {
  205 + data.setOrderType(vo.getOrderType());
  206 + }
  207 + if (vo.getShowOrder() != null) {
  208 + data.setShowOrder(vo.getShowOrder());
  209 + }
  210 +
  211 + getBaseMapper().insert(data);
  212 +
  213 + OpLogUtil.setVariable("id", data.getId());
  214 + OpLogUtil.setExtra(vo);
  215 +
  216 + return data.getId();
  217 + }
  218 +
  219 + @Override
  220 + public void processHistoricalData() {
  221 + QueryPurchaseOrderInfoVo vo2 = new QueryPurchaseOrderInfoVo();
  222 + List<PurchaseOrderInfo> query = purchaseOrderInfoService.query(vo2);
  223 + if (CollectionUtils.isNotEmpty(query)) {
  224 + for (PurchaseOrderInfo purchaseOrderInfo : query) {
  225 + ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId());
  226 + CustomerCredit customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId());
  227 + QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo();
  228 + vo1.setPurchaseOrderId(purchaseOrderInfo.getId());
  229 + List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1);
  230 + if (CollectionUtils.isNotEmpty(lineVoList)) {
  231 + for (PurchaseOrderLine line : lineVoList) {
  232 + CreateOrderDetailReportVo vo = new CreateOrderDetailReportVo();
  233 + vo.setPurchaseOrderLineId(line.getId());
  234 + vo.setOrderNo(purchaseOrderInfo.getOrderNo());
  235 + vo.setOrderDate(purchaseOrderInfo.getOrderDate());
  236 + vo.setWorkshopId(purchaseOrderInfo.getWorkshopId());
  237 + vo.setDeptName(purchaseOrderInfo.getDeptName());
  238 + vo.setRegionName(purchaseOrderInfo.getRegionName());
  239 + vo.setOrderingUnitName(purchaseOrderInfo.getOrderingUnitName());
  240 + vo.setIndustry(line.getIndustry());
  241 + vo.setBrand(line.getBrand());
  242 + vo.setThickness(line.getThickness());
  243 + vo.setThicknessTolPos(line.getThicknessTolPos());
  244 + vo.setThicknessTolNeg(line.getThicknessTolNeg());
  245 + vo.setWidth(line.getWidth());
  246 + vo.setWidthTolPos(line.getWidthTolPos());
  247 + vo.setWidthTolNeg(line.getWidthTolNeg());
  248 + vo.setLength(line.getLength());
  249 + vo.setLengthTolPos(line.getLengthTolPos());
  250 + vo.setLengthTolNeg(line.getLengthTolNeg());
  251 + vo.setStatus(line.getStatus());
  252 + vo.setQuantity(line.getQuantity());
  253 + String assessmentExceedsAgreement;
  254 + BigDecimal salesPrice = line.getSalesPrice();
  255 + if (line.getSalesPrice() != null && StringUtils.isNotEmpty(line.getAssessmentExceedsAgreement())) {
  256 + assessmentExceedsAgreement = line.getAssessmentExceedsAgreement().trim();
  257 + try {
  258 + BigDecimal exceedsAgreement = new BigDecimal(assessmentExceedsAgreement);
  259 + BigDecimal divisor = new BigDecimal("1000");
  260 + BigDecimal adjustment = exceedsAgreement.divide(divisor, 4, RoundingMode.HALF_UP); // 保留4位小数
  261 + BigDecimal subtract = salesPrice.subtract(adjustment);
  262 + vo.setSuggestedPrice(subtract.toPlainString());
  263 + } catch (NumberFormatException e) {
  264 + // 日志记录或按业务处理:超协价格式无效,忽略计算
  265 + log.error("assessmentExceedsAgreement====>" + assessmentExceedsAgreement);
  266 + }
  267 + }
  268 + vo.setDeliveryDate(line.getDeliveryDate());
  269 + vo.setAssessmentExceedsAgreement(line.getAssessmentExceedsAgreement());
  270 + vo.setSalesPrice(line.getSalesPrice().toPlainString());
  271 + vo.setPriceListNo(purchaseOrderInfo.getPriceListNo());
  272 + vo.setPackagingFee(line.getPackagingFee().toPlainString());
  273 + vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus());
  274 + vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader());
  275 + vo.setSurface(purchaseOrderInfo.getSurface());
  276 + vo.setTolerance(purchaseOrderInfo.getTolerance());
  277 + vo.setPerformance(purchaseOrderInfo.getPerformance());
  278 + vo.setPackaging(purchaseOrderInfo.getPackaging());
  279 + vo.setRemarks(purchaseOrderInfo.getRemarks());
  280 + //加工合同就是回程运费
  281 + String type = standard.getType();
  282 + if ("PROCESS_STD_AGMT".equals(type)) {
  283 + vo.setReturnShippingCost(purchaseOrderInfo.getShippingCost());
  284 + } else {
  285 + vo.setShippingCost(purchaseOrderInfo.getShippingCost());
  286 + }
  287 + if (customerCredit != null) {
  288 + SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", customerCredit.getEnterpriseType());
  289 + if (dataDicItem != null) {
  290 + vo.setCustomerType(dataDicItem.getName());
  291 + }
  292 + }
  293 + vo.setQuality(line.getQuality());
  294 + String contractType = handleContractType(type);
  295 + vo.setContractType(contractType);
  296 + if ("加工".equals(contractType)) {
  297 + String contractDistributorLineId = line.getContractDistributorLineId();
  298 + ContractStdProcessingLine processingLine = contractStdProcessingLineService.findById(contractDistributorLineId);
  299 +
  300 + if (processingLine != null) {
  301 + String materialProductRatio = processingLine.getMaterialProductRatio();
  302 + SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("RAW_TO_PROD_RATIO", materialProductRatio);
  303 +
  304 + if (dataDicItem != null) {
  305 + vo.setContractType(dataDicItem.getName() + contractType);
  306 + }
  307 + }
  308 + }
  309 + vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName());
  310 + //vo.setOrderType();
  311 + vo.setShowOrder(0);
  312 + orderDetailReportService.create(vo);
  313 + }
  314 + }
  315 + }
  316 + }
  317 + }
  318 +
  319 + private String handleContractType(String contractType) {
  320 + String result = "";
  321 + if ("DISTRIB_STD".equals(contractType) || "DIST_STOCK_CONTRACT".equals(contractType)
  322 + || "DRAFT_DIST_AGMT".equals(contractType)) {
  323 + result = "经销";
  324 + } else if ("INTL_STD_CONTRACT".equals(contractType) || "INTL_INVENTORY_AGMT".equals(contractType)
  325 + || "INTL_OPEN_SPEC_AGMT".equals(contractType)) {
  326 + result = "外贸";
  327 + } else if ("PROCESS_STD_AGMT".equals(contractType)) {
  328 + result = "加工";
  329 + }
  330 + return result;
  331 + }
  332 +
  333 + @Override
  334 + public void cleanCacheByKey(Serializable key) {
  335 +
  336 + }
  337 +}
... ...
  1 +package com.lframework.xingyun.sc.mappers;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  5 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * <p>
  12 + * 订单明细 Mapper 接口
  13 + * </p>
  14 + *
  15 + */
  16 +public interface OrderDetailReportMapper extends BaseMapper<OrderDetailReport> {
  17 +
  18 + /**
  19 + * 查询列表
  20 + * @param vo
  21 + * @return
  22 + */
  23 + List<OrderDetailReport> query(@Param("vo") QueryOrderDetailReportVo vo);
  24 +}
... ...
  1 +package com.lframework.xingyun.sc.service.statistics;
  2 +
  3 +import com.lframework.starter.web.core.service.BaseMpService;
  4 +import com.lframework.starter.web.core.components.resp.PageResult;
  5 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  6 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
  7 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 订单明细 Service
  12 + */
  13 +public interface OrderDetailReportService extends BaseMpService<OrderDetailReport> {
  14 +
  15 + /**
  16 + * 查询列表
  17 + * @return
  18 + */
  19 + PageResult<OrderDetailReport> query(Integer pageIndex, Integer pageSize, QueryOrderDetailReportVo vo);
  20 +
  21 + /**
  22 + * 查询列表
  23 + * @param vo
  24 + * @return
  25 + */
  26 + List<OrderDetailReport> query(QueryOrderDetailReportVo vo);
  27 +
  28 + /**
  29 + * 根据ID查询
  30 + * @param id
  31 + * @return
  32 + */
  33 + OrderDetailReport findById(String id);
  34 +
  35 + /**
  36 + * 创建
  37 + * @param vo
  38 + * @return
  39 + */
  40 + String create(CreateOrderDetailReportVo vo);
  41 +
  42 + /**
  43 + * 处理历史数据
  44 + */
  45 + void processHistoricalData();
  46 +
  47 +
  48 +}
... ...
  1 +package com.lframework.xingyun.sc.vo.statistics.orderDetail;
  2 +
  3 +import com.lframework.starter.web.core.components.validation.IsNumberPrecision;
  4 +import java.math.BigDecimal;
  5 +import java.time.LocalDate;
  6 +import com.lframework.starter.web.core.vo.BaseVo;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  9 +import org.hibernate.validator.constraints.Length;
  10 +import java.io.Serializable;
  11 +import lombok.Data;
  12 +
  13 +@Data
  14 +public class CreateOrderDetailReportVo implements BaseVo, Serializable {
  15 +
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /**
  19 + * 订货单物料行ID
  20 + */
  21 + @ApiModelProperty("订货单物料行ID")
  22 + @Length(message = "订货单物料行ID最多允许32个字符!")
  23 + private String purchaseOrderLineId;
  24 +
  25 + /**
  26 + * 订单编号
  27 + */
  28 + @ApiModelProperty("订单编号")
  29 + @Length(message = "订单编号最多允许100个字符!")
  30 + private String orderNo;
  31 +
  32 + /**
  33 + * 订货日期
  34 + */
  35 + @ApiModelProperty("订货日期")
  36 + @TypeMismatch(message = "订货日期格式有误!")
  37 + private LocalDate orderDate;
  38 +
  39 + /**
  40 + * 生产厂
  41 + */
  42 + @ApiModelProperty("生产厂")
  43 + @Length(message = "生产厂最多允许50个字符!")
  44 + private String workshopId;
  45 +
  46 + /**
  47 + * 科办
  48 + */
  49 + @ApiModelProperty("科办")
  50 + @Length(message = "科办最多允许50个字符!")
  51 + private String deptName;
  52 +
  53 + /**
  54 + * 区域
  55 + */
  56 + @ApiModelProperty("区域")
  57 + @Length(message = "区域最多允许50个字符!")
  58 + private String regionName;
  59 +
  60 + /**
  61 + * 订货单位名称
  62 + */
  63 + @ApiModelProperty("订货单位名称")
  64 + @Length(message = "订货单位名称最多允许200个字符!")
  65 + private String orderingUnitName;
  66 +
  67 + /**
  68 + * 行业
  69 + */
  70 + @ApiModelProperty("行业")
  71 + @Length(message = "行业最多允许50个字符!")
  72 + private String industry;
  73 +
  74 + /**
  75 + * 牌号
  76 + */
  77 + @ApiModelProperty("牌号")
  78 + @Length(message = "牌号最多允许50个字符!")
  79 + private String brand;
  80 +
  81 + /**
  82 + * 厚度
  83 + */
  84 + @ApiModelProperty("厚度")
  85 + @TypeMismatch(message = "厚度格式有误!")
  86 + @IsNumberPrecision(message = "厚度最多允许4位小数!", value = 4)
  87 + private BigDecimal thickness;
  88 +
  89 + /**
  90 + * 厚度公差正
  91 + */
  92 + @ApiModelProperty("厚度公差正")
  93 + @TypeMismatch(message = "厚度公差正格式有误!")
  94 + @IsNumberPrecision(message = "厚度公差正最多允许4位小数!", value = 4)
  95 + private BigDecimal thicknessTolPos;
  96 +
  97 + /**
  98 + * 厚度公差负
  99 + */
  100 + @ApiModelProperty("厚度公差负")
  101 + @TypeMismatch(message = "厚度公差负格式有误!")
  102 + @IsNumberPrecision(message = "厚度公差负最多允许4位小数!", value = 4)
  103 + private BigDecimal thicknessTolNeg;
  104 +
  105 + /**
  106 + * 宽度
  107 + */
  108 + @ApiModelProperty("宽度")
  109 + @TypeMismatch(message = "宽度格式有误!")
  110 + @IsNumberPrecision(message = "宽度最多允许4位小数!", value = 4)
  111 + private BigDecimal width;
  112 +
  113 + /**
  114 + * 宽度公差正
  115 + */
  116 + @ApiModelProperty("宽度公差正")
  117 + @TypeMismatch(message = "宽度公差正格式有误!")
  118 + @IsNumberPrecision(message = "宽度公差正最多允许4位小数!", value = 4)
  119 + private BigDecimal widthTolPos;
  120 +
  121 + /**
  122 + * 宽度公差负
  123 + */
  124 + @ApiModelProperty("宽度公差负")
  125 + @TypeMismatch(message = "宽度公差负格式有误!")
  126 + @IsNumberPrecision(message = "宽度公差负最多允许4位小数!", value = 4)
  127 + private BigDecimal widthTolNeg;
  128 +
  129 + /**
  130 + * 长度
  131 + */
  132 + @ApiModelProperty("长度")
  133 + @TypeMismatch(message = "长度格式有误!")
  134 + @IsNumberPrecision(message = "长度最多允许4位小数!", value = 4)
  135 + private BigDecimal length;
  136 +
  137 + /**
  138 + * 长度公差正
  139 + */
  140 + @ApiModelProperty("长度公差正")
  141 + @TypeMismatch(message = "长度公差正格式有误!")
  142 + @IsNumberPrecision(message = "长度公差正最多允许4位小数!", value = 4)
  143 + private BigDecimal lengthTolPos;
  144 +
  145 + /**
  146 + * 长度公差负
  147 + */
  148 + @ApiModelProperty("长度公差负")
  149 + @TypeMismatch(message = "长度公差负格式有误!")
  150 + @IsNumberPrecision(message = "长度公差负最多允许4位小数!", value = 4)
  151 + private BigDecimal lengthTolNeg;
  152 +
  153 + /**
  154 + * 状态
  155 + */
  156 + @ApiModelProperty("状态")
  157 + @Length(message = "状态最多允许50个字符!")
  158 + private String status;
  159 +
  160 + /**
  161 + * 数量
  162 + */
  163 + @ApiModelProperty("数量")
  164 + @TypeMismatch(message = "数量格式有误!")
  165 + @IsNumberPrecision(message = "数量最多允许4位小数!", value = 4)
  166 + private BigDecimal quantity;
  167 +
  168 + /**
  169 + * 指导价
  170 + */
  171 + @ApiModelProperty("指导价")
  172 + @Length(message = "指导价最多允许50个字符!")
  173 + private String suggestedPrice;
  174 +
  175 + /**
  176 + * 发货日期
  177 + */
  178 + @ApiModelProperty("发货日期")
  179 + @TypeMismatch(message = "发货日期格式有误!")
  180 + private LocalDate deliveryDate;
  181 +
  182 + /**
  183 + * 超协价
  184 + */
  185 + @ApiModelProperty("超协价")
  186 + @Length(message = "超协价最多允许50个字符!")
  187 + private String assessmentExceedsAgreement;
  188 +
  189 + /**
  190 + * 销售价
  191 + */
  192 + @ApiModelProperty("销售价")
  193 + @Length(message = "销售价最多允许50个字符!")
  194 + private String salesPrice;
  195 +
  196 + /**
  197 + * 价格表编号
  198 + */
  199 + @ApiModelProperty("价格表编号")
  200 + @Length(message = "价格表编号最多允许50个字符!")
  201 + private String priceListNo;
  202 +
  203 + /**
  204 + * 包装费
  205 + */
  206 + @ApiModelProperty("包装费")
  207 + @Length(message = "包装费最多允许50个字符!")
  208 + private String packagingFee;
  209 +
  210 + /**
  211 + * 开票情况
  212 + */
  213 + @ApiModelProperty("开票情况")
  214 + @Length(message = "开票情况最多允许50个字符!")
  215 + private String invoicingStatus;
  216 +
  217 + /**
  218 + * 件重条头
  219 + */
  220 + @ApiModelProperty("件重条头")
  221 + @Length(message = "件重条头最多允许65,535个字符!")
  222 + private String pieceWeightHeader;
  223 +
  224 + /**
  225 + * 表面
  226 + */
  227 + @ApiModelProperty("表面")
  228 + @Length(message = "表面最多允许65,535个字符!")
  229 + private String surface;
  230 +
  231 + /**
  232 + * 公差
  233 + */
  234 + @ApiModelProperty("公差")
  235 + @Length(message = "公差最多允许65,535个字符!")
  236 + private String tolerance;
  237 +
  238 + /**
  239 + * 性能
  240 + */
  241 + @ApiModelProperty("性能")
  242 + @Length(message = "性能最多允许65,535个字符!")
  243 + private String performance;
  244 +
  245 + /**
  246 + * 包装
  247 + */
  248 + @ApiModelProperty("包装")
  249 + @Length(message = "包装最多允许65,535个字符!")
  250 + private String packaging;
  251 +
  252 + /**
  253 + * 备注
  254 + */
  255 + @ApiModelProperty("备注")
  256 + @Length(message = "备注最多允许65,535个字符!")
  257 + private String remarks;
  258 +
  259 + /**
  260 + * 运费
  261 + */
  262 + @ApiModelProperty("运费")
  263 + @Length(message = "运费最多允许50个字符!")
  264 + private String shippingCost;
  265 +
  266 + /**
  267 + * 回程运费
  268 + */
  269 + @ApiModelProperty("回程运费")
  270 + @Length(message = "回程运费最多允许50个字符!")
  271 + private String returnShippingCost;
  272 +
  273 + /**
  274 + * 客户类型
  275 + */
  276 + @ApiModelProperty("客户类型")
  277 + @Length(message = "客户类型最多允许50个字符!")
  278 + private String customerType;
  279 +
  280 + /**
  281 + * 标准行业
  282 + */
  283 + @ApiModelProperty("标准行业")
  284 + @Length(message = "标准行业最多允许100个字符!")
  285 + private String quality;
  286 +
  287 + /**
  288 + * 加工经销
  289 + */
  290 + @ApiModelProperty("加工经销")
  291 + @Length(message = "加工经销最多允许100个字符!")
  292 + private String contractType;
  293 +
  294 + /**
  295 + * 备货单位
  296 + */
  297 + @ApiModelProperty("备货单位")
  298 + @Length(message = "备货单位最多允许200个字符!")
  299 + private String stockUpCompanyName;
  300 +
  301 + /**
  302 + * 订单类型
  303 + */
  304 + @ApiModelProperty("订单类型")
  305 + @Length(message = "订单类型最多允许50个字符!")
  306 + private String orderType;
  307 +
  308 + /**
  309 + * 排序,订货单:0,撤销单:1,规格变更单:2
  310 + */
  311 + @ApiModelProperty("排序,订货单:0,撤销单:1,规格变更单:2")
  312 + @TypeMismatch(message = "排序,订货单:0,撤销单:1,规格变更单:2格式有误!")
  313 + private Integer showOrder;
  314 +
  315 +}
... ...
  1 +package com.lframework.xingyun.sc.vo.statistics.orderDetail;
  2 +
  3 +import lombok.Data;
  4 +import com.lframework.starter.web.core.vo.PageVo;
  5 +import com.lframework.starter.web.core.vo.BaseVo;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import java.io.Serializable;
  8 +
  9 +@Data
  10 +public class QueryOrderDetailReportVo extends PageVo implements BaseVo, Serializable {
  11 +
  12 + private static final long serialVersionUID = 1L;
  13 +
  14 + /**
  15 + * 订货单物料行ID
  16 + */
  17 + @ApiModelProperty("订货单物料行ID")
  18 + private String purchaseOrderLineId;
  19 +
  20 + /**
  21 + * 订单编号
  22 + */
  23 + @ApiModelProperty("订单编号")
  24 + private String orderNo;
  25 +
  26 + /**
  27 + * 生产厂
  28 + */
  29 + @ApiModelProperty("生产厂")
  30 + private String workshopId;
  31 +
  32 + /**
  33 + * 科办
  34 + */
  35 + @ApiModelProperty("科办")
  36 + private String deptName;
  37 +
  38 + /**
  39 + * 订货单位名称
  40 + */
  41 + @ApiModelProperty("订货单位名称")
  42 + private String orderingUnitName;
  43 +
  44 + /**
  45 + * 导出类型
  46 + */
  47 + @ApiModelProperty("导出类型")
  48 + private String exportType;
  49 +
  50 +}
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.mappers.OrderDetailReportMapper">
  4 +
  5 + <resultMap id="OrderDetailReport" type="com.lframework.xingyun.sc.entity.OrderDetailReport">
  6 + <id column="id" property="id"/>
  7 + <result column="purchase_order_line_id" property="purchaseOrderLineId"/>
  8 + <result column="order_no" property="orderNo"/>
  9 + <result column="order_date" property="orderDate"/>
  10 + <result column="workshop_id" property="workshopId"/>
  11 + <result column="workshop_name" property="workshopName"/>
  12 + <result column="dept_name" property="deptName"/>
  13 + <result column="region_name" property="regionName"/>
  14 + <result column="ordering_unit_name" property="orderingUnitName"/>
  15 + <result column="industry" property="industry"/>
  16 + <result column="brand" property="brand"/>
  17 + <result column="thickness" property="thickness"/>
  18 + <result column="thickness_tol_pos" property="thicknessTolPos"/>
  19 + <result column="thickness_tol_neg" property="thicknessTolNeg"/>
  20 + <result column="width" property="width"/>
  21 + <result column="width_tol_pos" property="widthTolPos"/>
  22 + <result column="width_tol_neg" property="widthTolNeg"/>
  23 + <result column="length" property="length"/>
  24 + <result column="length_tol_pos" property="lengthTolPos"/>
  25 + <result column="length_tol_neg" property="lengthTolNeg"/>
  26 + <result column="status" property="status"/>
  27 + <result column="quantity" property="quantity"/>
  28 + <result column="suggested_price" property="suggestedPrice"/>
  29 + <result column="delivery_date" property="deliveryDate"/>
  30 + <result column="assessment_exceeds_agreement" property="assessmentExceedsAgreement"/>
  31 + <result column="sales_price" property="salesPrice"/>
  32 + <result column="price_list_no" property="priceListNo"/>
  33 + <result column="packaging_fee" property="packagingFee"/>
  34 + <result column="invoicing_status" property="invoicingStatus"/>
  35 + <result column="piece_weight_header" property="pieceWeightHeader"/>
  36 + <result column="surface" property="surface"/>
  37 + <result column="tolerance" property="tolerance"/>
  38 + <result column="performance" property="performance"/>
  39 + <result column="packaging" property="packaging"/>
  40 + <result column="remarks" property="remarks"/>
  41 + <result column="shipping_fee" property="shippingFee"/>
  42 + <result column="return_shipping_cost" property="returnShippingCost"/>
  43 + <result column="customer_type" property="customerType"/>
  44 + <result column="quality" property="quality"/>
  45 + <result column="contract_type" property="contractType"/>
  46 + <result column="stock_up_company_name" property="stockUpCompanyName"/>
  47 + <result column="order_type" property="orderType"/>
  48 + <result column="show_order" property="showOrder"/>
  49 + <result column="create_by_id" property="createById"/>
  50 + <result column="create_by" property="createBy"/>
  51 + <result column="update_by_id" property="updateById"/>
  52 + <result column="update_by" property="updateBy"/>
  53 + <result column="create_time" property="createTime"/>
  54 + <result column="update_time" property="updateTime"/>
  55 + </resultMap>
  56 +
  57 + <sql id="OrderDetailReport_sql">
  58 + SELECT
  59 + tb.id,
  60 + tb.purchase_order_line_id,
  61 + tb.order_no,
  62 + tb.order_date,
  63 + tb.workshop_id,
  64 + ws.name AS workshop_name,
  65 + tb.dept_name,
  66 + tb.region_name,
  67 + tb.ordering_unit_name,
  68 + tb.industry,
  69 + tb.brand,
  70 + tb.thickness,
  71 + tb.thickness_tol_pos,
  72 + tb.thickness_tol_neg,
  73 + tb.width,
  74 + tb.width_tol_pos,
  75 + tb.width_tol_neg,
  76 + tb.length,
  77 + tb.length_tol_pos,
  78 + tb.length_tol_neg,
  79 + tb.status,
  80 + tb.quantity,
  81 + tb.suggested_price,
  82 + tb.delivery_date,
  83 + tb.assessment_exceeds_agreement,
  84 + tb.sales_price,
  85 + tb.price_list_no,
  86 + tb.packaging_fee,
  87 + tb.invoicing_status,
  88 + tb.piece_weight_header,
  89 + tb.surface,
  90 + tb.tolerance,
  91 + tb.performance,
  92 + tb.packaging,
  93 + tb.remarks,
  94 + tb.shipping_fee,
  95 + tb.return_shipping_cost,
  96 + tb.customer_type,
  97 + tb.quality,
  98 + tb.contract_type,
  99 + tb.stock_up_company_name,
  100 + tb.order_type,
  101 + tb.show_order,
  102 + tb.create_by_id,
  103 + tb.create_by,
  104 + tb.update_by_id,
  105 + tb.update_by,
  106 + tb.create_time,
  107 + tb.update_time
  108 + FROM order_detail_report AS tb
  109 + left join base_data_workshop as ws on ws.id = tb.workshop_id
  110 + </sql>
  111 +
  112 + <select id="query" resultMap="OrderDetailReport">
  113 + <include refid="OrderDetailReport_sql"/>
  114 + <where>
  115 + <if test="vo.purchaseOrderLineId != null and vo.purchaseOrderLineId != ''">
  116 + AND tb.purchase_order_line_id = #{vo.purchaseOrderLineId}
  117 + </if>
  118 + <if test="vo.orderNo != null and vo.orderNo != ''">
  119 + AND tb.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')
  120 + </if>
  121 + <if test="vo.workshopId != null and vo.workshopId != ''">
  122 + AND tb.workshop_id = #{vo.workshopId}
  123 + </if>
  124 + <if test="vo.deptName != null and vo.deptName != ''">
  125 + AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%')
  126 + </if>
  127 + <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
  128 + AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')
  129 + </if>
  130 + </where>
  131 + </select>
  132 +</mapper>
... ...