demand: tms-统计报表-月结客户出货统计-查询性能优化

committer: heyu
This commit is contained in:
aike 2025-11-11 17:22:25 +08:00
parent 84a9a6a490
commit 253c8c69b7
3 changed files with 6 additions and 36 deletions

View File

@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.common.annotation.audit.DataAuditLog;
import com.xdadan.erp.common.annotation.audit.OperateType;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
import com.xdadan.erp.emis.service.impl.EmisWaybillServiceImpl;
import org.apache.ibatis.annotations.Param;
@ -370,7 +371,7 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
* @param emisWaybill 查询条件
* @return 统计结果列表
*/
List<Map> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill);
List<MonthlyCustomerShipmentStatVO> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill);
/**
* 查询月结客户出货明细

View File

@ -162,38 +162,7 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
*/
@Override
public List<MonthlyCustomerShipmentStatVO> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill) {
List<Map> mapList = emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill);
return mapList.stream().map(map -> {
MonthlyCustomerShipmentStatVO vo = new MonthlyCustomerShipmentStatVO();
vo.setCustomerName((String) map.get("customerName"));
vo.setCustNo((String) map.get("custNo"));
vo.setCustomerCode((String) map.get("customerCode"));
Object totalTicketsObj = map.get("totalTickets");
if (totalTicketsObj != null) {
vo.setTotalTickets(((Number) totalTicketsObj).intValue());
} else {
vo.setTotalTickets(0);
}
vo.setTotalWeight((java.math.BigDecimal) map.get("totalWeight"));
vo.setSalesmen((String) map.get("salesmen"));
Object expressTicketsObj = map.get("expressTickets");
vo.setExpressTickets(expressTicketsObj != null ? ((Number) expressTicketsObj).intValue() : 0);
vo.setExpressWeight((java.math.BigDecimal) map.getOrDefault("expressWeight", java.math.BigDecimal.ZERO));
Object airTicketsObj = map.get("airTickets");
vo.setAirTickets(airTicketsObj != null ? ((Number) airTicketsObj).intValue() : 0);
vo.setAirWeight((java.math.BigDecimal) map.getOrDefault("airWeight", java.math.BigDecimal.ZERO));
Object landTicketsObj = map.get("landTickets");
vo.setLandTickets(landTicketsObj != null ? ((Number) landTicketsObj).intValue() : 0);
vo.setLandWeight((java.math.BigDecimal) map.getOrDefault("landWeight", java.math.BigDecimal.ZERO));
Object importTicketsObj = map.get("importTickets");
vo.setImportTickets(importTicketsObj != null ? ((Number) importTicketsObj).intValue() : 0);
vo.setImportWeight((java.math.BigDecimal) map.getOrDefault("importWeight", java.math.BigDecimal.ZERO));
return vo;
}).collect(Collectors.toList());
return emisWaybillMapper.selectMonthlyCustomerShipmentStat(emisWaybill);
}
/**

View File

@ -4010,7 +4010,7 @@
IFNULL(SUM(CASE WHEN a.receive_country = '0086' AND tl.trans_type IN ('1', '2', '3') THEN a.bill_weight ELSE 0 END), 0) AS importWeight
FROM emis_waybill a
LEFT JOIN emis_trans_line tl ON a.trans_line_type = tl.line_code AND tl.del_flag = '0'
LEFT JOIN emis_customer_user cu ON a.cust_no = cu.monthly_pay_code AND cu.del_flag = '0'
LEFT JOIN emis_customer_user cu ON a.customer_code = cu.customer_code AND cu.del_flag = '0'
<where>
a.del_flag = '0'
AND a.order_status !='0'
@ -4062,7 +4062,7 @@
<if test="salesmen != null and salesmen != ''">
AND cu.salesmen LIKE CONCAT('%', #{salesmen}, '%')
</if>
<!-- 权限控制:销售主管 -->
<!-- 权限控制 -->
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
AND (
cu.sales_executive = #{params.privEmpName}
@ -4150,7 +4150,7 @@
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
AND EXISTS (
SELECT 1 FROM emis_customer_user cu
WHERE a.cust_no = cu.monthly_pay_code
WHERE a.customer_code = cu.customer_code
AND cu.del_flag = '0'
AND (
cu.sales_executive = #{params.privEmpName}