| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruixuan.isc.mapper.KwaixiaodianOrderCursorListMapper">
- <insert id="replaceBatchKWaixiaodianOrderCursorList">
- replace into `ruixuan`.kwaixiaodian_order_cursor_list(
- company_id,
- company_name,
- shop_id,
- shop_name,
- oid,
- pay_time,
- buyer_image,
- buyer_open_id,
- buyer_nick,
- seller_open_id,
- seller_nick,
- express_fee,
- discount_fee,
- total_fee,
- status,
- send_time,
- refund_time,
- create_time,
- update_time,
- remark,
- the_day_of_deliver_goods_time,
- promise_time_stamp_of_delivery,
- cps_type,
- valid_promise_shipment_time_stamp,
- pre_sale,
- recv_time,
- co_type,
- comment_status,
- pay_type,
- risk_code,
- pay_channel,
- seller_delay_promise_time_stamp,
- priority_delivery,
- remind_shipment_sign,
- remind_shipment_time,
- order_seller_role_info,
- disable_delivery_reason_code,
- multiple_pieces_no,
- all_activity_type,
- order_labels,
- enable_split_delivery_order,
- allowance_express_fee,
- pay_channel_discount,
- trade_in_pay_after_promo_amount,
- government_discount,
- sku_id,
- rel_sku_id,
- sku_desc,
- sku_nick,
- item_id,
- rel_item_id,
- item_title,
- item_link_url,
- item_pic_url,
- num,
- original_price,
- item_discount_fee,
- price,
- item_type,
- item_prev_info,
- goods_code,
- warehouse_code,
- good_store_code,
- service_rule,
- freight,
- freight_provider_type,
- first_order_guarantee,
- instant_delivery,
- instant_refund,
- compensate_fake,
- service_rule_info,
- category_info,
- order_refund_list,
- order_logistics_info,
- order_note,
- encrypted_consignee,
- desensitise_consignee,
- encrypted_mobile,
- desensitise_mobile,
- province_code,
- province,
- city_code,
- city,
- district_code,
- district,
- town_code,
- town,
- encrypted_address,
- desensitise_address,
- recharge_account,
- coordinate_info,
- order_step_info,
- distributor_id,
- distributor_name,
- order_delivery_info,
- sub_order_info,
- stat_date,
- stat_hour
- )
- values
- <foreach collection="list" item="li" separator=",">
- (
- #{li.companyId},
- #{li.companyName},
- #{li.shopId},
- #{li.shopName},
- #{li.oid},
- #{li.payTime},
- #{li.buyerImage},
- #{li.buyerOpenId},
- #{li.buyerNick},
- #{li.sellerOpenId},
- #{li.sellerNick},
- #{li.expressFee},
- #{li.discountFee},
- #{li.totalFee},
- #{li.status},
- #{li.sendTime},
- #{li.refundTime},
- #{li.createTime},
- #{li.updateTime},
- #{li.remark},
- #{li.theDayOfDeliverGoodsTime},
- #{li.promiseTimeStampOfDelivery},
- #{li.cpsType},
- #{li.validPromiseShipmentTimeStamp},
- #{li.preSale},
- #{li.recvTime},
- #{li.coType},
- #{li.commentStatus},
- #{li.payType},
- #{li.riskCode},
- #{li.payChannel},
- #{li.sellerDelayPromiseTimeStamp},
- #{li.priorityDelivery},
- #{li.remindShipmentSign},
- #{li.remindShipmentTime},
- #{li.orderSellerRoleInfo},
- #{li.disableDeliveryReasonCode},
- #{li.multiplePiecesNo},
- #{li.allActivityType},
- #{li.orderLabels},
- #{li.enableSplitDeliveryOrderb},
- #{li.allowanceExpressFee},
- #{li.payChannelDiscount},
- #{li.tradeInPayAfterPromoAmount},
- #{li.governmentDiscount},
- #{li.skuId},
- #{li.relSkuId},
- #{li.skuDesc},
- #{li.skuNick},
- #{li.itemId},
- #{li.relItemId},
- #{li.itemTitle},
- #{li.itemLinkUrl},
- #{li.itemPicUrl},
- #{li.num},
- #{li.originalPrice},
- #{li.itemDiscountFee},
- #{li.price},
- #{li.itemType},
- #{li.itemPrevInfo},
- #{li.goodsCode},
- #{li.warehouseCode},
- #{li.goodStoreCode},
- #{li.serviceRule},
- #{li.freight},
- #{li.freightProviderType},
- #{li.firstOrderGuarantee},
- #{li.instantDelivery},
- #{li.instantRefund},
- #{li.compensateFake},
- #{li.serviceRuleInfo},
- #{li.categoryInfo},
- #{li.orderRefundList},
- #{li.orderLogisticsInfo},
- #{li.orderNote},
- #{li.encryptedConsignee},
- #{li.desensitiseConsignee},
- #{li.encryptedMobile},
- #{li.desensitiseMobile},
- #{li.provinceCode},
- #{li.province},
- #{li.cityCode},
- #{li.city},
- #{li.districtCode},
- #{li.district},
- #{li.townCode},
- #{li.town},
- #{li.encryptedAddress},
- #{li.desensitiseAddress},
- #{li.rechargeAccount},
- #{li.coordinateInfo},
- #{li.orderStepInfo},
- #{li.distributorId},
- #{li.distributorName},
- #{li.orderDeliveryInfo},
- #{li.subOrderInfo},
- #{li.statDate},
- #{li.statHour}
- )
- </foreach>
- </insert>
- <insert id="insertKWaixiaodianOrderCursorList">
- replace
- INTO `ruixuan`.kwaixiaodian_order_cursor_list(
- company_id,
- company_name,
- shop_id,
- shop_name,
- oid,
- pay_time,
- buyer_image,
- buyer_open_id,
- buyer_nick,
- seller_open_id,
- seller_nick,
- express_fee,
- discount_fee,
- total_fee,
- status,
- send_time,
- refund_time,
- create_time,
- update_time,
- remark,
- the_day_of_deliver_goods_time,
- promise_time_stamp_of_delivery,
- cps_type,
- valid_promise_shipment_time_stamp,
- pre_sale,
- recv_time,
- co_type,
- comment_status,
- pay_type,
- risk_code,
- pay_channel,
- seller_delay_promise_time_stamp,
- priority_delivery,
- remind_shipment_sign,
- remind_shipment_time,
- order_seller_role_info,
- disable_delivery_reason_code,
- multiple_pieces_no,
- all_activity_type,
- order_labels,
- enable_split_delivery_order,
- allowance_express_fee,
- pay_channel_discount,
- trade_in_pay_after_promo_amount,
- government_discount,
- sku_id,
- rel_sku_id,
- sku_desc,
- sku_nick,
- item_id,
- rel_item_id,
- item_title,
- item_link_url,
- item_pic_url,
- num,
- original_price,
- item_discount_fee,
- price,
- item_type,
- item_prev_info,
- goods_code,
- warehouse_code,
- good_store_code,
- service_rule,
- freight,
- freight_provider_type,
- first_order_guarantee,
- instant_delivery,
- instant_refund,
- compensate_fake,
- service_rule_info,
- category_info,
- order_refund_list,
- order_logistics_info,
- order_note,
- encrypted_consignee,
- desensitise_consignee,
- encrypted_mobile,
- desensitise_mobile,
- province_code,
- province,
- city_code,
- city,
- district_code,
- district,
- town_code,
- town,
- encrypted_address,
- desensitise_address,
- recharge_account,
- coordinate_info,
- order_step_info,
- distributor_id,
- distributor_name,
- order_delivery_info,
- sub_order_info,
- stat_date,
- stat_hour
- )
- VALUES
- (
- #{order.companyId},
- #{order.companyName},
- #{order.shopId},
- #{order.shopName},
- #{order.oid},
- #{order.payTime},
- #{order.buyerImage},
- #{order.buyerOpenId},
- #{order.buyerNick},
- #{order.sellerOpenId},
- #{order.sellerNick},
- #{order.expressFee},
- #{order.discountFee},
- #{order.totalFee},
- #{order.status},
- #{order.sendTime},
- #{order.refundTime},
- #{order.createTime},
- #{order.updateTime},
- #{order.remark},
- #{order.theDayOfDeliverGoodsTime},
- #{order.promiseTimeStampOfDelivery},
- #{order.cpsType},
- #{order.validPromiseShipmentTimeStamp},
- #{order.preSale},
- #{order.recvTime},
- #{order.coType},
- #{order.commentStatus},
- #{order.payType},
- #{order.riskCode},
- #{order.payChannel},
- #{order.sellerDelayPromiseTimeStamp},
- #{order.priorityDelivery},
- #{order.remindShipmentSign},
- #{order.remindShipmentTime},
- #{order.orderSellerRoleInfo},
- #{order.disableDeliveryReasonCode},
- #{order.multiplePiecesNo},
- #{order.allActivityType},
- #{order.orderLabels},
- #{order.enableSplitDeliveryOrderb},
- #{order.allowanceExpressFee},
- #{order.payChannelDiscount},
- #{order.tradeInPayAfterPromoAmount},
- #{order.governmentDiscount},
- #{order.skuId},
- #{order.relSkuId},
- #{order.skuDesc},
- #{order.skuNick},
- #{order.itemId},
- #{order.relItemId},
- #{order.itemTitle},
- #{order.itemLinkUrl},
- #{order.itemPicUrl},
- #{order.num},
- #{order.originalPrice},
- #{order.itemDiscountFee},
- #{order.price},
- #{order.itemType},
- #{order.itemPrevInfo},
- #{order.goodsCode},
- #{order.warehouseCode},
- #{order.goodStoreCode},
- #{order.serviceRule},
- #{order.freight},
- #{order.freightProviderType},
- #{order.firstOrderGuarantee},
- #{order.instantDelivery},
- #{order.instantRefund},
- #{order.compensateFake},
- #{order.serviceRuleInfo},
- #{order.categoryInfo},
- #{order.orderRefundList},
- #{order.orderLogisticsInfo},
- #{order.orderNote},
- #{order.encryptedConsignee},
- #{order.desensitiseConsignee},
- #{order.encryptedMobile},
- #{order.desensitiseMobile},
- #{order.provinceCode},
- #{order.province},
- #{order.cityCode},
- #{order.city},
- #{order.districtCode},
- #{order.district},
- #{order.townCode},
- #{order.town},
- #{order.encryptedAddress},
- #{order.desensitiseAddress},
- #{order.rechargeAccount},
- #{order.coordinateInfo},
- #{order.orderStepInfo},
- #{order.distributorId},
- #{order.distributorName},
- #{order.orderDeliveryInfo},
- #{order.subOrderInfo},
- #{order.statDate},
- #{order.statHour}
- )
- </insert>
- <update id="updateKWaiShopOrderStatus">
- UPDATE `ruixuan`.kwaixiaodian_order_cursor_list
- SET status = #{status}
- <choose>
- <when test="field !=null and field !='' ">
- ,${field} =#{time}
- </when>
- </choose>
- WHERE oid = #{oid}
- </update>
- <select id="getScore" resultType="com.ruixuan.isc.entity.KwaixiaodianShopScore" parameterType="java.lang.String">
- SELECT *
- FROM ruixuan.kwaixiaodian_shop_score
- WHERE shop_id = #{shopId} limit 1
- </select>
- <select id="queryItemReport" resultType="com.alibaba.fastjson.JSONObject">
- select t1.*,
- round((t1.orderNum - t2.orderNum) / t2.orderNum * 100, 2) as 'orderNumRate'
- from (select t2.user_name as 'userName',
- t2.courtship_purchase_name as 'courtshipPurchaseName',
- (
- CASE when t2.item_type = 1
- then '自选品'
- when t2.item_type = 2
- then '推品'
- else '-'
- end
- ) as 'itemType',
- t1.item_id as itemId,
- t1.item_title as 'itemTitle',
- t1.item_pic_url as 'itemPicUrl',
- (case
- when min(t1.price) = max(t1.price)
- then concat(round(min(t1.price) / 100, 2), '元')
- else concat(round(min(t1.price) / 100, 2), '~', round(max(t1.price) / 100, 2), '元')
- end
- ) as price,
- round(sum(t1.total_fee) / 100, 2) as 'totalFee',
- IFNULL(round(SUM(CASE WHEN t1.status != 80 and t1.status != 10 THEN t1.total_fee ELSE 0 END) / 100, 2), 0) as
- 'validTotalFee',
- count(t1.oid) as 'orderNum',
- IFNULL(SUM(CASE WHEN t1.status != 80 and t1.status != 10 THEN 1 ELSE 0 END), 0) AS 'validOrderNum',
- IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
- round(sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) / count(t1.oid) * 100,
- 2) as 'validRadio',
- sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) /
- sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2) as 'deliveryRate',
- sum(case when t1.status = 30 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(t1.express_fee) / 100, 2) as 'expressFee'
- from kwaixiaodian_order_cursor_list t1
- left join kwaixiaodian_item_get t2
- on t1.item_id = t2.item_id
- and t1.company_id = t2.company_id
- where t1.stat_date >= #{start}
- and t1.stat_date <= #{end}
- <if test='nowHour != null and nowHour != ""'>
- and t1.stat_hour <= #{nowHour}
- </if>
- <if test='companyId != null and companyId != ""'>
- and t1.company_id = #{companyId}
- </if>
- <if test='shopId != null and shopId != ""'>
- and t1.shop_id = #{shopId}
- </if>
- <if test='itemType != null and itemType != ""'>
- and t2.item_type = #{itemType}
- </if>
- <if test='userIds != null and userIds.size() > 0'>
- AND t2.user_id in
- <foreach collection="userIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test='courtshipPurchaseIds != null and courtshipPurchaseIds.size() > 0'>
- AND t2.courtship_purchase_id in
- <foreach collection="courtshipPurchaseIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test='itemId != null and itemId != ""'>
- and t1.item_id = #{itemId}
- </if>
- <if test='itemTitle != null and itemTitle != ""'>
- and t1.item_title like concat('%',#{itemTitle},'%')
- </if>
- group by t1.item_id) t1
- left join (
- select t1.item_id as itemId,
- count(t1.oid) as 'orderNum'
- from kwaixiaodian_order_cursor_list t1 left join kwaixiaodian_item_get t2
- on t1.item_id = t2.item_id
- and t1.company_id = t2.company_id
- where t1.stat_date >= #{lastStart}
- and t1.stat_date <= #{lastEnd}
- <if test='nowHour != null and nowHour != ""'>
- and t1.stat_hour <= #{nowHour}
- </if>
- <if test='companyId != null and companyId != ""'>
- and t1.company_id = #{companyId}
- </if>
- <if test='shopId != null and shopId != ""'>
- and t1.shop_id = #{shopId}
- </if>
- <if test='userIds != null and userIds.size() > 0'>
- AND t2.user_id in
- <foreach collection="userIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test='itemId != null and itemId != ""'>
- and t1.item_id = #{itemId}
- </if>
- <if test='itemTitle != null and itemTitle != ""'>
- and t1.item_title like concat('%',#{itemTitle},'%')
- </if>
- group by t1.item_id) t2 on t1.itemId = t2.itemId
- order by t1.orderNum desc
- </select>
- <insert id="insertKwaixiaodianShopScore">
- INSERT
- INTO `ruixuan`.kwaixiaodian_shop_score
- (shop_id,
- shop_name,
- company_id,
- company_name,
- leader_name,
- master_score,
- master_score_body,
- shop_score,
- shop_score_body) VALUE
- ( #{shopScore.shopId},
- #{shopScore.shopName},
- #{shopScore.companyId},
- #{shopScore.companyName},
- #{shopScore.leaderName},
- #{shopScore.masterScore},
- #{shopScore.masterScoreBody},
- #{shopScore.shopScore},
- #{shopScore.shopScoreBody}
- )
- </insert>
- <update id="updateKwaixiaodianShopScore" parameterType="com.ruixuan.isc.entity.KwaixiaodianShopScore">
- update `ruixuan`.kwaixiaodian_shop_score
- <trim prefix="SET" suffixOverrides=",">
- <if test="shopName != null">shop_name = #{shopName},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyName != null">company_name = #{companyName},</if>
- <if test="leaderName != null">leader_name = #{leaderName},</if>
- <if test="masterScore != null">master_score = #{masterScore},</if>
- <if test="masterScoreBody != null">master_score_body = #{masterScoreBody},</if>
- <if test="shopScore != null">shop_score = #{shopScore},</if>
- <if test="shopScoreBody != null">shop_score_body = #{shopScoreBody},</if>
- </trim>
- where shop_id = #{shopId}
- </update>
- <insert id="replaceBatchKwaixiaodianOrderAftersalesList">
- replace into `ruixuan`.kwaixiaodian_order_aftersales_list(
- company_id,
- company_name,
- shop_id,
- shop_name,
- refund_id,
- oid,
- item_id,
- sku_id,
- refund_fee,
- status,
- refund_reason,
- seller_id,
- refund_type,
- handling_way,
- refund_desc,
- logistics_id,
- pictures,
- negotiate_status,
- valid_negotiate_buyer_modify_time_stamp,
- update_time,
- rel_sku_id,
- rel_item_id,
- seller_disagree_images,
- express_no,
- express_code,
- seller_disagree_desc,
- seller_disagree_reason,
- time_limit_negotiate_change,
- negotiate_reason,
- create_time,
- negotiate_update_time,
- submit_time,
- expire_time,
- end_time,
- buyer_open_id,
- address,
- special_refund_type,
- logistics_risk_infos,
- buyer_exchange_address,
- exchange_info,
- return_freight_info
- )
- values
- <foreach collection="list" item="li" separator=",">
- (
- #{li.companyId},
- #{li.companyName},
- #{li.shopId},
- #{li.shopName},
- #{li.refundId},
- #{li.oid},
- #{li.itemId},
- #{li.skuId},
- #{li.refundFee},
- #{li.status},
- #{li.refundReason},
- #{li.sellerId},
- #{li.refundType},
- #{li.handlingWay},
- #{li.refundDesc},
- #{li.logisticsId},
- #{li.pictures},
- #{li.negotiateStatus},
- #{li.validNegotiateBuyerModifyTimeStamp},
- #{li.updateTime},
- #{li.relSkuId},
- #{li.relItemId},
- #{li.sellerDisagreeImages},
- #{li.expressNo},
- #{li.expressCode},
- #{li.sellerDisagreeDesc},
- #{li.sellerDisagreeReason},
- #{li.timeLimitNegotiateChange},
- #{li.negotiateReason},
- #{li.createTime},
- #{li.negotiateUpdateTime},
- #{li.submitTime},
- #{li.expireTime},
- #{li.endTime},
- #{li.buyerOpenId},
- #{li.address},
- #{li.specialRefundType},
- #{li.logisticsRiskInfos},
- #{li.buyerExchangeAddress},
- #{li.exchangeInfo},
- #{li.returnFreightInfo}
- )
- </foreach>
- </insert>
- <update id="updateKWaiOrderAftersalesStatus">
- UPDATE `ruixuan`.kwaixiaodian_order_aftersales_list
- SET status = #{status}
- , handling_way =#{handlingWay}
- , special_refund_type =#{specialRefundType}
- , update_time =#{updateTime}
- , event_type=#{eventType}
- WHERE refund_id = #{refundId}
- </update>
- </mapper>
|