查看历史试算功能
This commit is contained in:
+27
@@ -1,14 +1,19 @@
|
||||
package com.ruoyi.web.controller.price;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.price.domain.PrcQuote;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
import com.ruoyi.price.service.ITmsPriceQuoteService;
|
||||
@@ -25,6 +30,28 @@ public class BillingController extends BaseController
|
||||
@Autowired
|
||||
private ITmsPriceQuoteService tmsPriceQuoteService;
|
||||
|
||||
/**
|
||||
* Historical quote list.
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:quote')")
|
||||
@GetMapping("/quote/list")
|
||||
public TableDataInfo list(PrcQuote query)
|
||||
{
|
||||
startPage();
|
||||
List<PrcQuote> list = tmsPriceQuoteService.selectQuoteList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Historical quote detail with fee lines.
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:quote')")
|
||||
@GetMapping("/quote/{quoteId}")
|
||||
public AjaxResult getInfo(@PathVariable Long quoteId)
|
||||
{
|
||||
return success(tmsPriceQuoteService.getQuote(quoteId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Same matching logic as TMS open API, for BMS console trial.
|
||||
*/
|
||||
|
||||
@@ -107,3 +107,7 @@ price.quote.productCodeRequired=productCode is required
|
||||
price.quote.countryRequired=countryCode or countryName is required
|
||||
price.quote.weightInvalid=weight must be > 0
|
||||
price.quote.bizDateInvalid=bizDate format must be yyyy-MM-dd
|
||||
price.quote.fixedPackageNoDetails=套餐固定价格没有明细,使用产品默认价格
|
||||
price.quote.noCustomerPackageOverride=没有客户套餐覆盖,使用产品默认运费/挂号费
|
||||
price.quote.quoteIdRequired=quoteId is required
|
||||
price.quote.hitCustomerFixedPackageDetail=命中客户套餐固定价格明细
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import com.ruoyi.price.domain.PrcQuote;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.price.domain.PrcQuote;
|
||||
|
||||
/** billing quote header mapper */
|
||||
public interface PrcQuoteMapper
|
||||
@@ -11,6 +12,8 @@ public interface PrcQuoteMapper
|
||||
|
||||
public PrcQuote selectPrcQuoteById(Long quoteId);
|
||||
|
||||
public List<PrcQuote> selectPrcQuoteList(PrcQuote quote);
|
||||
|
||||
public int insertPrcQuote(PrcQuote quote);
|
||||
|
||||
public int updateQuoteAmounts(@Param("quoteId") Long quoteId,
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ruoyi.price.service;
|
||||
|
||||
import com.ruoyi.price.domain.PrcQuote;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteRequest;
|
||||
import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TMS freight quote service.
|
||||
@@ -15,4 +17,8 @@ import com.ruoyi.price.domain.vo.TmsPriceQuoteResult;
|
||||
public interface ITmsPriceQuoteService
|
||||
{
|
||||
TmsPriceQuoteResult quote(TmsPriceQuoteRequest request);
|
||||
|
||||
List<PrcQuote> selectQuoteList(PrcQuote query);
|
||||
|
||||
TmsPriceQuoteResult getQuote(Long quoteId);
|
||||
}
|
||||
|
||||
+26
-3
@@ -112,6 +112,27 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcQuote> selectQuoteList(PrcQuote query)
|
||||
{
|
||||
return quoteMapper.selectPrcQuoteList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TmsPriceQuoteResult getQuote(Long quoteId)
|
||||
{
|
||||
if (quoteId == null)
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.quote.quoteIdRequired"));
|
||||
}
|
||||
PrcQuote quote = quoteMapper.selectPrcQuoteById(quoteId);
|
||||
if (quote == null)
|
||||
{
|
||||
throw new ServiceException("QUOTE_NOT_FOUND: quoteId=" + quoteId);
|
||||
}
|
||||
return toResult(quote, quoteFeeMapper.selectByQuoteId(quoteId), true);
|
||||
}
|
||||
|
||||
private TmsPriceQuoteResult doQuote(TmsPriceQuoteRequest request, Date bizDate)
|
||||
{
|
||||
String productCode = request.getProductCode().trim();
|
||||
@@ -164,7 +185,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
}
|
||||
|
||||
return buildDefault(request.getCustomerId(), base, productCode, productName, weight,
|
||||
"no customer package override; use product default freight/registration");
|
||||
MessageUtils.message("price.quote.noCustomerPackageOverride"));
|
||||
}
|
||||
|
||||
private TmsPriceQuoteResult tryFixed(PrcCustomerPriceSet bind, PrcPriceSet set,
|
||||
@@ -176,7 +197,8 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
TmsPriceQuoteResult r = buildFromRates(SRC_DEFAULT, base.getFreightPrice(), null, null,
|
||||
base.getRegistrationFee(), base, productCode, productName, weight, null);
|
||||
fillPackage(r, bind, set);
|
||||
r.setMatchMessage("FIXED package has no details; use bms_product_country default");
|
||||
// 套餐固定价格没有明细,使用产品默认价格
|
||||
r.setMatchMessage(MessageUtils.message("price.quote.fixedPackageNoDetails"));
|
||||
r.setCustomerId(bind.getCustomerId());
|
||||
return r;
|
||||
}
|
||||
@@ -208,7 +230,8 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
{
|
||||
r.setProductCountryId(detail.getProductCountryId());
|
||||
}
|
||||
r.setMatchMessage("hit customer FIXED package detail");
|
||||
// 命中客户套餐固定价格明细
|
||||
r.setMatchMessage(MessageUtils.message("price.quote.hitCustomerFixedPackageDetail"));
|
||||
r.setCustomerId(bind.getCustomerId());
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where quote_id = #{quoteId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcQuoteList" parameterType="PrcQuote" resultMap="PrcQuoteResult">
|
||||
<include refid="selectPrcQuoteVo"/>
|
||||
<where>
|
||||
<if test="customerId != null">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code like concat('%', #{productCode}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND product_name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">
|
||||
AND price_set_name like concat('%', #{priceSetName}, '%')
|
||||
</if>
|
||||
<if test="matchSource != null and matchSource != ''">
|
||||
AND match_source = #{matchSource}
|
||||
</if>
|
||||
<if test="bizDate != null">
|
||||
AND biz_date = #{bizDate}
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
AND date_format(created_at,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND date_format(created_at,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by quote_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcQuote" parameterType="PrcQuote" useGeneratedKeys="true" keyProperty="quoteId">
|
||||
insert into prc_quote (
|
||||
quote_key, customer_id, product_code, product_name,
|
||||
|
||||
@@ -13,6 +13,10 @@ INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component,
|
||||
SELECT 2302, N'试算执行', 2301, 1, '', NULL, 1, 0, 'F', '0', '0', 'price:billing:quote', '#', 'admin', sysdate()
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2302);
|
||||
|
||||
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
|
||||
SELECT 2303, N'试算查询', 2301, 2, '', NULL, 1, 0, 'F', '0', '0', 'price:billing:quote', '#', 'admin', sysdate()
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2303);
|
||||
|
||||
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||
SELECT 1, m.menu_id FROM (SELECT 2300 AS menu_id UNION SELECT 2301 UNION SELECT 2302) m
|
||||
SELECT 1, m.menu_id FROM (SELECT 2300 AS menu_id UNION SELECT 2301 UNION SELECT 2302 UNION SELECT 2303) m
|
||||
WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu rm WHERE rm.role_id = 1 AND rm.menu_id = m.menu_id);
|
||||
|
||||
Reference in New Issue
Block a user