This commit is contained in:
xd 2024-05-12 14:09:48 +08:00
parent 2b370ca07e
commit 0179891d08
11 changed files with 260 additions and 40 deletions

View File

@ -46,6 +46,7 @@ public class CacheController
caches.add(new SysCache(CacheConstants.SYS_JOB_KEY, "定时任务")); caches.add(new SysCache(CacheConstants.SYS_JOB_KEY, "定时任务"));
caches.add(new SysCache(CacheConstants.SAP_COMMON, "SAP公共数据")); caches.add(new SysCache(CacheConstants.SAP_COMMON, "SAP公共数据"));
caches.add(new SysCache(CacheConstants.RB_VERSION_DATE, "调价版本"));
} }
@PreAuthorize("@ss.hasPermi('monitor:cache:list')") @PreAuthorize("@ss.hasPermi('monitor:cache:list')")

View File

@ -2,17 +2,27 @@ package com.ruoyi.web.controller.redBook;
import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.domain.Customer;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.redBook.service.IRedBookService; import com.ruoyi.redBook.service.IRedBookService;
import com.ruoyi.web.utils.IdUtils; import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.SapFunction.RfcResult;
import com.ruoyi.web.utils.SapFunction.SapRfcUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -31,6 +41,9 @@ public class RedBookController extends BaseController
@Autowired @Autowired
private IRedBookService redBookService; private IRedBookService redBookService;
@Autowired
private RedisCache redisCache;
/** /**
* 获取目录 * 获取目录
* @param product * @param product
@ -192,6 +205,11 @@ public class RedBookController extends BaseController
return list; return list;
} }
/**
* 报价单生成
* @param quot
* @return
*/
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
@Log(title = "报价单生成", businessType = BusinessType.OTHER) @Log(title = "报价单生成", businessType = BusinessType.OTHER)
@PostMapping("/madeQuot") @PostMapping("/madeQuot")
@ -203,4 +221,47 @@ public class RedBookController extends BaseController
redBookService.insertOAQuot(quot); redBookService.insertOAQuot(quot);
return success(); return success();
} }
/**
* 获取调价日期
* @param oAQuot
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/versionList")
public AjaxResult versionList(OAQuot oAQuot)
{
AjaxResult ajax = AjaxResult.success();
List<RbVersionDateResult> resCache = redisCache.getCacheObject(getCacheKey("versionList"));
if(CollectionUtils.isEmpty(resCache)){
resCache = redBookService.versionList();
redisCache.setCacheObject(getCacheKey("versionList"),resCache);
}
ajax.put("versionList", resCache);
return ajax;
}
/**
* 获取redis 调价日期
* @param type
* @return
*/
private String getCacheKey(String type)
{
return CacheConstants.RB_VERSION_DATE + type;
}
/**
* 根据选择的调价日期 更新已选择结果数据
* @param params
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@PostMapping("/updateSelectedResultData")
public AjaxResult updateSelectedResultData(@RequestBody List<OAQuotProduct> params)
{
List<OAQuotProduct> oaQuotProducts = redBookService.queryRedBPriceByParams(params);
logger.info("根据选择的调价日期 匹配数据结果: {}", oaQuotProducts);
return success(oaQuotProducts);
}
} }

View File

@ -56,4 +56,9 @@ public class CacheConstants
* SAP-公共数据 redis key * SAP-公共数据 redis key
*/ */
public static final String SAP_COMMON = "sap_common:"; public static final String SAP_COMMON = "sap_common:";
/**
* 调价日期数据 redis key
*/
public static final String RB_VERSION_DATE = "rb_version_date:";
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.redBook.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
public class OAQuotProduct { public class OAQuotProduct {
private String uid_0;//版本uid
private String name_0;//型号 private String name_0;//型号
private String spec;//规格 private String spec;//规格
private String voltage;//电压 private String voltage;//电压
@ -13,6 +14,10 @@ public class OAQuotProduct {
private String quot_product_id;//id private String quot_product_id;//id
private String quot_id;//报价单id private String quot_id;//报价单id
public String getUid_0() { return uid_0; }
public void setUid_0(String uid_0) { this.uid_0 = uid_0; }
public String getName_0() { public String getName_0() {
return name_0; return name_0;
} }
@ -45,43 +50,23 @@ public class OAQuotProduct {
this.stu = stu; this.stu = stu;
} }
public BigDecimal getSetPrice() { public BigDecimal getSetPrice() { return setPrice; }
return setPrice;
}
public void setSetPrice(BigDecimal setPrice) { public void setSetPrice(BigDecimal setPrice) { this.setPrice = setPrice; }
this.setPrice = setPrice;
}
public BigDecimal getCount() { public BigDecimal getCount() { return count; }
return count;
}
public void setCount(BigDecimal count) { public void setCount(BigDecimal count) { this.count = count; }
this.count = count;
}
public BigDecimal getAllPrice() { public BigDecimal getAllPrice() { return allPrice; }
return allPrice;
}
public void setAllPrice(BigDecimal allPrice) { public void setAllPrice(BigDecimal allPrice) { this.allPrice = allPrice; }
this.allPrice = allPrice;
}
public String getQuot_product_id() { public String getQuot_product_id() { return quot_product_id; }
return quot_product_id;
}
public void setQuot_product_id(String quot_product_id) { public void setQuot_product_id(String quot_product_id) { this.quot_product_id = quot_product_id; }
this.quot_product_id = quot_product_id;
}
public String getQuot_id() { public String getQuot_id() { return quot_id; }
return quot_id;
}
public void setQuot_id(String quot_id) { public void setQuot_id(String quot_id) { this.quot_id = quot_id; }
this.quot_id = quot_id;
}
} }

