| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969 |
- <?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.SupplyChainMapper">
- <insert id="bindUser">
- insert into kuaishou_item_bind_user(item_id, user_id, user_name)
- value
- (#{itemId},#{userId},#{nikeName})
- </insert>
- <update id="updateOrder">
- update kuaishou_supply_chain
- set order_status = #{cpsOrderStatus}
- where oid = #{oid}
- </update>
- <update id="updateOrderRegimentalSettleAmount">
- update kuaishou_supply_chain
- set order_status = #{cpsOrderStatus},
- total_regimental_settle_amount = regimental_promotion_amount
- where oid = #{oid}
- </update>
- <update id="updateItem">
- update kuaishou_item_list
- set activity_item_status = #{status}
- where item_id = #{itemId}
- </update>
- <delete id="unbindUser" parameterType="java.lang.Long">
- delete
- from kuaishou_item_bind_user
- where item_id = #{itemId}
- </delete>
- <select id="getOrderList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (
- select promoter_id as 'promoterId',
- promoter_nick_name as 'promoterNickName',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(pay_amount) as 'payAmount',
- sum(case when order_status != 80 then pay_amount else 0 end) as 'validPayAmount',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
- then 1 else 0 end),4) as 'deliveryRadio',
- sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </if>
- group by promoter_id) t left join (
- select promoter_id as 'promoterId',group_concat(user_name) as 'userName' from kuaishou_promoter where media_id =
- 2
- group by promoter_id
- ) t2 on t.promoterId = t2.promoterId
- order by t.orderNum desc
- </select>
- <select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from
- (select item_id as 'itemId',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum'
- from kuaishou_supply_chain
- where promoter_id = #{promoterId}
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- group by item_id) t
- order by t.orderNum desc limit 3
- </select>
- <select id="anchorOrderDetail" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,
- t2.status,
- (
- case
- when t3.activity_item_status = 1 then '待审核'
- when t3.activity_item_status = 2 then '已上架'
- when t3.activity_item_status = 3 then '审核拒绝'
- when t3.activity_item_status = 4 then '活动失效'
- when t3.activity_item_status = 5 then '商品下架'
- else ''
- end
- ) as 'activityItemStatus'
- from (select
- item_title as 'itemTitle',
- item_id as 'itemId',
- reserve_price as 'reservePrice',
- image_url 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
- regimental_promotion_rate as 'regimentalPromotionRate',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
- then 1 else 0 end),4) as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- group by item_id) t left join ( select item_id as 'itemId', collect_sample_status as 'status' from
- kuaishou_item_collect_samples where promoter_id = #{promoterId}) t2
- on t.itemId = t2.itemId
- left join kuaishou_item_list t3
- on t.itemId = t3.item_id
- order by t.orderNum desc
- </select>
- <select id="orderStatistics" resultType="com.alibaba.fastjson.JSONObject">
- select FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') as 'date',
- count(t.oid) as 'orderNum'
- from (select oid,
- order_create_time
- from kuaishou_supply_chain
- where 1 = 1
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- ) t
- group by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d')
- order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') asc
- </select>
- <select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select t2.user_id as 'userId',
- t2.user_name as 'userName',
- t1.item_id as 'itemId',
- t1.reserve_price as 'reservePrice',
- t1.item_title as 'itemTitle',
- t1.image_url as 'imageUrl',
- count(t1.oid) as 'orderNum',
- sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid), 4) as 'validRadio',
- sum(case when t1.send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
- t1.order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
- send_status = 1 then 1 else 0 end), 4) as 'deliveryRadio',
- t1.item_commission_rate as 'itemCommissionRate',
- t3.ccr_value as 'ccrValue',
- (case
- when t3.ccr_value = '-' or t3.ccr_value is null
- then 0
- else replace( t3.ccr_value,'%','')
- end
- ) as 'ccrInt'
- from kuaishou_supply_chain t1
- left join kuaishou_item_bind_user t2
- on t1.item_id = t2.item_id
- left join kuaishou_item_ccr_info t3
- on t1.item_id = t3.item_id
- where 1 = 1
- <if test="start != null and start != ''">
- and t1.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t1.order_create_time <= #{end}
- </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(concat('%',#{itemTitle}),'%')
- </if>
- group by t1.item_id) t
- where 1 = 1
- <if test="userId != null and userId != ''">
- and t.userId = #{userId}
- </if>
- order by ${fieId} ${sort}
- </select>
- <select id="itemBindList" resultType="com.alibaba.fastjson.JSONObject">
- select t1.*,t2.*
- from (select t.item_id as 'itemId', t.item_title as 'itemTitle', t.user_id as 'userId', t.user_name as
- 'userName',
- (case
- when tt.ccr_value = '-' or tt.ccr_value is null
- then 0
- else replace(tt.ccr_value, '%', '')
- end
- ) as 'ccrInt',
- tt.ccr_value as 'ccrValue'
- from kuaishou_item_list t left join kuaishou_item_ccr_info tt
- on t.item_id = tt.item_id
- where
- t.create_time >= str_to_date(concat(#{bindStartDate},' 00:00:01'),'%Y-%m-%d
- %H:%i:%s')
- and
- t.create_time <= str_to_date(concat(#{bindEndDate},' 23:59:59'),'%Y-%m-%d
- %H:%i:%s')
- ) t1
- left join
- (select item_id as 'itemId',
- reserve_price as 'reservePrice',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),
- 4) as 'validRadio',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
- when
- send_status = 1
- then 1
- else 0 end),
- 4) as 'deliveryRadio',
- item_commission_rate as 'itemCommissionRate'
- from kuaishou_supply_chain
- where order_create_time >= #{start}
- group by item_id) t2 on t1.itemId = t2.itemId
- where 1 = 1
- <if test="itemId != null and itemId != ''">
- and t1.itemId = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and t1.itemTitle like concat(concat('%',#{itemTitle}),'%')
- </if>
- <if test="userId != null and userId != ''">
- and t1.userId = #{userId}
- </if>
- order by ${fieId} ${sort}
- </select>
- <select id="getTopPromoterByItemId" resultType="com.alibaba.fastjson.JSONObject">
- select
- *
- from
- (select promoter_id as 'promoterId',
- promoter_nick_name as 'promoterNickName',
- count(oid) as 'orderNum'
- from kuaishou_supply_chain
- where item_id = #{itemId}
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- group by promoter_id) t
- order by t.orderNum desc limit 3
- </select>
- <select id="itemDetail" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,tt.userName
- from (
- select
- promoter_nick_name as 'promoterNickName',
- promoter_id as 'promoterId',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
- regimental_promotion_rate as 'regimentalPromotionRate',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
- then 1 else 0 end),4) as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </if>
- group by promoter_id) t left join (select promoter_id,group_concat(user_name) as 'userName',user_id as 'userId'
- from
- kuaishou_promoter group by promoter_id) tt
- on t.promoterId = tt.promoter_id
- where 1 =1
- <if test="userId != null and userId != ''">
- and tt.userId = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="itemServiceCharge" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (
- select
- item_id as 'itemId',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
- then 1 else 0 end),4) as 'deliveryRadio',
- sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
- regimental_promotion_rate as 'regimentalPromotionRate',
- sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
- sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
- sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount',
- item_commission_rate as 'itemCommissionRate'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- group by item_id) t
- order by t.orderNum desc
- </select>
- <select id="getOrderTotal" resultType="com.alibaba.fastjson.JSONObject">
- select
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- </select>
- <select id="getOrderTotalRatio" resultType="java.lang.Double">
- select
- round((t1.oid -t2.oid) / t2.oid , 4) as 'orderTotalRatio'
- from (select count(oid) as 'oid'
- from kuaishou_supply_chain
- where 1= 1
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and order_create_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and order_create_time <= #{nowEndHourTemp}
- </if>
- ) t1
- join (select count(oid) as 'oid'
- from kuaishou_supply_chain
- where 1=1
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and order_create_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and order_create_time <= #{yesterdayEndHourTemp}
- </if>
- ) t2
- </select>
- <select id="getAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
- select
- sum(order_amount) as 'orderAmount',
- sum(base_amount) as 'baseAmount',
- sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
- sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- </select>
- <select id="getAmountTotalRatio" resultType="java.lang.Double">
- select
- round((t1.payAmount -t2.payAmount) / t2.payAmount , 4) as 'amountTotalRatio'
- from (select sum(pay_amount) as 'payAmount'
- from kuaishou_supply_chain
- where 1= 1
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and order_create_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and order_create_time <= #{nowEndHourTemp}
- </if>
- ) t1
- join (select sum(pay_amount) as 'payAmount'
- from kuaishou_supply_chain
- where 1=1
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and order_create_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and order_create_time <= #{yesterdayEndHourTemp}
- </if>
- ) t2
- </select>
- <select id="getServiceAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
- select
- count(distinct promoter_id) as 'promoterNum',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 then 1 else 0 end) / sum(case when order_status != 80 then 1 else 0 end),4)
- as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- </select>
- <select id="getOrderRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.*,
- round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
- from (select
- item_id as 'itemId',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 then 1 else 0 end) / sum(case when order_status != 80 then 1 else 0 end),4)
- as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and order_create_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and order_create_time <= #{nowEndHourTemp}
- </if>
- group by item_id
- ) t1
- left join (select
- item_id as 'itemId',
- count(oid) as 'orderNum'
- from kuaishou_supply_chain
- where 1=1
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and order_create_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and order_create_time <= #{yesterdayEndHourTemp}
- </if>
- group by item_id
- ) t2 on t1.itemId = t2.itemId
- order by t1.orderNum desc
- </select>
- <select id="getOrderRankRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.*,
- round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
- from (
- select
- product_id as 'itemId',
- product_name as 'itemTitle',
- product_img as 'imageUrl',
- count(order_id) as 'orderNum',
- sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
- from bytedance_order_list
- where 1= 1
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and pay_success_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and pay_success_time <= #{nowEndHourTemp}
- </if>
- group by product_id
- ) t1
- left join (select
- product_id as 'itemId',
- count(order_id) as 'orderNum'
- from bytedance_order_list
- where 1=1
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and pay_success_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and pay_success_time <= #{yesterdayEndHourTemp}
- </if>
- group by product_id
- ) t2 on t1.itemId = t2.itemId
- order by t1.orderNum desc
- </select>
- <select id="getOrderRankList" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select
- item_id as 'itemId',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- group by item_id) t
- order by t.orderNum desc
- </select>
- <select id="getOrderRankListBytedance" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select
- product_id as 'itemId',
- product_name as 'itemTitle',
- product_img as 'imageUrl',
- count(order_id) as 'orderNum',
- sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
- from bytedance_order_list
- where 1= 1
- <if test="start != null and start != ''">
- and pay_success_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and pay_success_time <= #{end}
- </if>
- group by product_id) t
- order by t.orderNum desc
- </select>
- <select id="getPromoterRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.*,
- round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
- from (
- select
- t.promoter_id as 'promoterId',
- t.promoter_nick_name as 'promoterNickName',
- tt.promoter_url as 'promoterUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio'
- from kuaishou_supply_chain t
- left join kuaishou_promoter tt on t.promoter_id = tt.promoter_id
- where 1= 1
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND t.promoter_id IN
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and order_create_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and order_create_time <= #{nowEndHourTemp}
- </if>
- group by t.promoter_id
- ) t1
- left join (select
- promoter_id as 'promoterId',
- count(oid) as 'orderNum'
- from kuaishou_supply_chain
- where 1=1
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id IN
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and order_create_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and order_create_time <= #{yesterdayEndHourTemp}
- </if>
- group by promoter_id
- ) t2 on t1.promoterId = t2.promoterId
- order by t1.orderNum desc
- </select>
- <select id="getPromoterRankRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.*,
- round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
- from (
- select
- author_short_id as 'promoterId',
- author_account as 'promoterNickName',
- count(order_id) as 'orderNum',
- sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
- from bytedance_order_list
- where author_short_id is not null
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id IN
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
- and pay_success_time >= #{nowStartHourTemp}
- </if>
- <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
- and pay_success_time <= #{nowEndHourTemp}
- </if>
- group by author_short_id
- ) t1
- left join (
- select
- author_short_id as 'promoterId',
- count(order_id) as 'orderNum'
- from bytedance_order_list
- where 1=1
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id IN
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
- and pay_success_time >= #{yesterdayStartHourTemp}
- </if>
- <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
- and pay_success_time <= #{yesterdayEndHourTemp}
- </if>
- group by author_short_id
- ) t2 on t1.promoterId = t2.promoterId
- order by t1.orderNum desc
- </select>
- <select id="getPromoterRatioList" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select
- t1.promoter_id as 'promoterId',
- t1.promoter_nick_name as 'promoterNickName',
- count(oid) as 'orderNum',
- tt.promoter_url as 'promoterUrl',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio'
- from kuaishou_supply_chain t1
- left join kuaishou_promoter tt on t1.promoter_id = tt.promoter_id
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- group by t1.promoter_id) t
- order by t.orderNum desc
- </select>
- <select id="getPromoterRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select
- author_short_id as 'promoterId',
- author_account as 'promoterNickName',
- count(order_id) as 'orderNum',
- sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
- from bytedance_order_list
- where author_short_id is not null
- <if test="start != null and start != ''">
- and pay_success_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and pay_success_time <= #{end}
- </if>
- group by author_short_id) t
- order by t.orderNum desc
- </select>
- <select id="exportPromoterTotal" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (
- select
- promoter_id as 'promoterId',
- promoter_nick_name as 'promoterNickName',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,2) as 'validRadio',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end) * 100,2) as 'deliveryRadio',
- round(sum(pay_amount) / 100,2) as 'payAmount',
- round(sum(case when order_status != 80 then pay_amount else 0 end) / 100 , 2 ) as 'validPayAmount',
- round(sum(case when order_status != 80 then regimental_promotion_amount else 0 end) / 100, 2) as
- 'regimentalPromotionAmount'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </if>
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- group by promoter_id) t
- order by t.orderNum desc
- </select>
- <select id="exportPromoter" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (
- select
- promoter_id as 'promoterId',
- promoter_nick_name as 'promoterNickName',
- item_id as 'itemId',
- item_title as 'itemTitle',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,2) as 'validRadio',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end) * 100,2) as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </if>
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- group by promoter_id,item_id) t
- order by t.promoterId,t.orderNum desc
- </select>
- <select id="exportOrder" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select
- t2.user_id as 'userId',
- t2.user_name as 'userName',
- t1.item_id as 'itemId',
- t1.item_title as 'itemTitle',
- t1.image_url as 'imageUrl',
- count(t1.oid) as 'orderNum',
- sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100, 2) as 'validRadio',
- sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t1.send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when t1.order_status
- != 80 then 1 else 0 end) * 100, 2) as 'deliveryRadio',
- round(t1.item_commission_rate / 10,2) as 'itemCommissionRate',
- t3.ccr_value as 'ccrValue'
- from kuaishou_supply_chain t1
- left join kuaishou_item_bind_user t2
- on t1.item_id = t2.item_id
- left join kuaishou_item_ccr_info t3
- on t1.item_id = t3.item_id
- where 1 = 1
- <if test="start != null and start != ''">
- and t1.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t1.order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and t1.promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and t1.promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </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(concat('%',#{itemTitle}),'%')
- </if>
- group by t1.item_id) t
- where 1 = 1
- <if test="userId != null and userId != ''">
- and t.userId = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="bindUserItemList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select t1.item_id as 'itemId',
- t1.item_title as 'itemTitle',
- t1.reserve_price as 'reservePrice',
- t1.image_url as 'imageUrl',
- t1.activity_id as 'activityId',
- t1.regimental_promotion_rate as 'regimentalPromotionRate',
- t2.user_id as 'userId',
- case when t2.user_id is null then 1 else 2 end as 'status',
- t2.user_name as 'userName',
- t2.create_time as 'bindTime',
- t1.item_commission_rate as 'itemCommissionRate'
- from kuaishou_item_info t1
- left join kuaishou_item_bind_user t2 on t1.item_id = t2.item_id
- where 1 = 1
- <if test="userId != null and userId != ''">
- and t2.user_id = #{userId}
- </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(concat('%',#{itemTitle}),'%')
- </if>
- <if test="activityId != null and activityId != ''">
- and t1.activity_id = #{activityId}
- </if>
- order by t1.create_time desc) t
- where 1 = 1
- <if test="status != null and status != ''">
- and t.status = #{status}
- </if>
- </select>
- <select id="getSupplyChainUserList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select t3.user_id as 'userId',
- t3.nick_name as 'nickMame',
- t1.role_name as 'roleName',
- t3.status,
- t3.create_time
- from sys_role t1
- left join sys_user_role t2 on t1.role_id = t2.role_id
- left join sys_user t3 on t2.user_id = t3.user_id
- where t1.role_key in (
- 'association',
- 'associationManager',
- 'bd',
- 'bdManager'
- )
- and t3.status = 0
- group by t3.user_id) t
- where t.userId is not null
- order by t.create_time desc
- </select>
- <select id="adminReportList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select t1.user_id as 'userId',
- t1.user_name as 'userName',
- count(distinct t2.item_id) as 'itemCount',
- count(t2.oid) as 'orderNum',
- sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid),4) as 'validRadio',
- sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when
- t2.order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
- when send_status = 1
- then 1
- else 0 end),
- 4) as 'deliveryRadio',
- sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
- sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) as 'payAmount',
- sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) as 'regimentalPromotionAmount',
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount',
- round( sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) ,5 ) as 'avgServiceRate'
- from kuaishou_item_bind_user t1
- left join kuaishou_supply_chain t2
- on t1.item_id = t2.item_id
- where 1= 1
- <if test="start != null and start != ''">
- and t2.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t2.order_create_time <= #{end}
- </if>
- group by t1.user_id) t left join (
- select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
- where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and courier_number_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- group by item_create_id
- ) t1 on t.userId = t1.item_create_id
- where 1 =1
- <if test="userId != null and userId != ''">
- and t.userId = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="userItemDetail" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- *
- FROM
- (
- SELECT
- t1.user_id,
- t1.user_name AS 'userName',
- t2.item_id AS 'itemId',
- t2.item_title AS 'itemTitle',
- t2.image_url AS 'imageUrl',
- t2.reserve_price AS 'reservePrice',
- count(t2.oid) AS 'orderNum',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'validOrderNUm',
- round(
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / count(t2.oid),
- 4
- ) AS 'validRadio',
- sum(
- CASE
- WHEN t2.send_status = 1
- THEN 1
- ELSE 0
- END
- ) AS 'deliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when
- t2.order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'effDeliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / sum(
- CASE
- WHEN t2.send_status = 1 THEN 1
- ELSE 0
- END
- ),
- 4
- ) AS 'deliveryRadio',
- sum(
- CASE
- WHEN t2.order_status = 80 THEN 1
- ELSE 0
- END
- ) AS 'invalidOrderNUm',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.pay_amount
- ELSE 0
- END
- ) AS 'payAmount',
- t2.regimental_promotion_rate AS 'regimentalPromotionRate',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
- ELSE 0
- END
- ) AS 'regimentalPromotionAmount',
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount',
- t2.item_commission_rate as 'itemCommissionRate',
- t3.ccr_value as 'ccrValue',
- (case
- when t3.ccr_value = '-' or t3.ccr_value is null
- then 0
- else replace(t3.ccr_value,'%','')
- end
- ) as 'ccrInt'
- FROM
- kuaishou_item_bind_user t1
- LEFT JOIN
- kuaishou_supply_chain t2 ON t1.item_id = t2.item_id
- left join kuaishou_item_ccr_info t3 on t1.item_id = t3.item_id
- WHERE
- 1 = 1
- <if test="start != null and start != ''">
- and t2.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t2.order_create_time <= #{end}
- </if>
- <if test="itemId != null and itemId != ''">
- and t1.item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and t2.item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- GROUP BY
- t1.item_id
- ) t
- where 1 = 1
- <if test="userId != null and userId != ''">
- and t.user_id = #{userId}
- </if>
- order by ${fieId} ${sort}
- </select>
- <select id="getTimeIntervalRatio" resultType="com.alibaba.fastjson.JSONObject">
- select
- round((t1.oid -t2.oid) / t2.oid , 4) as 'orderTotalRatio',
- round((t1.orderAmount -t2.orderAmount) / t2.orderAmount , 4) as 'orderAmountRatio'
- from (
- select count(oid) as 'oid',
- sum(order_amount) as 'orderAmount'
- from kuaishou_supply_chain
- where 1= 1
- <if test="thisCycleStartTemp != null and thisCycleStartTemp != ''">
- and order_create_time >= #{thisCycleStartTemp}
- </if>
- <if test="thisCycleEndTemp != null and thisCycleEndTemp != ''">
- and order_create_time <= #{thisCycleEndTemp}
- </if>
- ) t1
- join (
- select count(oid) as 'oid',
- sum(order_amount) as 'orderAmount'
- from kuaishou_supply_chain
- where 1=1
- <if test="lastCycleStartTemp != null and lastCycleStartTemp != ''">
- and order_create_time >= #{lastCycleStartTemp}
- </if>
- <if test="lastCycleStartTemp != null and lastCycleStartTemp != ''">
- and order_create_time <= #{lastCycleEndTemp}
- </if>
- ) t2
- </select>
- <select id="indexStatistics" resultType="com.alibaba.fastjson.JSONObject">
- select FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') as 'date',
- <if test="type == 'orderNum' ">
- count(t.oid) as 'orderNum'
- </if>
- <if test="type == 'validOrderNum' ">
- sum(case when t.order_status = 80 then 1 else 0 end) as 'validOrderNum'
- </if>
- <if test="type == 'orderAmount' ">
- sum(t.order_amount) as 'orderAmount'
- </if>
- <if test="type == 'baseAmount' ">
- sum(t.base_amount) as 'baseAmount'
- </if>
- <if test="type == 'deliveryNum' ">
- sum(case when t.send_status = 1 and t.order_status != 80 then 1 else 0 end) as 'deliveryNum'
- </if>
- from (select
- oid,
- order_status,
- order_amount,
- base_amount,
- send_status,
- order_create_time
- from kuaishou_supply_chain
- where 1 = 1
- <if test="startTemp != null and startTemp != ''">
- and order_create_time >= #{startTemp}
- </if>
- <if test="endTemp != null and endTemp != ''">
- and order_create_time <= #{endTemp}
- </if>
- ) t
- group by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d')
- order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') asc
- </select>
- <select id="itemBindSummary" resultType="com.alibaba.fastjson.JSONObject">
- select count(t1.item_id) as 'itemTotal', sum(case when t2.item_id is not null then 1 else 0 end) as 'claimCount', sum(case when t2.item_id is null then 1 else 0 end) as 'unClaimCount'
- from kuaishou_item_info t1
- left join kuaishou_item_bind_user t2
- on t1.item_id = t2.item_id
- where 1 = 1
- </select>
- <select id="userItemTotal" resultType="com.alibaba.fastjson.JSONObject">
- SELECT count(t2.oid) AS 'orderNum',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'validOrderNUm',
- round(
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / count(t2.oid),
- 4
- ) AS 'validRadio',
- sum(
- CASE
- WHEN t2.send_status = 1
- THEN 1
- ELSE 0
- END
- ) AS 'deliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case when
- t2.order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'effDeliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / sum(
- CASE
- WHEN t2.send_status != 80 THEN 1
- ELSE 0
- END
- ),
- 4
- ) AS 'deliveryRadio',
- sum(
- CASE
- WHEN t2.order_status = 80 THEN 1
- ELSE 0
- END
- ) AS 'invalidOrderNUm',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.pay_amount
- ELSE 0
- END
- ) AS 'payAmount',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
- ELSE 0
- END
- ) AS 'regimentalPromotionAmount',
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount'
- FROM kuaishou_item_bind_user t1
- LEFT JOIN
- kuaishou_supply_chain t2 ON t1.item_id = t2.item_id
- WHERE 1 = 1
- <if test="start != null and start != ''">
- and t2.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t2.order_create_time <= #{end}
- </if>
- <if test="userId != null and userId != ''">
- and t1.user_id = #{userId}
- </if>
- </select>
- <select id="exportUserItemDetail" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- *
- FROM
- (
- SELECT
- t1.user_id as 'user_id',
- t1.user_name AS 'userName',
- t2.item_id AS 'itemId',
- t2.item_title AS 'itemTitle',
- t2.image_url AS 'imageUrl',
- round(t2.reserve_price / 100,2) AS 'reservePrice',
- count(t2.oid) AS 'orderNum',
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'validOrderNUm',
- round(
- sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / count(t2.oid) * 100,
- 2
- ) AS 'validRadio',
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) AS 'deliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(
- sum(
- CASE
- WHEN t2.send_status = 1
- AND t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) / sum(
- CASE
- WHEN t2.order_status != 80 THEN 1
- ELSE 0
- END
- ) * 100,
- 2
- ) AS 'deliveryRadio',
- sum(
- CASE
- WHEN t2.order_status = 80 THEN 1
- ELSE 0
- END
- ) AS 'invalidOrderNUm',
- round( sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.pay_amount
- ELSE 0
- END
- )/ 100,2 )AS 'payAmount',
- concat(round(t2.regimental_promotion_rate / 10 ,2),'%') AS 'regimentalPromotionRate',
- round(
- sum(
- CASE
- WHEN t2.order_status != 80 THEN t2.regimental_promotion_amount
- ELSE 0
- END
- ) / 100 , 2)AS 'regimentalPromotionAmount',
- round(
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) / 100,2) as
- 'totalRegimentalSettleAmount',
- concat(round(t2.item_commission_rate / 10),'%') as 'itemCommissionRate',
- t3.ccr_value as 'ccrValue'
- FROM
- kuaishou_item_bind_user t1
- LEFT JOIN
- kuaishou_supply_chain t2 ON t1.item_id = t2.item_id
- left join kuaishou_item_ccr_info t3 on t1.item_id = t3.item_id
- WHERE
- 1 = 1
- <if test="start != null and start != ''">
- and t2.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t2.order_create_time <= #{end}
- </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(concat('%',#{itemTitle}),'%')
- </if>
- GROUP BY
- t1.item_id
- ) t
- where 1 = 1
- <if test="userId != null and userId != ''">
- and t.user_id = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="getCookie" resultType="java.lang.String">
- select cookie
- from kuaishou_supply_chain_cookie
- where id = #{regId} limit 1
- </select>
- <select id="selectOrderInfo" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- COUNT(DISTINCT promoter_id) as 'promoterCount',
- COUNT(DISTINCT item_id) as 'itemCount',
- COUNT(oid) as 'allNumber',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
- IFNULL(SUM(order_amount), 0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
- 'regimentalPromotionAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) as 'baseAmount'
- FROM kuaishou_supply_chain
- WHERE stat_date >= #{startDate}
- AND stat_date <= #{endDate}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id in
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectOrderInfoBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- COUNT(DISTINCT author_short_id) as 'promoterCount',
- COUNT(DISTINCT product_id) as 'itemCount',
- COUNT(order_id) as 'allNumber',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
- IFNULL(SUM(total_pay_amount), 0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount',
- IFNULL( sum(CASE
- WHEN flow_point != 'REFUND' and colonel_type != 2
- THEN colonel_estimated_commission
- WHEN flow_point != 'REFUND' and colonel_type = 2
- then second_estimated_commission
- ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount',
- IFNULL( sum(CASE
- WHEN flow_point != 'REFUND' and colonel_type != 2
- THEN second_estimated_commission
- ELSE 0 END) ,0) AS 'secondEstimatedCommission'
- FROM bytedance_order_list
- WHERE pay_success_time >= #{startDate}
- AND pay_success_time <= #{endDate}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id in
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectOrderInfoByItemIds" resultType="com.alibaba.fastjson.JSONObject">
- SELECT t.*,
- CONCAT(IFNULL(ROUND(sendCount / allNumber * 100, 2),0), '%') as 'sendRate'
- FROM (
- SELECT
- COUNT(DISTINCT promoter_id) as 'promoterCount',
- COUNT(DISTINCT item_id) as 'itemCount',
- COUNT(oid) as 'allNumber',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
- IFNULL(SUM(order_amount), 0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
- 'regimentalPromotionAmount',
- IFNULL(sum(base_amount), 0) as 'baseAmount',
- IFNULL(COUNT(CASE WHEN send_status = 1 THEN oid ELSE null END), 0) AS 'sendCount'
- FROM kuaishou_supply_chain
- WHERE stat_date >= #{startDate}
- AND stat_date <= #{endDate}
- <if test='itemIds != null and itemIds.size() > 0'>
- AND item_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- ) t
- </select>
- <select id="selectOrderInfoByItemIdsBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- COUNT(DISTINCT author_short_id) as 'promoterCount',
- COUNT(DISTINCT product_id) as 'itemCount',
- COUNT(order_id) as 'allNumber',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END)/100, 0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 /100,0) AS
- 'regimentalPromotionAmount'
- FROM bytedance_order_list
- WHERE pay_success_time >= #{startDate}
- AND pay_success_time <= #{endDate}
- <if test='itemIds != null and itemIds.size() > 0'>
- AND product_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectOrderRate" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- count(oid) as 'allNumber',
- IFNULL(sum(order_amount),0) AS 'orderAmount'
- FROM kuaishou_supply_chain
- WHERE order_create_time >= #{statDate}
- AND order_create_time <= #{endDate}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id in
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test='itemIds != null and itemIds.size() > 0'>
- AND item_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectOrderRateBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- count(order_id) as 'allNumber',
- IFNULL(sum(
- CASE
- WHEN flow_point != 'REFUND' THEN total_pay_amount
- ELSE 0
- END
- )/100,0) AS 'orderAmount'
- FROM bytedance_order_list
- WHERE pay_success_time >= #{statDate}
- AND pay_success_time <= #{endDate}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id in
- <foreach collection="promoterIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test='itemIds != null and itemIds.size() > 0'>
- AND product_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getMonthOrderAmount" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
- count(1) AS 'orderCount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'validOrderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
- 'regimentalPromotionAmount',
- COUNT(DISTINCT promoter_id) as 'promoterCount'
- FROM kuaishou_supply_chain t1
- WHERE order_create_time >= #{startLong}
- AND order_create_time <= #{endLong}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
- </select>
- <select id="getMonthOrderAmountBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
- count(1) AS 'orderCount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9 ,0) AS
- 'regimentalPromotionAmount',
- COUNT(DISTINCT author_short_id) as 'promoterCount'
- FROM bytedance_order_list
- WHERE pay_success_time >= #{startLong}
- AND pay_success_time <= #{endLong}
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- GROUP BY pay_success_time
- </select>
- <select id="getMonthOrderAmountByItems" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
- count(1) AS 'orderCount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END),0) AS 'validOrderAmount',
- IFNULL(SUM(CASE WHEN order_status != 80 THEN regimental_promotion_amount ELSE 0 END),0) AS
- 'regimentalPromotionAmount'
- FROM kuaishou_supply_chain
- WHERE order_create_time >= #{startLong}
- AND order_create_time <= #{endLong}
- <if test='itemIds != null and itemIds.size() > 0'>
- AND item_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
- </select>
- <select id="getMonthOrderAmountByItemsBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
- count(1) AS 'orderCount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount'
- FROM bytedance_order_list
- WHERE pay_success_time >= #{startLong}
- AND pay_success_time <= #{endLong}
- <if test='itemIds != null and itemIds.size() > 0'>
- AND product_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- GROUP BY pay_success_time
- </select>
- <select id="getMonthOrderAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
- CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
- 'regimentalPromotionAmountRate'
- FROM
- (
- SELECT
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount'
- FROM kuaishou_supply_chain t1
- WHERE order_status != 80
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND order_create_time >= #{startLong}
- AND order_create_time <= #{endLong}) t1
- LEFT JOIN
- (
- SELECT
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount'
- FROM kuaishou_supply_chain t1
- WHERE order_status != 80
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND promoter_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND order_create_time >= #{toStartLong}
- AND order_create_time <= #{endLong})t2 ON 1=1
- </select>
- <select id="getMonthOrderAmountTotalBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
- CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
- 'regimentalPromotionAmountRate'
- FROM
- (
- SELECT
- IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount'
- FROM bytedance_order_list t1
- WHERE flow_point != 'REFUND'
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND pay_success_time >= #{startLong}
- AND pay_success_time <= #{endLong}) t1
- LEFT JOIN
- (
- SELECT
- IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount'
- FROM bytedance_order_list t1
- WHERE flow_point != 'REFUND'
- <if test='promoterIds != null and promoterIds.size() > 0'>
- AND author_short_id in
- <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND pay_success_time >= #{toStartLong}
- AND pay_success_time <= #{endLong})t2 ON 1=1
- </select>
- <select id="getMonthOrderAmountTotalByItems" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.orderCount,
- CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
- CONCAT(IFNULL(ROUND(t2.orderCount/t1.orderCount*100,2),0),'%') as 'orderCountRate',
- CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
- 'regimentalPromotionAmountRate'
- FROM
- (
- SELECT
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount',
- COUNT(oid) as 'orderCount'
- FROM kuaishou_supply_chain t1
- WHERE order_status != 80
- <if test='itemIds != null and itemIds.size() > 0'>
- AND item_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND order_create_time >= #{startLong}
- AND order_create_time <= #{endLong}
- )t1
- LEFT JOIN
- (
- SELECT
- IFNULL(SUM(order_amount),0) AS 'orderAmount',
- IFNULL(SUM(regimental_promotion_amount),0) AS 'regimentalPromotionAmount',
- COUNT(oid) as 'orderCount'
- FROM kuaishou_supply_chain t1
- WHERE order_status != 80
- <if test='itemIds != null and itemIds.size() > 0'>
- AND item_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND order_create_time >= #{toStartLong}
- AND order_create_time <= #{endLong}
- )t2 ON 1=1
- </select>
- <select id="getMonthOrderAmountTotalByItemsBytedance" resultType="com.alibaba.fastjson.JSONObject">
- SELECT
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.orderCount,
- CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
- CONCAT(IFNULL(ROUND(t2.orderCount/t1.orderCount*100,2),0),'%') as 'orderCountRate',
- CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
- 'regimentalPromotionAmountRate'
- FROM
- (
- SELECT
- IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount',
- COUNT(order_id) as 'orderCount'
- FROM bytedance_order_list t1
- WHERE flow_point != 'REFUND'
- <if test='itemIds != null and itemIds.size() > 0'>
- AND product_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND pay_success_time >= #{IntStart}
- AND pay_success_time <= #{IntEnd}
- )t1
- LEFT JOIN
- (
- SELECT
- IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
- IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END) * 0.9,0) AS
- 'regimentalPromotionAmount',
- COUNT(order_id) as 'orderCount'
- FROM bytedance_order_list t1
- WHERE flow_point != 'REFUND'
- <if test='itemIds != null and itemIds.size() > 0'>
- AND product_id in
- <foreach collection="itemIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND pay_success_time >= #{IntStart}
- AND pay_success_time <= #{IntEnd}
- )t2 ON 1=1
- </select>
- <select id="bdReportList" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.collectSampleId,
- t1.collectSampleName,
- t2.promoterCount,
- t3.sampleCount,
- round(t3.sampleCount / t2.promoterCount * 100, 2) as 'sampleRate',
- t2.promoterCount - t3.sampleCount as 'notSampleCount',
- t1.orderNum,
- t1.validOrderNum,
- t1.validOrderRate,
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.totalRegimentalSettleAmount,
- t4.sendTotalCount,
- t4.sendPromoterCount,
- t4.sendItemCount,
- t1.voucherOrderNum,
- t1.voucherValidOrderNum,
- t1.voucherOrderAmount,
- t1.voucherRegimentalPromotionAmount,
- t1.voucherTotalRegimentalSettleAmount,
- IFNULL(t5.promoters_count,'-') as 'promotersCount'
- from (
- select collect_sample_id as 'collectSampleId',
- collect_sample_name as 'collectSampleName',
- sum(order_num) as 'orderNum',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN order_num ELSE 0 END), 0) AS 'voucherOrderNum',
- sum(valid_order_num) as 'validOrderNum',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN valid_order_num ELSE 0 END), 0) AS 'voucherValidOrderNum',
- round(sum(valid_order_num) / sum(order_num) * 100, 2) as 'validOrderRate',
- sum(order_amount) as 'orderAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN order_amount ELSE 0 END), 0) AS 'voucherOrderAmount',
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN regimental_promotion_amount ELSE 0 END), 0)
- AS'voucherRegimentalPromotionAmount',
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN total_regimental_settle_amount ELSE 0 END), 0) AS
- 'voucherTotalRegimentalSettleAmount'
- from promoter_item_order_count
- where 1 = 1
- <if test="start != null and start != ''">
- and stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by collect_sample_id) t1
- left join (
- select user_id as 'userId',
- count(distinct promoter_id) as 'promoterCount'
- from kuaishou_promoter
- group by user_id) t2
- on t1.collectSampleId = t2.userId
- left join (
- select collect_sample_id as 'collectSampleId',
- count(distinct promoter_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- group by collect_sample_id) t3
- on t2.userId = t3.collectSampleId
- left join (
- select collect_sample_id as 'collectSampleId',
- count(1) as 'sendTotalCount',
- count(distinct promoter_id) as 'sendPromoterCount',
- count(distinct item_id) as 'sendItemCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- <if test="start != null and start != ''">
- and create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
- %H:%i:%s')
- </if>
- <if test="end != null and end != ''">
- and create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')
- </if>
- group by collect_sample_id
- ) t4
- on t1.collectSampleId = t4.collectSampleId
- left join (
- select user_id,promoters_count
- from user_promoters_count
- where media_id = 2
- ) t5
- on t1.collectSampleId = t5.user_id
- order by t1.orderNum desc
- </select>
- <select id="bdDetailList" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.promoterId,
- t1.promoterName,
- t1.promoterUrl,
- t2.sampleCount,
- t1.orderNum,
- t1.validOrderNum,
- t1.validOrderRate,
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.totalRegimentalSettleAmount
- from (
- select promoter_id as 'promoterId',
- promoter_name as 'promoterName',
- promoter_url as 'promoterUrl',
- sum(order_num) as 'orderNum',
- sum(valid_order_num) as 'validOrderNum',
- round(sum(valid_order_num) / sum(order_num) * 100, 2) as 'validOrderRate',
- sum(order_amount) as 'orderAmount',
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
- from promoter_item_order_count
- where 1 = 1
- <if test="start != null and start != ''">
- and stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by promoter_id) t1
- left join (
- select promoter_id as 'promoterId',
- count(distinct item_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by promoter_id) t2
- on t1.promoterId = t2.promoterId
- order by ${fieId} ${sort}
- </select>
- <select id="bdTotal" resultType="com.alibaba.fastjson.JSONObject">
- select
- t2.sampleCount,
- t1.orderNum,
- t1.validOrderNum,
- t1.validOrderRate,
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.totalRegimentalSettleAmount
- from (
- select
- sum(order_num) as 'orderNum',
- sum(valid_order_num) as 'validOrderNum',
- round(sum(valid_order_num) / sum(order_num) * 100, 2) as 'validOrderRate',
- sum(order_amount) as 'orderAmount',
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
- from promoter_item_order_count
- where 1 = 1
- <if test="start != null and start != ''">
- and stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- ) t1
- join (
- select
- count(distinct item_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- ) t2
- </select>
- <select id="exportBdDetail" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.promoterId,
- t1.promoterName,
- t1.promoterUrl,
- t2.sampleCount,
- t1.orderNum,
- t1.validOrderNum,
- t1.validOrderRate,
- t1.orderAmount,
- t1.regimentalPromotionAmount,
- t1.totalRegimentalSettleAmount
- from (
- select promoter_id as 'promoterId',
- promoter_name as 'promoterName',
- promoter_url as 'promoterUrl',
- sum(order_num) as 'orderNum',
- sum(valid_order_num) as 'validOrderNum',
- round(sum(valid_order_num) / sum(order_num) * 100, 2) as 'validOrderRate',
- sum(order_amount) as 'orderAmount',
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
- from promoter_item_order_count
- where 1 = 1
- <if test="start != null and start != ''">
- and stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by promoter_id) t1
- left join (
- select promoter_id as 'promoterId',
- count(distinct item_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by promoter_id) t2
- on t1.promoterId = t2.promoterId
- order by t1.orderNum desc
- </select>
- <select id="getUserList" resultType="com.alibaba.fastjson.JSONObject">
- select promoter_id as 'promoterId', group_concat(user_name) as 'userName'
- from kuaishou_promoter where promoter_id in
- <foreach collection="map.values" item="v" separator="," open="(" close=")">
- ${v}
- </foreach>
- GROUP BY promoter_id
- </select>
- <select id="getUserName" resultType="java.lang.String" parameterType="java.lang.Long">
- select group_concat(user_name) as 'userName'
- from kuaishou_promoter
- where promoter_id = #{promoterId}
- </select>
- <select id="exportBdReportList" resultType="com.alibaba.fastjson.JSONObject">
- select
- t1.collectSampleId,
- t1.collectSampleName,
- t2.promoterCount,
- t3.sampleCount,
- round(t3.sampleCount / t2.promoterCount * 100, 2) as 'sampleRate',
- t2.promoterCount - t3.sampleCount as 'notSampleCount',
- t1.orderNum,
- t1.validOrderNum,
- t1.validOrderRate,
- round(t1.orderAmount / 100,2) as 'orderAmount',
- round(t1.regimentalPromotionAmount / 100 ,2 ) as 'regimentalPromotionAmount',
- round(t1.totalRegimentalSettleAmount / 100 , 2) as 'totalRegimentalSettleAmount',
- t4.sendTotalCount,
- t4.sendPromoterCount,
- t4.sendItemCount,
- t1.voucherOrderNum,
- t1.voucherValidOrderNum,
- round(t1.voucherOrderAmount / 100 ,2) as 'voucherOrderAmount',
- round(t1.voucherRegimentalPromotionAmount / 100 ,2) as 'voucherRegimentalPromotionAmount',
- round( t1.voucherTotalRegimentalSettleAmount / 100 , 2) as 'voucherTotalRegimentalSettleAmount'
- from (
- select collect_sample_id as 'collectSampleId',
- collect_sample_name as 'collectSampleName',
- sum(order_num) as 'orderNum',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN order_num ELSE 0 END), 0) AS 'voucherOrderNum',
- sum(valid_order_num) as 'validOrderNum',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN valid_order_num ELSE 0 END), 0) AS 'voucherValidOrderNum',
- round(sum(valid_order_num) / sum(order_num) * 100, 2) as 'validOrderRate',
- sum(order_amount) as 'orderAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN order_amount ELSE 0 END), 0) AS 'voucherOrderAmount',
- sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN regimental_promotion_amount ELSE 0 END), 0)
- AS'voucherRegimentalPromotionAmount',
- sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount',
- IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN total_regimental_settle_amount ELSE 0 END), 0) AS
- 'voucherTotalRegimentalSettleAmount'
- from promoter_item_order_count
- where 1 = 1
- <if test="start != null and start != ''">
- and stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by collect_sample_id) t1
- left join (
- select user_id as 'userId',
- count(distinct promoter_id) as 'promoterCount'
- from kuaishou_promoter
- group by user_id) t2
- on t1.collectSampleId = t2.userId
- left join (
- select collect_sample_id as 'collectSampleId',
- count(distinct promoter_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- group by collect_sample_id) t3
- on t2.userId = t3.collectSampleId
- left join (
- select collect_sample_id as 'collectSampleId',
- count(1) as 'sendTotalCount',
- count(distinct promoter_id) as 'sendPromoterCount',
- count(distinct item_id) as 'sendItemCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- <if test="start != null and start != ''">
- and create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
- %H:%i:%s')
- </if>
- <if test="end != null and end != ''">
- and create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')
- </if>
- group by collect_sample_id
- ) t4
- on t1.collectSampleId = t4.collectSampleId
- order by t1.orderNum desc
- </select>
- <select id="exportAdminReportList" resultType="com.alibaba.fastjson.JSONObject">
- select *
- from (select t1.user_id as 'userId',
- t1.user_name as 'userName',
- count(distinct t2.item_id) as 'itemCount',
- count(t2.oid) as 'orderNum',
- sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100,2) as 'validRadio',
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
- when t2.order_status != 80
- then 1
- else 0 end) * 100,
- 2) as 'deliveryRadio',
- sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
- round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
- round(sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / 100, 2 )as 'regimentalPromotionAmount',
- round(sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) / 100 , 2) as
- 'totalRegimentalSettleAmount',
- round( sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) * 100 ,2) as 'avgServiceRate'
- from kuaishou_item_bind_user t1
- left join kuaishou_supply_chain t2
- on t1.item_id = t2.item_id
- where 1= 1
- <if test="start != null and start != ''">
- and t2.order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t2.order_create_time <= #{end}
- </if>
- group by t1.user_id) t left join (
- select item_create_id,count(1) as 'sendSampleCount' from kuaishou_item_collect_samples
- where courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and courier_number_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- group by item_create_id
- ) t1 on t.userId = t1.item_create_id
- where 1 =1
- <if test="userId != null and userId != ''">
- and t.userId = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="getSupplyChainCourtshipUserList" resultType="com.alibaba.fastjson.JSONObject">
- select t3.user_id as 'userId', t3.nick_name as 'nickMame', t1.role_name as 'roleName', t3.status
- from sys_role t1
- left join sys_user_role t2 on t1.role_id = t2.role_id
- left join sys_user t3 on t2.user_id = t3.user_id
- where t1.role_key in (
- 'courtship',
- 'courtshipManager'
- )
- and t3.status = 0
- group by t3.user_id
- order by t3.create_time asc
- </select>
- <select id="adminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select t1.user_id as 'userId',
- t1.user_name as 'userName',
- count(distinct t1.item_id) as 'itemCount',
- count(t2.oid) as 'orderNum',
- sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid), 4) as 'validRadio',
- sum(case when t2.send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end),4) as 'shippingGreen',
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
- when t2.send_status = 1
- then 1
- else 0 end),
- 4) as 'deliveryRadio',
- sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
- sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) as 'payAmount',
- sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) as 'regimentalPromotionAmount',
- sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
- 'totalRegimentalSettleAmount',
- round( sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) ,5) as 'avgServiceRate'
- from kuaishou_item_list t1
- left join (select item_id,
- oid,
- order_status,
- send_status,
- pay_amount,
- regimental_promotion_amount,
- total_regimental_settle_amount
- from kuaishou_supply_chain
- where order_create_time >= #{start}) t2
- on t1.item_id = t2.item_id
- where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- <if test="userId != null and userId != ''">
- and t1.userId = #{userId}
- </if>
- group by t1.user_id ) t left join (
- select t1.user_id,count(distinct courier_number) as 'sendSampleCount' from kuaishou_item_list t1 left join
- kuaishou_item_collect_samples t2
- on t1.item_id = t2.item_id
- where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- and t2.courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- group by t1.user_id
- ) t2 on t.userId = t2.user_id order by t.orderNum desc
- </select>
- <select id="exportAdminReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
- select * from (
- select t1.user_id as 'userId',
- t1.user_name as 'userName',
- count(distinct t1.item_id) as 'itemCount',
- count(t2.oid) as 'orderNum',
- sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when t2.order_status != 80 then 1 else 0 end) / count(t2.oid) * 100,2) as 'validRadio',
- sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when t2.send_status = 1 and t2.order_status != 80 then 1 else 0 end) / sum(case
- when t2.order_status != 80
- then 1
- else 0 end) * 100,
- 2) as 'deliveryRadio',
- sum(case when t2.order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
- round(sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) / 100 , 2) as 'payAmount',
- round(sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / 100, 2 )as 'regimentalPromotionAmount',
- round(sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) / 100 , 2) as
- 'totalRegimentalSettleAmount',
- round( sum(case
- when t2.order_status != 80 then t2.regimental_promotion_amount
- else 0 end) / sum(case when t2.order_status != 80 then t2.pay_amount else 0 end) * 100 ,2) as 'avgServiceRate'
- from kuaishou_item_list t1
- left join (select item_id,
- oid,
- order_status,
- send_status,
- pay_amount,
- regimental_promotion_amount,
- total_regimental_settle_amount
- from kuaishou_supply_chain
- where order_create_time >= #{start}) t2
- on t1.item_id = t2.item_id
- where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- <if test="userId != null and userId != ''">
- and t1.userId = #{userId}
- </if>
- group by t1.user_id ) t left join (
- select t1.user_id,count(distinct courier_number) as 'sendSampleCount' from kuaishou_item_list t1 left join
- kuaishou_item_collect_samples t2
- on t1.item_id = t2.item_id
- where t1.create_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- and t1.create_time <= from_unixtime(#{end}/1000,'%Y-%m-%d %H:%i:%s')
- and t2.courier_number_time >= from_unixtime(#{start}/1000,'%Y-%m-%d %H:%i:%s')
- group by t1.user_id
- ) t2 on t.userId = t2.user_id order by t.orderNum desc;
- </select>
- <select id="bdReportListV2" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,
- tt.promoterCount,
- ttt.sampleCount,
- tttt.sendTotalCount,
- tttt.sendPromoterCount,
- tttt.sendItemCount,
- IFNULL( ttttt.promoters_count,'-') as 'promotersCount',
- concat(round(ttt.sampleCount / tt.promoterCount * 100, 2), '%') as 'sampleRate',
- tt.promoterCount - ttt.sampleCount as 'notSampleCount'
- from (
- select t1.user_id as 'collectSampleId',
- t1.user_name as 'collectSampleName',
- sum(t2.order_num) as 'orderNum',
- sum(t2.valid_order_num) as 'validOrderNum',
- concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
- round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
- from promoter_bind_channel_date t1
- left join promoter_item_order_count t2
- on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
- where 1 = 1
- and t1.media_id = 2
- <if test="start != null and start != ''">
- and t1.stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t1.stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and t1.user_id = #{collectSampleId}
- </if>
- group by t1.user_id) t
- left join (select user_id,
- count(distinct promoter_id) as 'promoterCount'
- from kuaishou_promoter
- group by user_id) tt on t.collectSampleId = tt.user_id
- left join (select collect_sample_id as 'user_id',
- count(distinct promoter_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- group by collect_sample_id) ttt on t.collectSampleId = ttt.user_id
- left join (select collect_sample_id as 'user_id',
- count(1) as 'sendTotalCount',
- count(distinct promoter_id) as 'sendPromoterCount',
- count(distinct item_id) as 'sendItemCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != ''">
- and collect_sample_id = #{collectSampleId}
- </if>
- <if test="start != null and start != ''">
- and create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
- %H:%i:%s')
- </if>
- <if test="end != null and end != ''">
- and create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')
- </if>
- group by collect_sample_id) tttt on t.collectSampleId = tttt.user_id
- left join (select user_id, promoters_count
- from user_promoters_count
- where media_id = 2) ttttt
- on t.collectSampleId = ttttt.user_id
- where t.orderNum > 0
- order by t.orderNum desc
- </select>
- <select id="bdTotalV2" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,tt.sampleCount
- from (select t1.user_id as 'collectSampleId',
- t1.user_name as 'collectSampleName',
- sum(t2.order_num) as 'orderNum',
- sum(t2.valid_order_num) as 'validOrderNum',
- concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
- round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
- from promoter_bind_channel_date t1
- left join promoter_item_order_count t2
- on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
- where 1 = 1
- <if test="start != null and start != '' ">
- and t1.stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t1.stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and t1.user_id = #{collectSampleId}
- </if>
- group by t1.user_id) t
- join (select count(distinct item_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- and collect_sample_id = #{collectSampleId} ) tt
- </select>
- <select id="bdDetailListV2" resultType="com.alibaba.fastjson.JSONObject">
- select t.*, tt.sampleCount
- from (select t1.promoter_id as 'promoterId',
- t1.promoter_name as 'promoterName',
- t1.promoter_url as 'promoterUrl',
- sum(t2.order_num) as 'orderNum',
- sum(t2.valid_order_num) as 'validOrderNum',
- concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
- round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
- from promoter_bind_channel_date t1
- left join promoter_item_order_count t2
- on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
- where 1 = 1
- <if test="start != null and start != '' ">
- and t1.stat_date >= #{start}
- </if>
- <if test="end != null and end != ''">
- and t1.stat_date <= #{end}
- </if>
- <if test="collectSampleId != null and collectSampleId != ''">
- and t1.user_id = #{collectSampleId}
- </if>
- group by t1.promoter_id) t
- left join (select promoter_id,
- count(distinct item_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- and collect_sample_id = #{collectSampleId}
- group by promoter_id) tt on t.promoterId = tt.promoter_id
- where t.orderNum > 0
- order by ${fieId} ${sort}
- </select>
- <select id="bdReportListV2ByBind" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,
- tt.promoterCount,
- ttt.sampleCount,
- tttt.sendTotalCount,
- tttt.sendPromoterCount,
- tttt.sendItemCount,
- IFNULL(ttttt.promoters_count, '-') as 'promotersCount'
- from (select t1.user_id as 'collectSampleId',
- t1.user_name as 'collectSampleName',
- sum(t2.order_num) as 'orderNum',
- sum(t2.valid_order_num) as 'validOrderNum',
- concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
- round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
- round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
- round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
- from kuaishou_promoter t1
- left join(select *
- from promoter_item_order_count
- where stat_date >= #{bindStartDate}) t2
- on t1.promoter_id = t2.promoter_id
- where 1 = 1
- <if test="bindStartDate != null and bindStartDate != '' ">
- and t1.create_time >= str_to_date(concat(date_format(#{bindStartDate}, '%Y-%m-%d'), '00:00:01'),
- '%Y-%m-%d %H:%i:%s')
- </if>
- <if test="bindEndDate != null and bindEndDate != '' ">
- and t1.create_time <= str_to_date(concat(date_format(#{bindEndDate}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
- %H:%i:%s')
- </if>
- <if test="collectSampleId != null and collectSampleId != '' ">
- and t1.user_id = #{collectSampleId}
- </if>
- group by t1.user_id) t
- left join (select user_id,
- count(distinct promoter_id) as 'promoterCount'
- from kuaishou_promoter
- where 1 = 1
- <if test="collectSampleId != null and collectSampleId != '' ">
- and user_id = #{collectSampleId}
- </if>
- group by user_id) tt on t.collectSampleId = tt.user_id
- left join (select collect_sample_id as 'user_id',
- count(distinct promoter_id) as 'sampleCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != '' ">
- and collect_sample_id = #{collectSampleId}
- </if>
- group by collect_sample_id) ttt on t.collectSampleId = ttt.user_id
- left join (select collect_sample_id as 'user_id',
- count(1) as 'sendTotalCount',
- count(distinct promoter_id) as 'sendPromoterCount',
- count(distinct item_id) as 'sendItemCount'
- from kuaishou_item_collect_samples
- where collect_sample_status > 2
- <if test="collectSampleId != null and collectSampleId != '' ">
- and collect_sample_id = #{collectSampleId}
- </if>
- <if test="bindStartDate != null and bindStartDate != '' ">
- and create_time >= str_to_date(concat(date_format(#{bindStartDate}, '%Y-%m-%d'), '00:00:01'),
- '%Y-%m-%d %H:%i:%s')
- </if>
- <if test="bindEndDate != null and bindEndDate != '' ">
- and create_time <= str_to_date(concat(date_format(#{bindEndDate}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
- %H:%i:%s')
- </if>
- group by collect_sample_id) tttt on t.collectSampleId = tttt.user_id
- left join (select user_id, promoters_count
- from user_promoters_count
- where media_id = 2
- <if test="collectSampleId != null and collectSampleId != '' ">
- and user_id = #{collectSampleId}
- </if>
- ) ttttt
- on t.collectSampleId = ttttt.user_id
- order by t.orderNum desc
- </select>
- <select id="exportBindOrder" resultType="com.alibaba.fastjson.JSONObject">
- select *,t3.ccr_value as 'ccrValue'
- from (select item_id as 'itemId', item_title as 'itemTitle', user_id as 'userId', user_name as 'userName'
- from kuaishou_item_list
- where
- create_time >= str_to_date(concat(#{bindStartDate},' 00:00:01'),'%Y-%m-%d
- %H:%i:%s')
- and
- create_time <= str_to_date(concat(#{bindEndDate},' 23:59:59'),'%Y-%m-%d
- %H:%i:%s')
- ) t1
- left join
- (select item_id as 'itemId',
- image_url as 'imageUrl',
- count(oid) as 'orderNum',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100, 2) as 'validRadio',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status
- != 80 then 1 else 0 end) * 100, 2) as 'deliveryRadio',
- round(item_commission_rate / 10,2) as 'itemCommissionRate'
- from kuaishou_supply_chain
- where order_create_time >= #{start}
- group by item_id) t2 on t1.itemId = t2.itemId
- left join kuaishou_item_ccr_info t3
- on t1.itemId = t3.item_id
- where 1 = 1
- <if test="itemId != null and itemId != ''">
- and t1.item_id = #{itemId}
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- and t1.item_title like concat(concat('%',#{itemTitle}),'%')
- </if>
- <if test="userId != null and userId != ''">
- and t1.userId = #{userId}
- </if>
- order by t2.orderNum desc
- </select>
- <insert id="replaceAll">
- replace into kuaishou_supply_chain(
- oid,
- item_id,
- item_title,
- reserve_price,
- image_url,
- order_status,
- order_create_time,
- send_status,
- settlement_biz_type,
- settlement_biz_type_desc,
- send_time,
- recv_time,
- seller_id,
- activity_id,
- order_amount,
- pay_amount,
- regimental_promotion_rate,
- share_rate,
- base_amount,
- service_amount,
- regimental_promotion_amount,
- total_regimental_settle_amount,
- stat_date,
- item_commission_rate,
- promoter_id,
- promoter_nick_name
- )
- values
- <foreach collection="list" item="add" separator=",">
- (
- #{add.oid},
- #{add.itemId},
- #{add.itemTitle},
- #{add.reservePrice},
- #{add.imageUrl},
- #{add.orderStatus},
- #{add.orderCreateTime},
- #{add.sendStatus},
- #{add.settlementBizType},
- #{add.settlementBizTypeDesc},
- #{add.sendTime},
- #{add.recvTime},
- #{add.sellerId},
- #{add.activityId},
- #{add.orderAmount},
- #{add.payAmount},
- #{add.regimentalPromotionRate},
- #{add.shareRate},
- #{add.baseAmount},
- #{add.serviceAmount},
- #{add.regimentalPromotionAmount},
- #{add.totalRegimentalSettleAmount},
- #{add.statDate},
- #{add.itemCommissionRate},
- #{add.promoterId},
- #{add.promoterNickName}
- )
- </foreach>
- </insert>
- <insert id="replaceKuaishouActivityInfo">
- replace into kuaishou_activity_info(
- activity_id,
- regimental_id,
- activity_title,
- activity_type,
- activity_begin_time,
- activity_end_time,
- activity_status,
- apply_item_count,
- wait_audit_item_count,
- audit_pass_item_count
- )
- values
- <foreach collection="list" item="add" separator=",">
- (
- #{add.activityId},
- #{add.regimentalId},
- #{add.activityTitle},
- #{add.activityType},
- #{add.activityBeginTime},
- #{add.activityEndTime},
- #{add.activityStatus},
- #{add.applyItemCount},
- #{add.waitAuditItemCount},
- #{add.auditPassItemCount}
- )
- </foreach>
- </insert>
- <insert id="replaceMgsKuaishouActivityInfo">
- replace into miaogousi.kuaishou_activity_info(
- activity_id,
- regimental_id,
- activity_title,
- activity_type,
- activity_begin_time,
- activity_end_time,
- activity_status,
- apply_item_count,
- wait_audit_item_count,
- audit_pass_item_count
- )
- values
- <foreach collection="list" item="add" separator=",">
- (
- #{add.activityId},
- #{add.regimentalId},
- #{add.activityTitle},
- #{add.activityType},
- #{add.activityBeginTime},
- #{add.activityEndTime},
- #{add.activityStatus},
- #{add.applyItemCount},
- #{add.waitAuditItemCount},
- #{add.auditPassItemCount}
- )
- </foreach>
- </insert>
- <insert id="replaceRocketKuaishouActivityInfo">
- replace into rocket.kuaishou_activity_info(
- activity_id,
- regimental_id,
- activity_title,
- activity_type,
- activity_begin_time,
- activity_end_time,
- activity_status,
- apply_item_count,
- wait_audit_item_count,
- audit_pass_item_count
- )
- values
- <foreach collection="list" item="add" separator=",">
- (
- #{add.activityId},
- #{add.regimentalId},
- #{add.activityTitle},
- #{add.activityType},
- #{add.activityBeginTime},
- #{add.activityEndTime},
- #{add.activityStatus},
- #{add.applyItemCount},
- #{add.waitAuditItemCount},
- #{add.auditPassItemCount}
- )
- </foreach>
- </insert>
- <update id="updateKuaishouSupplyChain">
- update kuaishou_supply_chain set send_status = 1
- where oid in
- <foreach collection="list" item="id" separator=","
- open="(" close=")">
- #{id}
- </foreach>
- </update>
- <update id="updateMgsKuaishouSupplyChain">
- update miaogousi.kuaishou_supply_chain set send_status = 1
- where oid in
- <foreach collection="list" item="id" separator=","
- open="(" close=")">
- #{id}
- </foreach>
- </update>
- <update id="updateRocketKuaishouSupplyChain">
- update rocket.kuaishou_supply_chain set send_status = 1
- where oid in
- <foreach collection="list" item="id" separator=","
- open="(" close=")">
- #{id}
- </foreach>
- </update>
- <select id="getBytedanceOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
- SELECT pay_success_time_hour as 'hour', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount'
- FROM bytedance_order_list
- WHERE pay_success_time = #{date}
- GROUP BY pay_success_time_hour
- ORDER BY pay_success_time_hour
- </select>
- <select id="getKuaishouOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
- SELECT stat_hour as 'hour', IFNULL(SUM(CASE WHEN order_status != 80 THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN order_status != 80 THEN order_amount ELSE 0 END), 0) as 'baseAmount'
- FROM kuaishou_supply_chain
- where stat_date = #{date}
- GROUP BY stat_hour
- ORDER BY stat_hour
- </select>
- <select id="exportItemDetail" resultType="com.alibaba.fastjson.JSONObject">
- select t.*,tt.userName
- from (
- select
- promoter_nick_name as 'promoterNickName',
- promoter_id as 'promoterId',
- count(oid) as 'orderNum',
- round(sum(case when order_status != 80 then pay_amount else 0 end)/100,2 )as 'payAmount',
- round(regimental_promotion_rate / 10 ,2) as 'regimentalPromotionRate',
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
- round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,2) as 'validRadio',
- sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
- then 1 else 0 end) * 100 ,2) as 'shippingGreen',
- sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'effDeliveryNum',
- sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
- round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when send_status = 1
- then 1 else 0 end) *100,2) as 'deliveryRadio'
- from kuaishou_supply_chain
- where 1= 1
- <if test="itemId != null and itemId != ''">
- and item_id = #{itemId}
- </if>
- <if test="start != null and start != ''">
- and order_create_time >= #{start}
- </if>
- <if test="end != null and end != ''">
- and order_create_time <= #{end}
- </if>
- <if test="promoterId != null and promoterId != ''">
- and promoter_id = #{promoterId}
- </if>
- <if test="promoterNickName != null and promoterNickName != ''">
- and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
- </if>
- group by promoter_id) t left join (select promoter_id,group_concat(user_name) as 'userName',user_id as 'userId'
- from
- kuaishou_promoter group by promoter_id) tt
- on t.promoterId = tt.promoter_id
- where 1 =1
- <if test="userId != null and userId != ''">
- and tt.userId = #{userId}
- </if>
- order by t.orderNum desc
- </select>
- <select id="getKsChannelGmvHourByDate" resultType="com.alibaba.fastjson.JSONObject">
- select stat_hour as 'time',
- round(sum(pay_amount) / 100, 2) as 'charge' from kuaishou_supply_chain
- where stat_date = #{date}
- <if test='userList != null and userList.size() > 0'>
- and promoter_id in (
- select promoter_id
- from kuaishou_promoter where
- 1 = 1
- and user_id in
- <foreach collection="userList" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- group by promoter_id
- )
- </if>
- group by stat_hour
- order by stat_hour asc;
- </select>
- <select id="getKsCourtshipGmvHourByDate" resultType="com.alibaba.fastjson.JSONObject">
- select stat_hour as 'time',
- round(sum(pay_amount) / 100, 2) as 'charge'
- from kuaishou_supply_chain
- where stat_date = #{date}
- <if test='userList != null and userList.size() > 0'>
- and item_id in (
- select item_id
- from kuaishou_item_list where
- 1 = 1
- and user_id in
- <foreach collection="userList" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- group by item_id
- )
- </if>
- group by stat_hour
- order by stat_hour asc;
- </select>
- <select id="getBytedanceChannelGmvHourByDate" resultType="com.alibaba.fastjson.JSONObject">
- select pay_success_time_hour as 'time',
- round(sum(total_pay_amount) / 100, 2) as 'charge' from bytedance_order_list where pay_success_time = #{date}
- <if test='userList != null and userList.size() > 0'>
- and author_short_id in(
- select promoter_id
- from kuaishou_promoter where
- 1 = 1
- and user_id in
- <foreach collection="userList" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- group by promoter_id
- )
- </if>
- group by pay_success_time_hour
- order by pay_success_time_hour asc;
- </select>
- <select id="getBytedanceCourtshipGmvHourByDate" resultType="com.alibaba.fastjson.JSONObject">
- select pay_success_time_hour as 'time',
- round(sum(total_pay_amount) / 100, 2) as 'charge' from bytedance_order_list where pay_success_time = #{date}
- <if test='userList != null and userList.size() > 0'>
- and product_id in(
- select item_id
- from kuaishou_item_list where
- 1 = 1
- and user_id in
- <foreach collection="userList" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- group by item_id
- )
- </if>
- group by pay_success_time_hour
- order by pay_success_time_hour asc;
- </select>
- <insert id="replaceKuaiShouActivityOpenItemList">
- replace into kuaishou_activity_open_item_list(
- item_id,
- item_category_name,
- item_price,
- pre_activity_id,
- item_leaf_category_id,
- item_commission_rate,
- investment_promotion_rate
- )
- values
- <foreach collection="list" item="li" separator=",">
- (
- #{li.itemId},
- #{li.itemCategoryName},
- #{li.itemPrice},
- #{li.preActivityId},
- #{li.itemLeafCategoryId},
- #{li.itemCommissionRate},
- #{li.investmentPromotionRate}
- )
- </foreach>
- </insert>
- <insert id="replaceMgsKuaiShouActivityOpenItemList">
- replace into miaogousi.kuaishou_activity_open_item_list(
- item_id,
- item_category_name,
- item_price,
- pre_activity_id,
- item_leaf_category_id,
- item_commission_rate,
- investment_promotion_rate
- )
- values
- <foreach collection="list" item="li" separator=",">
- (
- #{li.itemId},
- #{li.itemCategoryName},
- #{li.itemPrice},
- #{li.preActivityId},
- #{li.itemLeafCategoryId},
- #{li.itemCommissionRate},
- #{li.investmentPromotionRate}
- )
- </foreach>
- </insert>
- <insert id="replaceRocketKuaiShouActivityOpenItemList">
- replace into rocket.kuaishou_activity_open_item_list(
- item_id,
- item_category_name,
- item_price,
- pre_activity_id,
- item_leaf_category_id,
- item_commission_rate,
- investment_promotion_rate
- )
- values
- <foreach collection="list" item="li" separator=",">
- (
- #{li.itemId},
- #{li.itemCategoryName},
- #{li.itemPrice},
- #{li.preActivityId},
- #{li.itemLeafCategoryId},
- #{li.itemCommissionRate},
- #{li.investmentPromotionRate}
- )
- </foreach>
- </insert>
- <select id="getKuaishouActivityInfoList" resultType="Long">
- SELECT DISTINCT activity_id
- FROM kuaishou_activity_info
- WHERE activity_status = 2
- OR activity_status = 3
- </select>
- <select id="getMgsKuaishouActivityInfoList" resultType="Long">
- SELECT DISTINCT activity_id
- FROM miaogousi.kuaishou_activity_info
- WHERE activity_status = 2
- OR activity_status = 3
- </select>
- <select id="getRocketKuaishouActivityInfoList" resultType="Long">
- SELECT DISTINCT activity_id
- FROM rocket.kuaishou_activity_info
- WHERE activity_status = 2
- OR activity_status = 3
- </select>
- </mapper>
|