✨ 按客户区域计算毛利并完善汇总展示
This commit is contained in:
@@ -26,6 +26,8 @@ public class PrcProfitReportQuery extends BaseEntity
|
||||
private List<String> customerCodes;
|
||||
/** 按客户当前区域筛选。 */
|
||||
private String customerArea;
|
||||
/** 服务端根据客户区域确定的计算规则。 */
|
||||
private String profitRule;
|
||||
private String customerName;
|
||||
/** 客户名称拆分后的多值查询条件。 */
|
||||
private List<String> customerNames;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.bms.price.enums;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/** 客户区域字典值对应的毛利计算规则。 */
|
||||
public enum ProfitAreaRule
|
||||
{
|
||||
SHENZHEN("C"),
|
||||
GUANGZHOU("GZ");
|
||||
|
||||
private final String customerArea;
|
||||
|
||||
ProfitAreaRule(String customerArea)
|
||||
{
|
||||
this.customerArea = customerArea;
|
||||
}
|
||||
|
||||
public static ProfitAreaRule fromCustomerArea(String customerArea)
|
||||
{
|
||||
if (customerArea != null)
|
||||
{
|
||||
for (ProfitAreaRule rule : values())
|
||||
{
|
||||
if (rule.customerArea.equals(customerArea.trim()))
|
||||
{
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Map<String, String> areaRules()
|
||||
{
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
for (ProfitAreaRule rule : values())
|
||||
{
|
||||
result.put(rule.customerArea, rule.name());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.bms.price.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.bms.customer.customerinfo.domain.BmsCustomerOption;
|
||||
// 提成功能暂停使用:import com.bms.price.domain.PrcProfitCommissionRate;
|
||||
import com.bms.price.domain.PrcProfitReportExport;
|
||||
@@ -14,6 +15,8 @@ public interface IPrcProfitReportService
|
||||
{
|
||||
List<BmsCustomerOption> selectCustomerOptions(String keywords);
|
||||
|
||||
Map<String, String> selectAreaRules();
|
||||
|
||||
List<PrcProfitReportOrderRow> selectOrderRows(PrcProfitReportQuery query);
|
||||
|
||||
List<PrcProfitReportProductRow> selectProductRows(PrcProfitReportQuery query);
|
||||
|
||||
+20
-1
@@ -3,6 +3,7 @@ package com.bms.price.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
// 提成功能暂停使用:import java.math.BigDecimal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -19,6 +20,7 @@ import com.bms.price.domain.vo.PrcProfitReportOrderRow;
|
||||
import com.bms.price.domain.vo.PrcProfitReportProductRow;
|
||||
import com.bms.price.domain.vo.PrcProfitReportQuery;
|
||||
import com.bms.price.domain.vo.PrcProfitReportSummary;
|
||||
import com.bms.price.enums.ProfitAreaRule;
|
||||
import com.bms.price.mapper.PrcProfitReportMapper;
|
||||
import com.bms.price.service.IPrcProfitReportService;
|
||||
|
||||
@@ -48,6 +50,12 @@ public class PrcProfitReportServiceImpl implements IPrcProfitReportService
|
||||
return customerMapper.selectCustomerOptions(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> selectAreaRules()
|
||||
{
|
||||
return ProfitAreaRule.areaRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrcProfitReportOrderRow> selectOrderRows(PrcProfitReportQuery query)
|
||||
{
|
||||
@@ -105,12 +113,23 @@ public class PrcProfitReportServiceImpl implements IPrcProfitReportService
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
return;
|
||||
throw new ServiceException("请选择客户区域");
|
||||
}
|
||||
if ("COMMISSION_MISSING".equals(query.getDetailType()))
|
||||
{
|
||||
throw new ServiceException("提成功能已暂停使用");
|
||||
}
|
||||
if (query.getCustomerArea() == null || query.getCustomerArea().trim().isEmpty())
|
||||
{
|
||||
throw new ServiceException("请选择客户区域");
|
||||
}
|
||||
ProfitAreaRule rule = ProfitAreaRule.fromCustomerArea(query.getCustomerArea());
|
||||
if (rule == null)
|
||||
{
|
||||
throw new ServiceException("该客户区域未配置毛利规则");
|
||||
}
|
||||
query.setCustomerArea(query.getCustomerArea().trim());
|
||||
query.setProfitRule(rule.name());
|
||||
query.setOrderNos(splitFilterValues(query.getOrderNo(), "订单号"));
|
||||
query.setCustomerCodes(splitFilterValues(query.getCustomerCode(), "客户代码"));
|
||||
query.setCustomerNames(splitFilterValues(query.getCustomerName(), "客户名称"));
|
||||
|
||||
Reference in New Issue
Block a user