Commit 6ef80aebf054014fd5b5e1bfbbca1a091665b02d

Authored by 杨鸣坤
1 parent a81244c6

楚江ERP:合同框架调整,经销标准合同提交

Showing 16 changed files with 1601 additions and 42 deletions
... ... @@ -60,19 +60,87 @@ create table if not exists base_data_product_variety (
60 60
61 61
62 62 -- 合同框架
63   -create table if not exists `tbl_contract_framework` (
64   - `id` varchar(32) primary key comment 'ID',
65   - `code` varchar(20) not null comment '编号',
66   - `customer_id` varchar(32) not null comment '客户id',
67   - `company` varchar(50) not null comment '所属单位',
  63 +create table if not exists `tbl_contract_framework`(
  64 + `id` varchar(32) primary key comment 'ID',
  65 + `code` varchar(20) not null comment '编号',
  66 + `customer_id` varchar(32) not null comment '客户id',
  67 + `company` varchar(50) not null comment '所属单位',
68 68 `has_framework_agreement` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否签订框架合同',
69   - `material_type_id` varchar(32) NOT NULL COMMENT '品种id',
70   - `validity_time` date comment '期限',
71   - `create_by_id` varchar(32) not null comment '创建人ID',
72   - `create_by` varchar(20) not null comment '创建人',
73   - `update_by_id` varchar(32) not null comment '更新人ID',
74   - `update_by` varchar(20) not null comment '更新人',
75   - `create_time` datetime default now() comment '创建时间',
76   - `update_time` datetime default now() comment '更新时间'
77   - );
  69 + `material_type_id` varchar(500) NOT NULL COMMENT '品种id',
  70 + `validity_time` date comment '期限',
  71 + `create_by_id` varchar(32) not null comment '创建人ID',
  72 + `create_by` varchar(20) not null comment '创建人',
  73 + `update_by_id` varchar(32) not null comment '更新人ID',
  74 + `update_by` varchar(20) not null comment '更新人',
  75 + `create_time` datetime default now() comment '创建时间',
  76 + `update_time` datetime default now() comment '更新时间'
  77 +);
  78 +
  79 +-- 经销标准合同
  80 +create table if not exists `tbl_contract_distributor_standard`(
  81 + `id` varchar(32) primary key comment 'ID',
  82 + `code` varchar(20) not null comment '编号',
  83 + `supplier` varchar(50) not null comment '供方',
  84 + `buyer` varchar(200) not null comment '需方',
  85 + `dept_id` varchar(32) not null comment '办事处',
  86 + `order_date` date NOT NULL COMMENT '订货日期',
  87 + `unit` VARCHAR(50) COMMENT '单位',
  88 + `total_quantity` DECIMAL(15, 4) COMMENT '合计数量',
  89 + `total_amount_excluding_tax` DECIMAL(15, 4) COMMENT '合计不含税金额',
  90 + `total_amount_including_tax` DECIMAL(15, 4) COMMENT '合计总金额',
  91 + `total_amount_capital` VARCHAR(100) COMMENT '合计人民币金额(大写)',
  92 + `deposit_info` VARCHAR(500) COMMENT '交付定金信息(包含数额、时间)',
  93 + `packaging_requirements` VARCHAR(200) COMMENT '包装要求',
  94 + `payment_terms` VARCHAR(500) COMMENT '付款信息(包含付款方式、付款期限)',
  95 + `execution_standard` VARCHAR(50) COMMENT '执行标准',
  96 + `transport_mode` VARCHAR(100) COMMENT '运输方式',
  97 + `destination` VARCHAR(200) COMMENT '目的地',
  98 + `includes_packaging_fee` tinyint(1) NOT NULL DEFAULT 0 COMMENT '单价中是否已包含包装费',
  99 + `includes_transport_fee` tinyint(1) NOT NULL DEFAULT 0 COMMENT '单价中是否已包含运费',
  100 + `piece_weight_head` TEXT COMMENT '件重条头',
  101 + `surface` TEXT COMMENT '表面',
  102 + `tolerance` TEXT COMMENT '公差',
  103 + `performance` TEXT COMMENT '性能',
  104 + `special_terms` VARCHAR(50) COMMENT '特别条款要求',
  105 + `designated_consignee` TEXT COMMENT '需方指定收货人',
  106 + `remarks` TEXT COMMENT '备注',
  107 + `create_by_id` varchar(32) not null comment '创建人ID',
  108 + `create_by` varchar(20) not null comment '创建人',
  109 + `update_by_id` varchar(32) not null comment '更新人ID',
  110 + `update_by` varchar(20) not null comment '更新人',
  111 + `create_time` datetime default now() comment '创建时间',
  112 + `update_time` datetime default now() comment '更新时间'
  113 +);
78 114
  115 +-- 经销合同物料行
  116 +create table if not exists `tbl_contract_distributor_line`
  117 +(
  118 + `id` varchar(32) primary key comment 'ID',
  119 + `contract_id` varchar(32) NOT NULL COMMENT '合同主表ID',
  120 + `product_id` VARCHAR(50) NOT NULL COMMENT '产品名称',
  121 + `industry` VARCHAR(100) COMMENT '行业',
  122 + `quality` VARCHAR(100) COMMENT '品质',
  123 + `brand` VARCHAR(100) COMMENT '牌号',
  124 + `thickness` DECIMAL(10, 4) COMMENT '厚度',
  125 + `thickness_tol_pos` DECIMAL(10, 4) COMMENT '厚度公差正',
  126 + `thickness_tol_neg` DECIMAL(10, 4) COMMENT '厚度公差负',
  127 + `width` DECIMAL(10, 4) COMMENT '宽度',
  128 + `width_tol_pos` DECIMAL(10, 4) COMMENT '宽度公差正',
  129 + `width_tol_neg` DECIMAL(10, 4) COMMENT '宽度公差负',
  130 + `length` DECIMAL(10, 4) COMMENT '长度',
  131 + `length_tol_pos` DECIMAL(10, 4) COMMENT '长度公差正',
  132 + `length_tol_neg` DECIMAL(10, 4) COMMENT '长度公差负',
  133 + `status` VARCHAR(50) COMMENT '状态',
  134 + `quantity` DECIMAL(15, 4) NOT NULL COMMENT '数量',
  135 + `unit_price` DECIMAL(15, 4) NOT NULL COMMENT '单价',
  136 + `amount_excluding_tax` DECIMAL(15, 2) COMMENT '不含税金额',
  137 + `total_amount` DECIMAL(15, 2) COMMENT '总金额',
  138 + `delivery_date` DATE COMMENT '发货日期',
  139 + `show_order` INT DEFAULT 0 COMMENT '排序',
  140 + `create_by_id` varchar(32) not null comment '创建人ID',
  141 + `create_by` varchar(20) not null comment '创建人',
  142 + `update_by_id` varchar(32) not null comment '更新人ID',
  143 + `update_by` varchar(20) not null comment '更新人',
  144 + `create_time` datetime default now() comment '创建时间',
  145 + `update_time` datetime default now() comment '更新时间'
  146 +)
\ No newline at end of file
... ...
  1 +package com.lframework.xingyun.sc.bo.contract;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDate;
  12 +
  13 +/**
  14 + * <p>
  15 + * 经销标准合同 GetBo
  16 + * </p>
  17 + *
  18 + */
  19 +@Data
  20 +public class GetContractDistributorStandardBo extends BaseBo<ContractDistributorStandard> {
  21 +
  22 + /**
  23 + * ID
  24 + */
  25 + @ApiModelProperty("ID")
  26 + private String id;
  27 +
  28 + /**
  29 + * 编号
  30 + */
  31 + @ApiModelProperty("编号")
  32 + private String code;
  33 +
  34 + /**
  35 + * 供方
  36 + */
  37 + @ApiModelProperty("供方")
  38 + private String supplier;
  39 +
  40 + /**
  41 + * 需方
  42 + */
  43 + @ApiModelProperty("需方")
  44 + private String buyer;
  45 +
  46 + /**
  47 + * 办事处
  48 + */
  49 + @ApiModelProperty("办事处")
  50 + private String deptId;
  51 +
  52 + /**
  53 + * 订货日期
  54 + */
  55 + @ApiModelProperty("订货日期")
  56 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  57 + private LocalDate orderDate;
  58 +
  59 + /**
  60 + * 单位
  61 + */
  62 + @ApiModelProperty("单位")
  63 + private String unit;
  64 +
  65 + /**
  66 + * 合计人民币金额(大写)
  67 + */
  68 + @ApiModelProperty("合计人民币金额(大写)")
  69 + private String totalAmountCapital;
  70 +
  71 + /**
  72 + * 交付定金信息(包含数额、时间)
  73 + */
  74 + @ApiModelProperty("交付定金信息(包含数额、时间)")
  75 + private String depositInfo;
  76 +
  77 + /**
  78 + * 包装要求
  79 + */
  80 + @ApiModelProperty("包装要求")
  81 + private String packagingRequirements;
  82 +
  83 + /**
  84 + * 付款信息(包含付款方式、付款期限)
  85 + */
  86 + @ApiModelProperty("付款信息(包含付款方式、付款期限)")
  87 + private String paymentTerms;
  88 +
  89 + /**
  90 + * 执行标准
  91 + */
  92 + @ApiModelProperty("执行标准")
  93 + private String executionStandard;
  94 +
  95 + /**
  96 + * 运输方式
  97 + */
  98 + @ApiModelProperty("运输方式")
  99 + private String transportMode;
  100 +
  101 + /**
  102 + * 目的地
  103 + */
  104 + @ApiModelProperty("目的地")
  105 + private String destination;
  106 +
  107 + /**
  108 + * 单价中是否已包含包装费
  109 + */
  110 + @ApiModelProperty("单价中是否已包含包装费")
  111 + private Boolean includesPackagingFee;
  112 +
  113 + /**
  114 + * 单价中是否已包含运费
  115 + */
  116 + @ApiModelProperty("单价中是否已包含运费")
  117 + private Boolean includesTransportFee;
  118 +
  119 + /**
  120 + * 件重条头
  121 + */
  122 + @ApiModelProperty("件重条头")
  123 + private String pieceWeightHead;
  124 +
  125 + /**
  126 + * 表面
  127 + */
  128 + @ApiModelProperty("表面")
  129 + private String surface;
  130 +
  131 + /**
  132 + * 公差
  133 + */
  134 + @ApiModelProperty("公差")
  135 + private String tolerance;
  136 +
  137 + /**
  138 + * 性能
  139 + */
  140 + @ApiModelProperty("性能")
  141 + private String performance;
  142 +
  143 + /**
  144 + * 特别条款要求
  145 + */
  146 + @ApiModelProperty("特别条款要求")
  147 + private String specialTerms;
  148 +
  149 + /**
  150 + * 需方指定收货人
  151 + */
  152 + @ApiModelProperty("需方指定收货人")
  153 + private String designatedConsignee;
  154 +
  155 + /**
  156 + * 备注
  157 + */
  158 + @ApiModelProperty("备注")
  159 + private String remarks;
  160 +
  161 + /**
  162 + * 合计不含税金额
  163 + */
  164 + @ApiModelProperty("合计不含税金额")
  165 + private BigDecimal totalAmountExcludingTax;
  166 +
  167 + /**
  168 + * 合计总金额
  169 + */
  170 + @ApiModelProperty("合计总金额")
  171 + private BigDecimal totalAmountIncludingTax;
  172 +
  173 + /**
  174 + * 合计数量
  175 + */
  176 + @ApiModelProperty("合计数量")
  177 + private BigDecimal totalQuantity;
  178 +
  179 + public GetContractDistributorStandardBo() {
  180 +
  181 + }
  182 +
  183 + public GetContractDistributorStandardBo(ContractDistributorStandard dto) {
  184 +
  185 + super(dto);
  186 + }
  187 +
  188 + @Override
  189 + public BaseBo<ContractDistributorStandard> convert(ContractDistributorStandard dto) {
  190 + return super.convert(dto);
  191 + }
  192 +
  193 + @Override
  194 + protected void afterInit(ContractDistributorStandard dto) {
  195 +
  196 + }
  197 +}
... ...
  1 +package com.lframework.xingyun.sc.bo.contract;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDate;
  12 +
  13 +/**
  14 + * <p>
  15 + * 经销标准合同 QueryBo
  16 + * </p>
  17 + */
  18 +@Data
  19 +public class QueryContractDistributorStandardBo extends BaseBo<ContractDistributorStandard> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 编号
  29 + */
  30 + @ApiModelProperty("编号")
  31 + private String code;
  32 +
  33 + /**
  34 + * 需方
  35 + */
  36 + @ApiModelProperty("需方")
  37 + private String buyer;
  38 +
  39 + /**
  40 + * 办事处
  41 + */
  42 + @ApiModelProperty("办事处")
  43 + private String deptId;
  44 +
  45 + /**
  46 + * 创建人
  47 + */
  48 + @ApiModelProperty("创建人")
  49 + private String createBy;
  50 +
  51 + /**
  52 + * 订货日期
  53 + */
  54 + @ApiModelProperty("订货日期")
  55 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  56 + private LocalDate orderDate;
  57 +
  58 + /**
  59 + * 运输方式
  60 + */
  61 + @ApiModelProperty("运输方式")
  62 + private String transportMode;
  63 +
  64 + /**
  65 + * 目的地
  66 + */
  67 + @ApiModelProperty("目的地")
  68 + private String destination;
  69 +
  70 + /**
  71 + * 合计总金额
  72 + */
  73 + @ApiModelProperty("合计总金额")
  74 + private BigDecimal totalAmountIncludingTax;
  75 +
  76 + /**
  77 + * 合计数量
  78 + */
  79 + @ApiModelProperty("合计数量")
  80 + private BigDecimal totalQuantity;
  81 +
  82 + public QueryContractDistributorStandardBo() {
  83 +
  84 + }
  85 +
  86 + public QueryContractDistributorStandardBo(ContractDistributorStandard dto) {
  87 +
  88 + super(dto);
  89 + }
  90 +
  91 + @Override
  92 + public BaseBo<ContractDistributorStandard> convert(ContractDistributorStandard dto) {
  93 + return super.convert(dto);
  94 + }
  95 +
  96 + @Override
  97 + protected void afterInit(ContractDistributorStandard dto) {
  98 +
  99 + }
  100 +}
