demand: TMS系统 - 客户账单管理 - 财务开票处理 - 定制导出设置超时时间 TMS系统 - 签收管理 - 签收异常对比-未签收列表-查询过滤掉运输方式为空运且清关方式为自清自提的运单

committer: heyu
This commit is contained in:
aike 2025-11-10 17:46:28 +08:00
parent 3faa961f37
commit 65adf5b884
6 changed files with 316 additions and 0 deletions

View File

@ -42,6 +42,8 @@ import com.xdadan.erp.common.utils.StringUtils;
import com.xdadan.erp.common.utils.poi.ExcelUtil;
import com.xdadan.erp.emis.service.IEmisCustomerUserService;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
/**
* 快递客户用户Controller
@ -477,4 +479,47 @@ public class EmisCustomerUserController extends EmisBaseController
{
return toAjax(emisCustomerUserService.deleteEmisCustomerUserByIds(ids));
}
/**
* 查询月结客户出货统计
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:monthlyShipmentStat')")
@GetMapping("/monthlyShipmentStat")
public TableDataInfo monthlyShipmentStat(EmisWaybill emisWaybill) {
startPage();
// 设置权限参数
setPrivParams(emisWaybill);
List<MonthlyCustomerShipmentStatVO> list = emisCustomerUserService
.selectMonthlyCustomerShipmentStat(emisWaybill);
return getDataTable(list);
}
/**
* 查询月结客户出货明细
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:monthlyShipmentDetail')")
@GetMapping("/monthlyShipmentDetail")
public TableDataInfo monthlyShipmentDetail(EmisWaybill emisWaybill) {
startPage();
// 设置权限参数
setPrivParams(emisWaybill);
List<EmisWaybill> list = emisCustomerUserService.selectMonthlyCustomerShipmentDetail(emisWaybill);
return getDataTable(list);
}
/**
* 导出月结客户出货统计
*/
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:export')")
@Log(title = "月结客户出货统计", businessType = BusinessType.EXPORT)
@PostMapping("/exportMonthlyShipmentStat")
public void exportMonthlyShipmentStat(HttpServletResponse response, EmisWaybill emisWaybill) {
// 设置权限参数
setPrivParams(emisWaybill);
List<MonthlyCustomerShipmentStatVO> list = emisCustomerUserService
.selectMonthlyCustomerShipmentStat(emisWaybill);
ExcelUtil<MonthlyCustomerShipmentStatVO> util = new ExcelUtil<MonthlyCustomerShipmentStatVO>(
MonthlyCustomerShipmentStatVO.class);
util.exportExcel(response, list, "月结客户出货统计");
}
}

View File

@ -363,4 +363,20 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
* @return 运单列表
*/
List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill);
/**
* 查询月结客户出货统计
*
* @param emisWaybill 查询条件
* @return 统计结果列表
*/
List<Map> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill);
/**
* 查询月结客户出货明细
*
* @param emisWaybill 查询条件
* @return 运单明细列表
*/
List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
}

View File

@ -11,6 +11,8 @@ package com.xdadan.erp.emis.service;
import java.util.List;
import com.xdadan.erp.emis.domain.EmisCustomerUser;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
/**
* @ClassName EmisCustomerUserService
@ -86,4 +88,20 @@ public interface IEmisCustomerUserService
* @return 结果
*/
public int updateEnterpriseInfoByMonthlyPayCode(EmisCustomerUser emisCustomerUser);
/**
* 查询月结客户出货统计
*
* @param emisWaybill 查询条件
* @return 统计结果列表
*/
public List<MonthlyCustomerShipmentStatVO> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill);
/**
* 查询月结客户出货明细
*
* @param emisWaybill 查询条件
* @return 运单明细列表
*/
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
}

View File

@ -11,13 +11,18 @@
package com.xdadan.erp.emis.service.impl;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.xdadan.erp.common.utils.SecurityUtils;
import com.xdadan.erp.emis.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.emis.domain.EmisCustomerUser;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
import com.xdadan.erp.emis.mapper.EmisCustomerUserMapper;
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
import com.xdadan.erp.emis.service.IEmisCustomerUserService;
/**
@ -32,6 +37,9 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
@Autowired
private EmisCustomerUserMapper emisCustomerUserMapper;
@Autowired
private EmisWaybillMapper emisWaybillMapper;
/**
* 查询快递客户用户
*
@ -146,4 +154,57 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
return emisCustomerUserMapper.updateEnterpriseInfoByMonthlyPayCode(emisCustomerUser);
}
/**
* 查询月结客户出货统计
*
* @param emisWaybill 查询条件
* @return 统计结果列表
*/
@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());
}
/**
* 查询月结客户出货明细
*
* @param emisWaybill 查询条件
* @return 运单明细列表
*/
@Override
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill) {
return emisWaybillMapper.selectMonthlyCustomerShipmentDetail(emisWaybill);
}
}

View File

@ -1118,6 +1118,10 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
throw new EmisBizError(EmisBizErrorType.FAIL,
"只能对未开票状态的发票进行延期操作,申请序号: " + record.getApplySeqNo());
}
if ("1".equals(record.getBlDelay())) {
throw new EmisBizError(EmisBizErrorType.FAIL,
"已延期,请勿重复点击,申请序号: " + record.getApplySeqNo());
}
}
// 获取当前操作人

View File

