diff --git a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cWaybillController.java b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cWaybillController.java index ebae09d..2a321d0 100644 --- a/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cWaybillController.java +++ b/emis-oms-biz-web/src/main/java/com/xdadan/erp/oms/web/Oms2cWaybillController.java @@ -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") diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/mapper/EmisWaybillMapper.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/mapper/EmisWaybillMapper.java index d5878f5..b94e87b 100644 --- a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/mapper/EmisWaybillMapper.java +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/mapper/EmisWaybillMapper.java @@ -56,7 +56,12 @@ public interface EmisWaybillMapper extends BaseMapper */ public Long selectUserSendOrderCount(@Param("customerCode") String customerCode); - public OmsOrderStatInfo selectOmsOrderStatInfo(@Param("customerCode") String customerCode); + /** + * 获取个人用户统计数据 + * @param emisWaybill + * @return + */ + public OmsOrderStatInfo selectOmsOrderStatInfo(EmisWaybill emisWaybill); /** diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisWaybillService.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisWaybillService.java index 94a0729..f0de17d 100644 --- a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisWaybillService.java +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/IEmisWaybillService.java @@ -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); diff --git a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisWaybillServiceImpl.java b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisWaybillServiceImpl.java index 499137e..91640a9 100644 --- a/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisWaybillServiceImpl.java +++ b/emis-oms-biz/src/main/java/com/xdadan/erp/oms/service/impl/EmisWaybillServiceImpl.java @@ -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 diff --git a/emis-oms-biz/src/main/resources/mapper/EmisWaybillMapper.xml b/emis-oms-biz/src/main/resources/mapper/EmisWaybillMapper.xml index 38f40b2..45a549b 100644 --- a/emis-oms-biz/src/main/resources/mapper/EmisWaybillMapper.xml +++ b/emis-oms-biz/src/main/resources/mapper/EmisWaybillMapper.xml @@ -231,7 +231,7 @@ - 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) 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} + + or a.cust_no=#{params.myCustNo} + + + + or a.send_mobile=#{params.queryPhone} + + ) ) tb6 @@ -538,7 +629,10 @@ and a.user_id = #{userId} and a.bl_sign = #{blSign} - + + 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) + ) @@ -581,9 +675,7 @@ and FIND_IN_SET(a.`payment_type`,#{params.paymentType}) - 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.send_date = ]]> #{params.beginDate}