... ...
  1 +package com.lframework.xingyun.sc.controller.contract;
  2 +
  3 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  4 +import com.lframework.starter.web.core.annotations.security.HasPermission;
  5 +import com.lframework.starter.web.core.components.resp.InvokeResult;
  6 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  7 +import com.lframework.starter.web.core.components.resp.PageResult;
  8 +import com.lframework.starter.web.core.controller.DefaultBaseController;
  9 +import com.lframework.starter.web.core.utils.PageResultUtil;
  10 +import com.lframework.xingyun.sc.bo.contract.GetContractDistributorStandardBo;
  11 +import com.lframework.xingyun.sc.bo.contract.QueryContractDistributorStandardBo;
  12 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
  13 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  14 +import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo;
  15 +import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo;
  16 +import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo;
  17 +import io.swagger.annotations.Api;
  18 +import io.swagger.annotations.ApiImplicitParam;
  19 +import io.swagger.annotations.ApiOperation;
  20 +import org.apache.commons.collections4.CollectionUtils;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.validation.annotation.Validated;
  23 +import org.springframework.web.bind.annotation.*;
  24 +
  25 +import javax.validation.Valid;
  26 +import javax.validation.constraints.NotBlank;
  27 +import java.util.List;
  28 +import java.util.stream.Collectors;
  29 +
  30 +/**
  31 + * 经销标准合同 Controller
  32 + */
  33 +@Api(tags = "经销标准合同")
  34 +@Validated
  35 +@RestController
  36 +@RequestMapping("/contract/contractDistributorStandard")
  37 +public class ContractDistributorStandardController extends DefaultBaseController {
  38 +
  39 + @Autowired
  40 + private ContractDistributorStandardService contractDistributorStandardService;
  41 +
  42 + /**
  43 + * 查询列表
  44 + */
  45 + @ApiOperation("查询列表")
  46 + @HasPermission({"contract:contractDistributorStandard:query"})
  47 + @GetMapping("/query")
  48 + public InvokeResult<PageResult<QueryContractDistributorStandardBo>> query(@Valid QueryContractDistributorStandardVo vo) {
  49 +
  50 + PageResult<ContractDistributorStandard> pageResult = contractDistributorStandardService.query(getPageIndex(vo), getPageSize(vo), vo);
  51 +
  52 + List<ContractDistributorStandard> datas = pageResult.getDatas();
  53 + List<QueryContractDistributorStandardBo> results = null;
  54 +
  55 + if (CollectionUtils.isNotEmpty(datas)) {
  56 + results = datas.stream().map(QueryContractDistributorStandardBo::new).collect(Collectors.toList());
  57 + }
  58 +
  59 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  60 + }
  61 +
  62 + /**
  63 + * 根据ID查询
  64 + */
  65 + @ApiOperation("根据ID查询")
  66 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  67 + @HasPermission({"contract:contractDistributorStandard:query"})
  68 + @GetMapping
  69 + public InvokeResult<GetContractDistributorStandardBo> get(@NotBlank(message = "id不能为空!") String id) {
  70 +
  71 + ContractDistributorStandard data = contractDistributorStandardService.findById(id);
  72 + if (data == null) {
  73 + throw new DefaultClientException("经销标准合同不存在!");
  74 + }
  75 +
  76 + GetContractDistributorStandardBo result = new GetContractDistributorStandardBo(data);
  77 +
  78 + return InvokeResultBuilder.success(result);
  79 + }
  80 +
  81 + /**
  82 + * 新增
  83 + */
  84 + @ApiOperation("新增")
  85 + @HasPermission({"contract:contractDistributorStandard:add"})
  86 + @PostMapping
  87 + public InvokeResult<Void> create(@Valid CreateContractDistributorStandardVo vo) {
  88 +
  89 + contractDistributorStandardService.create(vo);
  90 +
  91 + return InvokeResultBuilder.success();
  92 + }
  93 +
  94 + /**
  95 + * 修改
  96 + */
  97 + @ApiOperation("修改")
  98 + @HasPermission({"contract:contractDistributorStandard:modify"})
  99 + @PutMapping
  100 + public InvokeResult<Void> update(@Valid UpdateContractDistributorStandardVo vo) {
  101 +
  102 + contractDistributorStandardService.update(vo);
  103 +
  104 + contractDistributorStandardService.cleanCacheByKey(vo.getId());
  105 +
  106 + return InvokeResultBuilder.success();
  107 + }
  108 +}