@ -3990,4 +3990,176 @@
</where>
order by a.order_date desc
</select>
<!-- 查询月结客户出货统计 -->
<select id="selectMonthlyCustomerShipmentStat" parameterType="EmisWaybill" resultType="map">
SELECT
a.customer_code AS customerCode,
a.cust_name AS customerName,
a.cust_no AS custNo,
COUNT(DISTINCT a.bill_code) AS totalTickets,
IFNULL(SUM(a.bill_weight), 0) AS totalWeight,
GROUP_CONCAT(DISTINCT a.salesmen ORDER BY a.order_date SEPARATOR '/') AS salesmen,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '1' THEN 1 ELSE 0 END) AS expressTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '1' THEN a.bill_weight ELSE 0 END), 0) AS expressWeight,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN 1 ELSE 0 END) AS airTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN a.bill_weight ELSE 0 END), 0) AS airWeight,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '3' THEN 1 ELSE 0 END) AS landTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '3' THEN a.bill_weight ELSE 0 END), 0) AS landWeight,
SUM(CASE WHEN a.receive_country = '0086' AND tl.trans_type IN ('1', '2', '3') THEN 1 ELSE 0 END) AS importTickets,
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'
<where>
a.del_flag = '0'
AND a.order_status !='0'
AND a.order_status!='2'
AND a.cust_no IS NOT NULL
AND a.cust_no != ''
-- AND cu.customer_type = '2'
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
AND NOT EXISTS (
SELECT 1 FROM emis_waybill_problem_info ewpi
WHERE ewpi.bill_code = a.bill_code
AND ewpi.del_flag = '0'
AND ewpi.problem_type IN (151, 170, 173)
)
<!-- 寄件日期范围 -->
<if test="params.beginSendDate != null and params.beginSendDate != ''">
AND a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
AND a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<!-- 客户名称 -->
<if test="customerName != null and customerName != ''">
AND a.cust_name LIKE CONCAT('%', #{custName}, '%')
</if>
<if test="customerCode != null and customerCode != ''">
AND a.customer_code = #{customerCode}
</if>
<if test="custNo != null and custNo != ''">
AND a.cust_no = #{custNo}
</if>
<!-- 寄件国家 -->
<if test="sendCountry != null and sendCountry != ''">
AND a.send_country = #{sendCountry}
</if>
<!-- 目的国家 -->
<if test="receiveCountry != null and receiveCountry != ''">
AND a.receive_country = #{receiveCountry}
</if>
<!-- 销售主管 -->
<if test="salesExecutive != null and salesExecutive != ''">
AND cu.sales_executive LIKE CONCAT('%', #{salesExecutive}, '%')
</if>
<!-- 销售支持 -->
<if test="salesSupport != null and salesSupport != ''">
AND cu.sales_support LIKE CONCAT('%', #{salesSupport}, '%')
</if>
<!-- 销售联系人 -->
<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}
OR cu.sales_support = #{params.privEmpName}
OR cu.salesmen = #{params.privEmpName}
OR cu.salesmen IN (
SELECT salesmen FROM emis_salesmen_rel esr
WHERE esr.del_flag = '0'
AND esr.bl_open = '1'
AND NOW() <![CDATA[ >= ]]> esr.start_date
AND NOW() <![CDATA[ <= ]]> esr.end_date
AND esr.sales_ass = #{params.privEmpName}
)
)
</if>
</where>
GROUP BY a.cust_no
ORDER BY a.cust_name
</select>
<!-- 查询月结客户出货明细 -->
<select id="selectMonthlyCustomerShipmentDetail" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag = '0'
AND a.order_status !='0'
AND a.order_status!='2'
AND a.cust_no IS NOT NULL
AND a.cust_no != ''
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
AND NOT EXISTS (
SELECT 1 FROM emis_waybill_problem_info ewpi
WHERE ewpi.bill_code = a.bill_code
AND ewpi.del_flag = '0'
AND ewpi.problem_type IN (151, 170, 173)
)
<!-- 寄件日期范围 -->
<if test="params.beginSendDate != null and params.beginSendDate != ''">
AND a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
AND a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<!-- 月结卡号 -->
<if test="custName != null and custName != ''">
AND a.cust_name LIKE CONCAT('%', #{custName}, '%')
</if>
<if test="customerCode != null and customerCode != ''">
AND a.customer_code = #{customerCode}
</if>
<if test="custNo != null and custNo != ''">
AND a.cust_no = #{custNo}
</if>
<!-- 运输方式筛选 -->
<if test="transType != null and transType != ''">
AND EXISTS (
SELECT 1 FROM emis_trans_line tl
WHERE tl.line_code = a.trans_line_type
AND tl.del_flag = '0'
AND tl.trans_type = #{transType}
<if test="transType == '1'">
AND a.send_country = '0086'
</if>
<if test="transType == '2'">
AND a.send_country = '0086'
</if>
<if test="transType == '3'">
AND a.send_country = '0086'
</if>
<if test="transType == 'import'">
AND a.receive_country = '0086'
AND tl.trans_type IN ('1', '2', '3')
</if>
)
</if>
<!-- 权限控制 -->
<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
AND cu.del_flag = '0'
AND (
cu.sales_executive = #{params.privEmpName}
OR cu.sales_support = #{params.privEmpName}
OR cu.salesmen = #{params.privEmpName}
OR cu.salesmen IN (
SELECT salesmen FROM emis_salesmen_rel esr
WHERE esr.del_flag = '0'
AND esr.bl_open = '1'
AND NOW() <![CDATA[ >= ]]> esr.start_date
AND NOW() <![CDATA[ <= ]]> esr.end_date
AND esr.sales_ass = #{params.privEmpName}
)
)
)
</if>
</where>
ORDER BY a.order_date DESC, a.send_date DESC
</select>
</mapper>