This commit is contained in:
linfso 2025-07-09 10:53:05 +08:00
parent 9ba0917610
commit fb04bdc67c
5 changed files with 129 additions and 17 deletions

View File

@ -406,7 +406,19 @@ public class Oms2cWaybillController extends BaseController
@GetMapping("/getOmsOrderStatInfo")
public AjaxResult getOmsOrderStatInfo()
{
return AjaxResult.success("成功",emisWaybillService.getOmsOrderStatInfo(getLoginUser().getUser().getCustomerCode()));
EmisWaybill emisWaybill=new EmisWaybill();
emisWaybill.getParams().put("isSapp","1");
// 用户只能获取自己的单子
emisWaybill.setCustomerCode(getLoginUser().getUser().getCustomerCode());
// bug:1361 EMIS - 运单号的寄件手机号与小程序的手机号一致全部给小程序对应的手机号
// 获取当前登录人的手机号,如果电话一致就把订单归属给他
emisWaybill.getParams().put("queryPhone",getLoginUser().getUser().getPhone());
emisWaybill.getParams().put("myCustomerType",getLoginUser().getUser().getCustomerType());
emisWaybill.getParams().put("myCustNo",getLoginUser().getUser().getMonthlyPayCode());
return AjaxResult.success("成功",emisWaybillService.getOmsOrderStatInfo(emisWaybill));
}
@GetMapping("/getLatestMonthCreateOrderMapList")

View File

@ -56,7 +56,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
*/
public Long selectUserSendOrderCount(@Param("customerCode") String customerCode);
public OmsOrderStatInfo selectOmsOrderStatInfo(@Param("customerCode") String customerCode);
/**
* 获取个人用户统计数据
* @param emisWaybill
* @return
*/
public OmsOrderStatInfo selectOmsOrderStatInfo(EmisWaybill emisWaybill);
/**

View File

@ -39,7 +39,7 @@ public interface IEmisWaybillService
public Map selectUserSendAndReciveOrderCount(String customerCode);
public OmsOrderStatInfo getOmsOrderStatInfo(String customerCode);
public OmsOrderStatInfo getOmsOrderStatInfo(EmisWaybill emisWaybill);
public Map selectOmsBillFeeStatInfo(String customerCode);

View File

@ -79,13 +79,16 @@ public class EmisWaybillServiceImpl implements IEmisWaybillService
/**
* 获取OMS 首页统计数据
* @param customerCode
* @param emisWaybill
* @return
*/
@Override
public OmsOrderStatInfo getOmsOrderStatInfo(String customerCode)
public OmsOrderStatInfo getOmsOrderStatInfo(EmisWaybill emisWaybill)
{
return emisWaybillMapper.selectOmsOrderStatInfo(customerCode);
// 只能获取用户自己的运单
emisWaybill.setCustomerCode(SecurityUtils.getLoginUser().getUser().getCustomerCode());
return emisWaybillMapper.selectOmsOrderStatInfo(emisWaybill);
}
@Override

View File

@ -231,7 +231,7 @@
</resultMap>
<select id="selectOmsOrderStatInfo" parameterType="String" resultMap="OmsOrderStatInfoResult">
<select id="selectOmsOrderStatInfo" parameterType="EmisWaybill" resultMap="OmsOrderStatInfoResult">
SELECT
tb1.totalCount,
tb2.issueCount,
@ -240,17 +240,108 @@
tb5.dispatchCount,
tb6.signCount
FROM
( SELECT count( 1 ) AS totalCount FROM emis_waybill WHERE del_flag='0' and customer_code = #{customerCode}
(
SELECT count( 1 ) AS totalCount FROM emis_waybill a
WHERE a.del_flag='0'
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb1,
( SELECT count( 1 ) AS issueCount FROM emis_waybill WHERE del_flag='0' and bl_is_question = '1' AND customer_code = #{customerCode}
(
SELECT count( 1 ) AS issueCount FROM emis_waybill a
WHERE a.del_flag='0' and a.bl_is_question = '1'
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb2,
( SELECT count( 1 ) AS waitGotCount FROM emis_waybill WHERE del_flag='0' and order_status = '0' AND waybill_status = 0 AND customer_code = #{customerCode}
(
SELECT count( 1 ) AS waitGotCount FROM emis_waybill a
WHERE a.del_flag='0' and a.order_status = '0' AND a.waybill_status = 0
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb3,
( SELECT count( 1 ) AS transCount FROM emis_waybill WHERE del_flag='0' and order_status != '2' AND waybill_status != 0 AND bl_sign != '1' AND customer_code = #{customerCode}
(
SELECT count( 1 ) AS transCount FROM emis_waybill
WHERE del_flag='0' and order_status != '2' AND waybill_status != 0 AND bl_sign != '1'
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb4,
( SELECT count( 1 ) AS dispatchCount FROM emis_waybill WHERE del_flag='0' and order_status != '2' AND waybill_status = '40' AND bl_sign != '1' AND customer_code = #{customerCode}
(
SELECT count( 1 ) AS dispatchCount FROM emis_waybill a
WHERE a.del_flag='0' and a.order_status != '2' AND a.waybill_status = '40' AND a.bl_sign != '1'
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb5,
( SELECT count( 1 ) AS signCount FROM emis_waybill WHERE del_flag='0' and bl_sign = '1' AND customer_code = #{customerCode}
(
SELECT count( 1 ) AS signCount FROM emis_waybill a
WHERE a.del_flag='0' and a.bl_sign = '1'
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
and (
a.customer_code=#{customerCode}
<if test="params.myCustomerType==2 and params.myCustNo != null and params.myCustNo != '' ">
or a.cust_no=#{params.myCustNo}
</if>
<if test="params.queryPhone != null and params.queryPhone != '' ">
or a.send_mobile=#{params.queryPhone}
</if>
)
) tb6
</select>
@ -538,7 +629,10 @@
<if test="userId != null "> and a.user_id = #{userId}</if>
<if test="blSign != null and blSign != '' "> and a.bl_sign = #{blSign}</if>
<!-- 去除虚拟单 -->
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
<!-- 寄件 客户自己开单,发件号码是自己的,月结账号是自己的都要显示出来 -->
<if test="params.omsOrderTab == null or (params.omsOrderTab != null and params.omsOrderTab != 2) ">
@ -581,9 +675,7 @@
and FIND_IN_SET(a.`payment_type`,#{params.paymentType})
</if>
and not exists(
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` !=null and ewpi.`problem_type` in(173,170,151)
)
<if test="params.beginDate != null and params.beginDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}