... ...
1 1 package com.lframework.xingyun.sc.controller.contract;
2 2
3 3 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
4   -import com.lframework.starter.common.utils.DateUtil;
5   -import com.lframework.starter.common.utils.StringUtil;
6 4 import com.lframework.starter.mq.core.utils.ExportTaskUtil;
7 5 import com.lframework.starter.web.core.annotations.security.HasPermission;
8 6 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
... ... @@ -50,9 +48,7 @@ import javax.validation.constraints.NotBlank;
50 48 import javax.validation.constraints.NotNull;
51 49 import java.time.LocalDate;
52 50 import java.time.format.DateTimeFormatter;
53   -import java.util.HashMap;
54   -import java.util.List;
55   -import java.util.Map;
  51 +import java.util.*;
56 52 import java.util.function.Function;
57 53 import java.util.stream.Collectors;
58 54
... ... @@ -86,7 +82,7 @@ public class ContractFrameworkController extends DefaultBaseController {
86 82 * 查询列表
87 83 */
88 84 @ApiOperation("查询列表")
89   - @HasPermission({"contractFramework:contractFramework:query"})
  85 + @HasPermission({"contract:contractFramework:query"})
90 86 @GetMapping("/query")
91 87 public InvokeResult<PageResult<QueryContractFrameworkBo>> query(@Valid QueryContractFrameworkVo vo) {
92 88
... ... @@ -105,7 +101,13 @@ public class ContractFrameworkController extends DefaultBaseController {
105 101 }
106 102
107 103 results = boPageResult.getDatas();
108   - List<String> materialTypeIdList = results.stream().map(QueryContractFrameworkBo::getMaterialTypeId).collect(Collectors.toList());
  104 + List<String> materialTypeIdList = results.stream()
  105 + .filter(bo -> StringUtils.isNotBlank(bo.getMaterialTypeId()))
  106 + .flatMap(bo -> Arrays.stream(bo.getMaterialTypeId().split(",")))
  107 + .map(String::trim)
  108 + .filter(StringUtils::isNotBlank)
  109 + .distinct()
  110 + .collect(Collectors.toList());
109 111 Map<String, ProductVariety> productVarietyMap = new HashMap<>(materialTypeIdList.size());
110 112 if (CollectionUtils.isNotEmpty(materialTypeIdList)) {
111 113 List<ProductVariety> productVarietyList = productVarietyService.listByIds(materialTypeIdList);
... ... @@ -129,8 +131,15 @@ public class ContractFrameworkController extends DefaultBaseController {
129 131 if (bo == null) return;
130 132
131 133 if (StringUtils.isNotBlank(bo.getMaterialTypeId())) {
132   - ProductVariety productVariety = productVarietyMap.get(bo.getMaterialTypeId());
133   - bo.setMaterialTypeName(productVariety != null ? productVariety.getName() : "");
  134 + String materialTypeName = Arrays.stream(bo.getMaterialTypeId().split(","))
  135 + .map(String::trim)
  136 + .filter(StringUtils::isNotBlank)
  137 + .map(productVarietyMap::get)
  138 + .filter(Objects::nonNull)
  139 + .map(ProductVariety::getName)
  140 + .collect(Collectors.joining(","));
  141 +
  142 + bo.setMaterialTypeName(materialTypeName);
134 143 }
135 144
136 145 if (StringUtils.isNotBlank(bo.getCustomerId())) {
... ... @@ -151,14 +160,14 @@ public class ContractFrameworkController extends DefaultBaseController {
151 160 * 新增
152 161 */
153 162 @ApiOperation("新增")
154   - @HasPermission({"contractFramework:contractFramework:add"})
  163 + @HasPermission({"contract:contractFramework:add"})
155 164 @PostMapping
156 165 public InvokeResult<String> create(@Valid CreateContractFrameworkVo vo) {
157 166 return InvokeResultBuilder.success(contractFrameworkService.create(vo));
158 167 }
159 168
160 169 @ApiOperation("获取code")
161   - @HasPermission({"contractFramework:contractFramework:add"})
  170 + @HasPermission({"contract:contractFramework:add"})
162 171 @GetMapping("/code")
163 172 public InvokeResult<String> code(String company) {
164 173 StringBuilder stringBuilder = new StringBuilder();
... ... @@ -187,7 +196,7 @@ public class ContractFrameworkController extends DefaultBaseController {
187 196 */
188 197 @ApiOperation("根据ID查询")
189 198 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
190   - @HasPermission({"contractFramework:contractFramework:query"})
  199 + @HasPermission({"contract:contractFramework:query"})
191 200 @GetMapping
192 201 public InvokeResult<QueryContractFrameworkBo> get(@NotBlank(message = "id不能为空!") String id) {
193 202
... ... @@ -197,11 +206,37 @@ public class ContractFrameworkController extends DefaultBaseController {
197 206 }
198 207
199 208 QueryContractFrameworkBo result = new QueryContractFrameworkBo(data);
200   - String materialTypeId = result.getMaterialTypeId();
201   - ProductVariety productVariety = productVarietyService.findById(materialTypeId);
  209 + String materialTypeIds = result.getMaterialTypeId();
  210 + if (StringUtils.isNotBlank(materialTypeIds)) {
  211 + // 分割ID并去重
  212 + List<String> idList = Arrays.stream(materialTypeIds.split(","))
  213 + .map(String::trim)
  214 + .filter(StringUtils::isNotEmpty)
  215 + .collect(Collectors.toList());
  216 +
  217 + if (CollectionUtils.isNotEmpty(idList)) {
  218 + // 批量查询
  219 + List<ProductVariety> productVarietyList = productVarietyService.listByIds(idList);
  220 +
  221 + // 转换为Map提高查找效率
  222 + Map<String, String> idToNameMap = productVarietyList.stream()
  223 + .collect(Collectors.toMap(
  224 + ProductVariety::getId,
  225 + ProductVariety::getName
  226 + ));
  227 +
  228 + // 按原始顺序构建名称字符串
  229 + String materialTypeName = idList.stream()
  230 + .map(idToNameMap::get)
  231 + .filter(Objects::nonNull) // 过滤掉未找到的ID
  232 + .collect(Collectors.joining(","));
  233 +
  234 + result.setMaterialTypeName(materialTypeName);
  235 + }
  236 + }
  237 +
202 238 String customerId = result.getCustomerId();
203 239 Customer customer = customerService.findById(customerId);
204   - result.setMaterialTypeName(productVariety != null ? productVariety.getName() : "");
205 240 result.setCustomerName(customer != null ? customer.getName() : "");
206 241 SysDataDicItem sysDataDicItem = sysDataDicItemService.findByCode(SUPPLIER_DIC_CODE, result.getCompany());
207 242 result.setCompanyName(sysDataDicItem != null ? sysDataDicItem.getName() : "");
... ... @@ -213,7 +248,7 @@ public class ContractFrameworkController extends DefaultBaseController {
213 248 * 修改
214 249 */
215 250 @ApiOperation("修改")
216   - @HasPermission({"contractFramework:contractFramework:modify"})
  251 + @HasPermission({"contract:contractFramework:modify"})
217 252 @PutMapping
218 253 public InvokeResult<Void> update(@Valid UpdateContractFrameworkVo vo) {
219 254
... ... @@ -231,7 +266,7 @@ public class ContractFrameworkController extends DefaultBaseController {
231 266 * @return
232 267 */
233 268 @ApiOperation("导出")
234   - @HasPermission({"contractFramework:contractFramework:export"})
  269 + @HasPermission({"contract:contractFramework:export"})
235 270 @PostMapping("/export")
236 271 public InvokeResult<Void> export(@Valid QueryContractFrameworkVo vo) {
237 272
... ... @@ -241,14 +276,14 @@ public class ContractFrameworkController extends DefaultBaseController {
241 276 }
242 277
243 278 @ApiOperation("下载导入模板")
244   - @HasPermission({"contractFramework:contractFramework:import"})
  279 + @HasPermission({"contract:contractFramework:import"})
245 280 @GetMapping("/import/template")
246 281 public void downloadImportTemplate() {
247 282 ExcelUtil.exportXls("合同框架导入模板", ContractFrameworkImportModel.class);
248 283 }
249 284
250 285 @ApiOperation("导入")
251   - @HasPermission({"contractFramework:contractFramework:import"})
  286 + @HasPermission({"contract:contractFramework:import"})
252 287 @PostMapping("/import")
253 288 public InvokeResult<Void> importExcel(@NotBlank(message = "ID不能为空") String id,
254 289 @NotNull(message = "请上传文件") MultipartFile file) {
... ...
  1 +package com.lframework.xingyun.sc.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableName;
  4 +
  5 +import java.math.BigDecimal;
  6 +
  7 +import com.lframework.starter.web.core.dto.BaseDto;
  8 +
  9 +import java.time.LocalDate;
  10 +import java.time.LocalDateTime;
  11 +
  12 +import com.baomidou.mybatisplus.annotation.FieldFill;
  13 +import com.lframework.starter.web.core.entity.BaseEntity;
  14 +import com.baomidou.mybatisplus.annotation.TableField;
  15 +import lombok.Data;
  16 +
  17 +/**
  18 + * <p>
  19 + * 经销标准合同
  20 + * </p>
  21 + */
  22 +@Data
  23 +@TableName("tbl_contract_distributor_standard")
  24 +public class ContractDistributorStandard extends BaseEntity implements BaseDto {
  25 +
  26 + private static final long serialVersionUID = 1L;
  27 +
  28 + public static final String CACHE_NAME = "ContractDistributorStandard";
  29 +
  30 + /**
  31 + * ID
  32 + */
  33 + private String id;
  34 +
  35 + /**
  36 + * 编号
  37 + */
  38 + private String code;
  39 +
  40 + /**
  41 + * 供方
  42 + */
  43 + private String supplier;
  44 +
  45 + /**
  46 + * 需方
  47 + */
  48 + private String buyer;
  49 +
  50 + /**
  51 + * 办事处
  52 + */
  53 + private String deptId;
  54 +
  55 + /**
  56 + * 订货日期
  57 + */
  58 + private LocalDate orderDate;
  59 +
  60 + /**
  61 + * 单位
  62 + */
  63 + private String unit;
  64 +
  65 + /**
  66 + * 合计人民币金额(大写)
  67 + */
  68 + private String totalAmountCapital;
  69 +
  70 + /**
  71 + * 交付定金信息(包含数额、时间)
  72 + */
  73 + private String depositInfo;
  74 +
  75 + /**
  76 + * 包装要求
  77 + */
  78 + private String packagingRequirements;
  79 +
  80 + /**
  81 + * 付款信息(包含付款方式、付款期限)
  82 + */
  83 + private String paymentTerms;
  84 +
  85 + /**
  86 + * 执行标准
  87 + */
  88 + private String executionStandard;
  89 +
  90 + /**
  91 + * 运输方式
  92 + */
  93 + private String transportMode;
  94 +
  95 + /**
  96 + * 目的地
  97 + */
  98 + private String destination;
  99 +
  100 + /**
  101 + * 单价中是否已包含包装费
  102 + */
  103 + private Boolean includesPackagingFee;
  104 +
  105 + /**
  106 + * 单价中是否已包含运费
  107 + */
  108 + private Boolean includesTransportFee;
  109 +
  110 + /**
  111 + * 件重条头
  112 + */
  113 + private String pieceWeightHead;
  114 +
  115 + /**
  116 + * 表面
  117 + */
  118 + private String surface;
  119 +
  120 + /**
  121 + * 公差
  122 + */
  123 + private String tolerance;
  124 +
  125 + /**
  126 + * 性能
  127 + */
  128 + private String performance;
  129 +
  130 + /**
  131 + * 特别条款要求
  132 + */
  133 + private String specialTerms;
  134 +
  135 + /**
  136 + * 需方指定收货人
  137 + */
  138 + private String designatedConsignee;
  139 +
  140 + /**
  141 + * 备注
  142 + */
  143 + private String remarks;
  144 +
  145 + /**
  146 + * 创建人ID
  147 + */
  148 + @TableField(fill = FieldFill.INSERT)
  149 + private String createById;
  150 +
  151 + /**
  152 + * 创建人
  153 + */
  154 + @TableField(fill = FieldFill.INSERT)
  155 + private String createBy;
  156 +
  157 + /**
  158 + * 更新人ID
  159 + */
  160 + @TableField(fill = FieldFill.INSERT_UPDATE)
  161 + private String updateById;
  162 +
  163 + /**
  164 + * 更新人
  165 + */
  166 + @TableField(fill = FieldFill.INSERT_UPDATE)
  167 + private String updateBy;
  168 +
  169 + /**
  170 + * 创建时间
  171 + */
  172 + @TableField(fill = FieldFill.INSERT)
  173 + private LocalDateTime createTime;
  174 +
  175 + /**
  176 + * 更新时间
  177 + */
  178 + @TableField(fill = FieldFill.INSERT_UPDATE)
  179 + private LocalDateTime updateTime;
  180 +
  181 + /**
  182 + * 合计数量
  183 + */
  184 + private BigDecimal totalQuantity;
  185 +
  186 + /**
  187 + * 合计不含税金额
  188 + */
  189 + private BigDecimal totalAmountExcludingTax;
  190 +
  191 + /**
  192 + * 合计总金额
  193 + */
  194 + private BigDecimal totalAmountIncludingTax;
  195 +
  196 +}
... ...
... ... @@ -21,11 +21,13 @@ import com.lframework.xingyun.sc.controller.contract.ContractFrameworkController
21 21 import com.lframework.xingyun.sc.entity.ContractFramework;
22 22 import io.swagger.annotations.ApiModelProperty;
23 23 import lombok.Data;
  24 +import org.apache.commons.collections4.CollectionUtils;
24 25 import org.apache.commons.lang3.BooleanUtils;
25 26 import org.apache.commons.lang3.StringUtils;
26 27
27 28 import java.time.format.DateTimeFormatter;
28   -import java.util.Date;
  29 +import java.util.*;
  30 +import java.util.stream.Collectors;
29 31
30 32 @Data
31 33 public class ContractFrameworkExportModel extends BaseBo<ContractFramework> implements ExcelModel {
... ... @@ -90,9 +92,31 @@ public class ContractFrameworkExportModel extends BaseBo<ContractFramework> impl
90 92 }
91 93
92 94 if (StringUtils.isNotBlank(dto.getMaterialTypeId())) {
93   - ProductVarietyService productVarietyService = ApplicationUtil.getBean(ProductVarietyService.class);
94   - ProductVariety productVariety = productVarietyService.findById(dto.getMaterialTypeId());
95   - this.materialTypeName = productVariety != null ? productVariety.getName() : "";
  95 + String materialTypeIds = dto.getMaterialTypeId();
  96 + // 分割ID并去重
  97 + List<String> idList = Arrays.stream(materialTypeIds.split(","))
  98 + .map(String::trim)
  99 + .filter(StringUtils::isNotEmpty)
  100 + .collect(Collectors.toList());
  101 +
  102 + if (CollectionUtils.isNotEmpty(idList)) {
  103 + ProductVarietyService productVarietyService = ApplicationUtil.getBean(ProductVarietyService.class);
  104 + // 批量查询
  105 + List<ProductVariety> productVarietyList = productVarietyService.listByIds(idList);
  106 +
  107 + // 转换为Map提高查找效率
  108 + Map<String, String> idToNameMap = productVarietyList.stream()
  109 + .collect(Collectors.toMap(
  110 + ProductVariety::getId,
  111 + ProductVariety::getName
  112 + ));
  113 +
  114 + // 按原始顺序构建名称字符串
  115 + this.materialTypeName = idList.stream()
  116 + .map(idToNameMap::get)
  117 + .filter(Objects::nonNull) // 过滤掉未找到的ID
  118 + .collect(Collectors.joining(","));
  119 + }
96 120 }
97 121
98 122 this.hasFrameworkAgreementStr = BooleanUtils.isTrue(dto.getHasFrameworkAgreement()) ? "是" : "否";
... ...
... ... @@ -30,7 +30,10 @@ import org.apache.commons.lang3.StringUtils;
30 30
31 31 import java.time.LocalDate;
32 32 import java.time.format.DateTimeFormatter;
  33 +import java.util.Arrays;
33 34 import java.util.List;
  35 +import java.util.Objects;
  36 +import java.util.stream.Collectors;
34 37
35 38 @Slf4j
36 39 public class ContractFrameworkImportListener extends ExcelImportListener<ContractFrameworkImportModel> {
... ... @@ -77,16 +80,25 @@ public class ContractFrameworkImportListener extends ExcelImportListener<Contrac
77 80 "第" + context.readRowHolder().getRowIndex() + "行授信截止日期不可为空");
78 81 }
79 82
  83 + if (StringUtils.isBlank(data.getMaterialTypeName())) {
  84 + throw new DefaultClientException(
  85 + "第" + context.readRowHolder().getRowIndex() + "行品种不可为空!");
  86 + }
  87 +
80 88 ProductVarietyService productVarietyService = ApplicationUtil.getBean(ProductVarietyService.class);
81 89 Wrapper<ProductVariety> productVarietyWrapper = Wrappers.lambdaQuery(ProductVariety.class)
82   - .eq(ProductVariety::getName, data.getMaterialTypeName());
83   - ProductVariety productVariety = productVarietyService.getOne(productVarietyWrapper);
84   - if (productVariety == null) {
  90 + .in(ProductVariety::getName, Arrays.asList(data.getMaterialTypeName().split(",")));
  91 + List<ProductVariety> productVarietyList = productVarietyService.list(productVarietyWrapper);
  92 + if (CollectionUtils.isEmpty(productVarietyList)) {
85 93 throw new DefaultClientException("第" + context.readRowHolder().getRowIndex() + "行,品种[" + data.getMaterialTypeName()
86 94 + "]不存在,请检查后再次导入!");
87 95 }
88 96
89   - data.setMaterialTypId(productVariety.getId());
  97 + data.setMaterialTypId(productVarietyList.stream()
  98 + .map(ProductVariety::getId)
  99 + .filter(Objects::nonNull)
  100 + .distinct()
  101 + .collect(Collectors.joining(",")));
90 102 }
91 103
92 104 @Override
... ...
  1 +package com.lframework.xingyun.sc.impl.contract;
  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.xingyun.sc.entity.ContractDistributorStandard;
  7 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  8 +import com.lframework.starter.web.core.utils.PageResultUtil;
  9 +import com.lframework.starter.web.core.utils.OpLogUtil;
  10 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  11 +import com.lframework.starter.web.core.utils.IdUtil;
  12 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  13 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  14 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  15 +import com.lframework.starter.web.core.components.resp.PageResult;
  16 +import com.lframework.starter.common.utils.ObjectUtil;
  17 +import com.lframework.starter.common.utils.Assert;
  18 +import com.lframework.xingyun.sc.mappers.ContractDistributorStandardMapper;
  19 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  20 +import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo;
  21 +import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo;
  22 +import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo;
  23 +import org.springframework.cache.annotation.CacheEvict;
  24 +import org.springframework.cache.annotation.Cacheable;
  25 +import org.springframework.stereotype.Service;
  26 +import org.springframework.transaction.annotation.Transactional;
  27 +
  28 +import java.io.Serializable;
  29 +import java.util.List;
  30 +
  31 +@Service
  32 +public class ContractDistributorStandardServiceImpl extends
  33 + BaseMpServiceImpl<ContractDistributorStandardMapper, ContractDistributorStandard> implements ContractDistributorStandardService {
  34 +
  35 + @Override
  36 + public PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo) {
  37 +
  38 + Assert.greaterThanZero(pageIndex);
  39 + Assert.greaterThanZero(pageSize);
  40 +
  41 + PageHelperUtil.startPage(pageIndex, pageSize);
  42 + List<ContractDistributorStandard> datas = this.query(vo);
  43 +
  44 + return PageResultUtil.convert(new PageInfo<>(datas));
  45 + }
  46 +
  47 + @Override
  48 + public List<ContractDistributorStandard> query(QueryContractDistributorStandardVo vo) {
  49 +
  50 + return getBaseMapper().query(vo);
  51 + }
  52 +
  53 + @Cacheable(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")
  54 + @Override
  55 + public ContractDistributorStandard findById(String id) {
  56 +
  57 + return getBaseMapper().selectById(id);
  58 + }
  59 +
  60 + @OpLog(type = OtherOpLogType.class, name = "新增经销标准合同,ID:{}", params = {"#id"})
  61 + @Transactional(rollbackFor = Exception.class)
  62 + @Override
  63 + public String create(CreateContractDistributorStandardVo vo) {
  64 +
  65 + ContractDistributorStandard data = new ContractDistributorStandard();
  66 + data.setId(IdUtil.getUUID());
  67 + data.setCode(vo.getCode());
  68 + data.setSupplier(vo.getSupplier());
  69 + data.setBuyer(vo.getBuyer());
  70 + data.setOrderDate(vo.getOrderDate());
  71 + data.setUnit(vo.getUnit());
  72 + data.setTotalAmountCapital(vo.getTotalAmountCapital());
  73 + data.setDepositInfo(vo.getDepositInfo());
  74 + data.setPackagingRequirements(vo.getPackagingRequirements());
  75 + data.setPaymentTerms(vo.getPaymentTerms());
  76 + data.setExecutionStandard(vo.getExecutionStandard());
  77 + data.setTransportMode(vo.getTransportMode());
  78 + data.setDestination(vo.getDestination());
  79 + data.setIncludesPackagingFee(vo.getIncludesPackagingFee());
  80 + data.setIncludesTransportFee(vo.getIncludesTransportFee());
  81 + data.setPieceWeightHead(vo.getPieceWeightHead());
  82 + data.setSurface(vo.getSurface());
  83 + data.setTolerance(vo.getTolerance());
  84 + data.setPerformance(vo.getPerformance());
  85 + data.setSpecialTerms(vo.getSpecialTerms());
  86 + data.setDesignatedConsignee(vo.getDesignatedConsignee());
  87 + data.setRemarks(vo.getRemarks());
  88 + data.setTotalAmountExcludingTax(vo.getTotalAmountExcludingTax());
  89 + data.setTotalAmountIncludingTax(vo.getTotalAmountIncludingTax());
  90 + data.setTotalQuantity(vo.getTotalQuantity());
  91 +
  92 + getBaseMapper().insert(data);
  93 +
  94 + OpLogUtil.setVariable("id", data.getId());
  95 + OpLogUtil.setExtra(vo);
  96 +
  97 + return data.getId();
  98 + }
  99 +
  100 + @OpLog(type = OtherOpLogType.class, name = "修改经销标准合同,ID:{}", params = {"#id"})
  101 + @Transactional(rollbackFor = Exception.class)
  102 + @Override
  103 + public void update(UpdateContractDistributorStandardVo vo) {
  104 +
  105 + ContractDistributorStandard data = getBaseMapper().selectById(vo.getId());
  106 + if (ObjectUtil.isNull(data)) {
  107 + throw new DefaultClientException("经销标准合同不存在!");
  108 + }
  109 +
  110 + LambdaUpdateWrapper<ContractDistributorStandard> updateWrapper = Wrappers.lambdaUpdate(ContractDistributorStandard.class)
  111 + .set(ContractDistributorStandard::getCode, vo.getCode())
  112 + .set(ContractDistributorStandard::getSupplier, vo.getSupplier())
  113 + .set(ContractDistributorStandard::getBuyer, vo.getBuyer())
  114 + .set(ContractDistributorStandard::getOrderDate, vo.getOrderDate())
  115 + .set(ContractDistributorStandard::getUnit, vo.getUnit())
  116 + .set(ContractDistributorStandard::getTotalAmountCapital, vo.getTotalAmountCapital())
  117 + .set(ContractDistributorStandard::getDepositInfo, vo.getDepositInfo())
  118 + .set(ContractDistributorStandard::getPackagingRequirements, vo.getPackagingRequirements())
  119 + .set(ContractDistributorStandard::getPaymentTerms, vo.getPaymentTerms())
  120 + .set(ContractDistributorStandard::getExecutionStandard, vo.getExecutionStandard())
  121 + .set(ContractDistributorStandard::getTransportMode, vo.getTransportMode())
  122 + .set(ContractDistributorStandard::getDestination, vo.getDestination())
  123 + .set(ContractDistributorStandard::getIncludesPackagingFee, vo.getIncludesPackagingFee())
  124 + .set(ContractDistributorStandard::getIncludesTransportFee, vo.getIncludesTransportFee())
  125 + .set(ContractDistributorStandard::getPieceWeightHead, vo.getPieceWeightHead())
  126 + .set(ContractDistributorStandard::getSurface, vo.getSurface())
  127 + .set(ContractDistributorStandard::getTolerance, vo.getTolerance())
  128 + .set(ContractDistributorStandard::getPerformance, vo.getPerformance())
  129 + .set(ContractDistributorStandard::getSpecialTerms, vo.getSpecialTerms())
  130 + .set(ContractDistributorStandard::getDesignatedConsignee, vo.getDesignatedConsignee())
  131 + .set(ContractDistributorStandard::getRemarks, vo.getRemarks())
  132 + .set(ContractDistributorStandard::getTotalAmountExcludingTax, vo.getTotalAmountExcludingTax())
  133 + .set(ContractDistributorStandard::getTotalAmountIncludingTax, vo.getTotalAmountIncludingTax())
  134 + .set(ContractDistributorStandard::getTotalQuantity, vo.getTotalQuantity())
  135 + .eq(ContractDistributorStandard::getId, vo.getId());
  136 +
  137 + getBaseMapper().update(updateWrapper);
  138 +
  139 + OpLogUtil.setVariable("id", data.getId());
  140 + OpLogUtil.setExtra(vo);
  141 + }
  142 +
  143 + @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
  144 + @Override
  145 + public void cleanCacheByKey(Serializable key) {
  146 +
  147 + }
  148 +}
  149 +
... ...
  1 +package com.lframework.xingyun.sc.mappers;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
  5 +import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * <p>
  12 + * 经销标准合同 Mapper 接口
  13 + * </p>
  14 + */
  15 +public interface ContractDistributorStandardMapper extends BaseMapper<ContractDistributorStandard> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + *
  20 + * @param vo
  21 + * @return
  22 + */
  23 + List<ContractDistributorStandard> query(@Param("vo") QueryContractDistributorStandardVo vo);
  24 +}
... ...
  1 +package com.lframework.xingyun.sc.service.contract;
  2 +
  3 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
  4 +import com.lframework.starter.web.core.service.BaseMpService;
  5 +import com.lframework.starter.web.core.components.resp.PageResult;
  6 +import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo;
  7 +import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo;
  8 +import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * 经销标准合同 Service
  14 + */
  15 +public interface ContractDistributorStandardService extends BaseMpService<ContractDistributorStandard> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + *
  20 + * @return
  21 + */
  22 + PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo);
  23 +
  24 + /**
  25 + * 查询列表
  26 + *
  27 + * @param vo
  28 + * @return
  29 + */
  30 + List<ContractDistributorStandard> query(QueryContractDistributorStandardVo vo);
  31 +
  32 + /**
  33 + * 根据ID查询
  34 + *
  35 + * @param id
  36 + * @return
  37 + */
  38 + ContractDistributorStandard findById(String id);
  39 +
  40 + /**
  41 + * 创建
  42 + *
  43 + * @param vo
  44 + * @return
  45 + */
  46 + String create(CreateContractDistributorStandardVo vo);
  47 +
  48 + /**
  49 + * 修改
  50 + *
  51 + * @param vo
  52 + */
  53 + void update(UpdateContractDistributorStandardVo vo);
  54 +
  55 +}
\ No newline at end of file
... ...
  1 +package com.lframework.xingyun.sc.vo.contract.createVo;
  2 +
  3 +import java.math.BigDecimal;
  4 +import javax.validation.constraints.NotBlank;
  5 +import java.time.LocalDate;
  6 +
  7 +import com.lframework.starter.web.core.vo.BaseVo;
  8 +
  9 +import javax.validation.constraints.NotNull;
  10 +
  11 +import io.swagger.annotations.ApiModelProperty;
  12 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  13 +import org.hibernate.validator.constraints.Length;
  14 +
  15 +import java.io.Serializable;
  16 +
  17 +import lombok.Data;
  18 +
  19 +@Data
  20 +public class CreateContractDistributorStandardVo implements BaseVo, Serializable {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + /**
  25 + * 编号
  26 + */
  27 + @ApiModelProperty(value = "编号", required = true)
  28 + @NotBlank(message = "请输入编号!")
  29 + @Length(message = "编号最多允许20个字符!")
  30 + private String code;
  31 +
  32 + /**
  33 + * 供方
  34 + */
  35 + @ApiModelProperty(value = "供方", required = true)
  36 + @NotBlank(message = "请输入供方!")
  37 + @Length(message = "供方最多允许50个字符!")
  38 + private String supplier;
  39 +
  40 + /**
  41 + * 需方
  42 + */
  43 + @ApiModelProperty(value = "需方", required = true)
  44 + @NotBlank(message = "请输入需方!")
  45 + @Length(message = "需方最多允许200个字符!")
  46 + private String buyer;
  47 +
  48 + /**
  49 + * 订货日期
  50 + */
  51 + @ApiModelProperty(value = "订货日期", required = true)
  52 + @NotNull(message = "请输入订货日期!")
  53 + @TypeMismatch(message = "订货日期格式有误!")
  54 + private LocalDate orderDate;
  55 +
  56 + /**
  57 + * 单位
  58 + */
  59 + @ApiModelProperty(value = "单位", required = true)
  60 + @NotBlank(message = "请输入单位!")
  61 + @Length(message = "单位最多允许50个字符!")
  62 + private String unit;
  63 +
  64 + /**
  65 + * 合计人民币金额(大写)
  66 + */
  67 + @ApiModelProperty(value = "合计人民币金额(大写)", required = true)
  68 + @NotBlank(message = "请输入合计人民币金额(大写)!")
  69 + @Length(message = "合计人民币金额(大写)最多允许100个字符!")
  70 + private String totalAmountCapital;
  71 +
  72 + /**
  73 + * 交付定金信息(包含数额、时间)
  74 + */
  75 + @ApiModelProperty(value = "交付定金信息(包含数额、时间)", required = true)
  76 + @NotBlank(message = "请输入交付定金信息(包含数额、时间)!")
  77 + @Length(message = "交付定金信息(包含数额、时间)最多允许500个字符!")
  78 + private String depositInfo;
  79 +
  80 + /**
  81 + * 包装要求
  82 + */
  83 + @ApiModelProperty(value = "包装要求", required = true)
  84 + @NotBlank(message = "请输入包装要求!")
  85 + @Length(message = "包装要求最多允许200个字符!")
  86 + private String packagingRequirements;
  87 +
  88 + /**
  89 + * 付款信息(包含付款方式、付款期限)
  90 + */
  91 + @ApiModelProperty(value = "付款信息(包含付款方式、付款期限)", required = true)
  92 + @NotBlank(message = "请输入付款信息(包含付款方式、付款期限)!")
  93 + @Length(message = "付款信息(包含付款方式、付款期限)最多允许500个字符!")
  94 + private String paymentTerms;
  95 +
  96 + /**
  97 + * 执行标准
  98 + */
  99 + @ApiModelProperty(value = "执行标准", required = true)
  100 + @NotBlank(message = "请输入执行标准!")
  101 + @Length(message = "执行标准最多允许50个字符!")
  102 + private String executionStandard;
  103 +
  104 + /**
  105 + * 运输方式
  106 + */
  107 + @ApiModelProperty(value = "运输方式", required = true)
  108 + @NotBlank(message = "请输入运输方式!")
  109 + @Length(message = "运输方式最多允许100个字符!")
  110 + private String transportMode;
  111 +
  112 + /**
  113 + * 目的地
  114 + */
  115 + @ApiModelProperty(value = "目的地", required = true)
  116 + @NotBlank(message = "请输入目的地!")
  117 + @Length(message = "目的地最多允许200个字符!")
  118 + private String destination;
  119 +
  120 + /**
  121 + * 单价中是否已包含包装费
  122 + */
  123 + @ApiModelProperty(value = "单价中是否已包含包装费", required = true)
  124 + @NotNull(message = "请输入单价中是否已包含包装费!")
  125 + @TypeMismatch(message = "单价中是否已包含包装费格式有误!")
  126 + private Boolean includesPackagingFee;
  127 +
  128 + /**
  129 + * 单价中是否已包含运费
  130 + */
  131 + @ApiModelProperty(value = "单价中是否已包含运费", required = true)
  132 + @NotNull(message = "请输入单价中是否已包含运费!")
  133 + @TypeMismatch(message = "单价中是否已包含运费格式有误!")
  134 + private Boolean includesTransportFee;
  135 +
  136 + /**
  137 + * 件重条头
  138 + */
  139 + @ApiModelProperty(value = "件重条头", required = true)
  140 + @NotBlank(message = "请输入件重条头!")
  141 + @Length(message = "件重条头最多允许65,535个字符!")
  142 + private String pieceWeightHead;
  143 +
  144 + /**
  145 + * 表面
  146 + */
  147 + @ApiModelProperty(value = "表面", required = true)
  148 + @NotBlank(message = "请输入表面!")
  149 + @Length(message = "表面最多允许65,535个字符!")
  150 + private String surface;
  151 +
  152 + /**
  153 + * 公差
  154 + */
  155 + @ApiModelProperty(value = "公差", required = true)
  156 + @NotBlank(message = "请输入公差!")
  157 + @Length(message = "公差最多允许65,535个字符!")
  158 + private String tolerance;
  159 +
  160 + /**
  161 + * 性能
  162 + */
  163 + @ApiModelProperty(value = "性能", required = true)
  164 + @NotBlank(message = "请输入性能!")
  165 + @Length(message = "性能最多允许65,535个字符!")
  166 + private String performance;
  167 +
  168 + /**
  169 + * 特别条款要求
  170 + */
  171 + @ApiModelProperty(value = "特别条款要求", required = true)
  172 + @NotBlank(message = "请输入特别条款要求!")
  173 + @Length(message = "特别条款要求最多允许50个字符!")
  174 + private String specialTerms;
  175 +
  176 + /**
  177 + * 需方指定收货人
  178 + */
  179 + @ApiModelProperty(value = "需方指定收货人", required = true)
  180 + @NotBlank(message = "请输入需方指定收货人!")
  181 + @Length(message = "需方指定收货人最多允许65,535个字符!")
  182 + private String designatedConsignee;
  183 +
  184 + /**
  185 + * 备注
  186 + */
  187 + @ApiModelProperty(value = "备注", required = true)
  188 + @NotBlank(message = "请输入备注!")
  189 + @Length(message = "备注最多允许65,535个字符!")
  190 + private String remarks;
  191 +
  192 + /**
  193 + * 合计数量
  194 + */
  195 + @ApiModelProperty(value = "合计数量", required = true)
  196 + @NotNull(message = "请输入合计数量!")
  197 + @TypeMismatch(message = "合计数量格式有误!")
  198 + private BigDecimal totalQuantity;
  199 +
  200 + /**
  201 + * 合计不含税金额
  202 + */
  203 + @ApiModelProperty(value = "合计不含税金额", required = true)
  204 + @NotNull(message = "请输入合计不含税金额!")
  205 + @TypeMismatch(message = "合计不含税金额格式有误!")
  206 + private BigDecimal totalAmountExcludingTax;
  207 +
  208 + /**
  209 + * 合计总金额
  210 + */
  211 + @ApiModelProperty(value = "合计总金额", required = true)
  212 + @NotNull(message = "请输入合计总金额!")
  213 + @TypeMismatch(message = "合计总金额格式有误!")
  214 + private BigDecimal totalAmountIncludingTax;
  215 +
  216 +}
... ...
  1 +package com.lframework.xingyun.sc.vo.contract.queryVo;
  2 +
  3 +import lombok.Data;
  4 +import com.lframework.starter.web.core.vo.PageVo;
  5 +
  6 +import java.time.LocalDate;
  7 +
  8 +import com.lframework.starter.web.core.vo.BaseVo;
  9 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  10 +import io.swagger.annotations.ApiModelProperty;
  11 +
  12 +import java.io.Serializable;
  13 +
  14 +@Data
  15 +public class QueryContractDistributorStandardVo extends PageVo implements BaseVo, Serializable {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /**
  20 + * 编号
  21 + */
  22 + @ApiModelProperty("编号")
  23 + private String code;
  24 +
  25 + /**
  26 + * 需方
  27 + */
  28 + @ApiModelProperty("需方")
  29 + private String buyer;
  30 +
  31 + /**
  32 + * 办事处
  33 + */
  34 + @ApiModelProperty("办事处")
  35 + private String deptId;
  36 +
  37 + /**
  38 + * 订货日期
  39 + */
  40 + @ApiModelProperty("订货日期")
  41 + @TypeMismatch(message = "订货日期格式有误!")
  42 + private LocalDate orderDate;
  43 +
  44 + @ApiModelProperty("订货日期筛选开始日期")
  45 + @TypeMismatch(message = "订货日期格式有误!")
  46 + private LocalDate orderDateStart;
  47 +
  48 + @ApiModelProperty("订货日期筛选结束日期")
  49 + @TypeMismatch(message = "订货日期格式有误!")
  50 + private LocalDate orderDateEnd;
  51 +}
  52 +
... ...
  1 +package com.lframework.xingyun.sc.vo.contract.updateVo;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.math.BigDecimal;
  6 +import javax.validation.constraints.NotBlank;
  7 +import java.time.LocalDate;
  8 +
  9 +import com.lframework.starter.web.core.vo.BaseVo;
  10 +
  11 +import javax.validation.constraints.NotNull;
  12 +
  13 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  14 +import io.swagger.annotations.ApiModelProperty;
  15 +import org.hibernate.validator.constraints.Length;
  16 +
  17 +import java.io.Serializable;
  18 +
  19 +@Data
  20 +public class UpdateContractDistributorStandardVo implements BaseVo, Serializable {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + /**
  25 + * ID
  26 + */
  27 + @ApiModelProperty(value = "ID", required = true)
  28 + @NotBlank(message = "id不能为空!")
  29 + private String id;
  30 +
  31 + /**
  32 + * 编号
  33 + */
  34 + @ApiModelProperty(value = "编号", required = true)
  35 + @NotBlank(message = "请输入编号!")
  36 + @Length(message = "编号最多允许20个字符!")
  37 + private String code;
  38 +
  39 + /**
  40 + * 供方
  41 + */
  42 + @ApiModelProperty(value = "供方", required = true)
  43 + @NotBlank(message = "请输入供方!")
  44 + @Length(message = "供方最多允许50个字符!")
  45 + private String supplier;
  46 +
  47 + /**
  48 + * 需方
  49 + */
  50 + @ApiModelProperty(value = "需方", required = true)
  51 + @NotBlank(message = "请输入需方!")
  52 + @Length(message = "需方最多允许200个字符!")
  53 + private String buyer;
  54 +
  55 + /**
  56 + * 订货日期
  57 + */
  58 + @ApiModelProperty(value = "订货日期", required = true)
  59 + @TypeMismatch(message = "订货日期格式有误!")
  60 + @NotNull(message = "请输入订货日期!")
  61 + private LocalDate orderDate;
  62 +
  63 + /**
  64 + * 单位
  65 + */
  66 + @ApiModelProperty(value = "单位", required = true)
  67 + @NotBlank(message = "请输入单位!")
  68 + @Length(message = "单位最多允许50个字符!")
  69 + private String unit;
  70 +
  71 + /**
  72 + * 合计人民币金额(大写)
  73 + */
  74 + @ApiModelProperty(value = "合计人民币金额(大写)", required = true)
  75 + @NotBlank(message = "请输入合计人民币金额(大写)!")
  76 + @Length(message = "合计人民币金额(大写)最多允许100个字符!")
  77 + private String totalAmountCapital;
  78 +
  79 + /**
  80 + * 交付定金信息(包含数额、时间)
  81 + */
  82 + @ApiModelProperty(value = "交付定金信息(包含数额、时间)", required = true)
  83 + @NotBlank(message = "请输入交付定金信息(包含数额、时间)!")
  84 + @Length(message = "交付定金信息(包含数额、时间)最多允许500个字符!")
  85 + private String depositInfo;
  86 +
  87 + /**
  88 + * 包装要求
  89 + */
  90 + @ApiModelProperty(value = "包装要求", required = true)
  91 + @NotBlank(message = "请输入包装要求!")
  92 + @Length(message = "包装要求最多允许200个字符!")
  93 + private String packagingRequirements;
  94 +
  95 + /**
  96 + * 付款信息(包含付款方式、付款期限)
  97 + */
  98 + @ApiModelProperty(value = "付款信息(包含付款方式、付款期限)", required = true)
  99 + @NotBlank(message = "请输入付款信息(包含付款方式、付款期限)!")
  100 + @Length(message = "付款信息(包含付款方式、付款期限)最多允许500个字符!")
  101 + private String paymentTerms;
  102 +
  103 + /**
  104 + * 执行标准
  105 + */
  106 + @ApiModelProperty(value = "执行标准", required = true)
  107 + @NotBlank(message = "请输入执行标准!")
  108 + @Length(message = "执行标准最多允许50个字符!")
  109 + private String executionStandard;
  110 +
  111 + /**
  112 + * 运输方式
  113 + */
  114 + @ApiModelProperty(value = "运输方式", required = true)
  115 + @NotBlank(message = "请输入运输方式!")
  116 + @Length(message = "运输方式最多允许100个字符!")
  117 + private String transportMode;
  118 +
  119 + /**
  120 + * 目的地
  121 + */
  122 + @ApiModelProperty(value = "目的地", required = true)
  123 + @NotBlank(message = "请输入目的地!")
  124 + @Length(message = "目的地最多允许200个字符!")
  125 + private String destination;
  126 +
  127 + /**
  128 + * 单价中是否已包含包装费
  129 + */
  130 + @ApiModelProperty(value = "单价中是否已包含包装费", required = true)
  131 + @TypeMismatch(message = "单价中是否已包含包装费格式有误!")
  132 + @NotNull(message = "请输入单价中是否已包含包装费!")
  133 + private Boolean includesPackagingFee;
  134 +
  135 + /**
  136 + * 单价中是否已包含运费
  137 + */
  138 + @ApiModelProperty(value = "单价中是否已包含运费", required = true)
  139 + @TypeMismatch(message = "单价中是否已包含运费格式有误!")
  140 + @NotNull(message = "请输入单价中是否已包含运费!")
  141 + private Boolean includesTransportFee;
  142 +
  143 + /**
  144 + * 件重条头
  145 + */
  146 + @ApiModelProperty(value = "件重条头", required = true)
  147 + @NotBlank(message = "请输入件重条头!")
  148 + @Length(message = "件重条头最多允许65,535个字符!")
  149 + private String pieceWeightHead;
  150 +
  151 + /**
  152 + * 表面
  153 + */
  154 + @ApiModelProperty(value = "表面", required = true)
  155 + @NotBlank(message = "请输入表面!")
  156 + @Length(message = "表面最多允许65,535个字符!")
  157 + private String surface;
  158 +
  159 + /**
  160 + * 公差
  161 + */
  162 + @ApiModelProperty(value = "公差", required = true)
  163 + @NotBlank(message = "请输入公差!")
  164 + @Length(message = "公差最多允许65,535个字符!")
  165 + private String tolerance;
  166 +
  167 + /**
  168 + * 性能
  169 + */
  170 + @ApiModelProperty(value = "性能", required = true)
  171 + @NotBlank(message = "请输入性能!")
  172 + @Length(message = "性能最多允许65,535个字符!")
  173 + private String performance;
  174 +
  175 + /**
  176 + * 特别条款要求
  177 + */
  178 + @ApiModelProperty(value = "特别条款要求", required = true)
  179 + @NotBlank(message = "请输入特别条款要求!")
  180 + @Length(message = "特别条款要求最多允许50个字符!")
  181 + private String specialTerms;
  182 +
  183 + /**
  184 + * 需方指定收货人
  185 + */
  186 + @ApiModelProperty(value = "需方指定收货人", required = true)
  187 + @NotBlank(message = "请输入需方指定收货人!")
  188 + @Length(message = "需方指定收货人最多允许65,535个字符!")
  189 + private String designatedConsignee;
  190 +
  191 + /**
  192 + * 备注
  193 + */
  194 + @ApiModelProperty(value = "备注", required = true)
  195 + @NotBlank(message = "请输入备注!")
  196 + @Length(message = "备注最多允许65,535个字符!")
  197 + private String remarks;
  198 +
  199 + /**
  200 + * 合计数量
  201 + */
  202 + @ApiModelProperty(value = "合计数量", required = true)
  203 + @TypeMismatch(message = "合计数量格式有误!")
  204 + @NotNull(message = "请输入合计数量!")
  205 + private BigDecimal totalQuantity;
  206 +
  207 + /**
  208 + * 合计不含税金额
  209 + */
  210 + @ApiModelProperty(value = "合计不含税金额", required = true)
  211 + @TypeMismatch(message = "合计不含税金额格式有误!")
  212 + @NotNull(message = "请输入合计不含税金额!")
  213 + private BigDecimal totalAmountExcludingTax;
  214 +
  215 + /**
  216 + * 合计总金额
  217 + */
  218 + @ApiModelProperty(value = "合计总金额", required = true)
  219 + @TypeMismatch(message = "合计总金额格式有误!")
  220 + @NotNull(message = "请输入合计总金额!")
  221 + private BigDecimal totalAmountIncludingTax;
  222 +
  223 +}
... ...
  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.ContractDistributorStandardMapper">
  4 +
  5 + <resultMap id="ContractDistributorStandard" type="com.lframework.xingyun.sc.entity.ContractDistributorStandard">
  6 + <id column="id" property="id"/>
  7 + <result column="code" property="code"/>
  8 + <result column="supplier" property="supplier"/>
  9 + <result column="buyer" property="buyer"/>
  10 + <result column="dept_id" property="deptId"/>
  11 + <result column="order_date" property="orderDate"/>
  12 + <result column="unit" property="unit"/>
  13 + <result column="total_amount_capital" property="totalAmountCapital"/>
  14 + <result column="deposit_info" property="depositInfo"/>
  15 + <result column="packaging_requirements" property="packagingRequirements"/>
  16 + <result column="payment_terms" property="paymentTerms"/>
  17 + <result column="execution_standard" property="executionStandard"/>
  18 + <result column="transport_mode" property="transportMode"/>
  19 + <result column="destination" property="destination"/>
  20 + <result column="includes_packaging_fee" property="includesPackagingFee"/>
  21 + <result column="includes_transport_fee" property="includesTransportFee"/>
  22 + <result column="piece_weight_head" property="pieceWeightHead"/>
  23 + <result column="surface" property="surface"/>
  24 + <result column="tolerance" property="tolerance"/>
  25 + <result column="performance" property="performance"/>
  26 + <result column="special_terms" property="specialTerms"/>
  27 + <result column="designated_consignee" property="designatedConsignee"/>
  28 + <result column="remarks" property="remarks"/>
  29 + <result column="create_by_id" property="createById"/>
  30 + <result column="create_by" property="createBy"/>
  31 + <result column="update_by_id" property="updateById"/>
  32 + <result column="update_by" property="updateBy"/>
  33 + <result column="create_time" property="createTime"/>
  34 + <result column="update_time" property="updateTime"/>
  35 + <result column="total_quantit" property="totalQuantit"/>
  36 + <result column="total_amount_excluding_tax" property="totalAmountExcludingTax"/>
  37 + <result column="total_amount_including_tax" property="totalAmountIncludingTax"/>
  38 + </resultMap>
  39 +
  40 + <sql id="ContractDistributorStandard_sql">
  41 + SELECT
  42 + tb.id,
  43 + tb.code,
  44 + tb.supplier,
  45 + tb.buyer,
  46 + tb.dept_id,
  47 + tb.order_date,
  48 + tb.unit,
  49 + tb.total_amount_capital,
  50 + tb.deposit_info,
  51 + tb.packaging_requirements,
  52 + tb.payment_terms,
  53 + tb.execution_standard,
  54 + tb.transport_mode,
  55 + tb.destination,
  56 + tb.includes_packaging_fee,
  57 + tb.includes_transport_fee,
  58 + tb.piece_weight_head,
  59 + tb.surface,
  60 + tb.tolerance,
  61 + tb.performance,
  62 + tb.special_terms,
  63 + tb.designated_consignee,
  64 + tb.remarks,
  65 + tb.create_by_id,
  66 + tb.create_by,
  67 + tb.update_by_id,
  68 + tb.update_by,
  69 + tb.create_time,
  70 + tb.update_time,
  71 + tb.total_quantit,
  72 + tb.total_amount_excluding_tax,
  73 + tb.total_amount_including_tax
  74 + FROM tbl_contract_distributor_standard AS tb
  75 + </sql>
  76 +
  77 + <select id="query" resultMap="ContractDistributorStandard">
  78 + <include refid="ContractDistributorStandard_sql"/>
  79 + <where>
  80 + <if test="vo.code != null and vo.code != ''">
  81 + AND tb.code LIKE CONCAT('%', #{vo.code})
  82 + </if>
  83 + <if test="vo.buyer != null and vo.buyer != ''">
  84 + AND tb.buyer LIKE CONCAT('%', #{vo.buyer})
  85 + </if>
  86 + <if test="vo.deptId != null and vo.deptId != ''">
  87 + AND tb.dept_id = #{vo.deptId}
  88 + </if>
  89 + <if test="vo.orderDate != null">
  90 + AND tb.order_date IN (#{vo.orderDate})
  91 + </if>
  92 + <if test="vo.orderDateStart != null">
  93 + AND tb.order_date &gt;= #{vo.orderDateStart}
  94 + </if>
  95 + <if test="vo.orderDateEnd != null">
  96 + AND tb.order_date &lt;= #{vo.orderDateEnd}
  97 + </if>
  98 + </where>
  99 + </select>
  100 +</mapper>
... ...
... ... @@ -52,7 +52,7 @@
52 52 AND tb.has_framework_agreement = #{vo.hasFrameworkAgreement}
53 53 </if>
54 54 <if test="vo.materialTypeId != null and vo.materialTypeId != ''">
55   - AND tb.material_type_id = #{materialTypeId}
  55 + AND tb.material_type_id like CONCAT('%', #{vo.materialTypeId}, '%')
56 56 </if>
57 57 <if test="vo.validityTime != null">
58 58 AND tb.validity_time = #{vo.validityTime}
... ...