View File

@ -0,0 +1,22 @@
package com.ruoyi.redBook.domain;
public class RbVersionDateResult {
private String value;
private String label;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View File

@ -6,6 +6,7 @@ import com.ruoyi.material.domain.temp;
import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -86,4 +87,17 @@ public interface OARedBookMapper
* @param list * @param list
*/ */
void batchOAQuotProduct(List<OAQuotProduct> list); void batchOAQuotProduct(List<OAQuotProduct> list);
/**
* 获取调价日期
* @return
*/
List<RbVersionDateResult> versionList();
/**
* 根据选择的调价日期 更新已选择结果数据
* @param params
* @return
*/
List<OAQuotProduct> queryRedBPriceByParams(@Param("params") List<OAQuotProduct> params);
} }

View File

@ -2,8 +2,11 @@ package com.ruoyi.redBook.service;
import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import java.util.List; import java.util.List;
@ -77,4 +80,17 @@ public interface IRedBookService
* @param quot * @param quot
*/ */
void insertOAQuot(OAQuot quot); void insertOAQuot(OAQuot quot);
/**
* 获取调价日期
* @return
*/
List<RbVersionDateResult> versionList();
/**
* 根据选择的调价日期 更新已选择结果数据
* @param params
* @return
*/
List<OAQuotProduct> queryRedBPriceByParams(List<OAQuotProduct> params);
} }

View File

@ -8,6 +8,7 @@ import com.ruoyi.customer.domain.Customer;
import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.redBook.mapper.OARedBookMapper; import com.ruoyi.redBook.mapper.OARedBookMapper;
import com.ruoyi.redBook.service.IRedBookService; import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -146,4 +147,23 @@ public class RedBookServiceImpl implements IRedBookService
} }
} }
} }
/**
* 获取调价日期
* @return
*/
@Override
public List<RbVersionDateResult> versionList() {
return oaRedBookMapper.versionList();
}
/**
* 根据选择的调价日期 更新已选择结果数据
* @param params
* @return
*/
@Override
public List<OAQuotProduct> queryRedBPriceByParams(List<OAQuotProduct> params) {
return oaRedBookMapper.queryRedBPriceByParams(params);
}
} }

