feat(sip): 添加订单同步功能并优化订单管理

- 在订单添加和编辑页面添加同步按钮,实现订单信息同步
- 优化订单导入功能,调整导入模板和数据处理逻辑
- 新增订单查询接口,用于获取订单详细信息
- 重构订单信息实体类,增加版本号等字段
- 优化订单列表展示,增加维保金额等信息
master
chenhao 2025-06-19 10:22:36 +08:00
parent 2999b18085
commit b0c278357c
15 changed files with 376 additions and 87 deletions

View File

@ -2,6 +2,10 @@ package com.ruoyi.web.controller.system;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
@ -26,6 +30,7 @@ import com.ruoyi.framework.web.service.ConfigService;
* @author ruoyi
*/
@Controller
@Slf4j
public class SysLoginController extends BaseController
{
/**
@ -45,6 +50,14 @@ public class SysLoginController extends BaseController
{
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
}
// try {
// SysUser sysUser = ShiroUtils.getSysUser();
// if (sysUser != null){
// return "redirect:/index";
// }
// } catch (Exception e) {
// log.error("已登录用户跳转失败",e);
// }
// 是否开启记住我
mmap.put("isRemembered", rememberMe);
// 是否开启用户注册

View File

@ -32,7 +32,11 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">合同编号:</label>
<div class="col-sm-8">
<input name="orderCode" class="form-control" type="text" required>
<div class="input-group">
<input name="orderCode" id="orderCode" class="form-control" type="text" required>
<span class="input-group-addon" id="syncInfo" onclick="syncInfo()" title="同步"><i
class="fa fa-refresh"></i></span>
</div>
</div>
</div>
</div>
@ -56,7 +60,7 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">合同类型:</label>
<div class="col-sm-8">
<select name="orderType" class="form-control" th:with="type=${@dict.getType('order_type')}"
<select name="orderType" style="pointer-events: none;" class="form-control" readonly th:with="type=${@dict.getType('order_type')}"
onchange="changeOrderType()" required>
<option value="">请选择合同类型</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
@ -69,11 +73,11 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">代表处:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input class="form-control" type="hidden" name="orderAgentCode">
<input class="form-control" type="text" name="orderAgentName" onclick="selectAgent()" required>
<span class="input-group-addon" onclick="selectAgent()"><i class="fa fa-search"></i></span>
</div>
<input class="form-control" type="text" name="orderAgentName" required>
<!-- <span class="input-group-addon" onclick="selectAgent()"><i class="fa fa-search"></i></span>-->
<!-- </div>-->
</div>
</div>
</div>
@ -81,15 +85,15 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">代理商:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input class="form-control" type="hidden" name="orderPartnerCode">
<input class="form-control" type="text" name="orderPartnerName" onclick="selectPartner()"
<input class="form-control" type="text" name="orderPartnerName"
required>
<span class="input-group-addon" onclick="selectPartner()"><i class="fa fa-search"></i></span>
<span class="input-group-addon" id="customerSet" onclick="setCustomer()" title="同步"><i
class="fa fa-refresh"></i></span>
<!-- <span class="input-group-addon" onclick="selectPartner()"><i class="fa fa-search"></i></span>-->
<!-- <span class="input-group-addon" id="customerSet" onclick="setCustomer()" title="同步"><i-->
<!-- class="fa fa-refresh"></i></span>-->
</div>
<!-- </div>-->
</div>
</div>
</div>
@ -108,12 +112,12 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required"> 最终客户名称:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input name="customerName" class="form-control" type="text" required
onclick="selectCustomer()">
<span class="input-group-addon" onclick="selectCustomer()"><i
class="fa fa-search"></i></span>
</div>
>
<!-- <span class="input-group-addon" onclick="selectCustomer()"><i-->
<!-- class="fa fa-search"></i></span>-->
<!-- </div>-->
</div>
</div>
</div>
@ -166,12 +170,12 @@
<div class="row">
<input id="uploadInput" type="file" accept=".xls,.xlsx" style="display: none">
<div class="col-xs-12">
<button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i
class="fa fa-download">
下载模板</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="importList()"><i class="fa fa-upload">
导入</i>
</button>
<!-- <button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i-->
<!-- class="fa fa-download">-->
<!-- 下载模板</i></button>-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="importList()"><i class="fa fa-upload">-->
<!-- 导入</i>-->
<!-- </button>-->
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
@ -201,6 +205,74 @@
autoclose: true
});
function syncInfo() {
let orderCode = $("#orderCode").val();
if (!orderCode) {
$.modal.alertWarning("请填写订单编号");
return
}
$.operate.get(ctx + `project/order/query/${orderCode}`, function (res) {
let data = res.data
if (!data) {
$("#bootstrap-table").bootstrapTable('removeAll');
$('[name="projectCode"]').val('');
$('[name="versionCode"]').val('');
$('[name="orderName"]').val('');
$('[name="orderType"]').val('');
$('[name="orderAgentCode"]').val('');
$('[name="orderAgentName"]').val('');
$('[name="orderPartnerCode"]').val('');
$('[name="orderPartnerName"]').val('');
$('[name="customerName"]').val('');
$('[name="customerCode"]').val('');
$('[name="customerContact"]').val('');
// $('[name="customerEmail"]').val(data.contactPhone);
$('[name="customerPhone"]').val('');
return
}
$('[name="projectCode"]').val(data.projectCode);
$('[name="versionCode"]').val(data.versionCode);
$('[name="orderName"]').val(data.projectName);
$('[name="orderType"]').val(data.orderChannel === '2' ? 'zq' : 'dls');
$('[name="orderAgentCode"]').val(data.agentCode);
$('[name="orderAgentName"]').val(data.agentName);
$('[name="orderPartnerCode"]').val(data.partnerCode);
$('[name="orderPartnerName"]').val(data.partnerName);
$('[name="customerName"]').val(data.customerName);
$('[name="customerCode"]').val(data.customerCode);
$('[name="customerContact"]').val(data.customerUserName);
// $('[name="customerEmail"]').val(data.contactPhone);
$('[name="customerPhone"]').val(data.customerPhone);
$("#bootstrap-table").bootstrapTable('removeAll');
if (data.softwareProjectProductInfoList) {
data.softwareProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
addRow(item)
})
}
if (data.hardwareProjectProductInfoList) {
data.hardwareProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
addRow(item)
})
}
if (data.maintenanceProjectProductInfoList) {
data.maintenanceProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
addRow(item)
})
}
})
}
$(function () {
var options = {
pagination: false,
@ -263,7 +335,10 @@
title: '折扣',
width: 90,
formatter: function (value, row, index) {
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0' required>", index, value);
let showValue=value?value*100+'%':'0%';
var html = $.common.sprintf("" +
"<input style='display: none' class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0' required>" +
"<input readonly class='form-control ' type='text' value='%s' required>", index, value,showValue);
return html;
}
},
@ -285,14 +360,15 @@
return html;
}
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
// {
// title: '操作',
// align: 'center',
// formatter: function (value, row, index) {
// var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
// return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
// }
// }
]
};
$.table.init(options);
@ -306,6 +382,20 @@
$('[name="versionCode"]').on('focus', function () {
$(this).blur()
})
const form = $('#form-order-add')
form.find('input').each(function () {
let name = $(this).attr('name');
if (name === 'orderCode' || name === 'orderDate'|| name === 'customerEmail') {
return
}
$(this).attr('readonly', true)
})
});
function addRow(row) {

View File

@ -30,7 +30,11 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">合同编号:</label>
<div class="col-sm-8">
<input name="orderCode" th:field="*{orderCode}" class="form-control" type="text" required>
<div class="input-group">
<input name="orderCode" id="orderCode" th:field="*{orderCode}" class="form-control" type="text" required>
<span class="input-group-addon" id="syncInfo" onclick="syncInfo()" title="同步"><i
class="fa fa-refresh"></i></span>
</div>
</div>
</div>
</div>
@ -38,7 +42,7 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">版本号:</label>
<div class="col-sm-8">
<input name="versionCode" th:field="*{versionCode}" class="form-control" type="number" max="100"
<input name="versionCode" th:field="*{versionCode}" class="form-control" type="number" max="1000"
min="0" required>
</div>
</div>
@ -55,7 +59,7 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">合同类型:</label>
<div class="col-sm-8">
<select name="orderType" class="form-control" th:with="type=${@dict.getType('order_type')}"
<select name="orderType" style="pointer-events: none;" readonly class="form-control" th:with="type=${@dict.getType('order_type')}"
onchange="changeOrderType()" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
th:field="*{orderType}"></option>
@ -67,12 +71,12 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">代表处:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input class="form-control" type="hidden" name="orderAgentCode" th:field="*{orderAgentCode}"/>
<input class="form-control" name="orderAgentName" th:field="*{orderAgentName}"
onclick="selectAgent()" required/>
<span class="input-group-addon" onclick="selectAgent()"><i class="fa fa-search"></i></span>
</div>
required/>
<!-- <span class="input-group-addon" onclick="selectAgent()"><i class="fa fa-search"></i></span>-->
<!-- </div>-->
</div>
</div>
</div>
@ -80,15 +84,15 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">代理商:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input class="form-control" name="orderPartnerCode" type="hidden"
th:field="*{orderPartnerCode}">
<input class="form-control" name="orderPartnerName" th:field="*{orderPartnerName}"
onclick="selectPartner()" required>
<span class="input-group-addon" onclick="selectPartner()"><i class="fa fa-search"></i></span>
<span class="input-group-addon" id="customerSet" onclick="setCustomer()" title="同步" ><i
class="fa fa-refresh"></i></span>
</div>
required>
<!-- <span class="input-group-addon" onclick="selectPartner()"><i class="fa fa-search"></i></span>-->
<!-- <span class="input-group-addon" id="customerSet" onclick="setCustomer()" title="同步" ><i-->
<!-- class="fa fa-refresh"></i></span>-->
<!-- </div>-->
</div>
</div>
</div>
@ -109,12 +113,12 @@
<div class="form-group">
<label class="col-sm-4 control-label is-required">最终客户名称:</label>
<div class="col-sm-8">
<div class="input-group">
<!-- <div class="input-group">-->
<input name="customerName" th:field="*{customerName}" class="form-control" type="text"
required onclick="selectCustomer()">
<span class="input-group-addon" onclick="selectCustomer()"><i
class="fa fa-search"></i></span>
</div>
required >
<!-- <span class="input-group-addon" onclick="selectCustomer()"><i-->
<!-- class="fa fa-search"></i></span>-->
<!-- </div>-->
</div>
</div>
</div>
@ -171,12 +175,12 @@
<div class="row">
<input id="uploadInput" type="file" accept=".xls,.xlsx" style="display: none">
<div class="col-xs-12">
<button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i
class="fa fa-download"> 下载模板</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="importList()"><i class="fa fa-upload">
导入</i></button>
</div>
<!-- <div class="col-xs-12">-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i-->
<!-- class="fa fa-download"> 下载模板</i></button>-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="importList()"><i class="fa fa-upload">-->
<!-- 导入</i></button>-->
<!-- </div>-->
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -349,8 +353,86 @@
changeOrderType()
initCustomerSet()
const form = $('#form-order-edit')
form.find('input').each(function () {
let name = $(this).attr('name');
if (name === 'orderDate'|| name === 'customerEmail') {
return
}
$(this).attr('readonly', true)
})
});
function syncInfo() {
let orderCode = $("#orderCode").val();
if (!orderCode) {
$.modal.alertWarning("请填写订单编号");
return
}
$.operate.get(ctx + `project/order/query/${orderCode}`, function (res) {
let data = res.data
// $("#bootstrap-table").bootstrapTable('removeAll');
$("#bootstrap-table").bootstrapTable('destroy');
if (!data) {
$('[name="projectCode"]').val('');
$('[name="versionCode"]').val('');
$('[name="orderName"]').val('');
$('[name="orderType"]').val('');
$('[name="orderAgentCode"]').val('');
$('[name="orderAgentName"]').val('');
$('[name="orderPartnerCode"]').val('');
$('[name="orderPartnerName"]').val('');
$('[name="customerName"]').val('');
$('[name="customerCode"]').val('');
$('[name="customerContact"]').val('');
// $('[name="customerEmail"]').val(data.contactPhone);
$('[name="customerPhone"]').val('');
return
}
$('[name="projectCode"]').val(data.projectCode);
$('[name="versionCode"]').val(data.versionCode);
$('[name="orderName"]').val(data.projectName);
$('[name="orderType"]').val(data.orderChannel === '2' ? 'zq' : 'dls');
$('[name="orderAgentCode"]').val(data.agentCode);
$('[name="orderAgentName"]').val(data.agentName);
$('[name="orderPartnerCode"]').val(data.partnerCode);
$('[name="orderPartnerName"]').val(data.partnerName);
$('[name="customerName"]').val(data.customerName);
$('[name="customerCode"]').val(data.customerCode);
$('[name="customerContact"]').val(data.customerUserName);
// $('[name="customerEmail"]').val(data.contactPhone);
$('[name="customerPhone"]').val(data.customerPhone);
let allProduct = []
if (data.softwareProjectProductInfoList) {
data.softwareProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
allProduct.push( item)
})
}
if (data.hardwareProjectProductInfoList) {
data.hardwareProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
allProduct.push( item)
})
}
if (data.maintenanceProjectProductInfoList) {
data.maintenanceProjectProductInfoList.forEach(item => {
item.productCode = item.productBomCode
item.amount = item.allPrice
allProduct.push( item)
})
}
initTable(allProduct)
})
}
function downloadTem() {
$.modal.loading("正在下载,请稍候...");
window.location.href = prefix + "/list/export"
@ -411,7 +493,7 @@
align: 'center',
title: 'BOM编码',
formatter: function (value, row, index) {
var html = $.common.sprintf("<p ='' class='form-control-static'>%s</p>", value);
var html = $.common.sprintf("<input readonly type='text' class='form-control' name='orderListList[%s].productCode' value='%s'>",index, value);
return html;
}
},
@ -420,7 +502,7 @@
align: 'center',
title: '产品名称',
formatter: function (value, row, index) {
var html = $.common.sprintf("<p class='form-control-static'>%s</p>", value);
var html = $.common.sprintf("<input readonly type='text' class='form-control' name='orderListList[%s].productName' value='%s'>",index, value);
return html;
}
},
@ -449,7 +531,11 @@
title: '折扣',
width: 90,
formatter: function (value, row, index) {
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0' required>", index, value);
let showValue=value?value*100+'%':'0%';
var html = $.common.sprintf("" +
"<input readonly class='form-control discount' style='display: none' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0' required>" +
"<input readonly class='form-control' type='text' value='%s' required>", index, value,showValue);
return html;
}
},

View File

@ -51,9 +51,7 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manage:order:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manage:order:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="manage:order:remove">
<i class="fa fa-remove"></i> 删除
</a>

View File

@ -129,7 +129,7 @@
onclick="searchProject()">
</td>
<td class="shortTd">项目名称<span class="is-required">*</span></td>
<td><input type="text" name="projectName"
<td><input type="text" name="projectName" id="projectName"
class="form-control" placeholder="选择项目后带入" readonly></td>
<td class="shortTd">最终客户<span class="is-required">*</span></td>
<td><input name="customerName" class="form-control" type="text" readonly placeholder="选择项目后带入"
@ -200,16 +200,19 @@
<!-- onblur="updateShipmentAmountValue('actualPurchaseAmount')" >-->
<!-- </td>-->
<td>执行单有效截止时间<span class="is-required">*</span></td>
<td colspan="5">
<input name="orderEndTime" class="form-control" placeholder="yyyy-MM-dd"
<td colspan="3">
<input name="orderEndTime" class="form-control" autocomplete="off" placeholder="yyyy-MM-dd"
required>
</td>
<td>版本号<span class="is-required">*</span></td>
<td><input onchange="changeName()" name="versionCode" id="versionCode" class="form-control"
required type="number" min="0" value="1"></td>
</tr>
<tr>
<td>要求到货时间<span class="is-required">*</span></td>
<td>
<input name="deliveryTime" class="form-control" placeholder="yyyy-MM-dd" required>
<input name="deliveryTime" class="form-control" autocomplete="off" placeholder="yyyy-MM-dd" required>
</td>
<td>公司直发</td>
<td colspan="3">
@ -373,7 +376,26 @@
})
}
function changeName(){
console.log('11111111')
let name = $('#projectName').val()
console.log(name)
let versionCode = $('#versionCode').val()
console.log(versionCode)
let result='';
if (name){
result=name;
console.log('22222')
console.log(result)
if (versionCode){
result+='Rev '+versionCode;
console.log('33333333')
console.log(result)
}
}
$('#projectNameBox').text(result)
}
function updateShipmentAmountValue(key) {
// 获取显示用的输入框
const displayInput = document.getElementById('display'+key);
@ -447,7 +469,7 @@
window.localStorage.setItem('getDetail', 1)
$.operate.get(ctx + `sip/project/query/${id}`, function (res) {
let data = res.data
$('#projectNameBox').text(data.projectName)
$('#projectNameBox').text(data.projectName+'Rev 1')
$('[name="customerCode"]').val(data.customerCode);
$('[name="customerName"]').val(data.customerName);
$('[name="projectCode"]').val(data.projectCode);
@ -545,7 +567,7 @@
$.modal.alertWarning("请选择一个项目");
return;
}
$('#projectNameBox').text(rows[0].projectName)
$('#projectNameBox').text(rows[0].projectName+'Rev 1')
$('[name="customerCode"]').val(rows[0].customerCode);
$('[name="customerName"]').val(rows[0].customerName);
$('[name="projectCode"]').val(rows[0].projectCode);

View File

@ -201,12 +201,15 @@
<!-- onblur="updateShipmentAmountValue('actualPurchaseAmount')" >-->
<!-- </td>-->
<td>执行单有效截止时间<span class="is-required">*</span></td>
<td colspan="5">
<td colspan="3">
<input name="orderEndTime" class="form-control"
th:value="${#dates.format(projectOrderInfo.orderEndTime, 'yyyy-MM-dd')}"
placeholder="yyyy-MM-dd"
required>
</td>
<td>版本号<span class="is-required">*</span></td>
<td><input name="versionCode" class="form-control" th:field="*{versionCode}"
required type="number" min="0"></td>
</tr>
<tr>
@ -562,7 +565,12 @@
function initData() {
changeBg()
$('[name="industryType"]').val([[${projectOrderInfo.industryType}]]);
$('#projectNameBox').text([[${projectOrderInfo.projectName}]])
let name = [[${projectOrderInfo.projectName}]];
let versionCode = [[${projectOrderInfo.versionCode}]];
if (versionCode){
name=name + 'Rev ' + versionCode
}
$('#projectNameBox').text(name)
}
function doSubmitPeople(index, layero) {

View File

@ -123,6 +123,15 @@ public class ProjectOrderInfoController extends BaseController
return prefix + "/edit";
}
@GetMapping("/query/{orderCode}")
@ResponseBody
public AjaxResult query(@PathVariable("orderCode") String orderCode)
{
ProjectOrderInfo projectOrderInfo = projectOrderInfoService.selectProjectOrderInfoByOrderCode(orderCode);
return AjaxResult.success(projectOrderInfo);
}
/**
*
*/

View File

@ -38,6 +38,7 @@ public class ProjectOrderInfo extends BaseEntity {
private String projectCode;
@Excel(name="项目名称")
private String projectName;
private String versionCode;
private String industryType;
private String bgProperty;
@ -51,6 +52,9 @@ public class ProjectOrderInfo extends BaseEntity {
private String orderCode;
@Excel(name = "最终客户")
private String customerName;
private String customerCode;
private String customerPhone;
private String customerUserName;
/**
*
@ -76,6 +80,7 @@ public class ProjectOrderInfo extends BaseEntity {
private String dutyName;
@Excel(name = "代表处")
private String agentName;
private String agentCode;
/**
*
*/

View File

@ -32,6 +32,7 @@ public class ProjectProductInfo extends BaseEntity
/** 产品编码 */
@Excel(name = "产品编码")
private String productBomCode;
private String productName;
/** 产品型号 */
@Excel(name = "产品型号")

View File

@ -74,4 +74,6 @@ public interface IProjectOrderInfoService
String exportList(ProjectOrderInfo projectOrderInfo);
List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto);
ProjectOrderInfo selectProjectOrderInfoByOrderCode(String orderCode);
}

View File

@ -137,16 +137,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
//
// orderInfoMapper.logicRemoveListById(deleteList);
// }
// orderInfoMapper.deleteOrderListByOrderId(orderInfo.getId());
// insertOrderList(orderInfo);
orderInfo.setUpdateBy(ShiroUtils.getUserId().toString());
List<OrderList> orderListList = orderInfo.getOrderListList();
if (orderListList!=null && !orderListList.isEmpty()){
for (OrderList orderList : orderListList) {
orderList.setUpdateBy(ShiroUtils.getUserId().toString());
}
orderInfoMapper.updateListBatch(orderListList);
}
orderInfoMapper.deleteOrderListByOrderId(orderInfo.getId());
insertOrderList(orderInfo);
// orderInfo.setUpdateBy(ShiroUtils.getUserId().toString());
// List<OrderList> orderListList = orderInfo.getOrderListList();
// List<OrderList> existsOrderList = orderInfoMapper.selectOrderListList(orderInfo.getId());
// existsOrderList.stream().filter(item->)
// if (orderListList!=null && !orderListList.isEmpty()){
// for (OrderList orderList : orderListList) {
// orderList.setUpdateBy(ShiroUtils.getUserId().toString());
// }
// orderInfoMapper.updateListBatch(orderListList);
// }
return orderInfoMapper.updateOrderInfo(orderInfo);
}

