Commit 8fcd43be by 伍思炜

优化导出宽带订单清单功能

parent 317fce09
......@@ -332,7 +332,7 @@ public class Order implements Serializable{
private String hehuorenArea;
/**
* 合伙人县分
* 合伙人名字
*/
@TableField(value = "hehuoren_name")
private String hehuorenName;
......
package com.winsun.bean;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* < >
* @Author pxl
* @Date 2020-05-27
*/
@Data
@TableName ("hhr_school")
public class Schools implements Serializable {
private static final long serialVersionUID = 6941854875917339515L;
@TableId(value = "id" ,type = IdType.AUTO)
private Integer id;
/**
* 县分
*/
@TableField("sub_name" )
private String subName;
/**
* 学校
*/
@TableField("school_name" )
private String schoolName;
/**
* 是否禁用(0禁用;1使用)
*/
@TableField("status" )
private Integer status;
/**
* 二维码扫码后默认办理套餐
*/
@TableField("defaultPackage" )
private Integer defaultPackage;
/**
* 学校对应客服的二维码地址
*/
@TableField("service_qrcode" )
private String serviceQrcode;
/**
* 揽装人
*/
@TableField("lz_user" )
private String lzUser;
/**
* 揽装工号
*/
@TableField("lzgh" )
private String lzgh;
/**
* 网点id
*/
@TableField("net_id" )
private String netId;
/**
* 宽带速率
*/
@TableField("kdsl" )
private String kdsl;
/**
* 1包月2包年3包月包年
*/
@TableField("fee_type" )
private String feeType;
/**
* 生成二维码的url
*/
@TableField("url" )
private String url;
/**
* 是否新装融合(0:否 1:是)
*/
@TableField("net_type" )
private Integer netType;
/**
* 是否收到电信卡,0:否,1:是
*/
@TableField("is_recv" )
private Integer isRecv;
/**
* 是否显示0息购机0:否,1:是
*/
@TableField("net_phone" )
private Integer netPhone;
/**
* 单宽id
*/
@TableField("bandproduct_id" )
private String bandproductId;
/**
* 显示宽带
*/
@TableField("is_showband" )
private String isShowband;
/**
* 是否显示融合
*/
@TableField("is_showrh" )
private String isShowrh;
/**
* 是否显示优惠购机
*/
@TableField("is_showyhgj")
private String isShowyhgj;
/**
* 是否显示毕业生融合办理
*/
@TableField("bysrh" )
private String bysrh;
/**
* 网点编码
*/
@TableField("network_code" )
private String networkCode;
/**
* 网点名称
*/
@TableField("network_name" )
private String networkName;
/**
* 开学时间
*/
@TableField("start_date")
private Date startDate;
/**
* 结束时间
*/
@TableField("end_date")
private Date endDate;
/**
* 大于50元激励
*/
@TableField(value = "greater_fifty", fill = FieldFill.UPDATE)
private Double greaterFifty;
/**
* 大于100元激励
*/
@TableField(value = "greater_hundred", fill = FieldFill.UPDATE)
private Double greaterHundred;
/**
* 是否显示宽叠移按钮
*/
@TableField("kdy_btn")
private String kdyBtn;
/**
* 是否显示优惠购机按钮
*/
@TableField("is_showyhgj")
private String yhgj;
/**
* 宽带、融合是否甩单
*/
@TableField("jilt_kd")
private String jiltKd;
/**
* 宽叠移是否甩单
*/
@TableField("jilt_kdy")
private String jiltKdy;
/**
* 线上线下按钮是否显示
*/
@TableField("ud_btn")
private String udBtn;
/**
* 手机卡办理
*/
@TableField("sjkbl")
private String sjkbl;
/**
* 套餐升级
*/
@TableField("tcsj")
private String tcsj;
/**
* 手机卡套餐升级
*/
@TableField("sjktcsj")
private String sjktcsj;
/**
* 终端编码
*/
@TableField("app_id")
private String appId;
/**
* 终端密匙
*/
@TableField("app_key")
private String appKey;
private String userId;
}
......@@ -2,227 +2,258 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.winsun.mapper.OrderMapper">
<resultMap id="broadBandOrder" type="com.winsun.bean.BroadBandOrder">
<result column="order_number" property="orderNumber" />
<result column="xb_order_id" property="xbOrderId" />
<result column="order_id" property="orderId" />
<result column="order_status" property="orderStatus" />
<result column="hehuoren_id" property="hehuorenId" />
<result column="package_id" property="packageId" />
<result column="customer_name" property="customerName" />
<result column="business_number" property="businessNumber" />
<result column="contact_number" property="contactNumber" />
<result column="id_card" property="idCard" />
<result column="business_iccid" property="businessIccid" />
<result column="kapin" property="kapin" />
<result column="id_cardz" property="idCardz" />
<result column="id_cardf" property="idCardf" />
<result column="id_cardzs" property="idCardzs" />
<result column="studen_card" property="studenCard" />
<result column="create_time" property="createTime" />
<result column="success_time" property="successTime" />
<result column="address" property="address" />
<result column="remarks" property="remarks" />
<result column="site" property="site" />
<result column="msg" property="msg" />
<result column="send_type" property="sendType" />
<result column="now_package" property="nowPackage" />
<result column="business_package" property="businessPackage" />
<result column="user_bussiness_type" property="userBussinessType" />
<result column="user_type" property="userType" />
<result column="accept_result" property="acceptResult" />
<result column="accept_name" property="acceptName" />
<result column="accept_comment" property="acceptComment" />
<result column="accept_date" property="acceptDate" />
<result column="yj_count" property="yjCount" />
<result column="yj_type" property="yjType" />
<result column="tj_type" property="tjType" />
<result column="xb_type" property="xbType" />
<result column="net_number" property="netNumber" />
<result column="net_password" property="netPassword" />
<result column="userSchool" property="userSchool" />
<result column="check_fail" property="checkFail" />
<result column="expenses" property="expenses" />
<result column="identifying" property="identifying" />
<result column="kd_order_id" property="kdOrderId" />
<result column="gift_account" property="giftAccount" />
<result column="gift_password" property="giftCypher" />
<result column="hehuoren_area" property="hehuorenArea" />
<result column="hehuoren_name" property="hehuorenName" />
<result column="hehuoren_school" property="hehuorenSchool" />
<result column="hehuoren_phone" property="hehuorenPhone" />
<result column="supervisor_name" property="supervisorName" />
<result column="th_status" property="thStatus" />
<result column="rh_time" property="rhTime" />
<result column="orderSeq" property="orderSeq" />
<result column="productName" property="productName" />
<result column="order_set_meal" property="orderSetMeal" />
<result column="order_university_name" property="orderUniversityName" />
<result column="orderName" property="orderName" />
<result column="orderDate" property="orderDate" />
<result column="status" property="status" />
<result column="order_region" property="orderRegion" />
<result column="ipay" property="iPay" />
<result column="payType" property="payType" />
<result column="webOrderAmount" property="webOrderAmount" />
<result column="order_payment_time" property="orderPaymentTime" />
<result column="orderReqtranSeq" property="orderReqtranSeq" />
<result column="customeRid" property="customerId" />
<result column="orderPhone" property="orderPhone" />
<result column="order_customer_type" property="orderCustomerType" />
<result column="order_customer_student_id" property="orderCustomerStudentId" />
<result column="order_customer_remarks" property="orderCustomerRemarks" />
<result column="order_customer_account" property="orderCustomerAccount" />
<result column="order_customer_pwd" property="orderCustomerPwd" />
<result column="uptranseq" property="uptranseq" />
<result column="expenses" property="expenses" />
<resultMap id="broadBandOrder" type="com.winsun.bean.BroadBandOrder">
<result column="order_number" property="orderNumber"/>
<result column="xb_order_id" property="xbOrderId"/>
<result column="order_id" property="orderId"/>
<result column="order_status" property="orderStatus"/>
<result column="hehuoren_id" property="hehuorenId"/>
<result column="package_id" property="packageId"/>
<result column="customer_name" property="customerName"/>
<result column="business_number" property="businessNumber"/>
<result column="contact_number" property="contactNumber"/>
<result column="id_card" property="idCard"/>
<result column="business_iccid" property="businessIccid"/>
<result column="kapin" property="kapin"/>
<result column="id_cardz" property="idCardz"/>
<result column="id_cardf" property="idCardf"/>
<result column="id_cardzs" property="idCardzs"/>
<result column="studen_card" property="studenCard"/>
<result column="create_time" property="createTime"/>
<result column="success_time" property="successTime"/>
<result column="address" property="address"/>
<result column="remarks" property="remarks"/>
<result column="site" property="site"/>
<result column="msg" property="msg"/>
<result column="send_type" property="sendType"/>
<result column="now_package" property="nowPackage"/>
<result column="business_package" property="businessPackage"/>
<result column="user_bussiness_type" property="userBussinessType"/>
<result column="user_type" property="userType"/>
<result column="accept_result" property="acceptResult"/>
<result column="accept_name" property="acceptName"/>
<result column="accept_comment" property="acceptComment"/>
<result column="accept_date" property="acceptDate"/>
<result column="yj_count" property="yjCount"/>
<result column="yj_type" property="yjType"/>
<result column="tj_type" property="tjType"/>
<result column="xb_type" property="xbType"/>
<result column="net_number" property="netNumber"/>
<result column="net_password" property="netPassword"/>
<result column="userSchool" property="userSchool"/>
<result column="check_fail" property="checkFail"/>
<result column="expenses" property="expenses"/>
<result column="identifying" property="identifying"/>
<result column="kd_order_id" property="kdOrderId"/>
<result column="gift_account" property="giftAccount"/>
<result column="gift_password" property="giftCypher"/>
<result column="hehuoren_area" property="hehuorenArea"/>
<result column="hehuoren_name" property="hehuorenName"/>
<result column="hehuoren_school" property="hehuorenSchool"/>
<result column="hehuoren_phone" property="hehuorenPhone"/>
<result column="supervisor_name" property="supervisorName"/>
<result column="th_status" property="thStatus"/>
<result column="rh_time" property="rhTime"/>
<result column="orderSeq" property="orderSeq"/>
<result column="productName" property="productName"/>
<result column="order_set_meal" property="orderSetMeal"/>
<result column="order_university_name" property="orderUniversityName"/>
<result column="orderName" property="orderName"/>
<result column="orderDate" property="orderDate"/>
<result column="status" property="status"/>
<result column="order_region" property="orderRegion"/>
<result column="ipay" property="iPay"/>
<result column="payType" property="payType"/>
<result column="webOrderAmount" property="webOrderAmount"/>
<result column="order_payment_time" property="orderPaymentTime"/>
<result column="orderReqtranSeq" property="orderReqtranSeq"/>
<result column="customeRid" property="customerId"/>
<result column="orderPhone" property="orderPhone"/>
<result column="order_customer_type" property="orderCustomerType"/>
<result column="order_customer_student_id" property="orderCustomerStudentId"/>
<result column="order_customer_remarks" property="orderCustomerRemarks"/>
<result column="order_customer_account" property="orderCustomerAccount"/>
<result column="order_customer_pwd" property="orderCustomerPwd"/>
<result column="uptranseq" property="uptranseq"/>
<result column="expenses" property="expenses"/>
<result column="order_rf2" property="orderRf2"></result>
<result column="orderSeqTHD" property="orderseqThd" />
</resultMap>
<result column="orderSeqTHD" property="orderseqThd"/>
</resultMap>
<select id="selectBroadBandOrderList" resultMap="broadBandOrder">
select
ho.*,
ov.productName,
ov.order_set_meal,
ov.order_university_name,
ov.orderName,
ov.ipay,
ov.payType,
ov.webOrderAmount,
ov.order_payment_time,
ov.orderReqtranSeq,
ov.customeRid,
ov.orderPhone,
ov.order_customer_type,
ov.order_customer_student_id,
ov.order_customer_remarks,
ov.order_customer_account,
ov.order_customer_pwd,
ov.uptranseq,
ov.expenses,
ov.order_rf2,
ov.orderSeqTHD,
ov.order_region,
ov.orderDate
from (
select * from hhr_order
where
kd_order_id is not null
and user_type in (3,5,9,10)
<if test="createTimeStart != null and createTimeStart != ''">
and create_time &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
and create_time &lt;= #{createTimeEnd}
</if>
<if test="successTimeStart != null and successTimeStart != ''">
and success_time &gt;= #{successTimeStart}
</if>
<if test="successTimeEnd != null and successTimeEnd != ''">
and success_time &lt;= #{successTimeEnd}
</if>
<if test="userType != null and userType != ''">
and user_type = #{userType}
</if>
<if test="hehuorenArea != null and hehuorenArea != ''">
and hehuoren_area = #{hehuorenArea}
</if>
<if test="orderStatus != null and orderStatus != ''">
and order_status = #{orderStatus}
</if>
<if test="hehuorenSchool != null and hehuorenSchool != ''">
and hehuoren_school = #{hehuorenSchool}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
</if>
<if test="hehuorenName != null and hehuorenName != ''">
and hehuoren_name = #{hehuorenName}
</if>
<if test="contactNumber != null and contactNumber != ''">
and contact_number = #{contactNumber}
</if>
<if test="businessNumber != null and businessNumber != ''">
and business_number = #{businessNumber}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId}
</if>
<if test="hehuorenIds != null and hehuorenIds.size > 0">
and hehuoren_id in
<foreach collection="hehuorenIds" item="hehuorenId" open="(" close=")" separator=",">
#{hehuorenId}
</foreach>
</if>
) ho,order_view ov
where
ho.kd_order_id = ov.orderSeq
order by create_time desc
</select>
<select id="selectBroadBandOrderList" resultMap="broadBandOrder">
select
ho.*,
ov.productName,
ov.order_set_meal,
ov.order_university_name,
ov.orderName,
ov.ipay,
ov.payType,
ov.webOrderAmount,
ov.order_payment_time,
ov.orderReqtranSeq,
ov.customeRid,
ov.orderPhone,
ov.order_customer_type,
ov.order_customer_student_id,
ov.order_customer_remarks,
ov.order_customer_account,
ov.order_customer_pwd,
ov.uptranseq,
ov.expenses,
ov.order_rf2,
ov.orderSeqTHD,
ov.order_region,
ov.orderDate
from (
select * from hhr_order
where
kd_order_id is not null
and user_type in (3,5,9,10)
<if test="createTimeStart != null and createTimeStart != ''">
and create_time &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
and create_time &lt;= #{createTimeEnd}
</if>
<if test="successTimeStart != null and successTimeStart != ''">
and success_time &gt;= #{successTimeStart}
</if>
<if test="successTimeEnd != null and successTimeEnd != ''">
and success_time &lt;= #{successTimeEnd}
</if>
<if test="userType != null and userType != ''">
and user_type = #{userType}
</if>
<if test="hehuorenArea != null and hehuorenArea != ''">
and hehuoren_area = #{hehuorenArea}
</if>
<if test="orderStatus != null and orderStatus != ''">
and order_status = #{orderStatus}
</if>
<if test="hehuorenSchool != null and hehuorenSchool != ''">
and hehuoren_school = #{hehuorenSchool}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
</if>
<if test="hehuorenName != null and hehuorenName != ''">
and hehuoren_name = #{hehuorenName}
</if>
<if test="contactNumber != null and contactNumber != ''">
and contact_number = #{contactNumber}
</if>
<if test="businessNumber != null and businessNumber != ''">
and business_number = #{businessNumber}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId}
</if>
<if test="hehuorenIds != null and hehuorenIds.size > 0">
and hehuoren_id in
<foreach collection="hehuorenIds" item="hehuorenId" open="(" close=")" separator=",">
#{hehuorenId}
</foreach>
</if>
) ho,order_view ov
where
ho.kd_order_id = ov.orderSeq
order by create_time desc
</select>
<select id="selectOrderIdByOrderNumber" parameterType="String" resultMap="broadBandOrder">
select * from hhr_order where order_number = #{orderNumber}
select *
from hhr_order
where order_number = #{orderNumber}
</select>
<select id="selectRepeatOrder" parameterType="String" resultType="com.winsun.bean.Order">
select * from hhr_order where user_type in('3','5','9','10') and order_status !='异常单' and id_card=#{idCard}
select *
from hhr_order
where user_type in ('3', '5', '9', '10')
and order_status != '异常单'
and id_card = #{idCard}
</select>
<select id="selectKdyOrder" parameterType="String" resultType="com.winsun.bean.Order">
select * from hhr_order where user_type in('3','9','10') and order_status !='异常单' and id_card=#{idCard}
select *
from hhr_order
where user_type in ('3', '9', '10')
and order_status != '异常单'
and id_card = #{idCard}
</select>
<select id="selectBroadList" parameterType="String" resultType="HashMap">
select * from hhr_kd_dmt where account_number = #{accountNumber}
select *
from hhr_kd_dmt
where account_number = #{accountNumber}
</select>
<select id="selectReportOrder" parameterType="String" resultType="com.winsun.bean.OrderView">
select * from order_view where orderSeq = #{orderSeq}
select *
from order_view
where orderSeq = #{orderSeq}
</select>
<select id="checkOldKdUser" parameterType="String" resultType="HashMap">
select * from hhr_kd_dmt_1 where account_number = #{accountNumber}
select *
from hhr_kd_dmt_1
where account_number = #{accountNumber}
</select>
<select id="checkOldhhrOrder" parameterType="String" resultType="HashMap">
select * from hhr_order where order_status !='异常单' and net_number = #{accountNumber}
select *
from hhr_order
where order_status != '异常单'
and net_number = #{accountNumber}
</select>
<select id="selectCompleteOrder" resultType="com.winsun.bean.Order">
select * from hhr_order WHERE WHERE order_status='已发货' AND TO_DAYS(NOW()) - TO_DAYS(create_time) > 7
select *
from hhr_order
WHERE
WHERE order_status='已发货' AND TO_DAYS(NOW()) - TO_DAYS(create_time) > 7
</select>
<update id="updateCompleteOrder">
UPDATE hhr_order SET order_status = '已完成' WHERE order_status='已发货' AND TO_DAYS(NOW()) - TO_DAYS(create_time) > 7
UPDATE hhr_order
SET order_status = '已完成'
WHERE order_status = '已发货'
AND TO_DAYS(NOW()) - TO_DAYS(create_time) > 7
</update>
<select id="selectKdOrder" parameterType="String" resultType="HashMap">
select * from hhr_order where order_status !='异常单' and kd_order_id = #{KdOrderID}
select *
from hhr_order
where order_status != '异常单'
and kd_order_id = #{KdOrderID}
</select>
<!-- 更新未下单并且融合时间小于当前时间的订单 -->
<update id="updateNosendAndRhTimeLtNowOrder">
update hhr_order set order_status = "待受理",remarks="融合时间已过当前时间" where rh_time &lt; #{now} and order_status = "未下单"
update hhr_order
set order_status = "待受理",
remarks="融合时间已过当前时间"
where rh_time &lt; #{now}
and order_status = "未下单"
</update>
<!-- 00:移动通报学校 -->
<!-- 00:移动通报学校 -->
<select id="orderConversionXX" parameterType="String" resultType="HashMap">
SELECT order_by,sub_name,school,supervisor ,
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
......@@ -240,17 +271,17 @@
HAVING order_by is not null
ORDER BY order_by
</select>
<!-- 01:移动通报县份 -->
<!-- 01:移动通报县份 -->
<select id="orderConversionXF" parameterType="String" resultType="HashMap">
SELECT sub_id,sub_name ,
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
......@@ -268,19 +299,19 @@
HAVING sub_name is not null and sub_name != 'null'
ORDER BY sub_id
</select>
<!-- 10:宽带通报学校 -->
<!-- 10:宽带通报学校 -->
<select id="kdOrderConversionXX" parameterType="String" resultType="HashMap">
SELECT order_by,sub_name,school,supervisor,
COUNT(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
COUNT(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
......@@ -296,20 +327,20 @@
HAVING order_by is not null
ORDER BY order_by
</select>
<!-- 11:宽带通报学校-->
<!-- 11:宽带通报学校-->
<select id="kdOrderConversionXF" parameterType="String" resultType="HashMap">
SELECT sub_id,sub_name,
count(DISTINCT school) schoolCount,
count(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
count(DISTINCT school) schoolCount,
count(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
......@@ -328,151 +359,152 @@
<select id="getUserSalesStatistic" parameterType="map" resultType="java.util.HashMap">
SELECT
hehuoren_name as name,
count( hehuoren_id ) as num
hehuoren_name as name,
count( hehuoren_id ) as num
FROM
hhr_order
hhr_order
WHERE
order_status = "已完成"
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
order_status = "已完成"
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
hehuoren_id
hehuoren_id
ORDER BY
count( hehuoren_id ) DESC
LIMIT 0, 10
count( hehuoren_id ) DESC
LIMIT 0, 10
</select>
<select id="getLzSalesStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
supervisor_name as name,
count( supervisor_name ) as num
supervisor_name as name,
count( supervisor_name ) as num
FROM
hhr_order
hhr_order
WHERE
order_status = "已完成"
AND supervisor_name IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
order_status = "已完成"
AND supervisor_name IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
supervisor_name
supervisor_name
ORDER BY
count( supervisor_name ) DESC
LIMIT 0, 10
count( supervisor_name ) DESC
LIMIT 0, 10
</select>
<select id="getSchoolSaleStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hehuoren_school as name,
count( hehuoren_school ) as num
hehuoren_school as name,
count( hehuoren_school ) as num
FROM
hhr_order
hhr_order
WHERE
order_status = "已完成"
AND hehuoren_school IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
order_status = "已完成"
AND hehuoren_school IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
hehuoren_school
hehuoren_school
ORDER BY
count( hehuoren_school ) DESC
LIMIT 0, 10
count( hehuoren_school ) DESC
LIMIT 0, 10
</select>
<select id="getProductTransferStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hp.package_name as name,
round( complate.num / ( all_order.num + 1000 ) * 100, 2) as num
hp.package_name as name,
round( complate.num / ( all_order.num + 1000 ) * 100, 2) as num
FROM
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
order_status = "已完成"
AND user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
package_id
) complate
RIGHT JOIN
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY package_id
) all_order
ON
complate.package_id = all_order.package_id
LEFT JOIN hhr_package hp ON all_order.package_id = hp.id
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
order_status = "已完成"
AND user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
package_id
) complate
RIGHT JOIN
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY package_id
) all_order
ON
complate.package_id = all_order.package_id
LEFT JOIN hhr_package hp ON all_order.package_id = hp.id
ORDER BY
( complate.num / ( all_order.num + 1000 ) ) DESC
LIMIT 0, 10
( complate.num / ( all_order.num + 1000 ) ) DESC
LIMIT 0, 10
</select>
<select id="getProductSalesStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hp.package_name as name,
count( ho.id ) as num
hp.package_name as name,
count( ho.id ) as num
FROM
hhr_package hp
LEFT JOIN
(
select
id, package_id
from
hhr_order
<where>
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
</where>
)ho ON hp.id = ho.package_id
AND ho.id IS NOT NULL
hhr_package hp
LEFT JOIN
(
select
id, package_id
from
hhr_order
<where>
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
</where>
)ho ON hp.id = ho.package_id
AND ho.id IS NOT NULL
GROUP BY
hp.id
hp.id
ORDER BY
count( ho.id ) DESC
count( ho.id ) DESC
limit 0, 5
</select>
<select id="selectBroadBandOrderList2" resultType="java.util.HashMap">
<select id="selectBroadBandOrderList2" resultType="java.util.Map">
select
ho.*,
ov.productName,
ov.orderSeq,
ov.order_set_meal,
ov.order_university_name,
ov.orderName,
......@@ -483,6 +515,7 @@
ov.orderReqtranSeq,
ov.customeRid,
ov.orderPhone,
ov.status,
ov.order_customer_type,
ov.order_customer_student_id,
ov.order_customer_remarks,
......
......@@ -118,15 +118,22 @@ public class OrderController extends BaseController {
private static String ORDER_STATUS = "受理状态(已完成,异常单)";
private static OrderMapper orderMapper;
private static OrderViewMapper orderViewMapper;
@Autowired
private OrderMapper orderMapper;
private static SchoolMapper schoolMapper;
@Autowired
private OrderViewMapper orderViewMapper;
private static SysUserMapper sysUserMapper;
@Autowired
private SchoolMapper schoolMapper;
private static AppMapper appMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private AppMapper appMapper;
@Autowired
private ExportExcelMapper exportExcelMapper;
@Autowired
......@@ -153,18 +160,6 @@ public class OrderController extends BaseController {
@Autowired
private ISalesListService salesListService;
@Autowired
public OrderController(OrderMapper orderMapper, SchoolMapper schoolMapper, SysUserMapper sysUserMapper,
AppMapper appMapper, ExportExcelMapper exportExcelMapper, OrderViewMapper orderViewMapper) {
OrderController.orderMapper = orderMapper;
OrderController.schoolMapper = schoolMapper;
OrderController.sysUserMapper = sysUserMapper;
OrderController.appMapper = appMapper;
this.exportExcelMapper = exportExcelMapper;
OrderController.orderViewMapper = orderViewMapper;
}
/**
* 查询订单历史状态
*/
......@@ -551,7 +546,6 @@ public class OrderController extends BaseController {
*/
@Permission(menuname = "查询订单信息", value = "broadBandOrder", method = RequestMethod.POST)
public ResponseData<Page<BroadBandOrder>> getBroadBandOrder(BroadBandOrder broadBandOrder) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员", "系统管理员", "县分管理员(订单)", "修改身份证", "合伙人"))) {
return ResponseData.error("无权限查询订单");
......@@ -879,7 +873,7 @@ public class OrderController extends BaseController {
}
}
public void ExportOrderView2(Map<String, Object> map) {
/*public void ExportOrderView2(Map<String, Object> map) {
String createTimeStart = "";
if (map.containsKey("createTimeStart")) {
createTimeStart = map.get("createTimeStart").toString();
......@@ -1104,8 +1098,8 @@ public class OrderController extends BaseController {
}
for (Map<String, Object> maps : Orders) {
/*String schoolId = schoolMapper.selectSchoolIdByUserId(maps.get("hehuoren_id").toString());
school = schoolMapper.selectById(schoolId);*/
*//*String schoolId = schoolMapper.selectSchoolIdByUserId(maps.get("hehuoren_id").toString());
school = schoolMapper.selectById(schoolId);*//*
schools.get(maps.get("hehuoren_id").toString());
maps.put("lz_user", school.getLzUser());
maps.put("lzgh", school.getLzgh());
......@@ -1151,7 +1145,7 @@ public class OrderController extends BaseController {
}
}
}
}
}*/
@Permission(menuname = "一人一码统计数据", value = "getHhrOrderInfo", method = RequestMethod.POST)
......
......@@ -15,6 +15,10 @@ import com.winsun.constant.OrderStatus;
import com.winsun.mapper.OrderMapper;
import com.winsun.mapper.OrderViewMapper;
import com.winsun.service.IHhrUserService;
import com.winsun.utils.ExcelTreeNodeHelper;
import com.winsun.utils.ExportExcel;
import com.winsun.utils.TreeNode;
import com.winsun.utils.TreeNodeData;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFCell;
......@@ -45,14 +49,11 @@ import java.util.Map;
@RequestMapping("/orderView")
public class OrderViewController extends BaseController {
private static OrderViewMapper orderViewMapper;
private static OrderMapper orderMapper;
@Autowired
private OrderViewMapper orderViewMapper;
@Autowired
public OrderViewController(OrderViewMapper orderViewMapper) {
OrderViewController.orderViewMapper = orderViewMapper;
}
private OrderMapper orderMapper;
@Autowired
private IHhrUserService hhrUserService;
......@@ -103,144 +104,28 @@ public class OrderViewController extends BaseController {
return ResponseData.success(page, "查询成功!");
}
/*@Permission(menuname = "导出宽带订单", value = "download", method = RequestMethod.POST)
public ResponseData<String> downloadOrderView(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime,
@RequestParam("orderseq") String orderseq, @RequestParam("orderUniversityName") String orderUniversityName,
@RequestParam("status") String status, @RequestParam("ordername") String ordername) throws ParseException {
@Permission(menuname = "导出宽带订单", value = "download", method = RequestMethod.POST)
public ResponseData<String> downloadOrderView2(BroadBandOrder broadBandOrder){
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员", "系统管理员", "县分管理员(订单)", "修改身份证", "合伙人"))) {
return ResponseData.error("无权限查询订单");
}
List<Integer> userIds = hhrUserService.getUserIds(user.getId(), user.getRoleNames());
String dateFormat = "YYYY-MM-DD";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) {
startTime = startTime.substring(0, dateFormat.length()) + " 00:00:00";
endTime = endTime.substring(0, dateFormat.length()) + " 23:59:59";
} else {
startTime = null;
endTime = null;
}
String state = null;
if (StringUtils.isNotBlank(status)) {
state = OrderStatus.findById(status).getId();
}
*//*Wrapper<OrderView> wrapper = new EntityWrapper();
wrapper.like(StringUtils.isNotBlank(orderseq), "orderSeq", orderseq, SqlLike.DEFAULT);
wrapper.like(StringUtils.isNotBlank(ordername), "orderName", ordername, SqlLike.DEFAULT);
wrapper.like(StringUtils.isNotBlank(orderUniversityName), "order_university_name", orderUniversityName, SqlLike.DEFAULT);
wrapper.eq(StringUtils.isNotBlank(status), "status", state);
wrapper.ge(StringUtils.isNotBlank(startTime), "orderDate", startTime);
wrapper.le(StringUtils.isNotBlank(endTime), "orderDate", endTime);
wrapper.in("hehuoren_id",userIds);*//*
BroadBandOrder broadBandOrder = new BroadBandOrder();
if (StringUtils.isNotBlank(orderseq)){
broadBandOrder.setOrderSeq(orderseq);
}
if (StringUtils.isNotBlank(ordername)){
broadBandOrder.setOrderName(ordername);
}
if (StringUtils.isNotBlank(orderUniversityName)){
broadBandOrder.setOrderUniversityName(orderUniversityName);
}
if (StringUtils.isNotBlank(state)){
broadBandOrder.setStatus(state);
}
broadBandOrder.setHehuorenIds(userIds);
List<Map<String, Object>> OrderViews = orderMapper.selectBroadBandOrderList2(broadBandOrder,startTime,endTime);
//List<Map<String, Object>> OrderViews = orderViewMapper.downloadOrderView(wrapper);;
List<String> tops = new ArrayList<>();
tops.add("订单id");
tops.add("订单编号");
tops.add("产品名称");
tops.add("产品价格");
tops.add("套餐");
tops.add("学校");
tops.add("区域");
tops.add("客户姓名");
tops.add("联系电话");
tops.add("订单状态");
tops.add("备注");
tops.add("创建时间");
tops.add("支付平台");
tops.add("支付方式");
tops.add("支付时间");
tops.add("穗易付订单号");
tops.add("接入商");
tops.add("支付平台流水号");
tops.add("智能平台订单号");
List<String> columns = new ArrayList<>();
columns.add("order_id");
columns.add("orderSeq");
columns.add("productName");
columns.add("webOrderAmount");
columns.add("order_set_meal");
columns.add("order_university_name");
columns.add("order_region");
columns.add("orderName");
columns.add("orderPhone");
columns.add("status");
columns.add("order_customer_remarks");
columns.add("orderDate");
columns.add("ipay");
columns.add("payType");
columns.add("order_payment_time");
columns.add("orderReqtranSeq");
columns.add("customeRid");
columns.add("uptranseq");
columns.add("orderSeqTHD");
ServletOutputStream os = null;
XSSFWorkbook workbook = new XSSFWorkbook();
if (userIds.size() != 0) {
broadBandOrder.setHehuorenIds(userIds);
};
List<Map<String, Object>> broadBandOrders = orderMapper.selectBroadBandOrderList2(broadBandOrder);
System.out.println(broadBandOrders.size());
try {
//创建工作表
XSSFSheet sheet = workbook.createSheet("宽带订单清单");
//添加表头
final XSSFRow row = sheet.createRow(0);
//设置列宽度
sheet.setColumnWidth(1, 6500);
sheet.setColumnWidth(2, 6500);
sheet.setColumnWidth(5, 7000);
sheet.setColumnWidth(8, 4000);
sheet.setColumnWidth(10, 6500);
sheet.setColumnWidth(11, 6500);
sheet.setColumnWidth(14, 6500);
sheet.setColumnWidth(15, 7000);
sheet.setColumnWidth(17, 7500);
sheet.setColumnWidth(18, 600);
//第一行字段名称
tops.forEach(column -> {
XSSFCell cell = row.createCell(Math.max(row.getLastCellNum(), 0));
cell.setCellValue(column);
});
//数据
int rowIndex = row.getRowNum();
for (Map<String, Object> maps : OrderViews) {
final XSSFRow rowdata = sheet.createRow(++rowIndex);
for (String column : columns) {
XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0));
if (maps.get(column) != null) {
cell.setCellValue(maps.get(column).toString());
}
}
}
HttpServletResponse response = getHttpServletResponse();
response.reset();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/octet-stream");
os = response.getOutputStream();
workbook.write(os);
os.flush();
TreeNode treeNode = TreeNodeData.getBroadbandOrder("宽带订单清单");
XSSFWorkbook workbook = ExcelTreeNodeHelper.getWorkbook(treeNode, broadBandOrders);
ExportExcel.toDownLoad(workbook, getHttpServletRequest(), getHttpServletResponse(), "宽带订单清单");
} catch (Exception e) {
log.error("文件出错!" + e.getMessage(), e);
} finally {
IOUtils.closeQuite(workbook, os);
return ResponseData.error("导出失败");
}
return ResponseData.success("导出成功");
}*/
}
}
......@@ -58,4 +58,36 @@ public class TreeNodeData {
return treeNode0;
}
/**
* 宽带订单表头
* @param actName
* @return
*/
public static TreeNode getBroadbandOrder(String actName){
TreeNode treeNode0 =new TreeNode(-1,"", null);
TreeNode treeNode =new TreeNode(0, actName, treeNode0);
TreeNode treeNode1 =new TreeNode(1, "订单id","order_id", treeNode);
TreeNode treeNode2 =new TreeNode(2, "订单编号","orderSeq", treeNode);
TreeNode treeNode3 =new TreeNode(3, "产品名称","productName", treeNode);
TreeNode treeNode4 =new TreeNode(4, "产品价格","webOrderAmount", treeNode);
TreeNode treeNode5 =new TreeNode(5, "套餐","order_set_meal", treeNode);
TreeNode treeNode6 =new TreeNode(6, "学校","order_university_name", treeNode);
TreeNode treeNode7 =new TreeNode(7, "区域","order_region", treeNode);
TreeNode treeNode8 =new TreeNode(8, "客户姓名","orderName", treeNode);
TreeNode treeNode9 =new TreeNode(9, "联系电话","orderPhone", treeNode);
TreeNode treeNode10 =new TreeNode(10, "订单状态","status", treeNode);
TreeNode treeNode11 =new TreeNode(11, "备注","order_customer_remarks", treeNode);
TreeNode treeNode12 =new TreeNode(12, "创建时间","orderDate", treeNode);
TreeNode treeNode13 =new TreeNode(13, "支付平台","ipay", treeNode);
TreeNode treeNode14 =new TreeNode(14, "支付方式","payType", treeNode);
TreeNode treeNode15 =new TreeNode(15, "支付时间","order_payment_time", treeNode);
TreeNode treeNode16 =new TreeNode(16, "穗易付订单号","orderReqtranSeq", treeNode);
TreeNode treeNode17 =new TreeNode(17, "接入商","customeRid", treeNode);
TreeNode treeNode18 =new TreeNode(18, "支付平台流水号","uptranseq", treeNode);
TreeNode treeNode19 =new TreeNode(19, "智能平台订单号","orderSeqTHD", treeNode);
treeNode0.calLeavesAmount(treeNode0);
treeNode0.calNodeLevel(treeNode0);
return treeNode0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment