Commit 94e1002ffa7b92c275e0d2755d3ea5a812c22334

Authored by 房远帅
1 parent 5ad1e84d

基础网价:基础功能

Showing 17 changed files with 2349 additions and 0 deletions
... ... @@ -2424,3 +2424,43 @@ ALTER TABLE procurement_supplier_quotation_project
2424 2424 ADD COLUMN supplier_department_id VARCHAR(32) DEFAULT NULL COMMENT '供应商部门ID';
2425 2425 -- 考虑到后续会频繁根据该字段进行数据权限过滤,加上索引
2426 2426 CREATE INDEX idx_supplier_department_id ON procurement_supplier_quotation_project(supplier_department_id);
  2427 +
  2428 +
  2429 +
  2430 +CREATE TABLE `base_data_online_price`
  2431 +(
  2432 + `id` VARCHAR(32) NOT NULL COMMENT '主键ID',
  2433 + `record_date` DATE NOT NULL COMMENT '日期',
  2434 + `cj_copper1_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#电铜-上限',
  2435 + `cj_copper1_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#电铜-下限',
  2436 + `cj_copper1_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#电铜-均价',
  2437 + `cj_zinc0_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-0#锌锭-上限',
  2438 + `cj_zinc0_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-0#锌锭-下限',
  2439 + `cj_zinc0_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-0#锌锭-均价',
  2440 + `cj_zinc1_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#锌锭-上限',
  2441 + `cj_zinc1_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#锌锭-下限',
  2442 + `cj_zinc1_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '长江现货-1#锌锭-均价',
  2443 + `sh_copper1_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜-上限',
  2444 + `sh_copper1_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜-下限',
  2445 + `sh_copper1_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜-均价',
  2446 + `sh_copper1_premium_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜升贴水-上限',
  2447 + `sh_copper1_premium_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜升贴水-下限',
  2448 + `sh_copper1_premium_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#电铜升贴水-均价',
  2449 + `sh_flat_copper_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-平水铜-上限',
  2450 + `sh_flat_copper_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-平水铜-下限',
  2451 + `sh_flat_copper_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-平水铜-均价',
  2452 + `sh_zinc0_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-0#锌锭-上限',
  2453 + `sh_zinc0_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-0#锌锭-下限',
  2454 + `sh_zinc0_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-0#锌锭-均价',
  2455 + `sh_zinc1_upper` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#锌锭-上限',
  2456 + `sh_zinc1_lower` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#锌锭-下限',
  2457 + `sh_zinc1_avg` DECIMAL(10, 2) DEFAULT NULL COMMENT '上海有色-1#锌锭-均价',
  2458 + `create_by_id` VARCHAR(32) DEFAULT NULL COMMENT '创建人ID',
  2459 + `create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建人',
  2460 + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  2461 + `update_by_id` VARCHAR(32) DEFAULT NULL COMMENT '更新人ID',
  2462 + `update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新人',
  2463 + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  2464 + PRIMARY KEY (`id`),
  2465 + UNIQUE KEY `uk_record_date` (`record_date`)
  2466 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='基础网价表';
... ...
  1 +package com.lframework.xingyun.basedata.bo.onlinePrice;
  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 java.time.LocalDateTime;
  9 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  10 +import io.swagger.annotations.ApiModelProperty;
  11 +
  12 +import lombok.Data;
  13 +
  14 +/**
  15 + * <p>
  16 + * 基础网价表 GetBo
  17 + * </p>
  18 + *
  19 + */
  20 +@Data
  21 +public class GetBaseDataOnlinePriceBo extends BaseBo<BaseDataOnlinePrice> {
  22 +
  23 + /**
  24 + * 主键ID
  25 + */
  26 + @ApiModelProperty("主键ID")
  27 + private String id;
  28 +
  29 + /**
  30 + * 日期
  31 + */
  32 + @ApiModelProperty("日期")
  33 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  34 + private LocalDate recordDate;
  35 +
  36 + /**
  37 + * 长江现货-1#电铜-上限
  38 + */
  39 + @ApiModelProperty("长江现货-1#电铜-上限")
  40 + private BigDecimal cjCopper1Upper;
  41 +
  42 + /**
  43 + * 长江现货-1#电铜-下限
  44 + */
  45 + @ApiModelProperty("长江现货-1#电铜-下限")
  46 + private BigDecimal cjCopper1Lower;
  47 +
  48 + /**
  49 + * 长江现货-1#电铜-均价
  50 + */
  51 + @ApiModelProperty("长江现货-1#电铜-均价")
  52 + private BigDecimal cjCopper1Avg;
  53 +
  54 + /**
  55 + * 长江现货-0#锌锭-上限
  56 + */
  57 + @ApiModelProperty("长江现货-0#锌锭-上限")
  58 + private BigDecimal cjZinc0Upper;
  59 +
  60 + /**
  61 + * 长江现货-0#锌锭-下限
  62 + */
  63 + @ApiModelProperty("长江现货-0#锌锭-下限")
  64 + private BigDecimal cjZinc0Lower;
  65 +
  66 + /**
  67 + * 长江现货-0#锌锭-均价
  68 + */
  69 + @ApiModelProperty("长江现货-0#锌锭-均价")
  70 + private BigDecimal cjZinc0Avg;
  71 +
  72 + /**
  73 + * 长江现货-1#锌锭-上限
  74 + */
  75 + @ApiModelProperty("长江现货-1#锌锭-上限")
  76 + private BigDecimal cjZinc1Upper;
  77 +
  78 + /**
  79 + * 长江现货-1#锌锭-下限
  80 + */
  81 + @ApiModelProperty("长江现货-1#锌锭-下限")
  82 + private BigDecimal cjZinc1Lower;
  83 +
  84 + /**
  85 + * 长江现货-1#锌锭-均价
  86 + */
  87 + @ApiModelProperty("长江现货-1#锌锭-均价")
  88 + private BigDecimal cjZinc1Avg;
  89 +
  90 + /**
  91 + * 上海有色-1#电铜-上限
  92 + */
  93 + @ApiModelProperty("上海有色-1#电铜-上限")
  94 + private BigDecimal shCopper1Upper;
  95 +
  96 + /**
  97 + * 上海有色-1#电铜-下限
  98 + */
  99 + @ApiModelProperty("上海有色-1#电铜-下限")
  100 + private BigDecimal shCopper1Lower;
  101 +
  102 + /**
  103 + * 上海有色-1#电铜-均价
  104 + */
  105 + @ApiModelProperty("上海有色-1#电铜-均价")
  106 + private BigDecimal shCopper1Avg;
  107 +
  108 + /**
  109 + * 上海有色-1#电铜升贴水-上限
  110 + */
  111 + @ApiModelProperty("上海有色-1#电铜升贴水-上限")
  112 + private BigDecimal shCopper1PremiumUpper;
  113 +
  114 + /**
  115 + * 上海有色-1#电铜升贴水-下限
  116 + */
  117 + @ApiModelProperty("上海有色-1#电铜升贴水-下限")
  118 + private BigDecimal shCopper1PremiumLower;
  119 +
  120 + /**
  121 + * 上海有色-1#电铜升贴水-均价
  122 + */
  123 + @ApiModelProperty("上海有色-1#电铜升贴水-均价")
  124 + private BigDecimal shCopper1PremiumAvg;
  125 +
  126 + /**
  127 + * 上海有色-平水铜-上限
  128 + */
  129 + @ApiModelProperty("上海有色-平水铜-上限")
  130 + private BigDecimal shFlatCopperUpper;
  131 +
  132 + /**
  133 + * 上海有色-平水铜-下限
  134 + */
  135 + @ApiModelProperty("上海有色-平水铜-下限")
  136 + private BigDecimal shFlatCopperLower;
  137 +
  138 + /**
  139 + * 上海有色-平水铜-均价
  140 + */
  141 + @ApiModelProperty("上海有色-平水铜-均价")
  142 + private BigDecimal shFlatCopperAvg;
  143 +
  144 + /**
  145 + * 上海有色-0#锌锭-上限
  146 + */
  147 + @ApiModelProperty("上海有色-0#锌锭-上限")
  148 + private BigDecimal shZinc0Upper;
  149 +
  150 + /**
  151 + * 上海有色-0#锌锭-下限
  152 + */
  153 + @ApiModelProperty("上海有色-0#锌锭-下限")
  154 + private BigDecimal shZinc0Lower;
  155 +
  156 + /**
  157 + * 上海有色-0#锌锭-均价
  158 + */
  159 + @ApiModelProperty("上海有色-0#锌锭-均价")
  160 + private BigDecimal shZinc0Avg;
  161 +
  162 + /**
  163 + * 上海有色-1#锌锭-上限
  164 + */
  165 + @ApiModelProperty("上海有色-1#锌锭-上限")
  166 + private BigDecimal shZinc1Upper;
  167 +
  168 + /**
  169 + * 上海有色-1#锌锭-下限
  170 + */
  171 + @ApiModelProperty("上海有色-1#锌锭-下限")
  172 + private BigDecimal shZinc1Lower;
  173 +
  174 + /**
  175 + * 上海有色-1#锌锭-均价
  176 + */
  177 + @ApiModelProperty("上海有色-1#锌锭-均价")
  178 + private BigDecimal shZinc1Avg;
  179 +
  180 + /**
  181 + * 创建人ID
  182 + */
  183 + @ApiModelProperty("创建人ID")
  184 + private String createById;
  185 +
  186 + /**
  187 + * 创建人
  188 + */
  189 + @ApiModelProperty("创建人")
  190 + private String createBy;
  191 +
  192 + /**
  193 + * 创建时间
  194 + */
  195 + @ApiModelProperty("创建时间")
  196 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  197 + private LocalDateTime createTime;
  198 +
  199 + /**
  200 + * 更新人ID
  201 + */
  202 + @ApiModelProperty("更新人ID")
  203 + private String updateById;
  204 +
  205 + /**
  206 + * 更新人
  207 + */
  208 + @ApiModelProperty("更新人")
  209 + private String updateBy;
  210 +
  211 + /**
  212 + * 更新时间
  213 + */
  214 + @ApiModelProperty("更新时间")
  215 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  216 + private LocalDateTime updateTime;
  217 +
  218 + public GetBaseDataOnlinePriceBo() {
  219 +
  220 + }
  221 +
  222 + public GetBaseDataOnlinePriceBo(BaseDataOnlinePrice dto) {
  223 +
  224 + super(dto);
  225 + }
  226 +
  227 + @Override
  228 + public BaseBo<BaseDataOnlinePrice> convert(BaseDataOnlinePrice dto) {
  229 + return super.convert(dto);
  230 + }
  231 +
  232 + @Override
  233 + protected void afterInit(BaseDataOnlinePrice dto) {
  234 +
  235 + }
  236 +}
... ...
  1 +package com.lframework.xingyun.basedata.bo.onlinePrice;
  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 java.time.LocalDateTime;
  9 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  10 +import io.swagger.annotations.ApiModelProperty;
  11 +
  12 +import lombok.Data;
  13 +
  14 +/**
  15 + * <p>
  16 + * 基础网价表 QueryBo
  17 + * </p>
  18 + *
  19 + */
  20 +@Data
  21 +public class QueryBaseDataOnlinePriceBo extends BaseBo<BaseDataOnlinePrice> {
  22 +
  23 + /**
  24 + * 主键ID
  25 + */
  26 + @ApiModelProperty("主键ID")
  27 + private String id;
  28 +
  29 + /**
  30 + * 日期
  31 + */
  32 + @ApiModelProperty("日期")
  33 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  34 + private LocalDate recordDate;
  35 +
  36 + /**
  37 + * 长江现货-1#电铜-上限
  38 + */
  39 + @ApiModelProperty("长江现货-1#电铜-上限")
  40 + private BigDecimal cjCopper1Upper;
  41 +
  42 + /**
  43 + * 长江现货-1#电铜-下限
  44 + */
  45 + @ApiModelProperty("长江现货-1#电铜-下限")
  46 + private BigDecimal cjCopper1Lower;
  47 +
  48 + /**
  49 + * 长江现货-1#电铜-均价
  50 + */
  51 + @ApiModelProperty("长江现货-1#电铜-均价")
  52 + private BigDecimal cjCopper1Avg;
  53 +
  54 + /**
  55 + * 长江现货-0#锌锭-上限
  56 + */
  57 + @ApiModelProperty("长江现货-0#锌锭-上限")
  58 + private BigDecimal cjZinc0Upper;
  59 +
  60 + /**
  61 + * 长江现货-0#锌锭-下限
  62 + */
  63 + @ApiModelProperty("长江现货-0#锌锭-下限")
  64 + private BigDecimal cjZinc0Lower;
  65 +
  66 + /**
  67 + * 长江现货-0#锌锭-均价
  68 + */
  69 + @ApiModelProperty("长江现货-0#锌锭-均价")
  70 + private BigDecimal cjZinc0Avg;
  71 +
  72 + /**
  73 + * 长江现货-1#锌锭-上限
  74 + */
  75 + @ApiModelProperty("长江现货-1#锌锭-上限")
  76 + private BigDecimal cjZinc1Upper;
  77 +
  78 + /**
  79 + * 长江现货-1#锌锭-下限
  80 + */
  81 + @ApiModelProperty("长江现货-1#锌锭-下限")
  82 + private BigDecimal cjZinc1Lower;
  83 +
  84 + /**
  85 + * 长江现货-1#锌锭-均价
  86 + */
  87 + @ApiModelProperty("长江现货-1#锌锭-均价")
  88 + private BigDecimal cjZinc1Avg;
  89 +
  90 + /**
  91 + * 上海有色-1#电铜-上限
  92 + */
  93 + @ApiModelProperty("上海有色-1#电铜-上限")
  94 + private BigDecimal shCopper1Upper;
  95 +
  96 + /**
  97 + * 上海有色-1#电铜-下限
  98 + */
  99 + @ApiModelProperty("上海有色-1#电铜-下限")
  100 + private BigDecimal shCopper1Lower;
  101 +
  102 + /**
  103 + * 上海有色-1#电铜-均价
  104 + */
  105 + @ApiModelProperty("上海有色-1#电铜-均价")
  106 + private BigDecimal shCopper1Avg;
  107 +
  108 + /**
  109 + * 上海有色-1#电铜升贴水-上限
  110 + */
  111 + @ApiModelProperty("上海有色-1#电铜升贴水-上限")
  112 + private BigDecimal shCopper1PremiumUpper;
  113 +
  114 + /**
  115 + * 上海有色-1#电铜升贴水-下限
  116 + */
  117 + @ApiModelProperty("上海有色-1#电铜升贴水-下限")
  118 + private BigDecimal shCopper1PremiumLower;
  119 +
  120 + /**
  121 + * 上海有色-1#电铜升贴水-均价
  122 + */
  123 + @ApiModelProperty("上海有色-1#电铜升贴水-均价")
  124 + private BigDecimal shCopper1PremiumAvg;
  125 +
  126 + /**
  127 + * 上海有色-平水铜-上限
  128 + */
  129 + @ApiModelProperty("上海有色-平水铜-上限")
  130 + private BigDecimal shFlatCopperUpper;
  131 +
  132 + /**
  133 + * 上海有色-平水铜-下限
  134 + */
  135 + @ApiModelProperty("上海有色-平水铜-下限")
  136 + private BigDecimal shFlatCopperLower;
  137 +
  138 + /**
  139 + * 上海有色-平水铜-均价
  140 + */
  141 + @ApiModelProperty("上海有色-平水铜-均价")
  142 + private BigDecimal shFlatCopperAvg;
  143 +
  144 + /**
  145 + * 上海有色-0#锌锭-上限
  146 + */
  147 + @ApiModelProperty("上海有色-0#锌锭-上限")
  148 + private BigDecimal shZinc0Upper;
  149 +
  150 + /**
  151 + * 上海有色-0#锌锭-下限
  152 + */
  153 + @ApiModelProperty("上海有色-0#锌锭-下限")
  154 + private BigDecimal shZinc0Lower;
  155 +
  156 + /**
  157 + * 上海有色-0#锌锭-均价
  158 + */
  159 + @ApiModelProperty("上海有色-0#锌锭-均价")
  160 + private BigDecimal shZinc0Avg;
  161 +
  162 + /**
  163 + * 上海有色-1#锌锭-上限
  164 + */
  165 + @ApiModelProperty("上海有色-1#锌锭-上限")
  166 + private BigDecimal shZinc1Upper;
  167 +
  168 + /**
  169 + * 上海有色-1#锌锭-下限
  170 + */
  171 + @ApiModelProperty("上海有色-1#锌锭-下限")
  172 + private BigDecimal shZinc1Lower;
  173 +
  174 + /**
  175 + * 上海有色-1#锌锭-均价
  176 + */
  177 + @ApiModelProperty("上海有色-1#锌锭-均价")
  178 + private BigDecimal shZinc1Avg;
  179 +
  180 + /**
  181 + * 创建人ID
  182 + */
  183 + @ApiModelProperty("创建人ID")
  184 + private String createById;
  185 +
  186 + /**
  187 + * 创建人
  188 + */
  189 + @ApiModelProperty("创建人")
  190 + private String createBy;
  191 +
  192 + /**
  193 + * 创建时间
  194 + */
  195 + @ApiModelProperty("创建时间")
  196 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  197 + private LocalDateTime createTime;
  198 +
  199 + /**
  200 + * 更新人ID
  201 + */
  202 + @ApiModelProperty("更新人ID")
  203 + private String updateById;
  204 +
  205 + /**
  206 + * 更新人
  207 + */
  208 + @ApiModelProperty("更新人")
  209 + private String updateBy;
  210 +
  211 + /**
  212 + * 更新时间
  213 + */
  214 + @ApiModelProperty("更新时间")
  215 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  216 + private LocalDateTime updateTime;
  217 +
  218 + public QueryBaseDataOnlinePriceBo() {
  219 +
  220 + }
  221 +
  222 + public QueryBaseDataOnlinePriceBo(BaseDataOnlinePrice dto) {
  223 +
  224 + super(dto);
  225 + }
  226 +
  227 + @Override
  228 + public BaseBo<BaseDataOnlinePrice> convert(BaseDataOnlinePrice dto) {
  229 + return super.convert(dto);
  230 + }
  231 +
  232 + @Override
  233 + protected void afterInit(BaseDataOnlinePrice dto) {
  234 +
  235 + }
  236 +}
... ...
  1 +package com.lframework.xingyun.basedata.controller;
  2 +
  3 +import com.alibaba.excel.EasyExcel;
  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.servlet.http.HttpServletResponse;
  10 +import javax.validation.constraints.NotBlank;
  11 +import javax.validation.constraints.NotNull;
  12 +import com.lframework.xingyun.basedata.bo.onlinePrice.GetBaseDataOnlinePriceBo;
  13 +import com.lframework.xingyun.basedata.bo.onlinePrice.QueryBaseDataOnlinePriceBo;
  14 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  15 +import com.lframework.xingyun.basedata.excel.onlinePrice.BaseDataOnlinePriceCellStyleHandler;
  16 +import com.lframework.xingyun.basedata.excel.onlinePrice.BaseDataOnlinePriceExportModel;
  17 +import com.lframework.xingyun.basedata.excel.onlinePrice.BaseDataOnlinePriceImportListener;
  18 +import com.lframework.xingyun.basedata.excel.onlinePrice.BaseDataOnlinePriceImportModel;
  19 +import com.lframework.xingyun.basedata.excel.onlinePrice.NoAutoMergeStrategy;
  20 +import com.lframework.xingyun.basedata.service.onlinePrice.BaseDataOnlinePriceService;
  21 +import com.lframework.xingyun.basedata.vo.onlinePrice.CreateBaseDataOnlinePriceVo;
  22 +import com.lframework.xingyun.basedata.vo.onlinePrice.QueryBaseDataOnlinePriceVo;
  23 +import com.lframework.xingyun.basedata.vo.onlinePrice.UpdateBaseDataOnlinePriceVo;
  24 +import io.swagger.annotations.ApiImplicitParam;
  25 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  26 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  27 +import io.swagger.annotations.ApiOperation;
  28 +import com.lframework.starter.common.utils.CollectionUtil;
  29 +import io.swagger.annotations.Api;
  30 +import org.springframework.web.bind.annotation.DeleteMapping;
  31 +import org.springframework.beans.factory.annotation.Autowired;
  32 +import org.springframework.validation.annotation.Validated;
  33 +import org.springframework.web.bind.annotation.*;
  34 +import org.springframework.web.multipart.MultipartFile;
  35 +import javax.validation.Valid;
  36 +import java.io.IOException;
  37 +import java.io.OutputStream;
  38 +import java.net.URLEncoder;
  39 +import java.nio.charset.StandardCharsets;
  40 +import java.util.List;
  41 +import java.util.stream.Collectors;
  42 +
  43 +/**
  44 + * 基础网价表 Controller
  45 + *
  46 + */
  47 +@Api(tags = "基础网价表")
  48 +@Validated
  49 +@RestController
  50 +@RequestMapping("/baseData/onlinePrice")
  51 +public class BaseDataOnlinePriceController extends DefaultBaseController {
  52 +
  53 + @Autowired
  54 + private BaseDataOnlinePriceService baseDataOnlinePriceService;
  55 +
  56 + /**
  57 + * 查询列表
  58 + */
  59 + @ApiOperation("查询列表")
  60 + @HasPermission({"base-data:online-price:query"})
  61 + @GetMapping("/query")
  62 + public InvokeResult<PageResult<QueryBaseDataOnlinePriceBo>> query(@Valid QueryBaseDataOnlinePriceVo vo) {
  63 +
  64 + PageResult<BaseDataOnlinePrice> pageResult = baseDataOnlinePriceService.query(getPageIndex(vo), getPageSize(vo), vo);
  65 +
  66 + List<BaseDataOnlinePrice> datas = pageResult.getDatas();
  67 + List<QueryBaseDataOnlinePriceBo> results = null;
  68 +
  69 + if (!CollectionUtil.isEmpty(datas)) {
  70 + results = datas.stream().map(QueryBaseDataOnlinePriceBo::new).collect(Collectors.toList());
  71 + }
  72 +
  73 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  74 + }
  75 +
  76 + /**
  77 + * 根据ID查询
  78 + */
  79 + @ApiOperation("根据ID查询")
  80 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  81 + @HasPermission({"base-data:online-price:query"})
  82 + @GetMapping
  83 + public InvokeResult<GetBaseDataOnlinePriceBo> get(@NotBlank(message = "id不能为空!") String id) {
  84 +
  85 + BaseDataOnlinePrice data = baseDataOnlinePriceService.findById(id);
  86 + if (data == null) {
  87 + throw new DefaultClientException("基础网价表不存在!");
  88 + }
  89 +
  90 + GetBaseDataOnlinePriceBo result = new GetBaseDataOnlinePriceBo(data);
  91 +
  92 + return InvokeResultBuilder.success(result);
  93 + }
  94 +
  95 + /**
  96 + * 新增
  97 + */
  98 + @ApiOperation("新增")
  99 + @HasPermission({"base-data:online-price:add"})
  100 + @PostMapping
  101 + public InvokeResult<Void> create(@RequestBody @Valid CreateBaseDataOnlinePriceVo vo) {
  102 +
  103 + baseDataOnlinePriceService.create(vo);
  104 +
  105 + return InvokeResultBuilder.success();
  106 + }
  107 +
  108 + /**
  109 + * 修改
  110 + */
  111 + @ApiOperation("修改")
  112 + @HasPermission({"base-data:online-price:modify"})
  113 + @PutMapping
  114 + public InvokeResult<Void> update(@RequestBody @Valid UpdateBaseDataOnlinePriceVo vo) {
  115 +
  116 + baseDataOnlinePriceService.update(vo);
  117 +
  118 + return InvokeResultBuilder.success();
  119 + }
  120 +
  121 + /**
  122 + * 根据ID删除
  123 + */
  124 + @ApiOperation("根据ID删除")
  125 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  126 + @HasPermission({"base-data:online-price:delete"})
  127 + @DeleteMapping
  128 + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) {
  129 +
  130 + baseDataOnlinePriceService.deleteById(id);
  131 +
  132 + return InvokeResultBuilder.success();
  133 + }
  134 +
  135 + /**
  136 + * 导出
  137 + */
  138 + @ApiOperation("导出")
  139 + @HasPermission({"base-data:online-price:export"})
  140 + @GetMapping("/export")
  141 + public void export(@Valid QueryBaseDataOnlinePriceVo vo, HttpServletResponse response) throws IOException {
  142 + String fileName = "网价.xlsx";
  143 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
  144 + String encoded = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()).replace("+", "%20");
  145 + response.setHeader("Content-Disposition", "attachment; filename=\"" + encoded + "\"; filename*=UTF-8''" + encoded);
  146 +
  147 + List<BaseDataOnlinePrice> datas = baseDataOnlinePriceService.query(vo);
  148 + List<BaseDataOnlinePriceExportModel> models = datas.stream()
  149 + .map(BaseDataOnlinePriceExportModel::new)
  150 + .collect(Collectors.toList());
  151 +
  152 + try (OutputStream out = response.getOutputStream()) {
  153 + EasyExcel.write(out, BaseDataOnlinePriceExportModel.class)
  154 + .registerWriteHandler(new NoAutoMergeStrategy())
  155 + .registerWriteHandler(new BaseDataOnlinePriceCellStyleHandler())
  156 + .sheet("网价")
  157 + .doWrite(models);
  158 + }
  159 + }
  160 +
  161 + /**
  162 + * 下载导入模板
  163 + */
  164 + @ApiOperation("下载导入模板")
  165 + @HasPermission({"base-data:online-price:import"})
  166 + @GetMapping("/import/template")
  167 + public void downloadImportTemplate(HttpServletResponse response) throws IOException {
  168 + String fileName = "网价导入模板.xlsx";
  169 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
  170 + String encoded = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()).replace("+", "%20");
  171 + response.setHeader("Content-Disposition", "attachment; filename=\"" + encoded + "\"; filename*=UTF-8''" + encoded);
  172 +
  173 + try (OutputStream out = response.getOutputStream()) {
  174 + EasyExcel.write(out, BaseDataOnlinePriceImportModel.class)
  175 + .registerWriteHandler(new NoAutoMergeStrategy())
  176 + .registerWriteHandler(new BaseDataOnlinePriceCellStyleHandler())
  177 + .sheet("网价")
  178 + .doWrite(java.util.Collections.emptyList());
  179 + }
  180 + }
  181 +
  182 + /**
  183 + * 导入
  184 + */
  185 + @ApiOperation("导入")
  186 + @HasPermission({"base-data:online-price:import"})
  187 + @PostMapping("/import")
  188 + public InvokeResult<Void> importExcel(@NotBlank(message = "ID不能为空") String id,
  189 + @NotNull(message = "请上传文件") MultipartFile file) throws IOException {
  190 +
  191 + BaseDataOnlinePriceImportListener listener = new BaseDataOnlinePriceImportListener();
  192 + listener.setTaskId(id);
  193 + EasyExcel.read(file.getInputStream(), BaseDataOnlinePriceImportModel.class, listener)
  194 + .headRowNumber(3)
  195 + .sheet()
  196 + .doRead();
  197 +
  198 + return InvokeResultBuilder.success();
  199 + }
  200 +}
... ...
  1 +package com.lframework.xingyun.basedata.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("base_data_online_price")
  21 +public class BaseDataOnlinePrice extends BaseEntity implements BaseDto {
  22 +
  23 + private static final long serialVersionUID = 1L;
  24 +
  25 + public static final String CACHE_NAME = "BaseDataOnlinePrice";
  26 +
  27 + /**
  28 + * 主键ID
  29 + */
  30 + private String id;
  31 +
  32 + /**
  33 + * 日期
  34 + */
  35 + private LocalDate recordDate;
  36 +
  37 + /**
  38 + * 长江现货-1#电铜-上限
  39 + */
  40 + private BigDecimal cjCopper1Upper;
  41 +
  42 + /**
  43 + * 长江现货-1#电铜-下限
  44 + */
  45 + private BigDecimal cjCopper1Lower;
  46 +
  47 + /**
  48 + * 长江现货-1#电铜-均价
  49 + */
  50 + private BigDecimal cjCopper1Avg;
  51 +
  52 + /**
  53 + * 长江现货-0#锌锭-上限
  54 + */
  55 + private BigDecimal cjZinc0Upper;
  56 +
  57 + /**
  58 + * 长江现货-0#锌锭-下限
  59 + */
  60 + private BigDecimal cjZinc0Lower;
  61 +
  62 + /**
  63 + * 长江现货-0#锌锭-均价
  64 + */
  65 + private BigDecimal cjZinc0Avg;
  66 +
  67 + /**
  68 + * 长江现货-1#锌锭-上限
  69 + */
  70 + private BigDecimal cjZinc1Upper;
  71 +
  72 + /**
  73 + * 长江现货-1#锌锭-下限
  74 + */
  75 + private BigDecimal cjZinc1Lower;
  76 +
  77 + /**
  78 + * 长江现货-1#锌锭-均价
  79 + */
  80 + private BigDecimal cjZinc1Avg;
  81 +
  82 + /**
  83 + * 上海有色-1#电铜-上限
  84 + */
  85 + private BigDecimal shCopper1Upper;
  86 +
  87 + /**
  88 + * 上海有色-1#电铜-下限
  89 + */
  90 + private BigDecimal shCopper1Lower;
  91 +
  92 + /**
  93 + * 上海有色-1#电铜-均价
  94 + */
  95 + private BigDecimal shCopper1Avg;
  96 +
  97 + /**
  98 + * 上海有色-1#电铜升贴水-上限
  99 + */
  100 + private BigDecimal shCopper1PremiumUpper;
  101 +
  102 + /**
  103 + * 上海有色-1#电铜升贴水-下限
  104 + */
  105 + private BigDecimal shCopper1PremiumLower;
  106 +
  107 + /**
  108 + * 上海有色-1#电铜升贴水-均价
  109 + */
  110 + private BigDecimal shCopper1PremiumAvg;
  111 +
  112 + /**
  113 + * 上海有色-平水铜-上限
  114 + */
  115 + private BigDecimal shFlatCopperUpper;
  116 +
  117 + /**
  118 + * 上海有色-平水铜-下限
  119 + */
  120 + private BigDecimal shFlatCopperLower;
  121 +
  122 + /**
  123 + * 上海有色-平水铜-均价
  124 + */
  125 + private BigDecimal shFlatCopperAvg;
  126 +
  127 + /**
  128 + * 上海有色-0#锌锭-上限
  129 + */
  130 + private BigDecimal shZinc0Upper;
  131 +
  132 + /**
  133 + * 上海有色-0#锌锭-下限
  134 + */
  135 + private BigDecimal shZinc0Lower;
  136 +
  137 + /**
  138 + * 上海有色-0#锌锭-均价
  139 + */
  140 + private BigDecimal shZinc0Avg;
  141 +
  142 + /**
  143 + * 上海有色-1#锌锭-上限
  144 + */
  145 + private BigDecimal shZinc1Upper;
  146 +
  147 + /**
  148 + * 上海有色-1#锌锭-下限
  149 + */
  150 + private BigDecimal shZinc1Lower;
  151 +
  152 + /**
  153 + * 上海有色-1#锌锭-均价
  154 + */
  155 + private BigDecimal shZinc1Avg;
  156 +
  157 + /**
  158 + * 创建人ID
  159 + */
  160 + @TableField(fill = FieldFill.INSERT)
  161 + private String createById;
  162 +
  163 + /**
  164 + * 创建人
  165 + */
  166 + @TableField(fill = FieldFill.INSERT)
  167 + private String createBy;
  168 +
  169 + /**
  170 + * 创建时间
  171 + */
  172 + @TableField(fill = FieldFill.INSERT)
  173 + private LocalDateTime createTime;
  174 +
  175 + /**
  176 + * 更新人ID
  177 + */
  178 + @TableField(fill = FieldFill.INSERT_UPDATE)
  179 + private String updateById;
  180 +
  181 + /**
  182 + * 更新人
  183 + */
  184 + @TableField(fill = FieldFill.INSERT_UPDATE)
  185 + private String updateBy;
  186 +
  187 + /**
  188 + * 更新时间
  189 + */
  190 + @TableField(fill = FieldFill.INSERT_UPDATE)
  191 + private LocalDateTime updateTime;
  192 +
  193 +}
... ...
  1 +package com.lframework.xingyun.basedata.excel.onlinePrice;
  2 +
  3 +import com.alibaba.excel.metadata.CellData;
  4 +import com.alibaba.excel.metadata.Head;
  5 +import com.alibaba.excel.write.handler.CellWriteHandler;
  6 +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
  7 +import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
  8 +import org.apache.poi.ss.usermodel.BorderStyle;
  9 +import org.apache.poi.ss.usermodel.BuiltinFormats;
  10 +import org.apache.poi.ss.usermodel.Cell;
  11 +import org.apache.poi.ss.usermodel.CellStyle;
  12 +import org.apache.poi.ss.usermodel.DataFormat;
  13 +import org.apache.poi.ss.usermodel.HorizontalAlignment;
  14 +import org.apache.poi.ss.usermodel.Row;
  15 +import org.apache.poi.ss.usermodel.Workbook;
  16 +
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +public class BaseDataOnlinePriceCellStyleHandler implements CellWriteHandler {
  22 +
  23 + private CellStyle headCellStyle;
  24 + private CellStyle dateCellStyle;
  25 + private CellStyle numberCellStyle;
  26 +
  27 + private final Map<String, CellStyle> cloneCache = new HashMap<>();
  28 +
  29 + @Override
  30 + public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
  31 + Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
  32 + }
  33 +
  34 + @Override
  35 + public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
  36 + Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
  37 + }
  38 +
  39 + @Override
  40 + public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
  41 + CellData cellData, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
  42 + if (Boolean.TRUE.equals(isHead)) {
  43 + if (headCellStyle == null) {
  44 + headCellStyle = cloneAndBorder(cell, "head_center");
  45 + headCellStyle.setAlignment(HorizontalAlignment.CENTER);
  46 + }
  47 + cell.setCellStyle(headCellStyle);
  48 + return;
  49 + }
  50 +
  51 + int colIdx = cell.getColumnIndex();
  52 + if (colIdx == 0) {
  53 + if (dateCellStyle == null) {
  54 + dateCellStyle = cloneAndBorder(cell, "date_center");
  55 + dateCellStyle.setAlignment(HorizontalAlignment.CENTER);
  56 + }
  57 + cell.setCellStyle(dateCellStyle);
  58 + } else {
  59 + if (numberCellStyle == null) {
  60 + numberCellStyle = cloneAndBorder(cell, "num_center_4");
  61 + numberCellStyle.setAlignment(HorizontalAlignment.CENTER);
  62 + Workbook wb = cell.getSheet().getWorkbook();
  63 + DataFormat dataFormat = wb.createDataFormat();
  64 + numberCellStyle.setDataFormat(dataFormat.getFormat("0.00"));
  65 + }
  66 + cell.setCellStyle(numberCellStyle);
  67 + }
  68 + }
  69 +
  70 + @Override
  71 + public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
  72 + List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
  73 + }
  74 +
  75 + private CellStyle cloneAndBorder(Cell cell, String cacheKey) {
  76 + return cloneCache.computeIfAbsent(cacheKey, k -> {
  77 + Workbook wb = cell.getSheet().getWorkbook();
  78 + CellStyle newStyle = wb.createCellStyle();
  79 + CellStyle orig = cell.getCellStyle();
  80 + if (orig != null) {
  81 + newStyle.cloneStyleFrom(orig);
  82 + }
  83 + newStyle.setBorderTop(BorderStyle.THIN);
  84 + newStyle.setBorderBottom(BorderStyle.THIN);
  85 + newStyle.setBorderLeft(BorderStyle.THIN);
  86 + newStyle.setBorderRight(BorderStyle.THIN);
  87 + return newStyle;
  88 + });
  89 + }
  90 +}
... ...
  1 +package com.lframework.xingyun.basedata.excel.onlinePrice;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.lframework.starter.web.core.bo.BaseBo;
  5 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  6 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  7 +import java.math.BigDecimal;
  8 +import java.math.RoundingMode;
  9 +import lombok.Data;
  10 +
  11 +@Data
  12 +public class BaseDataOnlinePriceExportModel extends BaseBo<BaseDataOnlinePrice>
  13 + implements ExcelModel {
  14 +
  15 + @ExcelProperty(value = {"日期", "日期", "日期"}, index = 0)
  16 + private String recordDate;
  17 +
  18 + @ExcelProperty(value = {"长江现货", "1#电铜", "上限"}, index = 1)
  19 + private BigDecimal cjCopper1Upper;
  20 +
  21 + @ExcelProperty(value = {"长江现货", "1#电铜", "下限"}, index = 2)
  22 + private BigDecimal cjCopper1Lower;
  23 +
  24 + @ExcelProperty(value = {"长江现货", "1#电铜", "均价"}, index = 3)
  25 + private BigDecimal cjCopper1Avg;
  26 +
  27 + @ExcelProperty(value = {"长江现货", "0#锌锭", "上限"}, index = 4)
  28 + private BigDecimal cjZinc0Upper;
  29 +
  30 + @ExcelProperty(value = {"长江现货", "0#锌锭", "下限"}, index = 5)
  31 + private BigDecimal cjZinc0Lower;
  32 +
  33 + @ExcelProperty(value = {"长江现货", "0#锌锭", "均价"}, index = 6)
  34 + private BigDecimal cjZinc0Avg;
  35 +
  36 + @ExcelProperty(value = {"长江现货", "1#锌锭", "上限"}, index = 7)
  37 + private BigDecimal cjZinc1Upper;
  38 +
  39 + @ExcelProperty(value = {"长江现货", "1#锌锭", "下限"}, index = 8)
  40 + private BigDecimal cjZinc1Lower;
  41 +
  42 + @ExcelProperty(value = {"长江现货", "1#锌锭", "均价"}, index = 9)
  43 + private BigDecimal cjZinc1Avg;
  44 +
  45 + @ExcelProperty(value = {"上海有色", "1#电铜", "上限"}, index = 10)
  46 + private BigDecimal shCopper1Upper;
  47 +
  48 + @ExcelProperty(value = {"上海有色", "1#电铜", "下限"}, index = 11)
  49 + private BigDecimal shCopper1Lower;
  50 +
  51 + @ExcelProperty(value = {"上海有色", "1#电铜", "均价"}, index = 12)
  52 + private BigDecimal shCopper1Avg;
  53 +
  54 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "上限"}, index = 13)
  55 + private BigDecimal shCopper1PremiumUpper;
  56 +
  57 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "下限"}, index = 14)
  58 + private BigDecimal shCopper1PremiumLower;
  59 +
  60 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "均价"}, index = 15)
  61 + private BigDecimal shCopper1PremiumAvg;
  62 +
  63 + @ExcelProperty(value = {"上海有色", "平水铜", "上限"}, index = 16)
  64 + private BigDecimal shFlatCopperUpper;
  65 +
  66 + @ExcelProperty(value = {"上海有色", "平水铜", "下限"}, index = 17)
  67 + private BigDecimal shFlatCopperLower;
  68 +
  69 + @ExcelProperty(value = {"上海有色", "平水铜", "均价"}, index = 18)
  70 + private BigDecimal shFlatCopperAvg;
  71 +
  72 + @ExcelProperty(value = {"上海有色", "0#锌锭", "上限"}, index = 19)
  73 + private BigDecimal shZinc0Upper;
  74 +
  75 + @ExcelProperty(value = {"上海有色", "0#锌锭", "下限"}, index = 20)
  76 + private BigDecimal shZinc0Lower;
  77 +
  78 + @ExcelProperty(value = {"上海有色", "0#锌锭", "均价"}, index = 21)
  79 + private BigDecimal shZinc0Avg;
  80 +
  81 + @ExcelProperty(value = {"上海有色", "1#锌锭", "上限"}, index = 22)
  82 + private BigDecimal shZinc1Upper;
  83 +
  84 + @ExcelProperty(value = {"上海有色", "1#锌锭", "下限"}, index = 23)
  85 + private BigDecimal shZinc1Lower;
  86 +
  87 + @ExcelProperty(value = {"上海有色", "1#锌锭", "均价"}, index = 24)
  88 + private BigDecimal shZinc1Avg;
  89 +
  90 + public BaseDataOnlinePriceExportModel() {
  91 + }
  92 +
  93 + public BaseDataOnlinePriceExportModel(BaseDataOnlinePrice dto) {
  94 + super(dto);
  95 + }
  96 +
  97 + @Override
  98 + protected void afterInit(BaseDataOnlinePrice dto) {
  99 + this.recordDate = dto.getRecordDate() == null ? "" : dto.getRecordDate().toString();
  100 +
  101 + this.cjCopper1Upper = scale4(dto.getCjCopper1Upper());
  102 + this.cjCopper1Lower = scale4(dto.getCjCopper1Lower());
  103 + this.cjCopper1Avg = scale4(dto.getCjCopper1Avg());
  104 + this.cjZinc0Upper = scale4(dto.getCjZinc0Upper());
  105 + this.cjZinc0Lower = scale4(dto.getCjZinc0Lower());
  106 + this.cjZinc0Avg = scale4(dto.getCjZinc0Avg());
  107 + this.cjZinc1Upper = scale4(dto.getCjZinc1Upper());
  108 + this.cjZinc1Lower = scale4(dto.getCjZinc1Lower());
  109 + this.cjZinc1Avg = scale4(dto.getCjZinc1Avg());
  110 + this.shCopper1Upper = scale4(dto.getShCopper1Upper());
  111 + this.shCopper1Lower = scale4(dto.getShCopper1Lower());
  112 + this.shCopper1Avg = scale4(dto.getShCopper1Avg());
  113 + this.shCopper1PremiumUpper = scale4(dto.getShCopper1PremiumUpper());
  114 + this.shCopper1PremiumLower = scale4(dto.getShCopper1PremiumLower());
  115 + this.shCopper1PremiumAvg = scale4(dto.getShCopper1PremiumAvg());
  116 + this.shFlatCopperUpper = scale4(dto.getShFlatCopperUpper());
  117 + this.shFlatCopperLower = scale4(dto.getShFlatCopperLower());
  118 + this.shFlatCopperAvg = scale4(dto.getShFlatCopperAvg());
  119 + this.shZinc0Upper = scale4(dto.getShZinc0Upper());
  120 + this.shZinc0Lower = scale4(dto.getShZinc0Lower());
  121 + this.shZinc0Avg = scale4(dto.getShZinc0Avg());
  122 + this.shZinc1Upper = scale4(dto.getShZinc1Upper());
  123 + this.shZinc1Lower = scale4(dto.getShZinc1Lower());
  124 + this.shZinc1Avg = scale4(dto.getShZinc1Avg());
  125 + }
  126 +
  127 + private BigDecimal scale4(BigDecimal val) {
  128 + if (val == null) {
  129 + return null;
  130 + }
  131 + return val.setScale(4, RoundingMode.HALF_UP);
  132 + }
  133 +}
... ...
  1 +package com.lframework.xingyun.basedata.excel.onlinePrice;
  2 +
  3 +import com.alibaba.excel.context.AnalysisContext;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  6 +import com.lframework.starter.common.utils.StringUtil;
  7 +import com.lframework.starter.web.core.components.excel.ExcelImportListener;
  8 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  9 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  10 +import com.lframework.xingyun.basedata.service.onlinePrice.BaseDataOnlinePriceService;
  11 +import com.lframework.xingyun.basedata.vo.onlinePrice.CreateBaseDataOnlinePriceVo;
  12 +import com.lframework.xingyun.basedata.vo.onlinePrice.UpdateBaseDataOnlinePriceVo;
  13 +import java.math.BigDecimal;
  14 +import java.time.LocalDate;
  15 +import java.time.format.DateTimeFormatter;
  16 +import java.util.ArrayList;
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +import lombok.extern.slf4j.Slf4j;
  21 +
  22 +@Slf4j
  23 +public class BaseDataOnlinePriceImportListener
  24 + extends ExcelImportListener<BaseDataOnlinePriceImportModel> {
  25 +
  26 + private final Map<String, Integer> recordDateRowMap = new HashMap<>();
  27 +
  28 + @Override
  29 + public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
  30 + }
  31 +
  32 + @Override
  33 + public void invokeHead(Map<Integer, com.alibaba.excel.metadata.CellData> headMap, AnalysisContext context) {
  34 + }
  35 +
  36 + @Override
  37 + protected void doInvoke(BaseDataOnlinePriceImportModel data, AnalysisContext context) {
  38 + int rowIndex = context.readRowHolder().getRowIndex() + 1;
  39 +
  40 + if (StringUtil.isNotBlank(data.getRecordDate())) {
  41 + data.setRecordDate(data.getRecordDate().trim());
  42 + }
  43 +
  44 + data.setRecordDateValue(parseDate(data.getRecordDate(), rowIndex));
  45 +
  46 + String dateKey = data.getRecordDateValue().toString();
  47 + if (recordDateRowMap.containsKey(dateKey)) {
  48 + throw new DefaultClientException(
  49 + "第" + rowIndex + "行“日期”与第" + recordDateRowMap.get(dateKey) + "行重复,同一天只能导入一条记录");
  50 + }
  51 + recordDateRowMap.put(dateKey, rowIndex);
  52 +
  53 + data.setCjCopper1UpperValue(parsePriceOrNull(data.getCjCopper1Upper(), "长江现货-1#电铜-上限", rowIndex));
  54 + data.setCjCopper1LowerValue(parsePriceOrNull(data.getCjCopper1Lower(), "长江现货-1#电铜-下限", rowIndex));
  55 + data.setCjCopper1AvgValue(parsePriceOrNull(data.getCjCopper1Avg(), "长江现货-1#电铜-均价", rowIndex));
  56 + data.setCjZinc0UpperValue(parsePriceOrNull(data.getCjZinc0Upper(), "长江现货-0#锌锭-上限", rowIndex));
  57 + data.setCjZinc0LowerValue(parsePriceOrNull(data.getCjZinc0Lower(), "长江现货-0#锌锭-下限", rowIndex));
  58 + data.setCjZinc0AvgValue(parsePriceOrNull(data.getCjZinc0Avg(), "长江现货-0#锌锭-均价", rowIndex));
  59 + data.setCjZinc1UpperValue(parsePriceOrNull(data.getCjZinc1Upper(), "长江现货-1#锌锭-上限", rowIndex));
  60 + data.setCjZinc1LowerValue(parsePriceOrNull(data.getCjZinc1Lower(), "长江现货-1#锌锭-下限", rowIndex));
  61 + data.setCjZinc1AvgValue(parsePriceOrNull(data.getCjZinc1Avg(), "长江现货-1#锌锭-均价", rowIndex));
  62 + data.setShCopper1UpperValue(parsePriceOrNull(data.getShCopper1Upper(), "上海有色-1#电铜-上限", rowIndex));
  63 + data.setShCopper1LowerValue(parsePriceOrNull(data.getShCopper1Lower(), "上海有色-1#电铜-下限", rowIndex));
  64 + data.setShCopper1AvgValue(parsePriceOrNull(data.getShCopper1Avg(), "上海有色-1#电铜-均价", rowIndex));
  65 + data.setShCopper1PremiumUpperValue(
  66 + parsePriceOrNull(data.getShCopper1PremiumUpper(), "上海有色-1#电铜升贴水-上限", rowIndex));
  67 + data.setShCopper1PremiumLowerValue(
  68 + parsePriceOrNull(data.getShCopper1PremiumLower(), "上海有色-1#电铜升贴水-下限", rowIndex));
  69 + data.setShCopper1PremiumAvgValue(
  70 + parsePriceOrNull(data.getShCopper1PremiumAvg(), "上海有色-1#电铜升贴水-均价", rowIndex));
  71 + data.setShFlatCopperUpperValue(parsePriceOrNull(data.getShFlatCopperUpper(), "上海有色-平水铜-上限", rowIndex));
  72 + data.setShFlatCopperLowerValue(parsePriceOrNull(data.getShFlatCopperLower(), "上海有色-平水铜-下限", rowIndex));
  73 + data.setShFlatCopperAvgValue(parsePriceOrNull(data.getShFlatCopperAvg(), "上海有色-平水铜-均价", rowIndex));
  74 + data.setShZinc0UpperValue(parsePriceOrNull(data.getShZinc0Upper(), "上海有色-0#锌锭-上限", rowIndex));
  75 + data.setShZinc0LowerValue(parsePriceOrNull(data.getShZinc0Lower(), "上海有色-0#锌锭-下限", rowIndex));
  76 + data.setShZinc0AvgValue(parsePriceOrNull(data.getShZinc0Avg(), "上海有色-0#锌锭-均价", rowIndex));
  77 + data.setShZinc1UpperValue(parsePriceOrNull(data.getShZinc1Upper(), "上海有色-1#锌锭-上限", rowIndex));
  78 + data.setShZinc1LowerValue(parsePriceOrNull(data.getShZinc1Lower(), "上海有色-1#锌锭-下限", rowIndex));
  79 + data.setShZinc1AvgValue(parsePriceOrNull(data.getShZinc1Avg(), "上海有色-1#锌锭-均价", rowIndex));
  80 + }
  81 +
  82 + @Override
  83 + protected void afterAllAnalysed(AnalysisContext context) {
  84 + BaseDataOnlinePriceService service = ApplicationUtil.getBean(BaseDataOnlinePriceService.class);
  85 + List<BaseDataOnlinePriceImportModel> datas = this.getDatas();
  86 + if (datas.isEmpty()) {
  87 + return;
  88 + }
  89 +
  90 + List<LocalDate> dateList = new ArrayList<>(datas.size());
  91 + for (BaseDataOnlinePriceImportModel m : datas) {
  92 + dateList.add(m.getRecordDateValue());
  93 + }
  94 + Map<LocalDate, String> existsDateToIdMap = new HashMap<>();
  95 + List<BaseDataOnlinePrice> existsList = service.list(
  96 + Wrappers.lambdaQuery(BaseDataOnlinePrice.class)
  97 + .in(BaseDataOnlinePrice::getRecordDate, dateList));
  98 + for (BaseDataOnlinePrice e : existsList) {
  99 + existsDateToIdMap.put(e.getRecordDate(), e.getId());
  100 + }
  101 +
  102 + for (int i = 0; i < datas.size(); i++) {
  103 + BaseDataOnlinePriceImportModel m = datas.get(i);
  104 + LocalDate recordDate = m.getRecordDateValue();
  105 + String existsId = existsDateToIdMap.get(recordDate);
  106 +
  107 + if (StringUtil.isBlank(existsId)) {
  108 + CreateBaseDataOnlinePriceVo vo = new CreateBaseDataOnlinePriceVo();
  109 + vo.setRecordDate(recordDate);
  110 + vo.setCjCopper1Upper(m.getCjCopper1UpperValue());
  111 + vo.setCjCopper1Lower(m.getCjCopper1LowerValue());
  112 + vo.setCjCopper1Avg(m.getCjCopper1AvgValue());
  113 + vo.setCjZinc0Upper(m.getCjZinc0UpperValue());
  114 + vo.setCjZinc0Lower(m.getCjZinc0LowerValue());
  115 + vo.setCjZinc0Avg(m.getCjZinc0AvgValue());
  116 + vo.setCjZinc1Upper(m.getCjZinc1UpperValue());
  117 + vo.setCjZinc1Lower(m.getCjZinc1LowerValue());
  118 + vo.setCjZinc1Avg(m.getCjZinc1AvgValue());
  119 + vo.setShCopper1Upper(m.getShCopper1UpperValue());
  120 + vo.setShCopper1Lower(m.getShCopper1LowerValue());
  121 + vo.setShCopper1Avg(m.getShCopper1AvgValue());
  122 + vo.setShCopper1PremiumUpper(m.getShCopper1PremiumUpperValue());
  123 + vo.setShCopper1PremiumLower(m.getShCopper1PremiumLowerValue());
  124 + vo.setShCopper1PremiumAvg(m.getShCopper1PremiumAvgValue());
  125 + vo.setShFlatCopperUpper(m.getShFlatCopperUpperValue());
  126 + vo.setShFlatCopperLower(m.getShFlatCopperLowerValue());
  127 + vo.setShFlatCopperAvg(m.getShFlatCopperAvgValue());
  128 + vo.setShZinc0Upper(m.getShZinc0UpperValue());
  129 + vo.setShZinc0Lower(m.getShZinc0LowerValue());
  130 + vo.setShZinc0Avg(m.getShZinc0AvgValue());
  131 + vo.setShZinc1Upper(m.getShZinc1UpperValue());
  132 + vo.setShZinc1Lower(m.getShZinc1LowerValue());
  133 + vo.setShZinc1Avg(m.getShZinc1AvgValue());
  134 + service.create(vo);
  135 + } else {
  136 + UpdateBaseDataOnlinePriceVo vo = new UpdateBaseDataOnlinePriceVo();
  137 + vo.setId(existsId);
  138 + vo.setRecordDate(recordDate);
  139 + vo.setCjCopper1Upper(m.getCjCopper1UpperValue());
  140 + vo.setCjCopper1Lower(m.getCjCopper1LowerValue());
  141 + vo.setCjCopper1Avg(m.getCjCopper1AvgValue());
  142 + vo.setCjZinc0Upper(m.getCjZinc0UpperValue());
  143 + vo.setCjZinc0Lower(m.getCjZinc0LowerValue());
  144 + vo.setCjZinc0Avg(m.getCjZinc0AvgValue());
  145 + vo.setCjZinc1Upper(m.getCjZinc1UpperValue());
  146 + vo.setCjZinc1Lower(m.getCjZinc1LowerValue());
  147 + vo.setCjZinc1Avg(m.getCjZinc1AvgValue());
  148 + vo.setShCopper1Upper(m.getShCopper1UpperValue());
  149 + vo.setShCopper1Lower(m.getShCopper1LowerValue());
  150 + vo.setShCopper1Avg(m.getShCopper1AvgValue());
  151 + vo.setShCopper1PremiumUpper(m.getShCopper1PremiumUpperValue());
  152 + vo.setShCopper1PremiumLower(m.getShCopper1PremiumLowerValue());
  153 + vo.setShCopper1PremiumAvg(m.getShCopper1PremiumAvgValue());
  154 + vo.setShFlatCopperUpper(m.getShFlatCopperUpperValue());
  155 + vo.setShFlatCopperLower(m.getShFlatCopperLowerValue());
  156 + vo.setShFlatCopperAvg(m.getShFlatCopperAvgValue());
  157 + vo.setShZinc0Upper(m.getShZinc0UpperValue());
  158 + vo.setShZinc0Lower(m.getShZinc0LowerValue());
  159 + vo.setShZinc0Avg(m.getShZinc0AvgValue());
  160 + vo.setShZinc1Upper(m.getShZinc1UpperValue());
  161 + vo.setShZinc1Lower(m.getShZinc1LowerValue());
  162 + vo.setShZinc1Avg(m.getShZinc1AvgValue());
  163 + service.update(vo);
  164 + }
  165 + this.setSuccessProcess(i);
  166 + }
  167 + }
  168 +
  169 + @Override
  170 + protected void doComplete() {
  171 + }
  172 +
  173 + private LocalDate parseDate(String value, int rowIndex) {
  174 + if (StringUtil.isBlank(value)) {
  175 + throw new DefaultClientException("第" + rowIndex + "行“日期”不能为空");
  176 + }
  177 + String cleaned = value.trim();
  178 +
  179 + String normalized = cleaned.replace('/', '-').replace('.', '-');
  180 + String[] parts = normalized.split("-");
  181 + if (parts.length == 3) {
  182 + try {
  183 + int y = Integer.parseInt(parts[0]);
  184 + int m = Integer.parseInt(parts[1]);
  185 + int d = Integer.parseInt(parts[2]);
  186 + return LocalDate.of(y, m, d);
  187 + } catch (Exception ignored) {
  188 + }
  189 + }
  190 +
  191 + if (cleaned.matches("\\d{8}")) {
  192 + try {
  193 + return LocalDate.parse(cleaned, DateTimeFormatter.ofPattern("yyyyMMdd"));
  194 + } catch (Exception ignored) {
  195 + }
  196 + }
  197 + if (cleaned.matches("\\d{7}")) {
  198 + try {
  199 + int y = Integer.parseInt(cleaned.substring(0, 4));
  200 + int m = Integer.parseInt(cleaned.substring(4, 5));
  201 + int d = Integer.parseInt(cleaned.substring(5, 7));
  202 + return LocalDate.of(y, m, d);
  203 + } catch (Exception ignored) {
  204 + }
  205 + }
  206 + if (cleaned.matches("\\d{6}")) {
  207 + try {
  208 + int y = Integer.parseInt(cleaned.substring(0, 4));
  209 + int m = Integer.parseInt(cleaned.substring(4, 5));
  210 + int d = Integer.parseInt(cleaned.substring(5, 6));
  211 + return LocalDate.of(y, m, d);
  212 + } catch (Exception ignored) {
  213 + }
  214 + }
  215 +
  216 + throw new DefaultClientException(
  217 + "第" + rowIndex + "行“日期”格式有误,支持 yyyy-MM-dd、yyyy/MM/dd、yyyyMMdd 以及单双位月日的日期格式");
  218 + }
  219 +
  220 + private BigDecimal parsePriceOrNull(String value, String fieldName, int rowIndex) {
  221 + if (StringUtil.isBlank(value)) {
  222 + return null;
  223 + }
  224 + String cleaned = value.trim();
  225 + BigDecimal decimal;
  226 + try {
  227 + decimal = new BigDecimal(cleaned);
  228 + } catch (NumberFormatException e) {
  229 + throw new DefaultClientException("第" + rowIndex + "行“" + fieldName + "”格式有误,必须是有效数字");
  230 + }
  231 + BigDecimal normalized = decimal.stripTrailingZeros();
  232 + int scale = Math.max(normalized.scale(), 0);
  233 + if (scale > 4) {
  234 + throw new DefaultClientException(
  235 + "第" + rowIndex + "行“" + fieldName + "”最多允许4位小数");
  236 + }
  237 + return decimal;
  238 + }
  239 +}
... ...
  1 +package com.lframework.xingyun.basedata.excel.onlinePrice;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelIgnore;
  4 +import com.alibaba.excel.annotation.ExcelProperty;
  5 +import com.lframework.starter.web.core.annotations.excel.ExcelRequired;
  6 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import java.math.BigDecimal;
  9 +import java.time.LocalDate;
  10 +
  11 +import lombok.Data;
  12 +
  13 +@Data
  14 +public class BaseDataOnlinePriceImportModel implements ExcelModel {
  15 +
  16 + @ExcelRequired
  17 + @ApiModelProperty("日期")
  18 + @ExcelProperty(value = {"日期", "日期", "日期"}, index = 0)
  19 + private String recordDate;
  20 +
  21 + @ApiModelProperty("长江现货_1#电铜_上限")
  22 + @ExcelProperty(value = {"长江现货", "1#电铜", "上限"}, index = 1)
  23 + private String cjCopper1Upper;
  24 +
  25 + @ApiModelProperty("长江现货_1#电铜_下限")
  26 + @ExcelProperty(value = {"长江现货", "1#电铜", "下限"}, index = 2)
  27 + private String cjCopper1Lower;
  28 +
  29 + @ApiModelProperty("长江现货_1#电铜_均价")
  30 + @ExcelProperty(value = {"长江现货", "1#电铜", "均价"}, index = 3)
  31 + private String cjCopper1Avg;
  32 +
  33 + @ApiModelProperty("长江现货_0#锌锭_上限")
  34 + @ExcelProperty(value = {"长江现货", "0#锌锭", "上限"}, index = 4)
  35 + private String cjZinc0Upper;
  36 +
  37 + @ApiModelProperty("长江现货_0#锌锭_下限")
  38 + @ExcelProperty(value = {"长江现货", "0#锌锭", "下限"}, index = 5)
  39 + private String cjZinc0Lower;
  40 +
  41 + @ApiModelProperty("长江现货_0#锌锭_均价")
  42 + @ExcelProperty(value = {"长江现货", "0#锌锭", "均价"}, index = 6)
  43 + private String cjZinc0Avg;
  44 +
  45 + @ApiModelProperty("长江现货_1#锌锭_上限")
  46 + @ExcelProperty(value = {"长江现货", "1#锌锭", "上限"}, index = 7)
  47 + private String cjZinc1Upper;
  48 +
  49 + @ApiModelProperty("长江现货_1#锌锭_下限")
  50 + @ExcelProperty(value = {"长江现货", "1#锌锭", "下限"}, index = 8)
  51 + private String cjZinc1Lower;
  52 +
  53 + @ApiModelProperty("长江现货_1#锌锭_均价")
  54 + @ExcelProperty(value = {"长江现货", "1#锌锭", "均价"}, index = 9)
  55 + private String cjZinc1Avg;
  56 +
  57 + @ApiModelProperty("上海有色_1#电铜_上限")
  58 + @ExcelProperty(value = {"上海有色", "1#电铜", "上限"}, index = 10)
  59 + private String shCopper1Upper;
  60 +
  61 + @ApiModelProperty("上海有色_1#电铜_下限")
  62 + @ExcelProperty(value = {"上海有色", "1#电铜", "下限"}, index = 11)
  63 + private String shCopper1Lower;
  64 +
  65 + @ApiModelProperty("上海有色_1#电铜_均价")
  66 + @ExcelProperty(value = {"上海有色", "1#电铜", "均价"}, index = 12)
  67 + private String shCopper1Avg;
  68 +
  69 + @ApiModelProperty("上海有色_1#电铜升贴水_上限")
  70 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "上限"}, index = 13)
  71 + private String shCopper1PremiumUpper;
  72 +
  73 + @ApiModelProperty("上海有色_1#电铜升贴水_下限")
  74 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "下限"}, index = 14)
  75 + private String shCopper1PremiumLower;
  76 +
  77 + @ApiModelProperty("上海有色_1#电铜升贴水_均价")
  78 + @ExcelProperty(value = {"上海有色", "1#电铜升贴水", "均价"}, index = 15)
  79 + private String shCopper1PremiumAvg;
  80 +
  81 + @ApiModelProperty("上海有色_平水铜_上限")
  82 + @ExcelProperty(value = {"上海有色", "平水铜", "上限"}, index = 16)
  83 + private String shFlatCopperUpper;
  84 +
  85 + @ApiModelProperty("上海有色_平水铜_下限")
  86 + @ExcelProperty(value = {"上海有色", "平水铜", "下限"}, index = 17)
  87 + private String shFlatCopperLower;
  88 +
  89 + @ApiModelProperty("上海有色_平水铜_均价")
  90 + @ExcelProperty(value = {"上海有色", "平水铜", "均价"}, index = 18)
  91 + private String shFlatCopperAvg;
  92 +
  93 + @ApiModelProperty("上海有色_0#锌锭_上限")
  94 + @ExcelProperty(value = {"上海有色", "0#锌锭", "上限"}, index = 19)
  95 + private String shZinc0Upper;
  96 +
  97 + @ApiModelProperty("上海有色_0#锌锭_下限")
  98 + @ExcelProperty(value = {"上海有色", "0#锌锭", "下限"}, index = 20)
  99 + private String shZinc0Lower;
  100 +
  101 + @ApiModelProperty("上海有色_0#锌锭_均价")
  102 + @ExcelProperty(value = {"上海有色", "0#锌锭", "均价"}, index = 21)
  103 + private String shZinc0Avg;
  104 +
  105 + @ApiModelProperty("上海有色_1#锌锭_上限")
  106 + @ExcelProperty(value = {"上海有色", "1#锌锭", "上限"}, index = 22)
  107 + private String shZinc1Upper;
  108 +
  109 + @ApiModelProperty("上海有色_1#锌锭_下限")
  110 + @ExcelProperty(value = {"上海有色", "1#锌锭", "下限"}, index = 23)
  111 + private String shZinc1Lower;
  112 +
  113 + @ApiModelProperty("上海有色_1#锌锭_均价")
  114 + @ExcelProperty(value = {"上海有色", "1#锌锭", "均价"}, index = 24)
  115 + private String shZinc1Avg;
  116 +
  117 + @ExcelIgnore
  118 + private LocalDate recordDateValue;
  119 +
  120 + @ExcelIgnore
  121 + private BigDecimal cjCopper1UpperValue;
  122 + @ExcelIgnore
  123 + private BigDecimal cjCopper1LowerValue;
  124 + @ExcelIgnore
  125 + private BigDecimal cjCopper1AvgValue;
  126 + @ExcelIgnore
  127 + private BigDecimal cjZinc0UpperValue;
  128 + @ExcelIgnore
  129 + private BigDecimal cjZinc0LowerValue;
  130 + @ExcelIgnore
  131 + private BigDecimal cjZinc0AvgValue;
  132 + @ExcelIgnore
  133 + private BigDecimal cjZinc1UpperValue;
  134 + @ExcelIgnore
  135 + private BigDecimal cjZinc1LowerValue;
  136 + @ExcelIgnore
  137 + private BigDecimal cjZinc1AvgValue;
  138 + @ExcelIgnore
  139 + private BigDecimal shCopper1UpperValue;
  140 + @ExcelIgnore
  141 + private BigDecimal shCopper1LowerValue;
  142 + @ExcelIgnore
  143 + private BigDecimal shCopper1AvgValue;
  144 + @ExcelIgnore
  145 + private BigDecimal shCopper1PremiumUpperValue;
  146 + @ExcelIgnore
  147 + private BigDecimal shCopper1PremiumLowerValue;
  148 + @ExcelIgnore
  149 + private BigDecimal shCopper1PremiumAvgValue;
  150 + @ExcelIgnore
  151 + private BigDecimal shFlatCopperUpperValue;
  152 + @ExcelIgnore
  153 + private BigDecimal shFlatCopperLowerValue;
  154 + @ExcelIgnore
  155 + private BigDecimal shFlatCopperAvgValue;
  156 + @ExcelIgnore
  157 + private BigDecimal shZinc0UpperValue;
  158 + @ExcelIgnore
  159 + private BigDecimal shZinc0LowerValue;
  160 + @ExcelIgnore
  161 + private BigDecimal shZinc0AvgValue;
  162 + @ExcelIgnore
  163 + private BigDecimal shZinc1UpperValue;
  164 + @ExcelIgnore
  165 + private BigDecimal shZinc1LowerValue;
  166 + @ExcelIgnore
  167 + private BigDecimal shZinc1AvgValue;
  168 +}
... ...
  1 +package com.lframework.xingyun.basedata.excel.onlinePrice;
  2 +
  3 +import com.alibaba.excel.metadata.Head;
  4 +import com.alibaba.excel.write.merge.AbstractMergeStrategy;
  5 +import org.apache.poi.ss.usermodel.Cell;
  6 +import org.apache.poi.ss.usermodel.Sheet;
  7 +
  8 +public class NoAutoMergeStrategy extends AbstractMergeStrategy {
  9 +
  10 + @Override
  11 + protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
  12 + }
  13 +}
... ...
  1 +package com.lframework.xingyun.basedata.impl.onlinePrice;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  7 +import com.lframework.starter.web.core.utils.PageResultUtil;
  8 +import com.lframework.starter.web.core.components.resp.PageResult;
  9 +import com.lframework.starter.web.core.utils.OpLogUtil;
  10 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  11 +import java.io.Serializable;
  12 +import com.lframework.starter.web.core.utils.IdUtil;
  13 +import com.lframework.starter.common.utils.ObjectUtil;
  14 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  15 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  16 +import com.lframework.starter.common.utils.Assert;
  17 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  18 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  19 +import com.lframework.xingyun.basedata.mappers.BaseDataOnlinePriceMapper;
  20 +import com.lframework.xingyun.basedata.service.onlinePrice.BaseDataOnlinePriceService;
  21 +import com.lframework.xingyun.basedata.vo.onlinePrice.CreateBaseDataOnlinePriceVo;
  22 +import com.lframework.xingyun.basedata.vo.onlinePrice.QueryBaseDataOnlinePriceVo;
  23 +import com.lframework.xingyun.basedata.vo.onlinePrice.UpdateBaseDataOnlinePriceVo;
  24 +import org.springframework.transaction.annotation.Transactional;
  25 +import org.springframework.stereotype.Service;
  26 +import java.util.List;
  27 +
  28 +@Service
  29 +public class BaseDataOnlinePriceServiceImpl extends BaseMpServiceImpl<BaseDataOnlinePriceMapper, BaseDataOnlinePrice> implements BaseDataOnlinePriceService {
  30 +
  31 + @Override
  32 + public PageResult<BaseDataOnlinePrice> query(Integer pageIndex, Integer pageSize, QueryBaseDataOnlinePriceVo vo) {
  33 +
  34 + Assert.greaterThanZero(pageIndex);
  35 + Assert.greaterThanZero(pageSize);
  36 +
  37 + PageHelperUtil.startPage(pageIndex, pageSize);
  38 + List<BaseDataOnlinePrice> datas = this.query(vo);
  39 +
  40 + return PageResultUtil.convert(new PageInfo<>(datas));
  41 + }
  42 +
  43 + @Override
  44 + public List<BaseDataOnlinePrice> query(QueryBaseDataOnlinePriceVo vo) {
  45 +
  46 + return getBaseMapper().query(vo);
  47 + }
  48 +
  49 + @Override
  50 + public BaseDataOnlinePrice findById(String id) {
  51 +
  52 + return getBaseMapper().selectById(id);
  53 + }
  54 +
  55 + @OpLog(type = OtherOpLogType.class, name = "新增基础网价表,ID:{}", params = {"#id"})
  56 + @Transactional(rollbackFor = Exception.class)
  57 + @Override
  58 + public String create(CreateBaseDataOnlinePriceVo vo) {
  59 +
  60 + BaseDataOnlinePrice data = new BaseDataOnlinePrice();
  61 + data.setId(IdUtil.getId());
  62 + data.setRecordDate(vo.getRecordDate());
  63 + data.setCjCopper1Upper(vo.getCjCopper1Upper());
  64 + data.setCjCopper1Lower(vo.getCjCopper1Lower());
  65 + data.setCjCopper1Avg(vo.getCjCopper1Avg());
  66 + data.setCjZinc0Upper(vo.getCjZinc0Upper());
  67 + data.setCjZinc0Lower(vo.getCjZinc0Lower());
  68 + data.setCjZinc0Avg(vo.getCjZinc0Avg());
  69 + data.setCjZinc1Upper(vo.getCjZinc1Upper());
  70 + data.setCjZinc1Lower(vo.getCjZinc1Lower());
  71 + data.setCjZinc1Avg(vo.getCjZinc1Avg());
  72 + data.setShCopper1Upper(vo.getShCopper1Upper());
  73 + data.setShCopper1Lower(vo.getShCopper1Lower());
  74 + data.setShCopper1Avg(vo.getShCopper1Avg());
  75 + data.setShCopper1PremiumUpper(vo.getShCopper1PremiumUpper());
  76 + data.setShCopper1PremiumLower(vo.getShCopper1PremiumLower());
  77 + data.setShCopper1PremiumAvg(vo.getShCopper1PremiumAvg());
  78 + data.setShFlatCopperUpper(vo.getShFlatCopperUpper());
  79 + data.setShFlatCopperLower(vo.getShFlatCopperLower());
  80 + data.setShFlatCopperAvg(vo.getShFlatCopperAvg());
  81 + data.setShZinc0Upper(vo.getShZinc0Upper());
  82 + data.setShZinc0Lower(vo.getShZinc0Lower());
  83 + data.setShZinc0Avg(vo.getShZinc0Avg());
  84 + data.setShZinc1Upper(vo.getShZinc1Upper());
  85 + data.setShZinc1Lower(vo.getShZinc1Lower());
  86 + data.setShZinc1Avg(vo.getShZinc1Avg());
  87 +
  88 + getBaseMapper().insert(data);
  89 +
  90 + OpLogUtil.setVariable("id", data.getId());
  91 + OpLogUtil.setExtra(vo);
  92 +
  93 + return data.getId();
  94 + }
  95 +
  96 + @OpLog(type = OtherOpLogType.class, name = "修改基础网价表,ID:{}", params = {"#id"})
  97 + @Transactional(rollbackFor = Exception.class)
  98 + @Override
  99 + public void update(UpdateBaseDataOnlinePriceVo vo) {
  100 +
  101 + BaseDataOnlinePrice data = getBaseMapper().selectById(vo.getId());
  102 + if (ObjectUtil.isNull(data)) {
  103 + throw new DefaultClientException("基础网价表不存在!");
  104 + }
  105 +
  106 + LambdaUpdateWrapper<BaseDataOnlinePrice> updateWrapper = Wrappers.lambdaUpdate(BaseDataOnlinePrice.class)
  107 + .set(BaseDataOnlinePrice::getRecordDate, vo.getRecordDate())
  108 + .set(BaseDataOnlinePrice::getCjCopper1Upper, vo.getCjCopper1Upper())
  109 + .set(BaseDataOnlinePrice::getCjCopper1Lower, vo.getCjCopper1Lower())
  110 + .set(BaseDataOnlinePrice::getCjCopper1Avg, vo.getCjCopper1Avg())
  111 + .set(BaseDataOnlinePrice::getCjZinc0Upper, vo.getCjZinc0Upper())
  112 + .set(BaseDataOnlinePrice::getCjZinc0Lower, vo.getCjZinc0Lower())
  113 + .set(BaseDataOnlinePrice::getCjZinc0Avg, vo.getCjZinc0Avg())
  114 + .set(BaseDataOnlinePrice::getCjZinc1Upper, vo.getCjZinc1Upper())
  115 + .set(BaseDataOnlinePrice::getCjZinc1Lower, vo.getCjZinc1Lower())
  116 + .set(BaseDataOnlinePrice::getCjZinc1Avg, vo.getCjZinc1Avg())
  117 + .set(BaseDataOnlinePrice::getShCopper1Upper, vo.getShCopper1Upper())
  118 + .set(BaseDataOnlinePrice::getShCopper1Lower, vo.getShCopper1Lower())
  119 + .set(BaseDataOnlinePrice::getShCopper1Avg, vo.getShCopper1Avg())
  120 + .set(BaseDataOnlinePrice::getShCopper1PremiumUpper, vo.getShCopper1PremiumUpper())
  121 + .set(BaseDataOnlinePrice::getShCopper1PremiumLower, vo.getShCopper1PremiumLower())
  122 + .set(BaseDataOnlinePrice::getShCopper1PremiumAvg, vo.getShCopper1PremiumAvg())
  123 + .set(BaseDataOnlinePrice::getShFlatCopperUpper, vo.getShFlatCopperUpper())
  124 + .set(BaseDataOnlinePrice::getShFlatCopperLower, vo.getShFlatCopperLower())
  125 + .set(BaseDataOnlinePrice::getShFlatCopperAvg, vo.getShFlatCopperAvg())
  126 + .set(BaseDataOnlinePrice::getShZinc0Upper, vo.getShZinc0Upper())
  127 + .set(BaseDataOnlinePrice::getShZinc0Lower, vo.getShZinc0Lower())
  128 + .set(BaseDataOnlinePrice::getShZinc0Avg, vo.getShZinc0Avg())
  129 + .set(BaseDataOnlinePrice::getShZinc1Upper, vo.getShZinc1Upper())
  130 + .set(BaseDataOnlinePrice::getShZinc1Lower, vo.getShZinc1Lower())
  131 + .set(BaseDataOnlinePrice::getShZinc1Avg, vo.getShZinc1Avg())
  132 + .eq(BaseDataOnlinePrice::getId, vo.getId());
  133 +
  134 + getBaseMapper().update(updateWrapper);
  135 +
  136 + OpLogUtil.setVariable("id", data.getId());
  137 + OpLogUtil.setExtra(vo);
  138 + }
  139 +
  140 + @OpLog(type = OtherOpLogType.class, name = "删除基础网价表,ID:{}", params = {"#id"})
  141 + @Transactional(rollbackFor = Exception.class)
  142 + @Override
  143 + public void deleteById(String id) {
  144 +
  145 + getBaseMapper().deleteById(id);
  146 + }
  147 +
  148 + @Override
  149 + public void cleanCacheByKey(Serializable key) {
  150 +
  151 + }
  152 +}
... ...
  1 +package com.lframework.xingyun.basedata.mappers;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice;
  5 +import com.lframework.xingyun.basedata.vo.onlinePrice.QueryBaseDataOnlinePriceVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * <p>
  11 + * 基础网价表 Mapper 接口
  12 + * </p>
  13 + *
  14 + */
  15 +public interface BaseDataOnlinePriceMapper extends BaseMapper<BaseDataOnlinePrice> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + * @param vo
  20 + * @return
  21 + */
  22 + List<BaseDataOnlinePrice> query(@Param("vo") QueryBaseDataOnlinePriceVo vo);
  23 +}
... ...
  1 +package com.lframework.xingyun.basedata.service.onlinePrice;
  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.basedata.entity.BaseDataOnlinePrice;
  6 +import com.lframework.xingyun.basedata.vo.onlinePrice.CreateBaseDataOnlinePriceVo;
  7 +import com.lframework.xingyun.basedata.vo.onlinePrice.QueryBaseDataOnlinePriceVo;
  8 +import com.lframework.xingyun.basedata.vo.onlinePrice.UpdateBaseDataOnlinePriceVo;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 基础网价表 Service
  13 + */
  14 +public interface BaseDataOnlinePriceService extends BaseMpService<BaseDataOnlinePrice> {
  15 +
  16 + /**
  17 + * 查询列表
  18 + * @return
  19 + */
  20 + PageResult<BaseDataOnlinePrice> query(Integer pageIndex, Integer pageSize, QueryBaseDataOnlinePriceVo vo);
  21 +
  22 + /**
  23 + * 查询列表
  24 + * @param vo
  25 + * @return
  26 + */
  27 + List<BaseDataOnlinePrice> query(QueryBaseDataOnlinePriceVo vo);
  28 +
  29 + /**
  30 + * 根据ID查询
  31 + * @param id
  32 + * @return
  33 + */
  34 + BaseDataOnlinePrice findById(String id);
  35 +
  36 + /**
  37 + * 创建
  38 + * @param vo
  39 + * @return
  40 + */
  41 + String create(CreateBaseDataOnlinePriceVo vo);
  42 +
  43 + /**
  44 + * 修改
  45 + * @param vo
  46 + */
  47 + void update(UpdateBaseDataOnlinePriceVo vo);
  48 +
  49 + /**
  50 + * 根据ID删除
  51 + * @param id
  52 + * @return
  53 + */
  54 + void deleteById(String id);
  55 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.onlinePrice;
  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.utils.IdUtil;
  7 +import com.lframework.starter.web.core.vo.BaseVo;
  8 +import javax.validation.constraints.NotNull;
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  11 +import java.io.Serializable;
  12 +import lombok.Data;
  13 +
  14 +@Data
  15 +public class CreateBaseDataOnlinePriceVo implements BaseVo, Serializable {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /**
  20 + * 日期
  21 + */
  22 + @ApiModelProperty(value = "日期", required = true)
  23 + @NotNull(message = "请输入日期!")
  24 + @TypeMismatch(message = "日期格式有误!")
  25 + private LocalDate recordDate;
  26 +
  27 + /**
  28 + * 长江现货-1#电铜-上限
  29 + */
  30 + @ApiModelProperty(value = "长江现货-1#电铜-上限")
  31 + @TypeMismatch(message = "长江现货-1#电铜-上限格式有误!")
  32 + @IsNumberPrecision(message = "长江现货-1#电铜-上限最多允许2位小数!", value = 2)
  33 + private BigDecimal cjCopper1Upper;
  34 +
  35 + /**
  36 + * 长江现货-1#电铜-下限
  37 + */
  38 + @ApiModelProperty(value = "长江现货-1#电铜-下限")
  39 + @TypeMismatch(message = "长江现货-1#电铜-下限格式有误!")
  40 + @IsNumberPrecision(message = "长江现货-1#电铜-下限最多允许2位小数!", value = 2)
  41 + private BigDecimal cjCopper1Lower;
  42 +
  43 + /**
  44 + * 长江现货-1#电铜-均价
  45 + */
  46 + @ApiModelProperty(value = "长江现货-1#电铜-均价")
  47 + @TypeMismatch(message = "长江现货-1#电铜-均价格式有误!")
  48 + @IsNumberPrecision(message = "长江现货-1#电铜-均价最多允许2位小数!", value = 2)
  49 + private BigDecimal cjCopper1Avg;
  50 +
  51 + /**
  52 + * 长江现货-0#锌锭-上限
  53 + */
  54 + @ApiModelProperty(value = "长江现货-0#锌锭-上限")
  55 + @TypeMismatch(message = "长江现货-0#锌锭-上限格式有误!")
  56 + @IsNumberPrecision(message = "长江现货-0#锌锭-上限最多允许2位小数!", value = 2)
  57 + private BigDecimal cjZinc0Upper;
  58 +
  59 + /**
  60 + * 长江现货-0#锌锭-下限
  61 + */
  62 + @ApiModelProperty(value = "长江现货-0#锌锭-下限")
  63 + @TypeMismatch(message = "长江现货-0#锌锭-下限格式有误!")
  64 + @IsNumberPrecision(message = "长江现货-0#锌锭-下限最多允许2位小数!", value = 2)
  65 + private BigDecimal cjZinc0Lower;
  66 +
  67 + /**
  68 + * 长江现货-0#锌锭-均价
  69 + */
  70 + @ApiModelProperty(value = "长江现货-0#锌锭-均价")
  71 + @TypeMismatch(message = "长江现货-0#锌锭-均价格式有误!")
  72 + @IsNumberPrecision(message = "长江现货-0#锌锭-均价最多允许2位小数!", value = 2)
  73 + private BigDecimal cjZinc0Avg;
  74 +
  75 + /**
  76 + * 长江现货-1#锌锭-上限
  77 + */
  78 + @ApiModelProperty(value = "长江现货-1#锌锭-上限")
  79 + @TypeMismatch(message = "长江现货-1#锌锭-上限格式有误!")
  80 + @IsNumberPrecision(message = "长江现货-1#锌锭-上限最多允许2位小数!", value = 2)
  81 + private BigDecimal cjZinc1Upper;
  82 +
  83 + /**
  84 + * 长江现货-1#锌锭-下限
  85 + */
  86 + @ApiModelProperty(value = "长江现货-1#锌锭-下限")
  87 + @TypeMismatch(message = "长江现货-1#锌锭-下限格式有误!")
  88 + @IsNumberPrecision(message = "长江现货-1#锌锭-下限最多允许2位小数!", value = 2)
  89 + private BigDecimal cjZinc1Lower;
  90 +
  91 + /**
  92 + * 长江现货-1#锌锭-均价
  93 + */
  94 + @ApiModelProperty(value = "长江现货-1#锌锭-均价")
  95 + @TypeMismatch(message = "长江现货-1#锌锭-均价格式有误!")
  96 + @IsNumberPrecision(message = "长江现货-1#锌锭-均价最多允许2位小数!", value = 2)
  97 + private BigDecimal cjZinc1Avg;
  98 +
  99 + /**
  100 + * 上海有色-1#电铜-上限
  101 + */
  102 + @ApiModelProperty(value = "上海有色-1#电铜-上限")
  103 + @TypeMismatch(message = "上海有色-1#电铜-上限格式有误!")
  104 + @IsNumberPrecision(message = "上海有色-1#电铜-上限最多允许2位小数!", value = 2)
  105 + private BigDecimal shCopper1Upper;
  106 +
  107 + /**
  108 + * 上海有色-1#电铜-下限
  109 + */
  110 + @ApiModelProperty(value = "上海有色-1#电铜-下限")
  111 + @TypeMismatch(message = "上海有色-1#电铜-下限格式有误!")
  112 + @IsNumberPrecision(message = "上海有色-1#电铜-下限最多允许2位小数!", value = 2)
  113 + private BigDecimal shCopper1Lower;
  114 +
  115 + /**
  116 + * 上海有色-1#电铜-均价
  117 + */
  118 + @ApiModelProperty(value = "上海有色-1#电铜-均价")
  119 + @TypeMismatch(message = "上海有色-1#电铜-均价格式有误!")
  120 + @IsNumberPrecision(message = "上海有色-1#电铜-均价最多允许2位小数!", value = 2)
  121 + private BigDecimal shCopper1Avg;
  122 +
  123 + /**
  124 + * 上海有色-1#电铜升贴水-上限
  125 + */
  126 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-上限")
  127 + @TypeMismatch(message = "上海有色-1#电铜升贴水-上限格式有误!")
  128 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-上限最多允许2位小数!", value = 2)
  129 + private BigDecimal shCopper1PremiumUpper;
  130 +
  131 + /**
  132 + * 上海有色-1#电铜升贴水-下限
  133 + */
  134 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-下限")
  135 + @TypeMismatch(message = "上海有色-1#电铜升贴水-下限格式有误!")
  136 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-下限最多允许2位小数!", value = 2)
  137 + private BigDecimal shCopper1PremiumLower;
  138 +
  139 + /**
  140 + * 上海有色-1#电铜升贴水-均价
  141 + */
  142 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-均价")
  143 + @TypeMismatch(message = "上海有色-1#电铜升贴水-均价格式有误!")
  144 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-均价最多允许2位小数!", value = 2)
  145 + private BigDecimal shCopper1PremiumAvg;
  146 +
  147 + /**
  148 + * 上海有色-平水铜-上限
  149 + */
  150 + @ApiModelProperty(value = "上海有色-平水铜-上限")
  151 + @TypeMismatch(message = "上海有色-平水铜-上限格式有误!")
  152 + @IsNumberPrecision(message = "上海有色-平水铜-上限最多允许2位小数!", value = 2)
  153 + private BigDecimal shFlatCopperUpper;
  154 +
  155 + /**
  156 + * 上海有色-平水铜-下限
  157 + */
  158 + @ApiModelProperty(value = "上海有色-平水铜-下限")
  159 + @TypeMismatch(message = "上海有色-平水铜-下限格式有误!")
  160 + @IsNumberPrecision(message = "上海有色-平水铜-下限最多允许2位小数!", value = 2)
  161 + private BigDecimal shFlatCopperLower;
  162 +
  163 + /**
  164 + * 上海有色-平水铜-均价
  165 + */
  166 + @ApiModelProperty(value = "上海有色-平水铜-均价")
  167 + @TypeMismatch(message = "上海有色-平水铜-均价格式有误!")
  168 + @IsNumberPrecision(message = "上海有色-平水铜-均价最多允许2位小数!", value = 2)
  169 + private BigDecimal shFlatCopperAvg;
  170 +
  171 + /**
  172 + * 上海有色-0#锌锭-上限
  173 + */
  174 + @ApiModelProperty(value = "上海有色-0#锌锭-上限")
  175 + @TypeMismatch(message = "上海有色-0#锌锭-上限格式有误!")
  176 + @IsNumberPrecision(message = "上海有色-0#锌锭-上限最多允许2位小数!", value = 2)
  177 + private BigDecimal shZinc0Upper;
  178 +
  179 + /**
  180 + * 上海有色-0#锌锭-下限
  181 + */
  182 + @ApiModelProperty(value = "上海有色-0#锌锭-下限")
  183 + @TypeMismatch(message = "上海有色-0#锌锭-下限格式有误!")
  184 + @IsNumberPrecision(message = "上海有色-0#锌锭-下限最多允许2位小数!", value = 2)
  185 + private BigDecimal shZinc0Lower;
  186 +
  187 + /**
  188 + * 上海有色-0#锌锭-均价
  189 + */
  190 + @ApiModelProperty(value = "上海有色-0#锌锭-均价")
  191 + @TypeMismatch(message = "上海有色-0#锌锭-均价格式有误!")
  192 + @IsNumberPrecision(message = "上海有色-0#锌锭-均价最多允许2位小数!", value = 2)
  193 + private BigDecimal shZinc0Avg;
  194 +
  195 + /**
  196 + * 上海有色-1#锌锭-上限
  197 + */
  198 + @ApiModelProperty(value = "上海有色-1#锌锭-上限")
  199 + @TypeMismatch(message = "上海有色-1#锌锭-上限格式有误!")
  200 + @IsNumberPrecision(message = "上海有色-1#锌锭-上限最多允许2位小数!", value = 2)
  201 + private BigDecimal shZinc1Upper;
  202 +
  203 + /**
  204 + * 上海有色-1#锌锭-下限
  205 + */
  206 + @ApiModelProperty(value = "上海有色-1#锌锭-下限")
  207 + @TypeMismatch(message = "上海有色-1#锌锭-下限格式有误!")
  208 + @IsNumberPrecision(message = "上海有色-1#锌锭-下限最多允许2位小数!", value = 2)
  209 + private BigDecimal shZinc1Lower;
  210 +
  211 + /**
  212 + * 上海有色-1#锌锭-均价
  213 + */
  214 + @ApiModelProperty(value = "上海有色-1#锌锭-均价")
  215 + @TypeMismatch(message = "上海有色-1#锌锭-均价格式有误!")
  216 + @IsNumberPrecision(message = "上海有色-1#锌锭-均价最多允许2位小数!", value = 2)
  217 + private BigDecimal shZinc1Avg;
  218 +
  219 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.onlinePrice;
  2 +
  3 +import lombok.Data;
  4 +import com.lframework.starter.web.core.vo.PageVo;
  5 +import java.time.LocalDate;
  6 +import com.lframework.starter.web.core.vo.BaseVo;
  7 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import java.io.Serializable;
  10 +import java.util.List;
  11 +
  12 +@Data
  13 +public class QueryBaseDataOnlinePriceVo extends PageVo implements BaseVo, Serializable {
  14 +
  15 + private static final long serialVersionUID = 1L;
  16 +
  17 + /**
  18 + * 日期
  19 + */
  20 + @ApiModelProperty("日期")
  21 + @TypeMismatch(message = "日期格式有误!")
  22 + private LocalDate recordDate;
  23 +
  24 + /**
  25 + * 导出类型
  26 + */
  27 + @ApiModelProperty("导出类型")
  28 + private String exportType;
  29 +
  30 + @ApiModelProperty("选中数据")
  31 + @TypeMismatch(message = "选中数据格式有误!")
  32 + private List<String> idList;
  33 +
  34 +}
... ...
  1 +package com.lframework.xingyun.basedata.vo.onlinePrice;
  2 +
  3 +import lombok.Data;
  4 +import com.lframework.starter.web.core.components.validation.IsNumberPrecision;
  5 +import java.math.BigDecimal;
  6 +import javax.validation.constraints.NotBlank;
  7 +import java.time.LocalDate;
  8 +import com.lframework.starter.web.core.vo.BaseVo;
  9 +import javax.validation.constraints.NotNull;
  10 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  11 +import io.swagger.annotations.ApiModelProperty;
  12 +import java.io.Serializable;
  13 +
  14 +@Data
  15 +public class UpdateBaseDataOnlinePriceVo implements BaseVo, Serializable {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /**
  20 + * 主键ID
  21 + */
  22 + @ApiModelProperty(value = "主键ID", required = true)
  23 + @NotBlank(message = "id不能为空!")
  24 + private String id;
  25 +
  26 + /**
  27 + * 日期
  28 + */
  29 + @ApiModelProperty(value = "日期")
  30 + @TypeMismatch(message = "日期格式有误!")
  31 + @NotNull(message = "请输入日期!")
  32 + private LocalDate recordDate;
  33 +
  34 + /**
  35 + * 长江现货-1#电铜-上限
  36 + */
  37 + @ApiModelProperty(value = "长江现货-1#电铜-上限")
  38 + @TypeMismatch(message = "长江现货-1#电铜-上限格式有误!")
  39 + @IsNumberPrecision(message = "长江现货-1#电铜-上限最多允许2位小数!", value = 2)
  40 + private BigDecimal cjCopper1Upper;
  41 +
  42 + /**
  43 + * 长江现货-1#电铜-下限
  44 + */
  45 + @ApiModelProperty(value = "长江现货-1#电铜-下限")
  46 + @TypeMismatch(message = "长江现货-1#电铜-下限格式有误!")
  47 + @IsNumberPrecision(message = "长江现货-1#电铜-下限最多允许2位小数!", value = 2)
  48 + private BigDecimal cjCopper1Lower;
  49 +
  50 + /**
  51 + * 长江现货-1#电铜-均价
  52 + */
  53 + @ApiModelProperty(value = "长江现货-1#电铜-均价")
  54 + @TypeMismatch(message = "长江现货-1#电铜-均价格式有误!")
  55 + @IsNumberPrecision(message = "长江现货-1#电铜-均价最多允许2位小数!", value = 2)
  56 + private BigDecimal cjCopper1Avg;
  57 +
  58 + /**
  59 + * 长江现货-0#锌锭-上限
  60 + */
  61 + @ApiModelProperty(value = "长江现货-0#锌锭-上限")
  62 + @TypeMismatch(message = "长江现货-0#锌锭-上限格式有误!")
  63 + @IsNumberPrecision(message = "长江现货-0#锌锭-上限最多允许2位小数!", value = 2)
  64 + private BigDecimal cjZinc0Upper;
  65 +
  66 + /**
  67 + * 长江现货-0#锌锭-下限
  68 + */
  69 + @ApiModelProperty(value = "长江现货-0#锌锭-下限")
  70 + @TypeMismatch(message = "长江现货-0#锌锭-下限格式有误!")
  71 + @IsNumberPrecision(message = "长江现货-0#锌锭-下限最多允许2位小数!", value = 2)
  72 + private BigDecimal cjZinc0Lower;
  73 +
  74 + /**
  75 + * 长江现货-0#锌锭-均价
  76 + */
  77 + @ApiModelProperty(value = "长江现货-0#锌锭-均价")
  78 + @TypeMismatch(message = "长江现货-0#锌锭-均价格式有误!")
  79 + @IsNumberPrecision(message = "长江现货-0#锌锭-均价最多允许2位小数!", value = 2)
  80 + private BigDecimal cjZinc0Avg;
  81 +
  82 + /**
  83 + * 长江现货-1#锌锭-上限
  84 + */
  85 + @ApiModelProperty(value = "长江现货-1#锌锭-上限")
  86 + @TypeMismatch(message = "长江现货-1#锌锭-上限格式有误!")
  87 + @IsNumberPrecision(message = "长江现货-1#锌锭-上限最多允许2位小数!", value = 2)
  88 + private BigDecimal cjZinc1Upper;
  89 +
  90 + /**
  91 + * 长江现货-1#锌锭-下限
  92 + */
  93 + @ApiModelProperty(value = "长江现货-1#锌锭-下限")
  94 + @TypeMismatch(message = "长江现货-1#锌锭-下限格式有误!")
  95 + @IsNumberPrecision(message = "长江现货-1#锌锭-下限最多允许2位小数!", value = 2)
  96 + private BigDecimal cjZinc1Lower;
  97 +
  98 + /**
  99 + * 长江现货-1#锌锭-均价
  100 + */
  101 + @ApiModelProperty(value = "长江现货-1#锌锭-均价")
  102 + @TypeMismatch(message = "长江现货-1#锌锭-均价格式有误!")
  103 + @IsNumberPrecision(message = "长江现货-1#锌锭-均价最多允许2位小数!", value = 2)
  104 + private BigDecimal cjZinc1Avg;
  105 +
  106 + /**
  107 + * 上海有色-1#电铜-上限
  108 + */
  109 + @ApiModelProperty(value = "上海有色-1#电铜-上限")
  110 + @TypeMismatch(message = "上海有色-1#电铜-上限格式有误!")
  111 + @IsNumberPrecision(message = "上海有色-1#电铜-上限最多允许2位小数!", value = 2)
  112 + private BigDecimal shCopper1Upper;
  113 +
  114 + /**
  115 + * 上海有色-1#电铜-下限
  116 + */
  117 + @ApiModelProperty(value = "上海有色-1#电铜-下限")
  118 + @TypeMismatch(message = "上海有色-1#电铜-下限格式有误!")
  119 + @IsNumberPrecision(message = "上海有色-1#电铜-下限最多允许2位小数!", value = 2)
  120 + private BigDecimal shCopper1Lower;
  121 +
  122 + /**
  123 + * 上海有色-1#电铜-均价
  124 + */
  125 + @ApiModelProperty(value = "上海有色-1#电铜-均价")
  126 + @TypeMismatch(message = "上海有色-1#电铜-均价格式有误!")
  127 + @IsNumberPrecision(message = "上海有色-1#电铜-均价最多允许2位小数!", value = 2)
  128 + private BigDecimal shCopper1Avg;
  129 +
  130 + /**
  131 + * 上海有色-1#电铜升贴水-上限
  132 + */
  133 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-上限")
  134 + @TypeMismatch(message = "上海有色-1#电铜升贴水-上限格式有误!")
  135 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-上限最多允许2位小数!", value = 2)
  136 + private BigDecimal shCopper1PremiumUpper;
  137 +
  138 + /**
  139 + * 上海有色-1#电铜升贴水-下限
  140 + */
  141 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-下限")
  142 + @TypeMismatch(message = "上海有色-1#电铜升贴水-下限格式有误!")
  143 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-下限最多允许2位小数!", value = 2)
  144 + private BigDecimal shCopper1PremiumLower;
  145 +
  146 + /**
  147 + * 上海有色-1#电铜升贴水-均价
  148 + */
  149 + @ApiModelProperty(value = "上海有色-1#电铜升贴水-均价")
  150 + @TypeMismatch(message = "上海有色-1#电铜升贴水-均价格式有误!")
  151 + @IsNumberPrecision(message = "上海有色-1#电铜升贴水-均价最多允许2位小数!", value = 2)
  152 + private BigDecimal shCopper1PremiumAvg;
  153 +
  154 + /**
  155 + * 上海有色-平水铜-上限
  156 + */
  157 + @ApiModelProperty(value = "上海有色-平水铜-上限")
  158 + @TypeMismatch(message = "上海有色-平水铜-上限格式有误!")
  159 + @IsNumberPrecision(message = "上海有色-平水铜-上限最多允许2位小数!", value = 2)
  160 + private BigDecimal shFlatCopperUpper;
  161 +
  162 + /**
  163 + * 上海有色-平水铜-下限
  164 + */
  165 + @ApiModelProperty(value = "上海有色-平水铜-下限")
  166 + @TypeMismatch(message = "上海有色-平水铜-下限格式有误!")
  167 + @IsNumberPrecision(message = "上海有色-平水铜-下限最多允许2位小数!", value = 2)
  168 + private BigDecimal shFlatCopperLower;
  169 +
  170 + /**
  171 + * 上海有色-平水铜-均价
  172 + */
  173 + @ApiModelProperty(value = "上海有色-平水铜-均价")
  174 + @TypeMismatch(message = "上海有色-平水铜-均价格式有误!")
  175 + @IsNumberPrecision(message = "上海有色-平水铜-均价最多允许2位小数!", value = 2)
  176 + private BigDecimal shFlatCopperAvg;
  177 +
  178 + /**
  179 + * 上海有色-0#锌锭-上限
  180 + */
  181 + @ApiModelProperty(value = "上海有色-0#锌锭-上限")
  182 + @TypeMismatch(message = "上海有色-0#锌锭-上限格式有误!")
  183 + @IsNumberPrecision(message = "上海有色-0#锌锭-上限最多允许2位小数!", value = 2)
  184 + private BigDecimal shZinc0Upper;
  185 +
  186 + /**
  187 + * 上海有色-0#锌锭-下限
  188 + */
  189 + @ApiModelProperty(value = "上海有色-0#锌锭-下限")
  190 + @TypeMismatch(message = "上海有色-0#锌锭-下限格式有误!")
  191 + @IsNumberPrecision(message = "上海有色-0#锌锭-下限最多允许2位小数!", value = 2)
  192 + private BigDecimal shZinc0Lower;
  193 +
  194 + /**
  195 + * 上海有色-0#锌锭-均价
  196 + */
  197 + @ApiModelProperty(value = "上海有色-0#锌锭-均价")
  198 + @TypeMismatch(message = "上海有色-0#锌锭-均价格式有误!")
  199 + @IsNumberPrecision(message = "上海有色-0#锌锭-均价最多允许2位小数!", value = 2)
  200 + private BigDecimal shZinc0Avg;
  201 +
  202 + /**
  203 + * 上海有色-1#锌锭-上限
  204 + */
  205 + @ApiModelProperty(value = "上海有色-1#锌锭-上限")
  206 + @TypeMismatch(message = "上海有色-1#锌锭-上限格式有误!")
  207 + @IsNumberPrecision(message = "上海有色-1#锌锭-上限最多允许2位小数!", value = 2)
  208 + private BigDecimal shZinc1Upper;
  209 +
  210 + /**
  211 + * 上海有色-1#锌锭-下限
  212 + */
  213 + @ApiModelProperty(value = "上海有色-1#锌锭-下限")
  214 + @TypeMismatch(message = "上海有色-1#锌锭-下限格式有误!")
  215 + @IsNumberPrecision(message = "上海有色-1#锌锭-下限最多允许2位小数!", value = 2)
  216 + private BigDecimal shZinc1Lower;
  217 +
  218 + /**
  219 + * 上海有色-1#锌锭-均价
  220 + */
  221 + @ApiModelProperty(value = "上海有色-1#锌锭-均价")
  222 + @TypeMismatch(message = "上海有色-1#锌锭-均价格式有误!")
  223 + @IsNumberPrecision(message = "上海有色-1#锌锭-均价最多允许2位小数!", value = 2)
  224 + private BigDecimal shZinc1Avg;
  225 +
  226 +}
... ...
  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.basedata.mappers.BaseDataOnlinePriceMapper">
  4 +
  5 + <resultMap id="BaseDataOnlinePrice" type="com.lframework.xingyun.basedata.entity.BaseDataOnlinePrice">
  6 + <id column="id" property="id"/>
  7 + <result column="record_date" property="recordDate"/>
  8 + <result column="cj_copper1_upper" property="cjCopper1Upper"/>
  9 + <result column="cj_copper1_lower" property="cjCopper1Lower"/>
  10 + <result column="cj_copper1_avg" property="cjCopper1Avg"/>
  11 + <result column="cj_zinc0_upper" property="cjZinc0Upper"/>
  12 + <result column="cj_zinc0_lower" property="cjZinc0Lower"/>
  13 + <result column="cj_zinc0_avg" property="cjZinc0Avg"/>
  14 + <result column="cj_zinc1_upper" property="cjZinc1Upper"/>
  15 + <result column="cj_zinc1_lower" property="cjZinc1Lower"/>
  16 + <result column="cj_zinc1_avg" property="cjZinc1Avg"/>
  17 + <result column="sh_copper1_upper" property="shCopper1Upper"/>
  18 + <result column="sh_copper1_lower" property="shCopper1Lower"/>
  19 + <result column="sh_copper1_avg" property="shCopper1Avg"/>
  20 + <result column="sh_copper1_premium_upper" property="shCopper1PremiumUpper"/>
  21 + <result column="sh_copper1_premium_lower" property="shCopper1PremiumLower"/>
  22 + <result column="sh_copper1_premium_avg" property="shCopper1PremiumAvg"/>
  23 + <result column="sh_flat_copper_upper" property="shFlatCopperUpper"/>
  24 + <result column="sh_flat_copper_lower" property="shFlatCopperLower"/>
  25 + <result column="sh_flat_copper_avg" property="shFlatCopperAvg"/>
  26 + <result column="sh_zinc0_upper" property="shZinc0Upper"/>
  27 + <result column="sh_zinc0_lower" property="shZinc0Lower"/>
  28 + <result column="sh_zinc0_avg" property="shZinc0Avg"/>
  29 + <result column="sh_zinc1_upper" property="shZinc1Upper"/>
  30 + <result column="sh_zinc1_lower" property="shZinc1Lower"/>
  31 + <result column="sh_zinc1_avg" property="shZinc1Avg"/>
  32 + <result column="create_by_id" property="createById"/>
  33 + <result column="create_by" property="createBy"/>
  34 + <result column="create_time" property="createTime"/>
  35 + <result column="update_by_id" property="updateById"/>
  36 + <result column="update_by" property="updateBy"/>
  37 + <result column="update_time" property="updateTime"/>
  38 + </resultMap>
  39 +
  40 + <sql id="BaseDataOnlinePrice_sql">
  41 + SELECT
  42 + tb.id,
  43 + tb.record_date,
  44 + tb.cj_copper1_upper,
  45 + tb.cj_copper1_lower,
  46 + tb.cj_copper1_avg,
  47 + tb.cj_zinc0_upper,
  48 + tb.cj_zinc0_lower,
  49 + tb.cj_zinc0_avg,
  50 + tb.cj_zinc1_upper,
  51 + tb.cj_zinc1_lower,
  52 + tb.cj_zinc1_avg,
  53 + tb.sh_copper1_upper,
  54 + tb.sh_copper1_lower,
  55 + tb.sh_copper1_avg,
  56 + tb.sh_copper1_premium_upper,
  57 + tb.sh_copper1_premium_lower,
  58 + tb.sh_copper1_premium_avg,
  59 + tb.sh_flat_copper_upper,
  60 + tb.sh_flat_copper_lower,
  61 + tb.sh_flat_copper_avg,
  62 + tb.sh_zinc0_upper,
  63 + tb.sh_zinc0_lower,
  64 + tb.sh_zinc0_avg,
  65 + tb.sh_zinc1_upper,
  66 + tb.sh_zinc1_lower,
  67 + tb.sh_zinc1_avg,
  68 + tb.create_by_id,
  69 + tb.create_by,
  70 + tb.create_time,
  71 + tb.update_by_id,
  72 + tb.update_by,
  73 + tb.update_time
  74 + FROM base_data_online_price AS tb
  75 + </sql>
  76 +
  77 + <select id="query" resultMap="BaseDataOnlinePrice">
  78 + <include refid="BaseDataOnlinePrice_sql"/>
  79 + <where>
  80 + <if test="vo.recordDate != null">
  81 + AND tb.record_date = #{vo.recordDate}
  82 + </if>
  83 + <if test="vo.idList != null and vo.idList.size() > 0">
  84 + AND tb.id IN
  85 + <foreach collection="vo.idList" item="id" open="(" separator="," close=")">
  86 + #{id}
  87 + </foreach>
  88 + </if>
  89 + </where>
  90 + ORDER BY tb.record_date DESC
  91 + </select>
  92 +</mapper>
... ...