View File

@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="searchData" parameterType="Product" resultType="Product"> <select id="searchData" parameterType="Product" resultType="Product">
select A.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,A.型号 model,isnull(A.规格,'') spec , select B.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,A.型号 model,isnull(A.规格,'') spec ,
convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate
from [rb_product_price] A from [rb_product_price] A
left join rb_productVersion B on A.version_uid_0=B.uid_0 left join rb_productVersion B on A.version_uid_0=B.uid_0
@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="handleSearchData" resultType="Product" parameterType="String"> <select id="handleSearchData" resultType="Product" parameterType="String">
select A.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,A.型号 model,isnull(A.规格,'') spec , select B.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,A.型号 model,isnull(A.规格,'') spec ,
convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate
from [rb_product_price] A from [rb_product_price] A
left join rb_productVersion B on A.version_uid_0=B.uid_0 left join rb_productVersion B on A.version_uid_0=B.uid_0
@ -110,4 +110,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id}) ( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
</foreach> </foreach>
</insert> </insert>
<select id="versionList" resultType="RbVersionDateResult">
select uid_0 value,
convert(varchar(10),[date_0],23)+' 铜:'+convert(varchar(10),[tong_price_0])+' 铝:'+convert(varchar(10),[lv_price_0]) label
from [rb_productVersion] A
inner join (select max(uid_0) muid from rb_productVersion
where sta_0=1 or sta_0=0 group by date_0 )B on A.uid_0=B.muid
order by sta_0 desc,uid_0 desc
</select>
<select id="queryRedBPriceByParams" resultType="OAQuotProduct">
SELECT a.红本价格 AS setPrice, a.namevoltage AS name_0, a.规格 AS spec, a.电压等级 AS voltage
FROM rb_productbase_price a
JOIN (VALUES
<foreach collection="params" item="param" open="(" separator="),(" close=")">
#{param.uid_0}, #{param.name_0}, #{param.spec}, #{param.voltage}
</foreach>
) AS v(version_uid_0,型号, 规格, 电压等级)
ON a.version_uid_0 = v.version_uid_0
AND a.namevoltage = v.型号
AND a.规格 = v.规格
AND a.电压等级 = v.电压等级
</select>
</mapper> </mapper>

View File

@ -108,6 +108,24 @@ export function madeQuot(data) {
data: data data: data
}) })
} }
//获取调价日期
export function versionList(query) {
return request({
url: '/redBook/redBook/versionList',
method: 'get',
params: query
})
}
//根据选择的调价日期 更新已选择结果数据
export function updateSelectedResultData(data) {
return request({
url: '/redBook/redBook/updateSelectedResultData',
method: 'post',
data: data
})
}

View File