View File

@ -1,6 +1,5 @@
package com.ruoyi.sip.service.impl;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@ -57,6 +56,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
@Autowired
private ICnareaService cnareaService;
private static final List<String> MAINTENANCE_SERVICES = Arrays.asList("8813A3YA", "8813A3YB", "8813A7U4", "8813A7U2");
/**
*
*
@ -272,6 +272,30 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
return staticsMap.values().stream().sorted(Comparator.comparing(StatisticsDetailDto::getStatisticsStr)).collect(Collectors.toList());
}
@Override
public ProjectOrderInfo selectProjectOrderInfoByOrderCode(String orderCode) {
ProjectOrderInfo queryParam = new ProjectOrderInfo();
queryParam.setOrderCode(orderCode);
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(queryParam);
if (CollUtil.isEmpty(projectOrderInfos)) {
return null;
}
ProjectOrderInfo projectOrderInfo= projectOrderInfos.stream().max(Comparator.comparing(ProjectOrderInfo::getVersionCode)).get();
List<ProjectProductInfo> projectProductInfos = productInfoService.selectProjectProductInfoListByProjectId(Collections.singletonList(projectOrderInfo.getProjectId()));
Map<String, List<ProjectProductInfo>> productListMap = projectProductInfos.stream().collect(Collectors.groupingBy(ProjectProductInfo::getType));
projectOrderInfo.setSoftwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.SOFTWARE.getType()));
projectOrderInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
return projectOrderInfo;
}
private List<ProjectOrderInfo> fetchProjectInfos(ProjectOrderInfo projectOrderInfo) {
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo);
if (CollUtil.isEmpty(projectOrderInfos)) {
@ -378,6 +402,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
headerList.add(Collections.singletonList("合同编号"));
headerList.add(Collections.singletonList("币种"));
headerList.add(Collections.singletonList("订单金额"));
headerList.add(Collections.singletonList("维保金额"));
headerList.add(Collections.singletonList("执行单有效截止时间"));
headerList.add(Collections.singletonList("要求到货时间"));
headerList.add(Collections.singletonList("公司直发"));
@ -385,6 +410,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
headerList.add(Collections.singletonList("供货商"));
headerList.add(Collections.singletonList("汇智责任人"));
headerList.add(Collections.singletonList("Email"));
headerList.add(Collections.singletonList("联系方式"));
headerList.add(Collections.singletonList("进货商"));
headerList.add(Collections.singletonList("进货商代码"));
headerList.add(Collections.singletonList("进货商类型"));
@ -462,11 +488,18 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
row.add(DictUtils.getDictLabel("order_status", info.getOrderStatus()));
BigDecimal totalPrice = BigDecimal.ZERO;
BigDecimal maintenancePrice = BigDecimal.ZERO;
// 添加软件产品列
for (int i = 0; i < maxSoftware; i++) {
if (CollUtil.isNotEmpty(info.getSoftwareProjectProductInfoList()) && i < info.getSoftwareProjectProductInfoList().size()) {
totalPrice = addProductRow(info.getSoftwareProjectProductInfoList().get(i), row, totalPrice);
ProjectProductInfo productInfo = info.getSoftwareProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
} else {
addProductRow(null, row, totalPrice);
}
@ -475,7 +508,13 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
// 添加终端产品列
for (int i = 0; i < maxHardware; i++) {
if (CollUtil.isNotEmpty(info.getHardwareProjectProductInfoList()) && i < info.getHardwareProjectProductInfoList().size()) {
totalPrice = addProductRow(info.getHardwareProjectProductInfoList().get(i), row, totalPrice);
ProjectProductInfo productInfo = info.getHardwareProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
} else {
addProductRow(null, row, totalPrice);
}
@ -484,13 +523,21 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
// 添加服务产品列
for (int i = 0; i < maxMaintenance; i++) {
if (CollUtil.isNotEmpty(info.getMaintenanceProjectProductInfoList()) && i < info.getMaintenanceProjectProductInfoList().size()) {
totalPrice = addProductRow(info.getMaintenanceProjectProductInfoList().get(i), row, totalPrice);
ProjectProductInfo productInfo = info.getMaintenanceProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
} else {
addProductRow(null, row, totalPrice);
}
}
row.add(totalPrice.toString());
//维保金额
row.add(12, maintenancePrice.toString());
dataList.add(row);
}

View File

@ -349,6 +349,7 @@
update order_list
<trim prefix="SET" suffixOverrides=",">
<if test="item.quantity != null">quantity = #{item.quantity},</if>
<if test="item.productCode != null">product_code = #{item.productCode},</if>
<if test="item.amount != null">amount = #{item.amount},</if>
<if test="item.discount != null and item.discount!=''">discount = #{item.discount},</if>
<if test="item.price != null and item.price!=''">price = #{item.price},</if>

View File

@ -39,14 +39,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, project_id,province, city, business_person, business_email, business_phone, order_code, currencyType,
shipment_amount, actual_purchase_amount, order_end_time, delivery_time, company_delivery, notifier,
notifier_email, notifier_phone, duty, duty_email, duty_phone, order_channel, partner_code, supplier,
remark, order_status, create_by, create_time, update_by, update_time from project_order_info t1
remark, order_status, create_by, create_time, update_by, update_time,version_code from project_order_info t1
</sql>
<sql id="selectProjectOrderInfoRelationVo">
select t1.id, t1.project_id,t1.province, t1.city, t1.business_person, t1.business_email, t1.business_phone, t1.order_code, t1.currencyType,
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email,t1.partner_phone
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code
,t3.partner_name,t3.level
,t4.agent_name
,t5.user_name as duty_name
@ -176,6 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessEmail != null">business_email,</if>
<if test="businessPhone != null">business_phone,</if>
<if test="orderCode != null">order_code,</if>
<if test="versionCode != null">version_code,</if>
<if test="currencyType != null">currencyType,</if>
<if test="shipmentAmount != null">shipment_amount,</if>
<if test="actualPurchaseAmount != null">actual_purchase_amount,</if>
@ -209,6 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessEmail != null">#{businessEmail},</if>
<if test="businessPhone != null">#{businessPhone},</if>
<if test="orderCode != null">#{orderCode},</if>
<if test="versionCode != null">#{versionCode},</if>
<if test="currencyType != null">#{currencyType},</if>
<if test="shipmentAmount != null">#{shipmentAmount},</if>
<if test="actualPurchaseAmount != null">#{actualPurchaseAmount},</if>
@ -246,6 +250,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessEmail != null">business_email = #{businessEmail},</if>
<if test="businessPhone != null">business_phone = #{businessPhone},</if>
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="versionCode != null">version_code=#{versionCode},</if>
<if test="currencyType != null">currencyType = #{currencyType},</if>
<if test="shipmentAmount != null">shipment_amount = #{shipmentAmount},</if>
<if test="actualPurchaseAmount != null">actual_purchase_amount = #{actualPurchaseAmount},</if>

View File

@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectProjectProductRelationInfoVo">
select t1.id, t1.project_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,t2.type
t1.catalogue_all_price, t1.price, t1.all_price, t1.guidance_discount, t1.discount, t1.remark,t2.type,t2.product_name
from project_product_info t1
left join product_info t2 on t1.product_bom_code = t2.product_code