feat(quotation): 添加报价单功能模块

- 新增报价单管理界面,支持报价单的增删改查操作
- 实现报价单基本信息设置和产品配置功能
- 添加报价单号自动生成机制,支持按日期和序列号生成
- 集成代表处选择和客户信息管理功能
- 实现多步骤表单流程,支持基本信息和配置信息分步填写
- 添加产品列表管理,支持软件、硬件和服务产品的分类配置
- 实现报价金额和折后金额的自动计算功能
- 优化发货记录中的服务年限计算逻辑
- 修复代码生成器中编号从0开始的问题,调整为从1开始
dev_1.0.2
chenhao 2026-01-27 18:04:44 +08:00
parent baa4b52553
commit aa2efbd42e
16 changed files with 1852 additions and 2 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询报价单列表
export function listQuotation(query) {
return request({
url: '/quotation/list',
method: 'get',
params: query
})
}
// 查询报价单详细
export function getQuotation(id) {
return request({
url: '/quotation/' + id,
method: 'get'
})
}
// 新增报价单
export function addQuotation(data) {
return request({
url: '/quotation/insert',
method: 'post',
data: data
})
}
// 修改报价单
export function updateQuotation(data) {
return request({
url: '/quotation/update',
method: 'put',
data: data
})
}
// 删除报价单
export function delQuotation(id) {
return request({
url: '/quotation/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,497 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="报价单号" prop="quotationCode">
<el-input
v-model="queryParams.quotationCode"
placeholder="请输入报价单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报价单" prop="quotationName">
<el-input
v-model="queryParams.quotationName"
placeholder="请输入报价单名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="quotationStatus">
<el-input
v-model="queryParams.quotationStatus"
placeholder="请输入状态"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['base:quotation:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['base:quotation:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['base:quotation:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="quotationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报价单号" align="center" prop="quotationCode" />
<el-table-column label="报价单" align="center" prop="quotationName" />
<el-table-column label="项目编号" align="center" prop="projectCode" />
<el-table-column label="报价金额" align="center" prop="quotationAmount" />
<el-table-column label="折后金额" align="center" prop="discountAmount" />
<el-table-column label="状态" align="center" prop="quotationStatus" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:quotation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:quotation:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报价单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" @close="cancel">
<el-steps :active="activeStep" simple finish-status="success" style="margin-bottom: 20px; cursor: pointer;">
<el-step title="报价单列表" @click.native="handleStepClick(0)"></el-step>
<el-step title="设置基本信息" @click.native="handleStepClick(1)"></el-step>
<el-step title="配置信息" @click.native="handleStepClick(2)"></el-step>
</el-steps>
<div v-if="form.quotationCode || catalogueTotalPrice > 0 || discountedTotalPrice > 0">
<el-divider></el-divider>
<el-row type="flex" justify="space-between" style="margin-bottom: 20px; font-size: 14px;">
<el-col :span="8">
<span v-if="form.quotationCode">
<span style="font-weight: bold;">报价单号</span>{{ form.quotationCode }}
</span>
</el-col>
<el-col :span="16" style="text-align: right;">
<span v-if="catalogueTotalPrice > 0" style="margin-right: 20px;">
<span style="font-weight: bold;">目录总价</span>{{ formatAmount(catalogueTotalPrice) }}
</span>
<span v-if="discountedTotalPrice > 0">
<span style="font-weight: bold;">折后总价</span>{{ formatAmount(discountedTotalPrice) }}
</span>
</el-col>
</el-row>
<el-divider></el-divider>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px" style="max-height: 50vh;overflow-y: auto;padding: 10px">
<!-- Step 1 Content: Basic Info -->
<div v-show="activeStep === 1">
<el-row>
<el-col :span="12">
<el-form-item label="报价单名称" prop="quotationName">
<el-input v-model="form.quotationName" placeholder="请输入报价单名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="币种" prop="amountType">
<el-select v-model="form.amountType" placeholder="请选择币种" style="width: 100%">
<el-option
v-for="dict in dict.type.currency_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="代表处" prop="agentCode">
<el-select v-model="form.agentCode" placeholder="请选择代表处" style="width: 100%">
<el-option
v-for="item in agentOptions"
:key="item.agentCode"
:label="item.agentName"
:value="item.agentCode"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="报价单备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</div>
<!-- Step 2 Content: Config Info -->
<div v-show="activeStep === 2">
<product-config :value="form" @input="updateProductConfig" />
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<div v-if="activeStep === 1">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="nextStep"></el-button>
</div>
<div v-if="activeStep === 2">
<el-button @click="prevStep"></el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { listQuotation, getQuotation, delQuotation, addQuotation, updateQuotation } from "@/api/base/quotation";
import { listAgent } from "@/api/system/agent";
import ProductConfig from "@/views/project/info/ProductConfig";
import {isEmpty} from "@/utils/validate";
export default {
name: "Quotation",
components: {
ProductConfig
},
dicts: ['currency_type'],
data() {
return {
//
activeStep: 1,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
quotationList: [],
//
dateRange: [],
//
agentOptions: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
quotationCode: null,
quotationName: null,
projectCode: null,
quotationStatus: null,
createTimeStart: null,
createTimeEnd: null,
},
//
form: {
softwareProjectProductInfoList: [],
hardwareProjectProductInfoList: [],
maintenanceProjectProductInfoList: []
},
//
rules: {
quotationName: [
{ required: true, message: "报价单名称不能为空", trigger: "blur" }
],
amountType: [
{ required: true, message: "币种不能为空", trigger: "change" }
],
agentCode: [
{ required: true, message: "代表处不能为空", trigger: "change" }
],
customerName: [
{ required: true, message: "客户名称不能为空", trigger: "blur" }
],
}
};
},
computed: {
catalogueTotalPrice() {
let total = 0;
const lists = [
this.form.softwareProjectProductInfoList,
this.form.hardwareProjectProductInfoList,
this.form.maintenanceProjectProductInfoList
];
lists.forEach(list => {
if (list && list.length > 0) {
list.forEach(item => {
total += Number(item.catalogueAllPrice) || 0;
});
}
});
return total;
},
discountedTotalPrice() {
let total = 0;
const lists = [
this.form.softwareProjectProductInfoList,
this.form.hardwareProjectProductInfoList,
this.form.maintenanceProjectProductInfoList
];
lists.forEach(list => {
if (list && list.length > 0) {
list.forEach(item => {
total += Number(item.allPrice) || 0;
});
}
});
return total;
}
},
created() {
this.getList();
this.getAgentList();
},
methods: {
/** 查询报价单列表 */
getList() {
this.loading = true;
if (null != this.dateRange && '' != this.dateRange) {
this.queryParams.createTimeStart = this.dateRange[0];
this.queryParams.createTimeEnd = this.dateRange[1];
}
listQuotation(this.queryParams).then(response => {
this.quotationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询代表处列表 */
getAgentList() {
listAgent().then(response => {
this.agentOptions = response.rows;
});
},
//
cancel() {
this.open = false;
this.reset();
this.activeStep = 1;
},
//
reset() {
this.form = {
id: null,
quotationCode: null,
quotationName: null,
projectCode: null,
quotationAmount: null,
discountAmount: null,
quotationStatus: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
agentCode: null,
amountType: null,
customerName: null,
softwareProjectProductInfoList: [],
hardwareProjectProductInfoList: [],
maintenanceProjectProductInfoList: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.createTimeStart = null;
this.queryParams.createTimeEnd = null;
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.activeStep = 1;
this.title = "添加报价单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getQuotation(id).then(response => {
this.form = response.data;
// Ensure product lists are initialized if null
this.form.softwareProjectProductInfoList = this.form.softwareProjectProductInfoList || [];
this.form.hardwareProjectProductInfoList = this.form.hardwareProjectProductInfoList || [];
this.form.maintenanceProjectProductInfoList = this.form.maintenanceProjectProductInfoList || [];
this.open = true;
this.activeStep = 1;
this.title = "修改报价单";
});
},
/** 处理步骤点击 */
handleStepClick(stepIndex) {
if (stepIndex === 0) {
this.cancel();
} else if (stepIndex === 1) {
this.activeStep = 1;
} else if (stepIndex === 2) {
// Validate step 1 before going to step 2
this.$refs["form"].validateField(['quotationName', 'amountType', 'agentCode', 'customerName'], (errorMessage) => {
if (!errorMessage) {
this.activeStep = 2;
}
});
}
},
/** 下一步 */
nextStep() {
// Step 1
this.$refs["form"].validateField(['quotationName', 'amountType', 'agentCode', 'customerName'], (errorMessage) => {
if (!errorMessage) {
this.activeStep = 2;
}
});
},
/** 上一步 */
prevStep() {
this.activeStep = 1;
},
updateProductConfig(data) {
this.form.softwareProjectProductInfoList = data.softwareProjectProductInfoList;
this.form.hardwareProjectProductInfoList = data.hardwareProjectProductInfoList;
this.form.maintenanceProjectProductInfoList = data.maintenanceProjectProductInfoList;
},
formatAmount(value) {
if (value === null || value === undefined) return '';
return Number(value).toLocaleString('en-US', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
const checkProduct=(list)=>isEmpty(list) ||( !isEmpty(list) && list.every(item => item.productBomCode!==''))
if (!checkProduct(this.form.softwareProjectProductInfoList) || !checkProduct(this.form.hardwareProjectProductInfoList) || !checkProduct(this.form.maintenanceProjectProductInfoList)) {
this.$modal.msgError("请完善产品信息");
return;
}
this.form.quotationAmount = this.catalogueTotalPrice;
this.form.discountAmount = this.discountedTotalPrice;
if (this.form.id != null) {
updateQuotation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addQuotation(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报价单编号为"' + ids + '"的数据项?').then(function() {
return delQuotation(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -0,0 +1,72 @@
package com.ruoyi.sip.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.sip.domain.Quotation;
import com.ruoyi.sip.service.IQuotationService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @Author makejava
* @Desc
* (Quotation)
* @Date 2026-01-26 14:58:02
*/
@RestController
@RequestMapping("/quotation")
public class QuotationController extends BaseController {
@Autowired
private IQuotationService quotationService;
@GetMapping("/list")
public TableDataInfo list(Quotation quotation) {
startPage();
List<Quotation> list = quotationService.queryAll(quotation);
return getDataTable(list);
}
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
return AjaxResult.success(quotationService.queryById(id));
}
@PostMapping("/insert")
public AjaxResult add(@RequestBody Quotation quotation) {
return toAjax(quotationService.insert(quotation));
}
@PutMapping("/update")
public AjaxResult edit(@RequestBody Quotation quotation) {
return toAjax(quotationService.update(quotation));
}
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable("id") Integer id) {
return toAjax(quotationService.deleteById(id));
}
/**
*
*/
@DeleteMapping("/remove/batch/{ids}")
public AjaxResult batchRemove(@PathVariable("ids") Integer[] ids) {
return AjaxResult.success(quotationService.batchRemove(ids));
}
}

View File

@ -81,6 +81,7 @@ public class CodeGenTable {
@Getter
public enum TableNameEnum{
ORDER_DELIVERY("order_delivery", "发货记录"),
OMS_QUOTATION("oms_quotation", "报价单"),
;
private final String name;
private final String desc;

View File

@ -0,0 +1,83 @@
package com.ruoyi.sip.domain;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/**
*
* (Quotation)
*
* @author makejava
* @since 2026-01-27 15:11:57
*/
@Data
public class Quotation extends BaseEntity {
private Integer id;
/**
*
*/
private String quotationCode;
/**
*
*/
private String quotationName;
/**
*
*/
private String projectCode;
/**
*
*/
private Double quotationAmount;
/**
*
*/
private Double discountAmount;
/**
*
*/
private String quotationStatus;
private Date createTime;
private String createBy;
private String updateBy;
private Date updateTime;
private String remark;
/**
* id
*/
private String projectId;
/**
*
*/
private String agentCode;
/**
*
*/
private String amountType;
private Date createTimeStart;
private Date createTimeEnd;
/**
*
*/
private String customerName;
// @Excel(name = "软件")
private List<QuotationProductInfo> softwareProjectProductInfoList;
// @Excel(name = "终端")
private List<QuotationProductInfo> hardwareProjectProductInfoList;
// @Excel(name = "服务")
private List<QuotationProductInfo> maintenanceProjectProductInfoList;
}

View File

@ -0,0 +1,79 @@
package com.ruoyi.sip.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/**
* (QuotationProductInfo)
*
* @author makejava
* @since 2026-01-27 14:45:17
*/
@Data
public class QuotationProductInfo extends BaseEntity {
private Integer id;
/**
*
*/
private String productBomCode;
/**
*
*/
private String model;
/**
*
*/
private String productCode;
/**
*
*/
private String productDesc;
/**
*
*/
private Double quantity;
/**
*
*/
private Double cataloguePrice;
/**
*
*/
private Double catalogueAllPrice;
/**
*
*/
private Double price;
/**
*
*/
private Double allPrice;
/**
*
*/
private Double guidanceDiscount;
/**
*
*/
private Double discount;
/**
*
*/
private String remark;
/**
*
*/
private Double taxRate;
/**
* id
*/
private Integer quotationId;
private String type;
}

View File

@ -0,0 +1,50 @@
package com.ruoyi.sip.mapper;
import com.ruoyi.sip.domain.Quotation;
import java.util.List;
/**
* @Author makejava
* @Desc
* (Quotation)访
* @Date 2026-01-26 14:58:02
*/
public interface QuotationMapper {
/**
*
*
* @param quotation
* @return
*/
List<Quotation> queryAll(Quotation quotation);
/**
* ID
*/
Quotation queryById(Integer id);
/**
*
*/
int insert(Quotation quotation);
/**
*
*/
int update(Quotation quotation);
/**
*
*/
int deleteById(Integer id);
/**
* id
*/
int batchRemove(Integer[] ids);
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.sip.mapper;
import com.ruoyi.sip.domain.QuotationProductInfo;
import java.util.List;
/**
* @Author makejava
* @Desc (QuotationProductInfo)访
* @Date 2026-01-27 14:45:17
*/
public interface QuotationProductInfoMapper {
/**
*
*
* @param quotationProductInfo
* @return
*/
List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo);
/**
* ID
*/
QuotationProductInfo queryById(Integer id);
/**
*
*/
int insert(QuotationProductInfo quotationProductInfo);
/**
*
*/
int update(QuotationProductInfo quotationProductInfo);
/**
*
*/
int deleteById(Integer id);
/**
* id
*/
int batchRemove(Integer[] ids);
void insertBatch(List<QuotationProductInfo> addList);
void updateBatch(List<QuotationProductInfo> addList);
List<QuotationProductInfo> listByQuotationId(List<Integer> integers);
}

View File

@ -0,0 +1,51 @@
package com.ruoyi.sip.service;
import com.ruoyi.sip.domain.QuotationProductInfo;
import java.util.List;
/**
* @Author makejava
* @Desc (QuotationProductInfo)
* @Date 2026-01-27 14:45:18
*/
public interface IQuotationProductInfoService {
/**
*
*/
List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo);
/**
* ID
*/
QuotationProductInfo queryById(Integer id);
/**
*
*/
int insert(QuotationProductInfo quotationProductInfo);
/**
*
*/
int update(QuotationProductInfo quotationProductInfo);
/**
*
*/
int deleteById(Integer id);
/**
* id
*/
int batchRemove(Integer[] ids);
void saveBatch(List<QuotationProductInfo> productList);
List<QuotationProductInfo> listByQuotationId(List<Integer> integers);
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.sip.service;
import com.ruoyi.sip.domain.Quotation;
import java.util.List;
/**
* @Author makejava
* @Desc
* (Quotation)
* @Date 2026-01-26 14:58:02
*/
public interface IQuotationService {
/**
*
*/
List<Quotation> queryAll(Quotation quotation);
/**
* ID
*/
Quotation queryById(Integer id);
/**
*
*/
int insert(Quotation quotation);
/**
*
*/
int update(Quotation quotation);
/**
*
*/
int deleteById(Integer id);
/**
* id
*/
int batchRemove(Integer[] ids);
}

View File

@ -86,7 +86,7 @@ public class CodeGenTableServiceImpl implements ICodeGenTableService {
updateDto.setVersion(codeGeneratorConfig.getVersion());
if (!DateUtils.isSameDay(codeGeneratorConfig.getGenDate(), DateUtils.getNowDate())) {
updateDto.setNumber(0);
updateDto.setNumber(1);
updateDto.setGenDate(DateUtils.getNowDate());
} else {
updateDto.setNumber(codeGeneratorConfig.getNumber());
@ -96,8 +96,13 @@ public class CodeGenTableServiceImpl implements ICodeGenTableService {
int currentSequence = updateDto.getNumber();
String sequenceStr = String.format("%0" + numberLength + "d", currentSequence);
String generatedCode;
// 构造唯一 code
String generatedCode = prefix + DELIMIT + datePart + DELIMIT + sequenceStr;
if (StringUtils.isEmpty( prefix)){
generatedCode = datePart + DELIMIT + sequenceStr;
}else {
generatedCode = prefix + DELIMIT + datePart + DELIMIT + sequenceStr;
}
// 更新数据库中的 number 字段,确保并发安全性
int updatedRows = codeGenTableMapper.updateNumber(updateDto);

View File

@ -468,6 +468,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
private Date updateStartTimeAndAddList(DeliveryInfoVo deliveryInfoVo, ProjectProductInfo productInfo, Date startTime, List<DeliveryInfoVo.ServiceInfo> serviceInfoList) {
int year = productInfo.getValue() == null ? 0 : Integer.parseInt(productInfo.getValue());
year= Math.toIntExact(year * (productInfo.getQuantity()==null? 1:productInfo.getQuantity()));
DeliveryInfoVo.ServiceInfo serviceInfo = deliveryInfoVo.new ServiceInfo();
serviceInfo.setServiceLevel(productInfo.getProductBomCode());
serviceInfo.setServiceDescribe(productInfo.getProductDesc());

View File

@ -0,0 +1,100 @@
package com.ruoyi.sip.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.sip.domain.QuotationProductInfo;
import com.ruoyi.sip.mapper.QuotationProductInfoMapper;
import com.ruoyi.sip.service.IQuotationProductInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author makejava
* @Desc (QuotationProductInfo)
* @Date 2026-01-27 14:45:18
*/
@Service
public class QuotationProductInfoServiceImpl implements IQuotationProductInfoService {
@Resource
private QuotationProductInfoMapper quotationProductInfoMapper;
/**
*
*
* @param quotationProductInfo
* @return
*/
@Override
public List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo) {
List<QuotationProductInfo> dataList = quotationProductInfoMapper.queryAll(quotationProductInfo);
return dataList;
}
@Override
public QuotationProductInfo queryById(Integer id) {
return quotationProductInfoMapper.queryById(id);
}
@Override
public int insert(QuotationProductInfo quotationProductInfo) {
return quotationProductInfoMapper.insert(quotationProductInfo);
}
@Override
public int update(QuotationProductInfo quotationProductInfo) {
return quotationProductInfoMapper.update(quotationProductInfo);
}
@Override
public int deleteById(Integer id) {
return quotationProductInfoMapper.deleteById(id);
}
/**
* id
*/
@Override
public int batchRemove(Integer[] ids) {
return quotationProductInfoMapper.batchRemove(ids);
}
@Override
public void saveBatch(List<QuotationProductInfo> productList) {
if (CollUtil.isEmpty(productList)) {
//保存详情
return;
}
List<QuotationProductInfo> addList = productList.stream().filter(quotationProductInfo -> quotationProductInfo.getId() == null).collect(Collectors.toList());
if (CollUtil.isNotEmpty(addList)){
//保存详情
quotationProductInfoMapper.insertBatch(addList);
}
List<QuotationProductInfo> updateList = productList.stream().filter(quotationProductInfo -> quotationProductInfo.getId() != null).collect(Collectors.toList());
if (CollUtil.isNotEmpty(updateList)){
//保存详情
quotationProductInfoMapper.updateBatch(updateList);
}
}
@Override
public List<QuotationProductInfo> listByQuotationId(List<Integer> integers) {
return quotationProductInfoMapper.listByQuotationId(integers);
}
}

View File

@ -0,0 +1,127 @@
package com.ruoyi.sip.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.mapper.QuotationMapper;
import com.ruoyi.sip.service.ICodeGenTableService;
import com.ruoyi.sip.service.IQuotationProductInfoService;
import com.ruoyi.sip.service.IQuotationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author makejava
* @Desc
* (Quotation)
* @Date 2026-01-26 14:58:02
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class QuotationServiceImpl implements IQuotationService {
@Resource
private QuotationMapper quotationMapper;
@Autowired
private ICodeGenTableService codeGenTableService;
@Autowired
private IQuotationProductInfoService quotationProductInfoService;
/**
*
*
* @param quotation
* @return
*/
@Override
public List<Quotation> queryAll(Quotation quotation) {
List<Quotation> dataList = quotationMapper.queryAll(quotation);
return dataList;
}
@Override
public Quotation queryById(Integer id) {
Quotation quotation = quotationMapper.queryById(id);
if (quotation != null) {
List<QuotationProductInfo> productInfoList = quotationProductInfoService.listByQuotationId(Collections.singletonList(quotation.getId()));
Map<String, List<QuotationProductInfo>> productListMap = productInfoList.stream().collect(Collectors.groupingBy(QuotationProductInfo::getType));
quotation.setSoftwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.SOFTWARE.getType()));
quotation.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
List<QuotationProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), new ArrayList<>()));
quotation.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
}
return quotation;
}
@Override
public int insert(Quotation quotation) {
String s = codeGenTableService.generateCode(CodeGenTable.TableNameEnum.OMS_QUOTATION.getName());
quotation.setQuotationCode(s);
int insert = quotationMapper.insert(quotation);
List<QuotationProductInfo> productList = new ArrayList<>();
if (CollUtil.isNotEmpty(quotation.getSoftwareProjectProductInfoList())) {
productList.addAll(quotation.getSoftwareProjectProductInfoList());
}
if (CollUtil.isNotEmpty(quotation.getHardwareProjectProductInfoList())) {
productList.addAll(quotation.getHardwareProjectProductInfoList());
}
if (CollUtil.isNotEmpty(quotation.getMaintenanceProjectProductInfoList())) {
productList.addAll(quotation.getMaintenanceProjectProductInfoList());
}
for (QuotationProductInfo quotationProductInfo : productList) {
quotationProductInfo.setQuotationId(quotation.getId());
}
quotationProductInfoService.saveBatch(productList);
return insert;
}
@Override
public int update(Quotation quotation) {
List<QuotationProductInfo> productList = new ArrayList<>();
if (CollUtil.isNotEmpty(quotation.getSoftwareProjectProductInfoList())) {
productList.addAll(quotation.getSoftwareProjectProductInfoList());
}
if (CollUtil.isNotEmpty(quotation.getHardwareProjectProductInfoList())) {
productList.addAll(quotation.getHardwareProjectProductInfoList());
}
if (CollUtil.isNotEmpty(quotation.getMaintenanceProjectProductInfoList())) {
productList.addAll(quotation.getMaintenanceProjectProductInfoList());
}
for (QuotationProductInfo quotationProductInfo : productList) {
quotationProductInfo.setQuotationId(quotation.getId());
}
quotationProductInfoService.saveBatch(productList);
return quotationMapper.update(quotation);
}
@Override
public int deleteById(Integer id) {
return quotationMapper.deleteById(id);
}
/**
* id
*/
@Override
public int batchRemove(Integer[] ids) {
return quotationMapper.batchRemove(ids);
}
}

View File

@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.QuotationMapper">
<resultMap type="com.ruoyi.sip.domain.Quotation" id="QuotationMap">
<result property="id" column="id"/>
<result property="quotationCode" column="quotation_code"/>
<result property="quotationName" column="quotation_name"/>
<result property="projectCode" column="project_code"/>
<result property="quotationAmount" column="quotation_amount"/>
<result property="discountAmount" column="discount_amount"/>
<result property="quotationStatus" column="quotation_status"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="projectId" column="project_id"/>
<result property="agentCode" column="agent_code"/>
<result property="amountType" column="amount_type"/>
<result property="customerName" column="customer_name"/>
</resultMap>
<!-- 基本字段 -->
<sql id="Base_Column_List">
id
, quotation_code, quotation_name, project_code, quotation_amount, discount_amount, quotation_status, create_time, create_by, update_by, update_time, remark, project_id, agent_code, amount_type, customer_name
</sql>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="QuotationMap">
select
<include refid="Base_Column_List"/>
from oms_quotation
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="quotationCode != null and quotationCode != ''">
and quotation_code = #{quotationCode}
</if>
<if test="quotationName != null and quotationName != ''">
and quotation_name = #{quotationName}
</if>
<if test="projectCode != null and projectCode != ''">
and project_code = #{projectCode}
</if>
<if test="quotationAmount != null">
and quotation_amount = #{quotationAmount}
</if>
<if test="discountAmount != null">
and discount_amount = #{discountAmount}
</if>
<if test="quotationStatus != null and quotationStatus != ''">
and quotation_status = #{quotationStatus}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="projectId != null and projectId != ''">
and project_id = #{projectId}
</if>
<if test="agentCode != null and agentCode != ''">
and agent_code = #{agentCode}
</if>
<if test="amountType != null and amountType != ''">
and amount_type = #{amountType}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="createTimeStart != null or createTimeEnd != null">
<choose>
<when test="createTimeStart != null and createTimeEnd != null">
and create_time between date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="createTimeStart != null">
and create_time <![CDATA[ >= ]]> date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="createTimeEnd != null">
and create_time <![CDATA[ <= ]]> date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
</where>
</select>
<!--根据ID查详情-->
<select id="queryById" parameterType="Integer" resultMap="QuotationMap">
SELECT id,
quotation_code,
quotation_name,
project_code,
quotation_amount,
discount_amount,
quotation_status,
create_time,
create_by,
update_by,
update_time,
remark,
project_id,
agent_code,
amount_type,
customer_name
FROM oms_quotation
WHERE id = #{id} LIMIT 1
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO oms_quotation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
quotation_code,
</if>
<if test="quotationName != null and quotationName != ''">
quotation_name,
</if>
<if test="projectCode != null and projectCode != ''">
project_code,
</if>
<if test="quotationAmount != null">
quotation_amount,
</if>
<if test="discountAmount != null">
discount_amount,
</if>
<if test="quotationStatus != null and quotationStatus != ''">
quotation_status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="projectId != null and projectId != ''">
project_id,
</if>
<if test="agentCode != null and agentCode != ''">
agent_code,
</if>
<if test="amountType != null and amountType != ''">
amount_type,
</if>
<if test="customerName != null and customerName != ''">
customer_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
#{quotationCode},
</if>
<if test="quotationName != null and quotationName != ''">
#{quotationName},
</if>
<if test="projectCode != null and projectCode != ''">
#{projectCode},
</if>
<if test="quotationAmount != null">
#{quotationAmount},
</if>
<if test="discountAmount != null">
#{discountAmount},
</if>
<if test="quotationStatus != null and quotationStatus != ''">
#{quotationStatus},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="projectId != null and projectId != ''">
#{projectId},
</if>
<if test="agentCode != null and agentCode != ''">
#{agentCode},
</if>
<if test="amountType != null and amountType != ''">
#{amountType},
</if>
<if test="customerName != null and customerName != ''">
#{customerName},
</if>
</trim>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE oms_quotation
<trim prefix="SET" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
quotation_code = #{quotationCode},
</if>
<if test="quotationName != null and quotationName != ''">
quotation_name = #{quotationName},
</if>
<if test="projectCode != null and projectCode != ''">
project_code = #{projectCode},
</if>
<if test="quotationAmount != null">
quotation_amount = #{quotationAmount},
</if>
<if test="discountAmount != null">
discount_amount = #{discountAmount},
</if>
<if test="quotationStatus != null and quotationStatus != ''">
quotation_status = #{quotationStatus},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="projectId != null and projectId != ''">
project_id = #{projectId},
</if>
<if test="agentCode != null and agentCode != ''">
agent_code = #{agentCode},
</if>
<if test="amountType != null and amountType != ''">
amount_type = #{amountType},
</if>
<if test="customerName != null and customerName != ''">
customer_name = #{customerName},
</if>
</trim>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM oms_quotation
WHERE id = #{id}
</delete>
<!--通过id批量删除-->
<delete id="batchRemove">
delete from oms_quotation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.QuotationProductInfoMapper">
<resultMap type="com.ruoyi.sip.domain.QuotationProductInfo" id="QuotationProductInfoMap">
<result property="id" column="id"/>
<result property="productBomCode" column="product_bom_code"/>
<result property="model" column="model"/>
<result property="productCode" column="product_code"/>
<result property="productDesc" column="product_desc"/>
<result property="quantity" column="quantity"/>
<result property="cataloguePrice" column="catalogue_price"/>
<result property="catalogueAllPrice" column="catalogue_all_price"/>
<result property="price" column="price"/>
<result property="allPrice" column="all_price"/>
<result property="guidanceDiscount" column="guidance_discount"/>
<result property="discount" column="discount"/>
<result property="remark" column="remark"/>
<result property="taxRate" column="tax_rate"/>
<result property="quotationId" column="quotation_id"/>
</resultMap>
<!-- 基本字段 -->
<sql id="base_query">
SELECT t1.id,
t1.product_bom_code,
t1.model,
t1.product_code,
t1.product_desc,
t1.quantity,
t1.catalogue_price,
t1.catalogue_all_price,
t1.price,
t1.all_price,
t1.guidance_discount,
t1.discount,
t1.remark,
t1.tax_rate,
t1.quotation_id,
t2.type
FROM oms_quotation_product_info t1
left join product_info t2 on t1.product_bom_code=t2.product_code
</sql>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="QuotationProductInfoMap">
<include refid="base_query"/>
<where>
<if test="id != null">
and t1.id = #{id}
</if>
<if test="productBomCode != null and productBomCode != ''">
and t1.product_bom_code = #{productBomCode}
</if>
<if test="model != null and model != ''">
and t1.model = #{model}
</if>
<if test="productCode != null and productCode != ''">
and t1.product_code = #{productCode}
</if>
<if test="productDesc != null and productDesc != ''">
and t1.product_desc = #{productDesc}
</if>
<if test="quantity != null">
and t1.quantity = #{quantity}
</if>
<if test="cataloguePrice != null">
and t1.catalogue_price = #{cataloguePrice}
</if>
<if test="catalogueAllPrice != null">
and t1.catalogue_all_price = #{catalogueAllPrice}
</if>
<if test="price != null">
and t1.price = #{price}
</if>
<if test="allPrice != null">
and t1.all_price = #{allPrice}
</if>
<if test="guidanceDiscount != null">
and t1.guidance_discount = #{guidanceDiscount}
</if>
<if test="discount != null">
and t1.discount = #{discount}
</if>
<if test="remark != null and remark != ''">
and t1.remark = #{remark}
</if>
<if test="taxRate != null">
and t1.tax_rate = #{taxRate}
</if>
<if test="quotationId != null">
and t1.quotation_id = #{quotationId}
</if>
</where>
</select>
<!--根据ID查详情-->
<select id="queryById" parameterType="Integer" resultMap="QuotationProductInfoMap">
<include refid="base_query"/>
WHERE t1.id = #{id} LIMIT 1
</select>
<select id="listByQuotationId" resultType="com.ruoyi.sip.domain.QuotationProductInfo">
<include refid="base_query"/>
WHERE t1.quotation_id in
<foreach item="item" index="index" open="(" close=")" collection="list" separator=",">
#{item}
</foreach>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO oms_quotation_product_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productBomCode != null and productBomCode != ''">
product_bom_code,
</if>
<if test="model != null and model != ''">
model,
</if>
<if test="productCode != null and productCode != ''">
product_code,
</if>
<if test="productDesc != null and productDesc != ''">
product_desc,
</if>
<if test="quantity != null">
quantity,
</if>
<if test="cataloguePrice != null">
catalogue_price,
</if>
<if test="catalogueAllPrice != null">
catalogue_all_price,
</if>
<if test="price != null">
price,
</if>
<if test="allPrice != null">
all_price,
</if>
<if test="guidanceDiscount != null">
guidance_discount,
</if>
<if test="discount != null">
discount,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="taxRate != null">
tax_rate,
</if>
<if test="quotationId != null">
quotation_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productBomCode != null and productBomCode != ''">
#{productBomCode},
</if>
<if test="model != null and model != ''">
#{model},
</if>
<if test="productCode != null and productCode != ''">
#{productCode},
</if>
<if test="productDesc != null and productDesc != ''">
#{productDesc},
</if>
<if test="quantity != null">
#{quantity},
</if>
<if test="cataloguePrice != null">
#{cataloguePrice},
</if>
<if test="catalogueAllPrice != null">
#{catalogueAllPrice},
</if>
<if test="price != null">
#{price},
</if>
<if test="allPrice != null">
#{allPrice},
</if>
<if test="guidanceDiscount != null">
#{guidanceDiscount},
</if>
<if test="discount != null">
#{discount},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="taxRate != null">
#{taxRate},
</if>
<if test="quotationId != null">
#{quotationId},
</if>
</trim>
</insert>
<insert id="insertBatch">
INSERT INTO oms_quotation_product_info(product_bom_code, model, product_code, product_desc,
quantity, catalogue_price, catalogue_all_price, price,
all_price, guidance_discount, discount, remark, tax_rate, quotation_id)
VALUES
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.productBomCode}, #{item.model}, #{item.productCode},#{item.productDesc},
#{item.quantity},#{item.cataloguePrice},#{item.catalogueAllPrice},#{item.price},
#{item.allPrice},#{item.guidanceDiscount},#{item.discount},#{item.remark},#{item.taxRate},#{item.quotationId}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE oms_quotation_product_info
<trim prefix="SET" suffixOverrides=",">
<if test="productBomCode != null and productBomCode != ''">
product_bom_code = #{productBomCode},
</if>
<if test="model != null and model != ''">
model = #{model},
</if>
<if test="productCode != null and productCode != ''">
product_code = #{productCode},
</if>
<if test="productDesc != null and productDesc != ''">
product_desc = #{productDesc},
</if>
<if test="quantity != null">
quantity = #{quantity},
</if>
<if test="cataloguePrice != null">
catalogue_price = #{cataloguePrice},
</if>
<if test="catalogueAllPrice != null">
catalogue_all_price = #{catalogueAllPrice},
</if>
<if test="price != null">
price = #{price},
</if>
<if test="allPrice != null">
all_price = #{allPrice},
</if>
<if test="guidanceDiscount != null">
guidance_discount = #{guidanceDiscount},
</if>
<if test="discount != null">
discount = #{discount},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="taxRate != null">
tax_rate = #{taxRate},
</if>
<if test="quotationId != null">
quotation_id = #{quotationId},
</if>
</trim>
WHERE id = #{id}
</update>
<update id="updateBatch">
<foreach collection="list" item="item" separator=";">
UPDATE oms_quotation_product_info
<trim prefix="SET" suffixOverrides=",">
<if test="item.productBomCode != null and item.productBomCode != ''">
product_bom_code = #{item.productBomCode},
</if>
<if test="item.model != null and item.model != ''">
model = #{item.model},
</if>
<if test="item.productCode != null and item.productCode != ''">
product_code = #{item.productCode},
</if>
<if test="item.productDesc != null and item.productDesc != ''">
product_desc = #{item.productDesc},
</if>
<if test="item.quantity != null">
quantity = #{item.quantity},
</if>
<if test="item.cataloguePrice != null">
catalogue_price = #{item.cataloguePrice},
</if>
<if test="item.catalogueAllPrice != null">
catalogue_all_price = #{item.catalogueAllPrice},
</if>
<if test="item.price != null">
price = #{item.price},
</if>
<if test="item.allPrice != null">
all_price = #{item.allPrice},
</if>
<if test="item.guidanceDiscount != null">
guidance_discount = #{item.guidanceDiscount},
</if>
<if test="item.discount != null">
discount = #{item.discount},
</if>
<if test="item.remark != null and item.remark != ''">
remark = #{item.remark},
</if>
<if test="item.taxRate != null">
tax_rate = #{item.taxRate},
</if>
<if test="item.quotationId != null">
quotation_id = #{item.quotationId},
</if>
</trim>
WHERE id = #{item.id}
</foreach>
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM oms_quotation_product_info
WHERE id = #{id}
</delete>
<!--通过id批量删除-->
<delete id="batchRemove">
delete from oms_quotation_product_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>