@ -50,11 +50,11 @@
</el-form-item> </el-form-item>
<el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick"> <el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick">
<el-table-column label="uid" align="center" prop="uid_0" v-if="false"/> <el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column label="型号" align="center" prop="name_0" width="180"/> <el-table-column label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/> <el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="120"/> <el-table-column label="电压" align="center" prop="voltage"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/> <el-table-column label="红本价(元)" align="center" prop="price"/>
<el-table-column label="单位" align="center" prop="stu"/> <el-table-column label="单位" align="center" prop="stu"/>
</el-table> </el-table>
<pagination <pagination
@ -98,19 +98,29 @@
<el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input> <el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input> <el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red">{{sumSelectedResultData}}</span> 总价:<span style="color:red">{{sumSelectedResultData}}</span>
<el-select v-model="form.rbDate" style="width: 40%;float: right" >
<el-option
v-for="item in versionList"
:key="item.value"
:label="item.label"
:value="item.value"
@click.native="selectRbDate(item.value)"
/>
</el-select>
</span> </span>
<el-table width="100%;" :height="tableHeight" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData"> <el-table v-loading="selectedResultLoading" width="100%;" :height="tableHeight" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
<el-table-column fixed="left" label="" align="center" prop="index" width="50"/> <el-table-column fixed="left" label="" align="center" prop="index" width="50"/>
<el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width"> <el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleDeleteClick(scope.$index)">删除</el-button> <el-button type="text" @click="handleDeleteClick(scope.$index)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column fixed="left" label="型号" align="center" prop="name_0" width="180"/> <el-table-column fixed="left" label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/> <el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="100"/> <el-table-column label="电压" align="center" prop="voltage" width="80"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/> <el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="单位" align="center" prop="stu" width="60"/> <el-table-column label="单位" align="center" prop="stu" width="50"/>
<el-table-column label="一次折扣" align="center" prop="percent" width="80"> <el-table-column label="一次折扣" align="center" prop="percent" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.percent" @blur="changeRowData"/> <el-input v-model="scope.row.percent" @blur="changeRowData"/>
@ -168,7 +178,7 @@
} }
</style> </style>
<script> <script>
import {toDecimal, productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData, madeQuot} from "@/api/redBook/redBook"; import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook";
export default { export default {
name: "productSelect", name: "productSelect",
@ -229,6 +239,7 @@
searchResultData: [], searchResultData: [],
/**==============已选择结果========================= */ /**==============已选择结果========================= */
selectedResultLoading: false,
// //
selectedResultTotal: 0, selectedResultTotal: 0,
selectedResultCurrentPage: 1, selectedResultCurrentPage: 1,
@ -240,11 +251,15 @@
perc2: '', perc2: '',
// //
form: {} form: {},
//
versionList: [], //
} }
}, },
created() { created() {
this.productList(); this.productList();
this.getVersionList();
}, },
mounted(){ mounted(){
/*设置内容高度*/ /*设置内容高度*/
@ -465,6 +480,7 @@
}, },
// //
handleRowDblclick(row, event, column) { handleRowDblclick(row, event, column) {
const uid_0 = row.uid_0;
const name_0 = row.name_0; const name_0 = row.name_0;
const spec = row.spec; const spec = row.spec;
const voltage = row.voltage; const voltage = row.voltage;
@ -477,6 +493,7 @@
const allPrice = toDecimal(count * setPrice); const allPrice = toDecimal(count * setPrice);
const rowDate = { const rowDate = {
uid_0: uid_0,
name_0: name_0, name_0: name_0,
spec: spec, spec: spec,
voltage: voltage, voltage: voltage,
@ -607,6 +624,43 @@
}); });
}, },
//
getVersionList(){
versionList(this.queryParams).then(response => {
this.versionList = response.versionList;
this.form.rbDate = this.versionList[0].value
});
},
//
selectRbDate(uid){
this.selectedResultData.forEach((row, index) => {
this.$set(this.selectedResultData, index, {
...row,
uid_0: uid // uid
});
});
this.selectedResultLoading = true;
updateSelectedResultData(this.selectedResultData).then(response => {
for (let i = 0; i < this.selectedResultData.length; i++) {
for (let j = 0; j < response.data.length; j++) {
//
if (
this.selectedResultData[i].name_0 === response.data[j].name_0 &&
this.selectedResultData[i].spec === response.data[j].spec &&
this.selectedResultData[i].voltage === response.data[j].voltage
) {
this.selectedResultData[i].price = response.data[j].setPrice;
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].percent?this.selectedResultData[i].percent:1) * (this.selectedResultData[i].percent2?this.selectedResultData[i].percent2:1));
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].percent?this.selectedResultData[i].percent:1) * (this.selectedResultData[i].percent2?this.selectedResultData[i].percent2:1));
this.selectedResultData[i].setPrice = setPrice;
this.selectedResultData[i].allPrice = allPrice;
}
}
}
this.selectedResultLoading = false;
});
}
}, },
updated(){ updated(){
// //