Showing
10 changed files
with
708 additions
and
0 deletions
| @@ -1678,3 +1678,97 @@ CREATE TABLE `base_data_price_sub_table` | @@ -1678,3 +1678,97 @@ CREATE TABLE `base_data_price_sub_table` | ||
| 1678 | KEY `idx_bdpst_product_id` (`product_id`), | 1678 | KEY `idx_bdpst_product_id` (`product_id`), |
| 1679 | KEY `idx_bdpst_create_time` (`create_time`) | 1679 | KEY `idx_bdpst_create_time` (`create_time`) |
| 1680 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='价格表子表'; | 1680 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='价格表子表'; |
| 1681 | + | ||
| 1682 | + | ||
| 1683 | +CREATE TABLE `procurement_salesman_quotation` | ||
| 1684 | +( | ||
| 1685 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 1686 | + `code` varchar(20) NOT NULL COMMENT '编号', | ||
| 1687 | + `supplier_id` varchar(32) NOT NULL COMMENT '供应商ID', | ||
| 1688 | + `purchase_department` varchar(32) NOT NULL COMMENT '采购处', | ||
| 1689 | + `region` varchar(32) NOT NULL COMMENT '区域', | ||
| 1690 | + `quote_time` datetime NOT NULL COMMENT '报价时间', | ||
| 1691 | + `validity_period` varchar(200) NOT NULL COMMENT '报价时效', | ||
| 1692 | + `quoter_id` varchar(32) NOT NULL COMMENT '报价人ID', | ||
| 1693 | + `quoter_name` varchar(64) NOT NULL COMMENT '报价人', | ||
| 1694 | + `long_term_operation` bool NOT NULL COMMENT '是否长单操作', | ||
| 1695 | + `terminal_customer` bool NOT NULL COMMENT '是否终端客户', | ||
| 1696 | + `priced` bool NOT NULL COMMENT '是否为点价', | ||
| 1697 | + `pricing_deadline` date DEFAULT NULL COMMENT '点价截止日期', | ||
| 1698 | + `other_expense_settlement` bool NOT NULL COMMENT '其他费用凭票到厂另行结算', | ||
| 1699 | + `delivery_mode` varchar(50) NOT NULL COMMENT '交提货方式', | ||
| 1700 | + `commodity_buyout` bool NOT NULL COMMENT '是否通货买断', | ||
| 1701 | + `quality_buyout` bool NOT NULL COMMENT '是否质量买断', | ||
| 1702 | + `quantity_buyout` bool NOT NULL COMMENT '是否数量买断', | ||
| 1703 | + `door_delivery` bool NOT NULL COMMENT '是否送货上门', | ||
| 1704 | + `loading_fee` decimal(18, 5) DEFAULT NULL COMMENT '装车费', | ||
| 1705 | + `invoice_product_name` varchar(200) NOT NULL COMMENT '开票品种', | ||
| 1706 | + `delivery_date` date NOT NULL COMMENT '交货日期', | ||
| 1707 | + `settlement_method` varchar(200) NOT NULL COMMENT '结算方式', | ||
| 1708 | + `settlement_ratio` decimal(10, 5) NOT NULL COMMENT '结算比例(%)', | ||
| 1709 | + `coordination_reason` varchar(200) NOT NULL COMMENT '协调事由', | ||
| 1710 | + `invoice_type_status` varchar(50) NOT NULL COMMENT '票类状况', | ||
| 1711 | + `total_quantity` decimal(18, 5) NOT NULL COMMENT '数量合计', | ||
| 1712 | + `material_condition_enabled` bool NOT NULL COMMENT '是否启用料质状况', | ||
| 1713 | + `material_condition_copper_rice` varchar(500) DEFAULT NULL COMMENT '铜米', | ||
| 1714 | + `material_condition_bright_copper` varchar(500) DEFAULT NULL COMMENT '光亮铜', | ||
| 1715 | + `material_condition_first_class` varchar(500) DEFAULT NULL COMMENT '一特', | ||
| 1716 | + `material_condition_second_class` varchar(500) DEFAULT NULL COMMENT '二特', | ||
| 1717 | + `material_condition_tin_coated` varchar(500) DEFAULT NULL COMMENT '镀锡紫', | ||
| 1718 | + `material_condition_scrap` varchar(500) DEFAULT NULL COMMENT '角料', | ||
| 1719 | + `material_condition_white_yellow` varchar(500) DEFAULT NULL COMMENT '镀白黄', | ||
| 1720 | + `material_condition_phosphor_copper` varchar(500) DEFAULT NULL COMMENT '磷铜', | ||
| 1721 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 1722 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 1723 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 1724 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 1725 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 1726 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 1727 | + PRIMARY KEY (`id`), | ||
| 1728 | + UNIQUE KEY `uk_psq_code` (`code`), | ||
| 1729 | + KEY `idx_psq_supplier_id` (`supplier_id`), | ||
| 1730 | + KEY `idx_psq_quote_time` (`quote_time`), | ||
| 1731 | + KEY `idx_psq_quoter_id` (`quoter_id`), | ||
| 1732 | + KEY `idx_psq_create_time` (`create_time`) | ||
| 1733 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='业务员报价主表'; | ||
| 1734 | + | ||
| 1735 | +CREATE TABLE `procurement_salesman_quotation_line` | ||
| 1736 | +( | ||
| 1737 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 1738 | + `quotation_id` varchar(32) NOT NULL COMMENT '业务员报价ID', | ||
| 1739 | + `product_id` varchar(32) NOT NULL COMMENT '品种ID', | ||
| 1740 | + `material_type` varchar(200) DEFAULT NULL COMMENT '料型', | ||
| 1741 | + `quantity` decimal(18, 5) NOT NULL COMMENT '数量', | ||
| 1742 | + `purchase_price` decimal(18, 10) DEFAULT NULL COMMENT '采购价', | ||
| 1743 | + `estimated_loss` decimal(18, 10) DEFAULT NULL COMMENT '买断料预计损耗', | ||
| 1744 | + `application_attrition` decimal(18, 10) DEFAULT NULL COMMENT '申请损耗', | ||
| 1745 | + `item_id` varchar(32) NOT NULL COMMENT '前端行标识', | ||
| 1746 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 1747 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 1748 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 1749 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 1750 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 1751 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 1752 | + PRIMARY KEY (`id`), | ||
| 1753 | + KEY `idx_psql_quotation_id` (`quotation_id`), | ||
| 1754 | + KEY `idx_psql_product_id` (`product_id`), | ||
| 1755 | + KEY `idx_psql_create_time` (`create_time`) | ||
| 1756 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='业务员报价明细表'; | ||
| 1757 | + | ||
| 1758 | +CREATE TABLE `procurement_salesman_quotation_peer` | ||
| 1759 | +( | ||
| 1760 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 1761 | + `peer_name` varchar(200) NOT NULL COMMENT '同行名称', | ||
| 1762 | + `peer_product_id` varchar(32) NOT NULL COMMENT '同行品种ID', | ||
| 1763 | + `peer_price` decimal(18, 10) NOT NULL COMMENT '同行报价', | ||
| 1764 | + `remark` varchar(500) DEFAULT NULL COMMENT '备注', | ||
| 1765 | + `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID', | ||
| 1766 | + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', | ||
| 1767 | + `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID', | ||
| 1768 | + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', | ||
| 1769 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 1770 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 1771 | + PRIMARY KEY (`id`), | ||
| 1772 | + KEY `idx_psqp_peer_product_id` (`peer_product_id`), | ||
| 1773 | + KEY `idx_psqp_create_time` (`create_time`) | ||
| 1774 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='同行报价信息'; |
| 1 | +package com.lframework.xingyun.sc.procurement.controller.quotation; | ||
| 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.xingyun.sc.procurement.entity.SalesmanQuotationPeer; | ||
| 10 | +import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationPeerService; | ||
| 11 | +import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationPeerVo; | ||
| 12 | +import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationPeerVo; | ||
| 13 | +import com.lframework.xingyun.sc.procurement.vo.quotation.UpdateSalesmanQuotationPeerVo; | ||
| 14 | +import io.swagger.annotations.Api; | ||
| 15 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 16 | +import io.swagger.annotations.ApiOperation; | ||
| 17 | +import javax.annotation.Resource; | ||
| 18 | +import javax.validation.Valid; | ||
| 19 | +import javax.validation.constraints.NotBlank; | ||
| 20 | +import org.springframework.validation.annotation.Validated; | ||
| 21 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 22 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 23 | +import org.springframework.web.bind.annotation.PutMapping; | ||
| 24 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 26 | +import org.springframework.web.bind.annotation.RestController; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * 同行报价信息 Controller | ||
| 30 | + */ | ||
| 31 | +@Api(tags = "同行报价信息") | ||
| 32 | +@Validated | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/procurement/salesmanQuotationPeer") | ||
| 35 | +public class SalesmanQuotationPeerController extends DefaultBaseController { | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 同行报价信息 Service | ||
| 39 | + */ | ||
| 40 | + @Resource | ||
| 41 | + private SalesmanQuotationPeerService salesmanQuotationPeerService; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 新增 | ||
| 45 | + * | ||
| 46 | + * @param vo 新增参数 | ||
| 47 | + * @return 操作结果 | ||
| 48 | + */ | ||
| 49 | + @ApiOperation("新增") | ||
| 50 | + @HasPermission({"procure-manage:sales-price-peer:add"}) | ||
| 51 | + @PostMapping | ||
| 52 | + public InvokeResult<Void> create(@Valid @RequestBody CreateSalesmanQuotationPeerVo vo) { | ||
| 53 | + salesmanQuotationPeerService.create(vo); | ||
| 54 | + return InvokeResultBuilder.success(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 分页查询 | ||
| 59 | + * | ||
| 60 | + * @param vo 查询条件 | ||
| 61 | + * @return 分页结果 | ||
| 62 | + */ | ||
| 63 | + @ApiOperation("分页查询") | ||
| 64 | + @HasPermission({"procure-manage:sales-price-peer:query"}) | ||
| 65 | + @GetMapping("/query") | ||
| 66 | + public InvokeResult<PageResult<SalesmanQuotationPeer>> query(@Valid QuerySalesmanQuotationPeerVo vo) { | ||
| 67 | + return InvokeResultBuilder.success( | ||
| 68 | + salesmanQuotationPeerService.query(getPageIndex(vo), getPageSize(vo), vo)); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 详情 | ||
| 73 | + * | ||
| 74 | + * @param id 主键ID | ||
| 75 | + * @return 详情 | ||
| 76 | + */ | ||
| 77 | + @ApiOperation("详情") | ||
| 78 | + @HasPermission({"procure-manage:sales-price-peer:query"}) | ||
| 79 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | ||
| 80 | + @GetMapping("") | ||
| 81 | + public InvokeResult<SalesmanQuotationPeer> get(@NotBlank(message = "id不能为空!") String id) { | ||
| 82 | + SalesmanQuotationPeer data = salesmanQuotationPeerService.findById(id); | ||
| 83 | + if (data == null) { | ||
| 84 | + throw new DefaultClientException("同行报价信息不存在!"); | ||
| 85 | + } | ||
| 86 | + return InvokeResultBuilder.success(data); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 修改 | ||
| 91 | + * | ||
| 92 | + * @param vo 修改参数 | ||
| 93 | + * @return 操作结果 | ||
| 94 | + */ | ||
| 95 | + @ApiOperation("修改") | ||
| 96 | + @HasPermission({"procure-manage:sales-price-peer:modify"}) | ||
| 97 | + @PutMapping | ||
| 98 | + public InvokeResult<Void> update(@Valid @RequestBody UpdateSalesmanQuotationPeerVo vo) { | ||
| 99 | + salesmanQuotationPeerService.update(vo); | ||
| 100 | + return InvokeResultBuilder.success(); | ||
| 101 | + } | ||
| 102 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/procurement/entity/SalesmanQuotationPeer.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.procurement.entity; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.lframework.starter.web.core.dto.BaseDto; | ||
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import lombok.Data; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 同行报价信息表 | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +@TableName("procurement_salesman_quotation_peer") | ||
| 17 | +public class SalesmanQuotationPeer extends BaseEntity implements BaseDto { | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = 1L; | ||
| 20 | + | ||
| 21 | + public static final String CACHE_NAME = "SalesmanQuotationPeer"; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * ID | ||
| 25 | + */ | ||
| 26 | + private String id; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 同行名称 | ||
| 30 | + */ | ||
| 31 | + private String peerName; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 同行品种ID | ||
| 35 | + */ | ||
| 36 | + private String peerProductId; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 同行品种名称 | ||
| 40 | + */ | ||
| 41 | + @TableField(exist = false) | ||
| 42 | + private String peerProductName; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 同行品种代号 | ||
| 46 | + */ | ||
| 47 | + @TableField(exist = false) | ||
| 48 | + private String peerProductCode; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 同行报价 | ||
| 52 | + */ | ||
| 53 | + private BigDecimal peerPrice; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 备注 | ||
| 57 | + */ | ||
| 58 | + private String remark; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 创建人ID | ||
| 62 | + */ | ||
| 63 | + @TableField(fill = FieldFill.INSERT) | ||
| 64 | + private String createById; | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 创建人 | ||
| 68 | + */ | ||
| 69 | + @TableField(fill = FieldFill.INSERT) | ||
| 70 | + private String createBy; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 更新人ID | ||
| 74 | + */ | ||
| 75 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 76 | + private String updateById; | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 更新人 | ||
| 80 | + */ | ||
| 81 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 82 | + private String updateBy; | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 创建时间 | ||
| 86 | + */ | ||
| 87 | + @TableField(fill = FieldFill.INSERT) | ||
| 88 | + private LocalDateTime createTime; | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 更新时间 | ||
| 92 | + */ | ||
| 93 | + @TableField(fill = FieldFill.INSERT_UPDATE) | ||
| 94 | + private LocalDateTime updateTime; | ||
| 95 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.impl.quotation; | ||
| 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.common.exceptions.impl.DefaultClientException; | ||
| 7 | +import com.lframework.starter.common.utils.Assert; | ||
| 8 | +import com.lframework.starter.common.utils.ObjectUtil; | ||
| 9 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 10 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 11 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | ||
| 12 | +import com.lframework.starter.web.core.utils.IdUtil; | ||
| 13 | +import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 14 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 15 | +import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 16 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | ||
| 17 | +import com.lframework.xingyun.basedata.entity.BreedRelationship; | ||
| 18 | +import com.lframework.xingyun.basedata.service.breed.BreedRelationshipService; | ||
| 19 | +import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationPeer; | ||
| 20 | +import com.lframework.xingyun.sc.procurement.mappers.quotation.SalesmanQuotationPeerMapper; | ||
| 21 | +import com.lframework.xingyun.sc.procurement.service.quotation.SalesmanQuotationPeerService; | ||
| 22 | +import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationPeerVo; | ||
| 23 | +import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationPeerVo; | ||
| 24 | +import com.lframework.xingyun.sc.procurement.vo.quotation.UpdateSalesmanQuotationPeerVo; | ||
| 25 | +import java.io.Serializable; | ||
| 26 | +import java.util.List; | ||
| 27 | +import javax.annotation.Resource; | ||
| 28 | +import org.apache.commons.lang3.StringUtils; | ||
| 29 | +import org.springframework.stereotype.Service; | ||
| 30 | +import org.springframework.transaction.annotation.Transactional; | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * 业务员报价同行信息 Service 实现 | ||
| 34 | + */ | ||
| 35 | +@Service | ||
| 36 | +public class SalesmanQuotationPeerServiceImpl | ||
| 37 | + extends BaseMpServiceImpl<SalesmanQuotationPeerMapper, SalesmanQuotationPeer> | ||
| 38 | + implements SalesmanQuotationPeerService { | ||
| 39 | + | ||
| 40 | + @Resource | ||
| 41 | + private BreedRelationshipService breedRelationshipService; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 分页查询 | ||
| 45 | + * | ||
| 46 | + * @param pageIndex 页码 | ||
| 47 | + * @param pageSize 页大小 | ||
| 48 | + * @param vo 查询条件 | ||
| 49 | + * @return 分页结果 | ||
| 50 | + */ | ||
| 51 | + @Override | ||
| 52 | + public PageResult<SalesmanQuotationPeer> query(Integer pageIndex, Integer pageSize, QuerySalesmanQuotationPeerVo vo) { | ||
| 53 | + Assert.greaterThanZero(pageIndex); | ||
| 54 | + Assert.greaterThanZero(pageSize); | ||
| 55 | + | ||
| 56 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 57 | + List<SalesmanQuotationPeer> datas = this.query(vo); | ||
| 58 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 查询列表 | ||
| 63 | + * | ||
| 64 | + * @param vo 查询条件 | ||
| 65 | + * @return 同行信息列表 | ||
| 66 | + */ | ||
| 67 | + @Override | ||
| 68 | + public List<SalesmanQuotationPeer> query(QuerySalesmanQuotationPeerVo vo) { | ||
| 69 | + return getBaseMapper().query(vo); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 根据ID查询 | ||
| 74 | + * | ||
| 75 | + * @param id 主键ID | ||
| 76 | + * @return 同行信息 | ||
| 77 | + */ | ||
| 78 | + @Override | ||
| 79 | + public SalesmanQuotationPeer findById(String id) { | ||
| 80 | + QuerySalesmanQuotationPeerVo queryVo = new QuerySalesmanQuotationPeerVo(); | ||
| 81 | + queryVo.setId(id); | ||
| 82 | + List<SalesmanQuotationPeer> datas = getBaseMapper().query(queryVo); | ||
| 83 | + return datas.isEmpty() ? null : datas.get(0); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 创建 | ||
| 88 | + * | ||
| 89 | + * @param vo 创建参数 | ||
| 90 | + * @return 主键ID | ||
| 91 | + */ | ||
| 92 | + @OpLog(type = OtherOpLogType.class, name = "新增业务员报价同行信息,ID:{}", params = {"#id"}) | ||
| 93 | + @Transactional(rollbackFor = Exception.class) | ||
| 94 | + @Override | ||
| 95 | + public String create(CreateSalesmanQuotationPeerVo vo) { | ||
| 96 | + checkPeerProduct(vo.getPeerProductId()); | ||
| 97 | + | ||
| 98 | + SalesmanQuotationPeer data = new SalesmanQuotationPeer(); | ||
| 99 | + data.setId(IdUtil.getId()); | ||
| 100 | + data.setPeerName(vo.getPeerName()); | ||
| 101 | + data.setPeerProductId(vo.getPeerProductId()); | ||
| 102 | + data.setPeerPrice(vo.getPeerPrice()); | ||
| 103 | + data.setRemark(StringUtils.defaultIfBlank(vo.getRemark(), null)); | ||
| 104 | + | ||
| 105 | + getBaseMapper().insert(data); | ||
| 106 | + | ||
| 107 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 108 | + OpLogUtil.setExtra(vo); | ||
| 109 | + return data.getId(); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * 修改 | ||
| 114 | + * | ||
| 115 | + * @param vo 修改参数 | ||
| 116 | + */ | ||
| 117 | + @OpLog(type = OtherOpLogType.class, name = "修改同行报价信息,ID:{}", params = {"#vo.id"}) | ||
| 118 | + @Transactional(rollbackFor = Exception.class) | ||
| 119 | + @Override | ||
| 120 | + public void update(UpdateSalesmanQuotationPeerVo vo) { | ||
| 121 | + SalesmanQuotationPeer data = getBaseMapper().selectById(vo.getId()); | ||
| 122 | + if (ObjectUtil.isNull(data)) { | ||
| 123 | + throw new DefaultClientException("同行报价信息不存在!"); | ||
| 124 | + } | ||
| 125 | + checkPeerProduct(vo.getPeerProductId()); | ||
| 126 | + | ||
| 127 | + LambdaUpdateWrapper<SalesmanQuotationPeer> updateWrapper = Wrappers.lambdaUpdate(SalesmanQuotationPeer.class) | ||
| 128 | + .set(SalesmanQuotationPeer::getPeerName, vo.getPeerName()) | ||
| 129 | + .set(SalesmanQuotationPeer::getPeerProductId, vo.getPeerProductId()) | ||
| 130 | + .set(SalesmanQuotationPeer::getPeerPrice, vo.getPeerPrice()) | ||
| 131 | + .set(SalesmanQuotationPeer::getRemark, StringUtils.defaultIfBlank(vo.getRemark(), null)) | ||
| 132 | + .eq(SalesmanQuotationPeer::getId, vo.getId()); | ||
| 133 | + | ||
| 134 | + getBaseMapper().update(updateWrapper); | ||
| 135 | + | ||
| 136 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 137 | + OpLogUtil.setExtra(vo); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * 清理缓存 | ||
| 142 | + * | ||
| 143 | + * @param key 缓存键 | ||
| 144 | + */ | ||
| 145 | + @Override | ||
| 146 | + public void cleanCacheByKey(Serializable key) { | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 校验同行品种 | ||
| 151 | + * | ||
| 152 | + * @param peerProductId 同行品种ID | ||
| 153 | + */ | ||
| 154 | + private void checkPeerProduct(String peerProductId) { | ||
| 155 | + BreedRelationship breedRelationship = breedRelationshipService.findById(peerProductId); | ||
| 156 | + if (breedRelationship == null) { | ||
| 157 | + throw new DefaultClientException("同行品种不存在,请重新选择!"); | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.mappers.quotation; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | ||
| 4 | +import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationPeer; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationPeerVo; | ||
| 6 | +import java.util.List; | ||
| 7 | +import org.apache.ibatis.annotations.Param; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 业务员报价同行信息 Mapper | ||
| 11 | + */ | ||
| 12 | +public interface SalesmanQuotationPeerMapper extends BaseMapper<SalesmanQuotationPeer> { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 查询列表 | ||
| 16 | + * | ||
| 17 | + * @param vo 查询条件 | ||
| 18 | + * @return 同行信息列表 | ||
| 19 | + */ | ||
| 20 | + List<SalesmanQuotationPeer> query(@Param("vo") QuerySalesmanQuotationPeerVo vo); | ||
| 21 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.service.quotation; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.components.resp.PageResult; | ||
| 4 | +import com.lframework.starter.web.core.service.BaseMpService; | ||
| 5 | +import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationPeer; | ||
| 6 | +import com.lframework.xingyun.sc.procurement.vo.quotation.CreateSalesmanQuotationPeerVo; | ||
| 7 | +import com.lframework.xingyun.sc.procurement.vo.quotation.QuerySalesmanQuotationPeerVo; | ||
| 8 | +import com.lframework.xingyun.sc.procurement.vo.quotation.UpdateSalesmanQuotationPeerVo; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 业务员报价同行信息 Service | ||
| 13 | + */ | ||
| 14 | +public interface SalesmanQuotationPeerService extends BaseMpService<SalesmanQuotationPeer> { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 分页查询 | ||
| 18 | + * | ||
| 19 | + * @param pageIndex 页码 | ||
| 20 | + * @param pageSize 页大小 | ||
| 21 | + * @param vo 查询条件 | ||
| 22 | + * @return 分页结果 | ||
| 23 | + */ | ||
| 24 | + PageResult<SalesmanQuotationPeer> query(Integer pageIndex, Integer pageSize, QuerySalesmanQuotationPeerVo vo); | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 查询列表 | ||
| 28 | + * | ||
| 29 | + * @param vo 查询条件 | ||
| 30 | + * @return 同行信息列表 | ||
| 31 | + */ | ||
| 32 | + List<SalesmanQuotationPeer> query(QuerySalesmanQuotationPeerVo vo); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 根据ID查询 | ||
| 36 | + * | ||
| 37 | + * @param id 主键ID | ||
| 38 | + * @return 同行信息 | ||
| 39 | + */ | ||
| 40 | + SalesmanQuotationPeer findById(String id); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 创建 | ||
| 44 | + * | ||
| 45 | + * @param vo 创建参数 | ||
| 46 | + * @return 主键ID | ||
| 47 | + */ | ||
| 48 | + String create(CreateSalesmanQuotationPeerVo vo); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 修改 | ||
| 52 | + * | ||
| 53 | + * @param vo 修改参数 | ||
| 54 | + */ | ||
| 55 | + void update(UpdateSalesmanQuotationPeerVo vo); | ||
| 56 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.quotation; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import java.io.Serializable; | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import javax.validation.constraints.Digits; | ||
| 8 | +import javax.validation.constraints.NotBlank; | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | +import lombok.Data; | ||
| 11 | +import org.hibernate.validator.constraints.Length; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 新增业务员报价同行信息入参 | ||
| 15 | + */ | ||
| 16 | +@Data | ||
| 17 | +public class CreateSalesmanQuotationPeerVo implements BaseVo, Serializable { | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = 1L; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 同行名称 | ||
| 23 | + */ | ||
| 24 | + @ApiModelProperty(value = "同行名称", required = true) | ||
| 25 | + @NotBlank(message = "同行名称不能为空!") | ||
| 26 | + @Length(max = 200, message = "同行名称最多允许200个字符!") | ||
| 27 | + private String peerName; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 同行品种ID | ||
| 31 | + */ | ||
| 32 | + @ApiModelProperty(value = "同行品种ID", required = true) | ||
| 33 | + @NotBlank(message = "同行品种不能为空!") | ||
| 34 | + private String peerProductId; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 同行报价 | ||
| 38 | + */ | ||
| 39 | + @ApiModelProperty(value = "同行报价", required = true) | ||
| 40 | + @NotNull(message = "同行报价不能为空!") | ||
| 41 | + @Digits(integer = 14, fraction = 10, message = "同行报价最多支持14位整数和10位小数!") | ||
| 42 | + private BigDecimal peerPrice; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 备注 | ||
| 46 | + */ | ||
| 47 | + @ApiModelProperty("备注") | ||
| 48 | + @Length(max = 500, message = "备注最多允许500个字符!") | ||
| 49 | + private String remark; | ||
| 50 | + | ||
| 51 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.quotation; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | ||
| 5 | +import io.swagger.annotations.ApiModelProperty; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.time.LocalDate; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 查询业务员报价同行信息入参 | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +public class QuerySalesmanQuotationPeerVo extends PageVo implements BaseVo, Serializable { | ||
| 15 | + | ||
| 16 | + private static final long serialVersionUID = 1L; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * ID | ||
| 20 | + */ | ||
| 21 | + @ApiModelProperty("ID") | ||
| 22 | + private String id; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 同行名称 | ||
| 26 | + */ | ||
| 27 | + @ApiModelProperty("同行名称") | ||
| 28 | + private String peerName; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 同行品种 | ||
| 32 | + */ | ||
| 33 | + @ApiModelProperty("同行品种") | ||
| 34 | + private String peerProductName; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 创建日期开始 | ||
| 38 | + */ | ||
| 39 | + @ApiModelProperty("创建日期开始") | ||
| 40 | + private LocalDate createDateStart; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 创建日期结束 | ||
| 44 | + */ | ||
| 45 | + @ApiModelProperty("创建日期结束") | ||
| 46 | + private LocalDate createDateEnd; | ||
| 47 | +} |
| 1 | +package com.lframework.xingyun.sc.procurement.vo.quotation; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import javax.validation.constraints.NotBlank; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 修改业务员报价同行信息入参 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class UpdateSalesmanQuotationPeerVo extends CreateSalesmanQuotationPeerVo { | ||
| 12 | + | ||
| 13 | + private static final long serialVersionUID = 1L; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * ID | ||
| 17 | + */ | ||
| 18 | + @ApiModelProperty("ID") | ||
| 19 | + @NotBlank(message = "ID不能为空!") | ||
| 20 | + private String id; | ||
| 21 | +} |
xingyun-sc/src/main/resources/mappers/procurement/quotation/SalesmanQuotationPeerMapper.xml
0 → 100644
| 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.procurement.mappers.quotation.SalesmanQuotationPeerMapper"> | ||
| 4 | + | ||
| 5 | + <resultMap id="SalesmanQuotationPeer" type="com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationPeer"> | ||
| 6 | + <id column="id" property="id"/> | ||
| 7 | + <result column="peer_name" property="peerName"/> | ||
| 8 | + <result column="peer_product_id" property="peerProductId"/> | ||
| 9 | + <result column="peer_product_name" property="peerProductName"/> | ||
| 10 | + <result column="peer_product_code" property="peerProductCode"/> | ||
| 11 | + <result column="peer_price" property="peerPrice"/> | ||
| 12 | + <result column="remark" property="remark"/> | ||
| 13 | + <result column="create_by_id" property="createById"/> | ||
| 14 | + <result column="create_by" property="createBy"/> | ||
| 15 | + <result column="update_by_id" property="updateById"/> | ||
| 16 | + <result column="update_by" property="updateBy"/> | ||
| 17 | + <result column="create_time" property="createTime"/> | ||
| 18 | + <result column="update_time" property="updateTime"/> | ||
| 19 | + </resultMap> | ||
| 20 | + | ||
| 21 | + <sql id="SalesmanQuotationPeerSql"> | ||
| 22 | + SELECT | ||
| 23 | + tb.id, | ||
| 24 | + tb.peer_name, | ||
| 25 | + tb.peer_product_id, | ||
| 26 | + br.product_name AS peer_product_name, | ||
| 27 | + br.code AS peer_product_code, | ||
| 28 | + tb.peer_price, | ||
| 29 | + tb.remark, | ||
| 30 | + tb.create_by_id, | ||
| 31 | + tb.create_by, | ||
| 32 | + tb.update_by_id, | ||
| 33 | + tb.update_by, | ||
| 34 | + tb.create_time, | ||
| 35 | + tb.update_time | ||
| 36 | + FROM procurement_salesman_quotation_peer tb | ||
| 37 | + LEFT JOIN base_data_breed_relationship br ON br.id = tb.peer_product_id | ||
| 38 | + </sql> | ||
| 39 | + | ||
| 40 | + <select id="query" resultMap="SalesmanQuotationPeer"> | ||
| 41 | + <include refid="SalesmanQuotationPeerSql"/> | ||
| 42 | + <where> | ||
| 43 | + <if test="vo.id != null and vo.id != ''"> | ||
| 44 | + AND tb.id = #{vo.id} | ||
| 45 | + </if> | ||
| 46 | + <if test="vo.peerName != null and vo.peerName != ''"> | ||
| 47 | + AND tb.peer_name LIKE CONCAT('%', #{vo.peerName}, '%') | ||
| 48 | + </if> | ||
| 49 | + <if test="vo.peerProductName != null and vo.peerProductName != ''"> | ||
| 50 | + AND br.product_name LIKE CONCAT('%', #{vo.peerProductName}, '%') | ||
| 51 | + </if> | ||
| 52 | + <if test="vo.createDateStart != null"> | ||
| 53 | + AND DATE(tb.create_time) <![CDATA[ >= ]]> #{vo.createDateStart} | ||
| 54 | + </if> | ||
| 55 | + <if test="vo.createDateEnd != null"> | ||
| 56 | + AND DATE(tb.create_time) <![CDATA[ <= ]]> #{vo.createDateEnd} | ||
| 57 | + </if> | ||
| 58 | + </where> | ||
| 59 | + ORDER BY tb.create_time DESC | ||
| 60 | + </select> | ||
| 61 | +</mapper> |