charts.php 296 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408
  1. <?php
  2. $config->bi->builtin->charts = array();
  3. $config->bi->builtin->charts[] = array
  4. (
  5. 'id' => 1001,
  6. 'name' => '年度总结-登录次数',
  7. 'code' => 'annualSummary_countLogin',
  8. 'dimension' => '1',
  9. 'type' => 'card',
  10. 'group' => '0',
  11. 'sql' => <<<EOT
  12. SELECT sum(t2.login) AS login, `year`, account, realname
  13. FROM zt_user t1
  14. LEFT JOIN (SELECT count(1) as login, actor, YEAR(`date`) as `year` FROM zt_action GROUP BY actor, `year`) t2 on t1.account = t2.actor
  15. WHERE t1.deleted = '0'
  16. GROUP BY `year`, account, realname
  17. EOT
  18. ,
  19. 'settings' => array
  20. (
  21. 'value' => array('type' => 'agg', 'field' => 'login', 'agg' => 'sum'),
  22. 'title' => array('type' => 'text', 'name' => ''),
  23. 'type' => 'value'
  24. ),
  25. 'filters' => array(),
  26. 'stage' => 'published',
  27. 'builtin' => '1'
  28. );
  29. $config->bi->builtin->charts[] = array
  30. (
  31. 'id' => 1002,
  32. 'name' => '年度总结-操作次数',
  33. 'code' => 'annualSummary_countAction',
  34. 'dimension' => '1',
  35. 'type' => 'card',
  36. 'group' => '0',
  37. 'sql' => <<<EOT
  38. SELECT sum(t2.allAction) as allAction, `year` , account, realname
  39. FROM zt_user t1
  40. LEFT JOIN (SELECT count(1) as allAction, actor, YEAR(`date`) as `year` FROM zt_action GROUP BY actor, `year`) t2 on t1.account = t2.actor
  41. WHERE t1.deleted = '0'
  42. GROUP BY `year`, account, realname
  43. EOT
  44. ,
  45. 'settings' => array
  46. (
  47. 'value' => array('type' => 'agg', 'field' => 'allAction', 'agg' => 'sum'),
  48. 'title' => array('type' => 'text', 'name' => ''),
  49. 'type' => 'value'
  50. ),
  51. 'filters' => array(),
  52. 'stage' => 'published',
  53. 'builtin' => '1'
  54. );
  55. $config->bi->builtin->charts[] = array
  56. (
  57. 'id' => 1003,
  58. 'name' => '年度总结-消耗工时',
  59. 'code' => 'annualSummary_consumed',
  60. 'dimension' => '1',
  61. 'type' => 'card',
  62. 'group' => '0',
  63. 'sql' => <<<EOT
  64. SELECT ROUND(SUM(t2.consumed)) AS consumed, `year` , t1.account, realname
  65. FROM zt_user t1
  66. LEFT JOIN (SELECT sum(consumed) as consumed, account, YEAR(`date`) as `year` FROM zt_effort WHERE deleted = '0' GROUP BY account, `year` ) t2 on t1.account = t2.account
  67. WHERE t1.deleted = '0'
  68. GROUP BY `year`, t1.account, realname
  69. EOT
  70. ,
  71. 'settings' => array
  72. (
  73. 'value' => array('type' => 'agg', 'field' => 'consumed', 'agg' => 'sum'),
  74. 'title' => array('type' => 'text', 'name' => ''),
  75. 'type' => 'value'
  76. ),
  77. 'filters' => array(),
  78. 'stage' => 'published',
  79. 'builtin' => '1'
  80. );
  81. $config->bi->builtin->charts[] = array
  82. (
  83. 'id' => 1004,
  84. 'name' => '年度总结-待办数',
  85. 'code' => 'annualSummary_countTodo',
  86. 'dimension' => '1',
  87. 'type' => 'card',
  88. 'group' => '0',
  89. 'sql' => <<<EOT
  90. SELECT
  91. SUM(t2.todo) AS todo,
  92. SUM(t2.undone) AS undone,
  93. SUM(t2.done) AS done,
  94. t2.`year`,
  95. t1.account,
  96. realname,
  97. dept
  98. FROM zt_user t1
  99. LEFT JOIN (
  100. SELECT
  101. COUNT(1) AS todo,
  102. SUM(CASE WHEN `status` != 'done' THEN 1 ELSE 0 END) AS undone,
  103. SUM(CASE WHEN `status` = 'done' THEN 1 ELSE 0 END) AS done,
  104. account,
  105. YEAR(`date`) AS `year`
  106. FROM zt_todo
  107. WHERE deleted = '0'
  108. GROUP BY account, `year`
  109. ) t2 ON t1.account = t2.account
  110. WHERE t1.deleted = '0'
  111. GROUP BY t2.`year`, t1.account, realname, dept;
  112. EOT
  113. ,
  114. 'settings' => array
  115. (
  116. 'value' => array('type' => 'agg', 'field' => 'todo', 'agg' => 'sum'),
  117. 'title' => array('type' => 'text', 'name' => ''),
  118. 'type' => 'value'
  119. ),
  120. 'filters' => array(),
  121. 'stage' => 'published',
  122. 'builtin' => '1'
  123. );
  124. $config->bi->builtin->charts[] = array
  125. (
  126. 'id' => 1005,
  127. 'name' => '年度总结-贡献数',
  128. 'code' => 'annualSummary_countContributions',
  129. 'dimension' => '1',
  130. 'type' => 'card',
  131. 'group' => '0',
  132. 'sql' => <<<EOT
  133. select tt.year,tt.actor as account, count(1) as num from (
  134. SELECT YEAR(t1.date) as `year`, t1.actor, t1.objectType, t1.action
  135. from zt_action t1
  136. WHERE
  137. (
  138. (t1.objectType = 'bug' AND t1.action in('resolved','opened','closed','activated') and (select deleted from zt_bug where id = t1.objectID) = '0')
  139. OR (t1.objectType = 'task' AND t1.action in('finished','opened','closed','activated','assigned') and (select deleted from zt_task where id = t1.objectID) = '0')
  140. OR (t1.objectType = 'story' AND t1.action in('opened','reviewed','closed') and (select deleted from zt_story where id = t1.objectID) = '0')
  141. OR (t1.objectType = 'execution' AND t1.action in('opened','edited','started','closed') and (select deleted from zt_project where id = t1.objectID) = '0')
  142. OR (t1.objectType = 'product' AND t1.action in('opened','edited','closed') and (select deleted from zt_product where id = t1.objectID) = '0')
  143. OR (t1.objectType = 'case' AND t1.action in('opened','run') and (select deleted from zt_case where id = t1.objectID) = '0')
  144. OR (t1.objectType = 'testtask' AND t1.action in('opened','edited') and (select deleted from zt_testtask where id = t1.objectID) = '0')
  145. OR (t1.objectType = 'productplan' AND t1.action in('opened') and (select deleted from zt_productplan where id = t1.objectID) = '0')
  146. OR (t1.objectType = 'release' AND t1.action in('opened') and (select deleted from zt_release where id = t1.objectID) = '0')
  147. OR (t1.objectType = 'doc' AND t1.action in('created','edited') and (select deleted from zt_doc where id = t1.objectID) = '0')
  148. OR (t1.objectType = 'build' AND t1.action in('opened') and (select deleted from zt_build where id = t1.objectID) = '0')
  149. )
  150. union all
  151. SELECT YEAR(t1.date) as `year`, t1.actor, 'code' as objectType, t1.action from zt_action t1
  152. where t1.action in ('gitcommited', 'svncommited') and t1.objectType = 'task'
  153. ) tt group by actor
  154. EOT
  155. ,
  156. 'settings' => array
  157. (
  158. 'value' => array('type' => 'agg', 'field' => 'num', 'agg' => 'sum'),
  159. 'title' => array('type' => 'text', 'name' => ''),
  160. 'type' => 'value'
  161. ),
  162. 'filters' => array(),
  163. 'stage' => 'published',
  164. 'builtin' => '1'
  165. );
  166. $config->bi->builtin->charts[] = array
  167. (
  168. 'id' => 1006,
  169. 'name' => '年度总结-贡献数据',
  170. 'code' => 'annualSummary_contributions',
  171. 'dimension' => '1',
  172. 'type' => 'bar',
  173. 'group' => '0',
  174. 'sql' => <<<EOT
  175. SELECT t2.year, t1.dept, t2.account, t2.objectType, t2.create, t2.edit
  176. FROM zt_user AS t1
  177. LEFT JOIN
  178. (SELECT
  179. YEAR(t1.date) AS `year`, t1.actor AS account, '产品' AS objectType,
  180. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  181. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  182. FROM zt_action AS t1
  183. LEFT JOIN zt_product AS t2 ON t1.objectID = t2.id
  184. WHERE t1.objectType = 'product' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  185. GROUP BY `year`, actor, objectType
  186. UNION ALL
  187. SELECT
  188. YEAR(t1.date) AS `year`, t1.actor, '需求' AS objectType,
  189. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  190. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  191. FROM zt_action AS t1
  192. LEFT JOIN zt_story AS t2 ON t1.objectID = t2.id
  193. WHERE t1.objectType = 'story' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  194. GROUP BY `year`, actor, objectType
  195. UNION ALL
  196. SELECT
  197. YEAR(t1.date) AS `year`, t1.actor, '计划' AS objectType,
  198. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  199. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  200. FROM zt_action AS t1
  201. LEFT JOIN zt_productplan AS t2 ON t1.objectID = t2.id
  202. WHERE t1.objectType = 'productplan' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  203. GROUP BY `year`, actor, objectType
  204. UNION ALL
  205. SELECT
  206. YEAR(t1.date) AS `year`, t1.actor, '发布' AS objectType,
  207. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  208. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  209. FROM zt_action AS t1
  210. LEFT JOIN zt_release AS t2 ON t1.objectID = t2.id
  211. WHERE t1.objectType = 'release' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  212. GROUP BY `year`, actor, objectType
  213. UNION ALL
  214. SELECT
  215. YEAR(t1.date) AS `year`, t1.actor, '执行' AS objectType,
  216. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  217. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  218. FROM zt_action AS t1
  219. LEFT JOIN zt_project AS t2 ON t1.objectID = t2.id
  220. WHERE t1.objectType = 'execution' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0' AND t2.type IN ('sprint', 'stage', 'kanban') AND t2.isTpl = '0'
  221. GROUP BY `year`, actor, objectType
  222. UNION ALL
  223. SELECT
  224. YEAR(t1.date) AS `year`, t1.actor, '任务' AS objectType,
  225. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  226. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  227. FROM zt_action AS t1
  228. LEFT JOIN zt_task AS t2 ON t1.objectID = t2.id
  229. WHERE t1.objectType = 'task' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  230. GROUP BY `year`, actor, objectType
  231. UNION ALL
  232. SELECT
  233. YEAR(t1.date) AS `year`, t1.actor, 'Bug' AS objectType,
  234. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  235. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  236. FROM zt_action AS t1
  237. LEFT JOIN zt_bug AS t2 ON t1.objectID = t2.id
  238. WHERE t1.objectType = 'bug' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  239. GROUP BY `year`, actor, objectType
  240. UNION ALL
  241. SELECT
  242. YEAR(t1.date) AS `year`, t1.actor, '版本' AS objectType,
  243. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  244. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  245. FROM zt_action AS t1
  246. LEFT JOIN zt_build AS t2 ON t1.objectID = t2.id
  247. WHERE t1.objectType = 'build' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  248. GROUP BY `year`, actor, objectType
  249. UNION ALL
  250. SELECT
  251. YEAR(t1.date) AS `year`, t1.actor, '用例' AS objectType,
  252. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  253. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  254. FROM zt_action AS t1
  255. LEFT JOIN zt_case AS t2 ON t1.objectID = t2.id
  256. WHERE t1.objectType = 'case' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  257. GROUP BY `year`, actor, objectType
  258. UNION ALL
  259. SELECT
  260. YEAR(t1.date) AS `year`, t1.actor, '测试单' AS objectType,
  261. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  262. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  263. FROM zt_action AS t1
  264. LEFT JOIN zt_testtask AS t2 ON t1.objectID = t2.id
  265. WHERE t1.objectType = 'testtask' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  266. GROUP BY `year`, actor, objectType
  267. UNION ALL
  268. SELECT
  269. YEAR(t1.date) AS `year`, t1.actor, '文档' AS objectType,
  270. SUM(IF(t1.action = 'opened', 1, 0)) AS `create`,
  271. SUM(IF(t1.action = 'edited', 1, 0)) AS `edit`
  272. FROM zt_action AS t1
  273. LEFT JOIN zt_doc AS t2 ON t1.objectID = t2.id
  274. WHERE t1.objectType = 'doc' AND t1.action IN ('opened', 'edited') AND t2.deleted = '0'
  275. GROUP BY `year`, actor, objectType) AS t2 ON t1.account = t2.account
  276. WHERE t2.account IS NOT NULL
  277. EOT
  278. ,
  279. 'settings' => array
  280. (
  281. 'xaxis' => array
  282. (
  283. array('field' => 'objectType', 'name' => '对象类型')
  284. ),
  285. 'yaxis' => array
  286. (
  287. array('type' => 'agg', 'field' => 'create', 'agg' => 'sum', 'name' => '创建', 'valOrAgg' => 'sum'),
  288. array('type' => 'value', 'field' => 'edit', 'agg' => 'sum', 'name' => '编辑', 'valOrAgg' => 'sum')
  289. )
  290. ),
  291. 'filters' => array(),
  292. 'stage' => 'published',
  293. 'builtin' => '1'
  294. );
  295. $config->bi->builtin->charts[] = array
  296. (
  297. 'id' => 1007,
  298. 'name' => '年度总结-能力雷达图',
  299. 'code' => 'annualSummary_capabilityRadar',
  300. 'dimension' => '1',
  301. 'type' => 'radar',
  302. 'group' => '0',
  303. 'sql' => <<<EOT
  304. select tt.year, tt.actor AS account,tt.dimension, count(1) as num from (
  305. SELECT YEAR(t1.date) as `year`, t1.actor, 'product' as dimension
  306. from zt_action t1
  307. WHERE
  308. (
  309. (t1.objectType = 'product' AND t1.action in('opened','edited') and (select deleted from zt_product where id = t1.objectID) = '0')
  310. OR (t1.objectType = 'story' AND t1.action in('opened','reviewed','closed') and (select deleted from zt_story where id = t1.objectID) = '0')
  311. OR (t1.objectType = 'productplan' AND t1.action in('opened') and (select deleted from zt_productplan where id = t1.objectID) = '0')
  312. OR (t1.objectType = 'release' AND t1.action in('opened') and (select deleted from zt_release where id = t1.objectID) = '0')
  313. )
  314. union all
  315. SELECT YEAR(t1.date) as `year`, t1.actor, 'execution' as dimension
  316. from zt_action t1
  317. WHERE
  318. (
  319. (t1.objectType = 'execution' AND t1.action in('opened','edited','started','closed') and (select deleted from zt_project where id = t1.objectID) = '0')
  320. OR (t1.objectType = 'build' AND t1.action in('opened') and (select deleted from zt_build where id = t1.objectID) = '0')
  321. OR (t1.objectType = 'task' AND t1.action in('opened','closed','activated','assigned') and (select deleted from zt_task where id = t1.objectID) = '0')
  322. )
  323. union all
  324. SELECT YEAR(t1.date) as `year`, t1.actor, 'devel' as dimension
  325. from zt_action t1
  326. WHERE
  327. (
  328. (t1.objectType = 'execution' AND t1.action in('opened','edited','started','closed') and (select deleted from zt_project where id = t1.objectID) = '0')
  329. OR (t1.objectType = 'build' AND t1.action in('opened') and (select deleted from zt_build where id = t1.objectID) = '0')
  330. OR (t1.objectType = 'task' AND t1.action in('opened','closed','assigned') and (select deleted from zt_task where id = t1.objectID) = '0')
  331. OR (t1.objectType = 'task' and t1.action in ('gitcommited', 'svncommited'))
  332. OR (t1.objectType = 'bug' AND t1.action in('resolved') and (select deleted from zt_bug where id = t1.objectID) = '0')
  333. )
  334. union all
  335. SELECT YEAR(t1.date) as `year`, t1.actor, 'qa' as dimension
  336. from zt_action t1
  337. WHERE
  338. (
  339. (t1.objectType = 'bug' AND t1.action in('opened','closed','activated') and (select deleted from zt_bug where id = t1.objectID) = '0')
  340. OR (t1.objectType = 'case' AND t1.action in('opened','run') and (select deleted from zt_case where id = t1.objectID) = '0')
  341. OR (t1.objectType = 'testtask' AND t1.action in('opened','edited') and (select deleted from zt_testtask where id = t1.objectID) = '0')
  342. )
  343. ) tt WHERE tt.year != '0000'
  344. GROUP BY tt.year, tt.dimension
  345. EOT
  346. ,
  347. 'settings' => array
  348. (
  349. 'group' => array
  350. (
  351. array('field' => 'dimension', 'name' => '维度')
  352. ),
  353. 'metric' => array
  354. (
  355. array('type' => 'value', 'field' => 'num', 'agg' => 'value', 'name' => '产品管理', 'key' => 'product', 'valOrAgg' => 'value'),
  356. array('type' => 'value', 'field' => 'num', 'agg' => 'value', 'name' => '项目管理', 'key' => 'project', 'valOrAgg' => 'value'),
  357. array('type' => 'value', 'field' => 'num', 'agg' => 'value', 'name' => '研发', 'key' => 'dev', 'valOrAgg' => 'value'),
  358. array('type' => 'value', 'field' => 'num', 'agg' => 'value', 'name' => '测试', 'key' => 'qa', 'valOrAgg' => 'value'),
  359. array('type' => 'value', 'field' => 'num', 'agg' => 'value', 'name' => '其他', 'key' => 'other', 'valOrAgg' => 'value')
  360. )
  361. ),
  362. 'filters' => array(),
  363. 'stage' => 'published',
  364. 'builtin' => '1'
  365. );
  366. $config->bi->builtin->charts[] = array
  367. (
  368. 'id' => 1008,
  369. 'name' => '年度总结-迭代数据',
  370. 'code' => 'annualSummary_executions',
  371. 'dimension' => '1',
  372. 'type' => 'table',
  373. 'group' => '0',
  374. 'sql' => <<<EOT
  375. SELECT
  376. tt.id,
  377. tt.name,
  378. tt.year,
  379. tt.account,
  380. tt.finishedStory,
  381. tt.finishedTask,
  382. count(t3.id) as resolvedBug
  383. from (
  384. SELECT
  385. tt.id,
  386. t2.name,
  387. tt.year,
  388. tt.account,
  389. SUM(if((t1.story != 0), 1 , 0)) as finishedStory,
  390. count(t1.id) as finishedTask
  391. from (
  392. SELECT
  393. *
  394. from (
  395. SELECT id, YEAR(begin) as `year`, openedBy as account from zt_project
  396. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(begin) != '0000' AND isTpl = '0'
  397. union all
  398. SELECT id, YEAR(begin) as `year`, PO as account from zt_project
  399. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(begin) != '0000' AND isTpl = '0'
  400. union all
  401. SELECT id, YEAR(begin) as `year`, PM as account from zt_project
  402. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(begin) != '0000' AND isTpl = '0'
  403. union all
  404. SELECT id, YEAR(begin) as `year`, QD as account from zt_project
  405. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(begin) != '0000' AND isTpl = '0'
  406. union all
  407. SELECT id, YEAR(begin) as `year`, RD as account from zt_project
  408. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(begin) != '0000' AND isTpl = '0'
  409. union all
  410. SELECT id, YEAR(end) as `year`, openedBy as account from zt_project
  411. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(end) != '0000' AND isTpl = '0'
  412. union all
  413. SELECT id, YEAR(end) as `year`, PO as account from zt_project
  414. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(end) != '0000' AND isTpl = '0'
  415. union all
  416. SELECT id, YEAR(end) as `year`, PM as account from zt_project
  417. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(end) != '0000' AND isTpl = '0'
  418. union all
  419. SELECT id, YEAR(end) as `year`, QD as account from zt_project
  420. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(end) != '0000' AND isTpl = '0'
  421. union all
  422. SELECT id, YEAR(end) as `year`, RD as account from zt_project
  423. WHERE deleted = '0' AND type = 'sprint' and multiple = '1' and YEAR(end) != '0000' AND isTpl = '0'
  424. union all
  425. SELECT t1.root as id, YEAR(t1.`join`) as `year`, t1.account from zt_team t1
  426. RIGHT JOIN zt_project t2 on t2.id = t1.root and t2.deleted = '0' and t2.type = 'sprint' AND t2.isTpl = '0'
  427. WHERE t1.type = 'execution' and YEAR(t1.`join`) != '0000'
  428. union all
  429. SELECT t1.execution as id, YEAR(t1.finishedDate) as `year`, t1.finishedBy as account from zt_task t1
  430. RIGHT JOIN zt_project t2 on t2.id = t1.execution and t2.deleted = '0' and t2.type = 'sprint' AND t2.isTpl = '0'
  431. WHERE t1.deleted = '0' and YEAR(t1.finishedDate) != '0000'
  432. ) tt
  433. where tt.account != ''
  434. GROUP BY tt.id, tt.`year`, tt.account
  435. ) tt
  436. LEFT JOIN zt_task t1 on t1.execution = tt.id and YEAR(t1.finishedDate) = tt.year and t1.deleted = '0' and t1.finishedBy = tt.account
  437. LEFT JOIN zt_project t2 on t2.id = tt.id AND t2.isTpl = '0'
  438. GROUP BY tt.id, tt.`year`, tt.account
  439. ) tt
  440. LEFT JOIN zt_bug t2 on t2.resolvedBy = tt.account and YEAR(t2.resolvedDate) = tt.year
  441. left join zt_build t3 on t2.resolvedBuild = t3.id and t3.execution = tt.id
  442. WHERE t2.deleted = '0'
  443. GROUP BY tt.account, tt.`year`, tt.id
  444. EOT
  445. ,
  446. 'settings' => array
  447. (
  448. 'group' => array(),
  449. 'column' => array
  450. (
  451. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '迭代名称'),
  452. array('field' => 'finishedStory', 'valOrAgg' => 'value', 'name' => '完成需求数'),
  453. array('field' => 'finishedTask', 'valOrAgg' => 'value', 'name' => '完成任务数'),
  454. array('field' => 'resolvedBug', 'valOrAgg' => 'value', 'name' => '解决Bug数')
  455. ),
  456. 'filter' => array()
  457. ),
  458. 'filters' => array(),
  459. 'stage' => 'published',
  460. 'builtin' => '1'
  461. );
  462. $config->bi->builtin->charts[] = array
  463. (
  464. 'id' => 1009,
  465. 'name' => '年度总结-产品数据',
  466. 'code' => 'annualSummary_products',
  467. 'dimension' => '1',
  468. 'type' => 'table',
  469. 'group' => '0',
  470. 'sql' => <<<EOT
  471. select * from (
  472. select tt.id, t2.name, tt.year, tt.account, tt.plans, tt.requirement, tt.story, count(t1.id) as closedStory
  473. from(
  474. select tt.id, tt.year, tt.account, tt.plans,
  475. sum(if((type = 'requirement'), 1, 0)) as requirement,
  476. sum(if((type = 'story'), 1, 0)) as story
  477. from (
  478. select tt.id, tt.year, tt.account,
  479. count(t2.id) as plans
  480. from (
  481. select * from (
  482. select id, YEAR(createdDate) as `year`, createdBy as account from zt_product
  483. where deleted = '0' and shadow = '0'
  484. union all
  485. select id, YEAR(createdDate) as `year`, PO as account from zt_product
  486. where deleted = '0' and shadow = '0'
  487. union all
  488. select id, YEAR(createdDate) as `year`, QD as account from zt_product
  489. where deleted = '0' and shadow = '0'
  490. union all
  491. select id, YEAR(createdDate) as `year`, RD as account from zt_product
  492. where deleted = '0' and shadow = '0'
  493. ) tt
  494. WHERE tt.account != '' and tt.year != '0000'
  495. GROUP BY tt.account, tt.year, tt.id
  496. ) tt
  497. LEFT JOIN zt_productplan t1 on t1.product = tt.id
  498. LEFT JOIN zt_action t2 on t1.id = t2.objectID and YEAR(t2.date) = tt.year
  499. and t2.objectType = 'productplan'
  500. and t1.deleted = '0'
  501. and t2.actor = tt.account
  502. and t2.action = 'opened'
  503. GROUP BY tt.account, tt.year, tt.id) tt
  504. LEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.openedDate) = tt.year and t1.openedBy = tt.account and t1.deleted = '0'
  505. GROUP BY tt.account, tt.year, tt.id) tt
  506. LEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.closedDate) = tt.year and t1.closedBy = tt.account and t1.deleted = '0'
  507. LEFT JOIN zt_product t2 on t2.id = tt.id
  508. GROUP BY tt.account, tt.year, tt.id) tt
  509. WHERE tt.account = 'zhangpeng'
  510. EOT
  511. ,
  512. 'settings' => array
  513. (
  514. 'group' => array(),
  515. 'column' => array
  516. (
  517. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '产品名称'),
  518. array('field' => 'plan', 'valOrAgg' => 'value', 'name' => '计划数'),
  519. array('field' => 'requirement', 'valOrAgg' => 'value', 'name' => '创建用户需求数'),
  520. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '创建需求数'),
  521. array('field' => 'closedStory', 'valOrAgg' => 'value', 'name' => '关闭需求数')
  522. ),
  523. 'filter' => array()
  524. ),
  525. 'filters' => array(),
  526. 'stage' => 'published',
  527. 'builtin' => '1'
  528. );
  529. $config->bi->builtin->charts[] = array
  530. (
  531. 'id' => 1010,
  532. 'name' => '年度总结-任务状态分布',
  533. 'code' => 'annualSummary_taskStatus',
  534. 'dimension' => '1',
  535. 'type' => 'pie',
  536. 'group' => '0',
  537. 'sql' => <<<EOT
  538. SELECT
  539. YEAR(t1.date) AS `year`,
  540. t3.account,
  541. t3.realname,
  542. CASE t2.status
  543. WHEN 'wait' THEN '未开始'
  544. WHEN 'doing' THEN '进行中'
  545. WHEN 'done' THEN '已完成'
  546. WHEN 'closed' THEN '已关闭'
  547. ELSE '未设置' END status,
  548. t1.id
  549. FROM zt_action t1
  550. LEFT JOIN zt_task t2 on t1.objectID=t2.id RIGHT JOIN zt_user t3 on t1.actor=t3.account
  551. WHERE t1.objectType = 'task'
  552. and t2.deleted = '0'
  553. EOT
  554. ,
  555. 'settings' => array
  556. (
  557. 'group' => array
  558. (
  559. array('field' => 'status', 'name' => '状态')
  560. ),
  561. 'metric' => array
  562. (
  563. array('type' => 'agg', 'field' => 'id', 'agg' => 'count', 'name' => '任务数', 'valOrAgg' => 'count')
  564. )
  565. ),
  566. 'filters' => array(),
  567. 'stage' => 'published',
  568. 'builtin' => '1'
  569. );
  570. $config->bi->builtin->charts[] = array
  571. (
  572. 'id' => 1011,
  573. 'name' => '年度总结-每月任务操作情况',
  574. 'code' => 'annualSummary_monthlyTaskAction',
  575. 'dimension' => '1',
  576. 'type' => 'bar',
  577. 'group' => '0',
  578. 'sql' => <<<EOT
  579. SELECT t2.opened,t2.started,t2.finished,t2.paused,t2.activated,t2.canceled,t2.closed,t1.account,t2.actionDate,YEAR(CONCAT(t2.actionDate, '-01')) AS `year`,realname,t3.`name` AS deptName FROM zt_user AS t1
  580. LEFT JOIN (
  581. SELECT t21.actor,LEFT(t21.`date`,7) AS actionDate,
  582. SUM(if(t21.action = 'opened', 1, 0)) as opened,
  583. SUM(if(t21.action = 'started', 1, 0)) as started,
  584. SUM(if(t21.action = 'finished', 1, 0)) as finished,
  585. SUM(if(t21.action = 'paused', 1, 0)) as paused,
  586. SUM(if(t21.action = 'activated', 1, 0)) as activated,
  587. SUM(if(t21.action = 'canceled', 1, 0)) as canceled,
  588. SUM(if(t21.action = 'closed', 1, 0)) as closed FROM zt_action AS t21
  589. LEFT JOIN zt_story AS t22 ON t21.objectID=t22.id
  590. WHERE t21.objectType='bug'
  591. AND t22.deleted='0'
  592. GROUP BY t21.actor,actionDate
  593. ) AS t2 ON t1.account=t2.actor
  594. LEFT JOIN zt_dept AS t3 ON t1.dept=t3.id
  595. WHERE t1.deleted='0'
  596. AND t2.actor IS NOT NULL
  597. GROUP BY t2.actionDate,deptName,t1.account,realname
  598. EOT
  599. ,
  600. 'settings' => array
  601. (
  602. 'xaxis' => array
  603. (
  604. array('field' => 'actionDate', 'name' => '日期', 'group' => 'value')
  605. ),
  606. 'yaxis' => array
  607. (
  608. array('type' => 'agg', 'field' => 'opened', 'agg' => 'sum', 'name' => '创建', 'valOrAgg' => 'sum'),
  609. array('type' => 'agg', 'field' => 'started', 'agg' => 'sum', 'name' => '开始', 'valOrAgg' => 'sum'),
  610. array('type' => 'agg', 'field' => 'finished', 'agg' => 'sum', 'name' => '完成', 'valOrAgg' => 'sum'),
  611. array('type' => 'agg', 'field' => 'paused', 'agg' => 'sum', 'name' => '暂停', 'valOrAgg' => 'sum'),
  612. array('type' => 'agg', 'field' => 'activated', 'agg' => 'sum', 'name' => '激活', 'valOrAgg' => 'sum'),
  613. array('type' => 'agg', 'field' => 'canceled', 'agg' => 'sum', 'name' => '取消', 'valOrAgg' => 'sum'),
  614. array('type' => 'agg', 'field' => 'closed', 'agg' => 'sum', 'name' => '关闭', 'valOrAgg' => 'sum')
  615. )
  616. ),
  617. 'filters' => array(),
  618. 'stage' => 'published',
  619. 'builtin' => '1'
  620. );
  621. $config->bi->builtin->charts[] = array
  622. (
  623. 'id' => 1012,
  624. 'name' => '年度总结-需求状态分布',
  625. 'code' => 'annualSummary_storyStatus',
  626. 'dimension' => '1',
  627. 'type' => 'pie',
  628. 'group' => '0',
  629. 'sql' => <<<EOT
  630. SELECT
  631. YEAR(t1.date) AS `year`,
  632. t3.account,
  633. t3.realname,
  634. CASE t2.status
  635. WHEN 'wait' THEN '未开始'
  636. WHEN 'doing' THEN '进行中'
  637. WHEN 'done' THEN '已完成'
  638. WHEN 'colsed' THEN '已关闭'
  639. ELSE '未设置'
  640. END status,
  641. t1.id
  642. FROM zt_action t1
  643. LEFT JOIN zt_task t2 on t1.objectID=t2.id RIGHT JOIN zt_user t3 on t1.actor=t3.account
  644. WHERE t1.objectType = 'story'
  645. and t2.deleted = '0'
  646. EOT
  647. ,
  648. 'settings' => array
  649. (
  650. 'group' => array
  651. (
  652. array('field' => 'status', 'name' => '状态')
  653. ),
  654. 'metric' => array
  655. (
  656. array('type' => 'agg', 'field' => 'id', 'agg' => 'count', 'name' => '需求数', 'valOrAgg' => 'count')
  657. )
  658. ),
  659. 'filters' => array(),
  660. 'stage' => 'published',
  661. 'builtin' => '1'
  662. );
  663. $config->bi->builtin->charts[] = array
  664. (
  665. 'id' => 1013,
  666. 'name' => '年度总结-每月需求操作情况',
  667. 'code' => 'annualSummary_monthlyStoryAction',
  668. 'dimension' => '1',
  669. 'type' => 'bar',
  670. 'group' => '0',
  671. 'sql' => <<<EOT
  672. SELECT t2.opened,t2.activated,t2.closed,t2.`changed`,t1.account,t2.actionDate,YEAR(CONCAT(t2.actionDate,'-01')) AS `year`,realname,t3.`name` AS deptName FROM zt_user AS t1
  673. LEFT JOIN (
  674. SELECT t21.actor,LEFT(t21.`date`, 7) AS actionDate,
  675. SUM(IF(t21.action='opened',1,0)) AS opened,
  676. SUM(IF(t21.action='activated',1,0)) AS activated,
  677. SUM(IF(t21.action='closed',1,0)) AS closed,
  678. SUM(IF(t21.action='changed',1,0)) AS `changed` FROM zt_action AS t21
  679. LEFT JOIN zt_story AS t22 ON t21.objectID=t22.id
  680. WHERE t21.objectType='story'
  681. AND t22.deleted='0'
  682. GROUP BY t21.actor,actionDate
  683. ) AS t2 ON t1.account=t2.actor
  684. LEFT JOIN zt_dept AS t3 ON t1.dept=t3.id
  685. WHERE t1.deleted='0'
  686. AND t2.actor IS NOT NULL
  687. GROUP BY t2.actionDate,deptName,t1.account,realname
  688. EOT
  689. ,
  690. 'settings' => array
  691. (
  692. 'xaxis' => array
  693. (
  694. array('field' => 'actionDate', 'name' => '日期', 'group' => 'value')
  695. ),
  696. 'yaxis' => array
  697. (
  698. array('type' => 'value', 'field' => 'opened', 'agg' => 'value', 'name' => '创建', 'valOrAgg' => 'value'),
  699. array('type' => 'value', 'field' => 'activated', 'agg' => 'value', 'name' => '激活', 'valOrAgg' => 'value'),
  700. array('type' => 'value', 'field' => 'changed', 'agg' => 'value', 'name' => '变更', 'valOrAgg' => 'value'),
  701. array('type' => 'value', 'field' => 'closed', 'agg' => 'value', 'name' => '关闭', 'valOrAgg' => 'value')
  702. )
  703. ),
  704. 'filters' => array(),
  705. 'stage' => 'published',
  706. 'builtin' => '1'
  707. );
  708. $config->bi->builtin->charts[] = array
  709. (
  710. 'id' => 1014,
  711. 'name' => '年度总结-Bug状态分布',
  712. 'code' => 'annualSummary_bugStatus',
  713. 'dimension' => '1',
  714. 'type' => 'pie',
  715. 'group' => '0',
  716. 'sql' => <<<EOT
  717. SELECT
  718. YEAR(t1.date) AS `year`, t3.account,
  719. t3.realname,
  720. CASE t2.status
  721. WHEN 'wait' THEN '未开始'
  722. WHEN 'doing' THEN '进行中'
  723. WHEN 'done' THEN '已完成'
  724. WHEN 'closed' THEN '已关闭'
  725. ELSE '未设置'
  726. END status,
  727. t1.id
  728. FROM zt_action t1
  729. LEFT JOIN zt_task t2 on t1.objectID=t2.id RIGHT JOIN zt_user t3 on t1.actor=t3.account
  730. WHERE t1.objectType = 'bug'
  731. and t2.deleted = '0'
  732. EOT
  733. ,
  734. 'settings' => array
  735. (
  736. 'group' => array
  737. (
  738. array('field' => 'status', 'name' => '状态')
  739. ),
  740. 'metric' => array
  741. (
  742. array('type' => 'agg', 'field' => 'id', 'agg' => 'count', 'name' => 'Bug数', 'valOrAgg' => 'count')
  743. )
  744. ),
  745. 'filters' => array(),
  746. 'stage' => 'published',
  747. 'builtin' => '1'
  748. );
  749. $config->bi->builtin->charts[] = array
  750. (
  751. 'id' => 1015,
  752. 'name' => '年度总结-每月Bug操作情况',
  753. 'code' => 'annualSummary_monthlyBugAction',
  754. 'dimension' => '1',
  755. 'type' => 'bar',
  756. 'group' => '0',
  757. 'sql' => <<<EOT
  758. SELECT t2.opened,t2.bugconfirmed,t2.activated,t2.resolved,t2.closed,t1.account,t2.actionDate,YEAR(CONCAT(t2.actionDate, '-01')) AS
  759. `year`,realname,t3.`name` AS deptName FROM zt_user AS t1
  760. LEFT JOIN (
  761. SELECT t21.actor,LEFT(t21.`date`, 7) AS actionDate,
  762. SUM(IF(t21.action='opened',1,0)) AS opened,
  763. SUM(IF(t21.action='bugconfirmed',1,0)) AS bugconfirmed,
  764. SUM(IF(t21.action='activated',1,0)) AS activated,
  765. SUM(IF(t21.action='resolved',1,0)) AS resolved,
  766. SUM(IF(t21.action='closed',1,0)) AS closed FROM zt_action AS t21
  767. LEFT JOIN zt_story AS t22 ON t21.objectID=t22.id
  768. WHERE t21.objectType='bug'
  769. AND t22.deleted='0'
  770. GROUP BY t21.actor,actionDate
  771. ) AS t2 ON t1.account=t2.actor
  772. LEFT JOIN zt_dept AS t3 ON t1.dept=t3.id
  773. WHERE t1.deleted='0'
  774. AND t2.actor IS NOT NULL
  775. GROUP BY t2.actionDate,deptName,t1.account,realname
  776. EOT
  777. ,
  778. 'settings' => array
  779. (
  780. 'xaxis' => array
  781. (
  782. array('field' => 'actionDate', 'name' => '日期', 'group' => 'value')
  783. ),
  784. 'yaxis' => array
  785. (
  786. array('type' => 'value', 'field' => 'opened', 'agg' => 'value', 'name' => '创建', 'valOrAgg' => 'value'),
  787. array('type' => 'value', 'field' => 'bugconfirmed', 'agg' => 'value', 'name' => '确认', 'valOrAgg' => 'value'),
  788. array('type' => 'value', 'field' => 'activated', 'agg' => 'value', 'name' => '激活', 'valOrAgg' => 'value'),
  789. array('type' => 'value', 'field' => 'resolved', 'agg' => 'value', 'name' => '解决', 'valOrAgg' => 'value'),
  790. array('type' => 'value', 'field' => 'closed', 'agg' => 'value', 'name' => '关闭', 'valOrAgg' => 'value')
  791. )
  792. ),
  793. 'filters' => array(),
  794. 'stage' => 'published',
  795. 'builtin' => '1'
  796. );
  797. $config->bi->builtin->charts[] = array
  798. (
  799. 'id' => 1016,
  800. 'name' => '年度总结-用例结果分布',
  801. 'code' => 'annualSummary_caseResult',
  802. 'dimension' => '1',
  803. 'type' => 'pie',
  804. 'group' => '0',
  805. 'sql' => <<<EOT
  806. SELECT count ,t2.caseResult as status,t2.`year`, t1.account, realname, dept
  807. FROM zt_user t1
  808. LEFT JOIN (
  809. SELECT t21.lastRunner, YEAR(t21.`date`) as `year`, t21.caseResult, count(distinct t21.`id`) as count
  810. FROM zt_testresult t21
  811. LEFT JOIN zt_case t22 on t21.case = t22.id
  812. WHERE t22.deleted = '0'
  813. GROUP BY t21.lastRunner, `year`, t21.caseResult
  814. ) t2 on t1.account = t2.lastRunner
  815. WHERE t1.deleted = '0'
  816. GROUP BY t2.caseResult,t2.`year`, t1.account, realname, dept
  817. EOT
  818. ,
  819. 'settings' => array
  820. (
  821. 'group' => array
  822. (
  823. array('field' => 'status', 'name' => '状态')
  824. ),
  825. 'metric' => array
  826. (
  827. array('type' => 'agg', 'field' => 'id', 'agg' => 'count', 'name' => '个数', 'valOrAgg' => 'count')
  828. )
  829. ),
  830. 'filters' => array(),
  831. 'stage' => 'published',
  832. 'builtin' => '1'
  833. );
  834. $config->bi->builtin->charts[] = array
  835. (
  836. 'id' => 1017,
  837. 'name' => '年度总结-每月用例操作情况',
  838. 'code' => 'annualSummary_monthlyCaseAction',
  839. 'dimension' => '1',
  840. 'type' => 'bar',
  841. 'group' => '0',
  842. 'sql' => <<<EOT
  843. SELECT SUM(createdCases) AS createdCases, SUM(toBugCases) AS toBugCases, SUM(runCases) AS runCases, YEAR(CONCAT(t2.actionDate, '-01')) AS `year`, t1.account, realname, dept
  844. FROM zt_user t1
  845. LEFT JOIN (
  846. SELECT t21.actor, LEFT(t21.`date`, 7) as actionDate,
  847. SUM(IF((t22.id IS NOT NULL AND t23.id IS NULL), 1, 0)) AS createdCases,
  848. SUM(IF((t22.id IS NOT NULL AND t23.id IS NOT NULL), 1, 0)) AS toBugCases,
  849. SUM(IF((t24.lastRunner = t21.actor AND t21.action = 'run' AND t21.`date` = t24.`date`), 1, 0)) AS runCases
  850. FROM zt_action t21
  851. LEFT JOIN zt_case t22 on t21.objectID = t22.id
  852. LEFT JOIN zt_bug t23 on t22.id = t23.case
  853. LEFT JOIN zt_testresult t24 on t22.id = t24.`case` AND t24.lastRunner = t21.actor AND t21.action = 'run' AND t21.`date` = t24.`date`
  854. WHERE t21.objectType = 'case'
  855. AND t21.action in ('opened', 'run')
  856. AND t22.deleted = '0'
  857. AND (t23.deleted = '0' OR t23.id IS NULL)
  858. GROUP BY t21.actor, actionDate
  859. ) t2 on t1.account = t2.actor
  860. WHERE t1.deleted = '0'
  861. AND t2.actor is not null
  862. GROUP BY t2.actionDate, t1.account, realname, dept
  863. EOT
  864. ,
  865. 'settings' => array
  866. (
  867. 'xaxis' => array
  868. (
  869. array('field' => 'actionDate', 'name' => '日期', 'group' => 'value')
  870. ),
  871. 'yaxis' => array
  872. (
  873. array('type' => 'value', 'field' => 'createdCases', 'agg' => 'value', 'name' => '创建', 'valOrAgg' => 'value'),
  874. array('type' => 'value', 'field' => 'toBugCases', 'agg' => 'value', 'name' => '转Bug', 'valOrAgg' => 'value'),
  875. array('type' => 'value', 'field' => 'runCases', 'agg' => 'value', 'name' => '执行', 'valOrAgg' => 'value')
  876. )
  877. ),
  878. 'filters' => array(),
  879. 'stage' => 'published',
  880. 'builtin' => '1'
  881. );
  882. $config->bi->builtin->charts[] = array
  883. (
  884. 'id' => 1018,
  885. 'name' => '宏观数据-一级项目集个数',
  886. 'code' => 'macro_countTopProgram',
  887. 'dimension' => '1',
  888. 'type' => 'card',
  889. 'group' => '45',
  890. 'sql' => <<<EOT
  891. SELECT id,name FROM zt_project WHERE type='program' AND parent=0 AND deleted='0'
  892. EOT
  893. ,
  894. 'settings' => array
  895. (
  896. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  897. 'title' => array('type' => 'text', 'name' => ''),
  898. 'type' => 'value'
  899. ),
  900. 'filters' => array(),
  901. 'fields' => array(),
  902. 'stage' => 'published',
  903. 'builtin' => '1'
  904. );
  905. $config->bi->builtin->charts[] = array
  906. (
  907. 'id' => 1019,
  908. 'name' => '宏观数据-项目个数',
  909. 'code' => 'macro_countProject',
  910. 'dimension' => '1',
  911. 'type' => 'card',
  912. 'group' => '46',
  913. 'sql' => <<<EOT
  914. SELECT id FROM zt_project WHERE type='project' AND deleted='0' AND market = 0 AND isTpl = '0'
  915. EOT
  916. ,
  917. 'settings' => array
  918. (
  919. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  920. 'title' => array('type' => 'text', 'name' => ''),
  921. 'type' => 'value'
  922. ),
  923. 'filters' => array(),
  924. 'stage' => 'published',
  925. 'builtin' => '1'
  926. );
  927. $config->bi->builtin->charts[] = array
  928. (
  929. 'id' => 1020,
  930. 'name' => '宏观数据-产品个数',
  931. 'code' => 'macro_countProduct',
  932. 'dimension' => '1',
  933. 'type' => 'card',
  934. 'group' => '47',
  935. 'sql' => <<<EOT
  936. SELECT id FROM zt_product WHERE deleted='0' AND shadow = '0' AND vision = 'rnd'
  937. EOT
  938. ,
  939. 'settings' => array
  940. (
  941. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  942. 'title' => array('type' => 'text', 'name' => ''),
  943. 'type' => 'value'
  944. ),
  945. 'filters' => array(),
  946. 'stage' => 'published',
  947. 'builtin' => '1'
  948. );
  949. $config->bi->builtin->charts[] = array
  950. (
  951. 'id' => 1021,
  952. 'name' => '宏观数据-计划个数',
  953. 'code' => 'macro_countPlan',
  954. 'dimension' => '1',
  955. 'type' => 'card',
  956. 'group' => '48',
  957. 'sql' => <<<EOT
  958. SELECT id FROM zt_productplan WHERE deleted='0'
  959. EOT
  960. ,
  961. 'settings' => array
  962. (
  963. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  964. 'title' => array('type' => 'text', 'name' => ''),
  965. 'type' => 'value'
  966. ),
  967. 'filters' => array(),
  968. 'stage' => 'published',
  969. 'builtin' => '1'
  970. );
  971. $config->bi->builtin->charts[] = array
  972. (
  973. 'id' => 1022,
  974. 'name' => '宏观数据-执行个数',
  975. 'code' => 'macro_countExecution',
  976. 'dimension' => '1',
  977. 'type' => 'card',
  978. 'group' => '49',
  979. 'sql' => <<<EOT
  980. SELECT id FROM zt_project WHERE type IN ('sprint','stage','kanban') AND deleted='0' AND multiple = '1' AND market = 0 AND isTpl = '0'
  981. EOT
  982. ,
  983. 'settings' => array
  984. (
  985. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  986. 'title' => array('type' => 'text', 'name' => ''),
  987. 'type' => 'value'
  988. ),
  989. 'filters' => array(),
  990. 'stage' => 'published',
  991. 'builtin' => '1'
  992. );
  993. $config->bi->builtin->charts[] = array
  994. (
  995. 'id' => 1023,
  996. 'name' => '宏观数据-发布个数',
  997. 'code' => 'macro_countRelease',
  998. 'dimension' => '1',
  999. 'type' => 'card',
  1000. 'group' => '50',
  1001. 'sql' => <<<EOT
  1002. SELECT id FROM zt_release WHERE deleted='0'
  1003. EOT
  1004. ,
  1005. 'settings' => array
  1006. (
  1007. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1008. 'title' => array('type' => 'text', 'name' => ''),
  1009. 'type' => 'value'
  1010. ),
  1011. 'filters' => array(),
  1012. 'stage' => 'published',
  1013. 'builtin' => '1'
  1014. );
  1015. $config->bi->builtin->charts[] = array
  1016. (
  1017. 'id' => 1024,
  1018. 'name' => '宏观数据-需求个数',
  1019. 'code' => 'macro_countStory',
  1020. 'dimension' => '1',
  1021. 'type' => 'card',
  1022. 'group' => '51',
  1023. 'sql' => <<<EOT
  1024. SELECT id FROM zt_story WHERE deleted='0'
  1025. EOT
  1026. ,
  1027. 'settings' => array
  1028. (
  1029. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1030. 'title' => array('type' => 'text', 'name' => ''),
  1031. 'type' => 'value'
  1032. ),
  1033. 'filters' => array(),
  1034. 'stage' => 'published',
  1035. 'builtin' => '1'
  1036. );
  1037. $config->bi->builtin->charts[] = array
  1038. (
  1039. 'id' => 1025,
  1040. 'name' => '宏观数据-任务个数',
  1041. 'code' => 'macro_countTask',
  1042. 'dimension' => '1',
  1043. 'type' => 'card',
  1044. 'group' => '52',
  1045. 'sql' => <<<EOT
  1046. SELECT id FROM zt_task WHERE deleted='0' AND type != 'research' AND isTpl = '0'
  1047. EOT
  1048. ,
  1049. 'settings' => array
  1050. (
  1051. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1052. 'title' => array('type' => 'text', 'name' => ''),
  1053. 'type' => 'value'
  1054. ),
  1055. 'filters' => array(),
  1056. 'stage' => 'published',
  1057. 'builtin' => '1'
  1058. );
  1059. $config->bi->builtin->charts[] = array
  1060. (
  1061. 'id' => 1026,
  1062. 'name' => '宏观数据-缺陷个数',
  1063. 'code' => 'macro_countBug',
  1064. 'dimension' => '1',
  1065. 'type' => 'card',
  1066. 'group' => '53',
  1067. 'sql' => <<<EOT
  1068. SELECT id FROM zt_bug WHERE deleted='0'
  1069. EOT
  1070. ,
  1071. 'settings' => array
  1072. (
  1073. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1074. 'title' => array('type' => 'text', 'name' => ''),
  1075. 'type' => 'value'
  1076. ),
  1077. 'filters' => array(),
  1078. 'stage' => 'published',
  1079. 'builtin' => '1'
  1080. );
  1081. $config->bi->builtin->charts[] = array
  1082. (
  1083. 'id' => 1027,
  1084. 'name' => '宏观数据-文档个数',
  1085. 'code' => 'macro_countDoc',
  1086. 'dimension' => '1',
  1087. 'type' => 'card',
  1088. 'group' => '54',
  1089. 'sql' => <<<EOT
  1090. SELECT id FROM zt_doc WHERE deleted='0'
  1091. EOT
  1092. ,
  1093. 'settings' => array
  1094. (
  1095. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1096. 'title' => array('type' => 'text', 'name' => ''),
  1097. 'type' => 'value'
  1098. ),
  1099. 'filters' => array(),
  1100. 'stage' => 'published',
  1101. 'builtin' => '1'
  1102. );
  1103. $config->bi->builtin->charts[] = array
  1104. (
  1105. 'id' => 1028,
  1106. 'name' => '宏观数据-现有人员个数',
  1107. 'code' => 'macro_activeAccounts',
  1108. 'dimension' => '1',
  1109. 'type' => 'card',
  1110. 'group' => '55',
  1111. 'sql' => <<<EOT
  1112. SELECT id FROM zt_user WHERE deleted='0'
  1113. EOT
  1114. ,
  1115. 'settings' => array
  1116. (
  1117. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1118. 'title' => array('type' => 'text', 'name' => ''),
  1119. 'type' => 'value'
  1120. ),
  1121. 'filters' => array(),
  1122. 'stage' => 'published',
  1123. 'builtin' => '1'
  1124. );
  1125. $config->bi->builtin->charts[] = array
  1126. (
  1127. 'id' => 1029,
  1128. 'name' => '宏观数据-累计消耗工时',
  1129. 'code' => 'macro_consumed',
  1130. 'dimension' => '1',
  1131. 'type' => 'card',
  1132. 'group' => '55',
  1133. 'sql' => <<<EOT
  1134. SELECT consumed FROM zt_effort WHERE deleted='0'
  1135. EOT
  1136. ,
  1137. 'settings' => array
  1138. (
  1139. 'value' => array('type' => 'agg', 'field' => 'consumed', 'agg' => 'sum'),
  1140. 'title' => array('type' => 'text', 'name' => ''),
  1141. 'type' => 'value'
  1142. ),
  1143. 'filters' => array(),
  1144. 'stage' => 'published',
  1145. 'builtin' => '1'
  1146. );
  1147. $config->bi->builtin->charts[] = array
  1148. (
  1149. 'id' => 1030,
  1150. 'name' => '宏观数据-禅道使用时长',
  1151. 'code' => 'macro_useZentao',
  1152. 'dimension' => '1',
  1153. 'type' => 'card',
  1154. 'group' => '58',
  1155. 'sql' => <<<EOT
  1156. SELECT
  1157. CASE WHEN years > 0
  1158. THEN CONCAT(years, '年', days, '天')
  1159. ELSE CONCAT(days, '天')
  1160. END AS period
  1161. from (
  1162. SELECT
  1163. firstDay,
  1164. CURRENT_DATE AS today,
  1165. CAST(EXTRACT(YEAR FROM CURRENT_DATE) - EXTRACT(YEAR FROM firstDay) AS DECIMAL) AS years,
  1166. MOD(
  1167. CAST(
  1168. (EXTRACT(MONTH FROM CURRENT_DATE) - EXTRACT(MONTH FROM firstDay)) * 30 +
  1169. (EXTRACT(DAY FROM CURRENT_DATE) - EXTRACT(DAY FROM firstDay)) + 365
  1170. AS DECIMAL
  1171. ),
  1172. 365
  1173. ) days
  1174. FROM (SELECT cast(`value` as DATE) AS firstDay FROM zt_config WHERE `owner` = 'system' AND `key` = 'installedDate') AS subquery
  1175. ) data
  1176. EOT
  1177. ,
  1178. 'settings' => array
  1179. (
  1180. 'value' => array('type' => 'value', 'field' => 'period', 'agg' => 'value'),
  1181. 'title' => array('type' => 'text', 'name' => ''),
  1182. 'type' => 'value'
  1183. ),
  1184. 'filters' => array(),
  1185. 'stage' => 'published',
  1186. 'builtin' => '1'
  1187. );
  1188. $config->bi->builtin->charts[] = array
  1189. (
  1190. 'id' => 1031,
  1191. 'name' => '宏观数据-需求完成率',
  1192. 'code' => 'macro_storyFinishedRate',
  1193. 'dimension' => '1',
  1194. 'type' => 'waterpolo',
  1195. 'group' => '36',
  1196. 'sql' => <<<EOT
  1197. SELECT id, IF(closedReason='done', 'done', 'undone') AS bugstatus FROM zt_story WHERE deleted='0' AND (status != 'closed' OR closedReason='done')
  1198. EOT
  1199. ,
  1200. 'settings' => array
  1201. (
  1202. array
  1203. (
  1204. 'type' => 'waterpolo',
  1205. 'calc' => 'count',
  1206. 'goal' => 'id',
  1207. 'conditions' => array
  1208. (
  1209. array('field' => 'bugstatus', 'condition' => 'eq', 'value' => 'done')
  1210. )
  1211. )
  1212. ),
  1213. 'filters' => array(),
  1214. 'fields' => array
  1215. (
  1216. 'id' => array('name' => '编号', 'object' => 'story', 'field' => 'id', 'type' => 'number'),
  1217. 'bugstatus' => array('name' => 'bugstatus', 'object' => 'story', 'field' => 'bugstatus', 'type' => 'string')
  1218. ),
  1219. 'langs' => array
  1220. (
  1221. 'id' => array('zh-cn' => '编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  1222. 'bugstatus' => array('zh-cn' => 'Bug状态', 'zh-tw' => '', 'en' => 'bugstatus', 'de' => '', 'fr' => '')
  1223. ),
  1224. 'stage' => 'published',
  1225. 'builtin' => '0'
  1226. );
  1227. $config->bi->builtin->charts[] = array
  1228. (
  1229. 'id' => 1032,
  1230. 'name' => '宏观数据-Bug修复率',
  1231. 'code' => 'macro_bugFixedRate',
  1232. 'dimension' => '1',
  1233. 'type' => 'waterpolo',
  1234. 'group' => '44',
  1235. 'sql' => <<<EOT
  1236. SELECT id, IF(`status`='closed' AND resolution='fixed', 'done', 'undone') AS bugstatus FROM zt_bug WHERE deleted='0' AND (status = 'active' OR resolution in ('fixed', 'postponed'))
  1237. EOT
  1238. ,
  1239. 'settings' => array
  1240. (
  1241. array
  1242. (
  1243. 'type' => 'waterpolo',
  1244. 'calc' => 'count',
  1245. 'goal' => 'id',
  1246. 'conditions' => array
  1247. (
  1248. array('field' => 'bugstatus', 'condition' => 'eq', 'value' => 'done')
  1249. )
  1250. )
  1251. ),
  1252. 'filters' => array(),
  1253. 'fields' => array
  1254. (
  1255. 'id' => array('name' => 'Bug编号', 'object' => 'bug', 'field' => 'id', 'type' => 'number'),
  1256. 'bugstatus' => array('name' => 'bugstatus', 'object' => 'bug', 'field' => 'bugstatus', 'type' => 'string')
  1257. ),
  1258. 'langs' => array
  1259. (
  1260. 'id' => array('zh-cn' => 'Bug编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  1261. 'bugstatus' => array('zh-cn' => 'Bug状态', 'zh-tw' => '', 'en' => 'bugstatus', 'de' => '', 'fr' => '')
  1262. ),
  1263. 'stage' => 'published',
  1264. 'builtin' => '0'
  1265. );
  1266. $config->bi->builtin->charts[] = array
  1267. (
  1268. 'id' => 1033,
  1269. 'name' => '宏观数据-未完成的一级项目集个数',
  1270. 'code' => 'macro_countTopProgram_undone',
  1271. 'dimension' => '1',
  1272. 'type' => 'card',
  1273. 'group' => '45',
  1274. 'sql' => <<<EOT
  1275. SELECT id FROM zt_project WHERE type='program' AND `status`!='closed' AND deleted='0' AND grade='1'
  1276. EOT
  1277. ,
  1278. 'settings' => array
  1279. (
  1280. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1281. 'title' => array('type' => 'text', 'name' => ''),
  1282. 'type' => 'value'
  1283. ),
  1284. 'filters' => array(),
  1285. 'stage' => 'published',
  1286. 'builtin' => '1'
  1287. );
  1288. $config->bi->builtin->charts[] = array
  1289. (
  1290. 'id' => 1034,
  1291. 'name' => '宏观数据-未完成的需求',
  1292. 'code' => 'macro_countStory_undone',
  1293. 'dimension' => '1',
  1294. 'type' => 'card',
  1295. 'group' => '51',
  1296. 'sql' => <<<EOT
  1297. SELECT id FROM zt_story WHERE `status`!='closed' AND deleted='0'
  1298. EOT
  1299. ,
  1300. 'settings' => array
  1301. (
  1302. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1303. 'title' => array('type' => 'text', 'name' => ''),
  1304. 'type' => 'value'
  1305. ),
  1306. 'filters' => array(),
  1307. 'stage' => 'published',
  1308. 'builtin' => '1'
  1309. );
  1310. $config->bi->builtin->charts[] = array
  1311. (
  1312. 'id' => 1035,
  1313. 'name' => '宏观数据-未完成的产品',
  1314. 'code' => 'macro_countProduct_undone',
  1315. 'dimension' => '1',
  1316. 'type' => 'card',
  1317. 'group' => '47',
  1318. 'sql' => <<<EOT
  1319. SELECT id FROM zt_product WHERE `status`!='closed' AND deleted='0' AND shadow='0'
  1320. EOT
  1321. ,
  1322. 'settings' => array
  1323. (
  1324. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1325. 'title' => array('type' => 'text', 'name' => ''),
  1326. 'type' => 'value'
  1327. ),
  1328. 'filters' => array(),
  1329. 'stage' => 'published',
  1330. 'builtin' => '1'
  1331. );
  1332. $config->bi->builtin->charts[] = array
  1333. (
  1334. 'id' => 1036,
  1335. 'name' => '宏观数据-未完成的项目',
  1336. 'code' => 'macro_countProject_undone',
  1337. 'dimension' => '1',
  1338. 'type' => 'card',
  1339. 'group' => '46',
  1340. 'sql' => <<<EOT
  1341. SELECT id FROM zt_project WHERE type='project' AND `status`!='closed' AND deleted='0' AND isTpl = '0'
  1342. EOT
  1343. ,
  1344. 'settings' => array
  1345. (
  1346. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1347. 'title' => array('type' => 'text', 'name' => ''),
  1348. 'type' => 'value'
  1349. ),
  1350. 'filters' => array(),
  1351. 'stage' => 'published',
  1352. 'builtin' => '1'
  1353. );
  1354. $config->bi->builtin->charts[] = array
  1355. (
  1356. 'id' => 1037,
  1357. 'name' => '宏观数据-未完成的计划',
  1358. 'code' => 'macro_countPlan_undone',
  1359. 'dimension' => '1',
  1360. 'type' => 'card',
  1361. 'group' => '48',
  1362. 'sql' => <<<EOT
  1363. SELECT id FROM (SELECT id,deleted FROM zt_productplan WHERE NOT ((`status`='closed' AND closedReason='done') OR `status`='done')) AS plan WHERE plan.deleted='0'
  1364. EOT
  1365. ,
  1366. 'settings' => array
  1367. (
  1368. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1369. 'title' => array('type' => 'text', 'name' => ''),
  1370. 'type' => 'value'
  1371. ),
  1372. 'filters' => array(),
  1373. 'stage' => 'published',
  1374. 'builtin' => '1'
  1375. );
  1376. $config->bi->builtin->charts[] = array
  1377. (
  1378. 'id' => 1038,
  1379. 'name' => '宏观数据-未完成的执行',
  1380. 'code' => 'macro_countExecution_undone',
  1381. 'dimension' => '1',
  1382. 'type' => 'card',
  1383. 'group' => '49',
  1384. 'sql' => <<<EOT
  1385. SELECT id FROM zt_project WHERE type IN ('sprint','stage','kanban') AND `status`!='closed' AND deleted='0' AND multiple = '1' AND isTpl = '0'
  1386. EOT
  1387. ,
  1388. 'settings' => array
  1389. (
  1390. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1391. 'title' => array('type' => 'text', 'name' => ''),
  1392. 'type' => 'value'
  1393. ),
  1394. 'filters' => array(),
  1395. 'stage' => 'published',
  1396. 'builtin' => '1'
  1397. );
  1398. $config->bi->builtin->charts[] = array
  1399. (
  1400. 'id' => 1039,
  1401. 'name' => '宏观数据-未完成的缺陷',
  1402. 'code' => 'macro_countBug_undone',
  1403. 'dimension' => '1',
  1404. 'type' => 'card',
  1405. 'group' => '53',
  1406. 'sql' => <<<EOT
  1407. SELECT id FROM zt_bug WHERE `status`!='closed' AND deleted='0'
  1408. EOT
  1409. ,
  1410. 'settings' => array
  1411. (
  1412. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1413. 'title' => array('type' => 'text', 'name' => ''),
  1414. 'type' => 'value'
  1415. ),
  1416. 'filters' => array(),
  1417. 'stage' => 'published',
  1418. 'builtin' => '1'
  1419. );
  1420. $config->bi->builtin->charts[] = array
  1421. (
  1422. 'id' => 1040,
  1423. 'name' => '宏观数据-未完成的任务',
  1424. 'code' => 'macro_countTask_undone',
  1425. 'dimension' => '1',
  1426. 'type' => 'card',
  1427. 'group' => '52',
  1428. 'sql' => <<<EOT
  1429. SELECT id FROM (SELECT id,deleted FROM zt_task WHERE `status` NOT IN ('closed','cancel','done') AND isTpl = '0') AS task WHERE task.deleted='0'
  1430. EOT
  1431. ,
  1432. 'settings' => array
  1433. (
  1434. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  1435. 'title' => array('type' => 'text', 'name' => ''),
  1436. 'type' => 'value'
  1437. ),
  1438. 'filters' => array(),
  1439. 'stage' => 'published',
  1440. 'builtin' => '1'
  1441. );
  1442. $config->bi->builtin->charts[] = array
  1443. (
  1444. 'id' => 1041,
  1445. 'name' => '宏观数据-项目集数据概览',
  1446. 'code' => 'macro_programOverview',
  1447. 'dimension' => '1',
  1448. 'type' => 'table',
  1449. 'group' => '64',
  1450. 'sql' => <<<EOT
  1451. SELECT
  1452. t1.name AS topProgram,
  1453. COALESCE(t2.subProgram, 0) AS subProgram,
  1454. COUNT(DISTINCT t3.id) AS product,
  1455. SUM(COALESCE(t4.story, 0)) AS story,
  1456. SUM(COALESCE(t5.`release`, 0)) AS `release`,
  1457. SUM(COALESCE(t6.bug, 0)) AS bug,
  1458. COALESCE(t7.project, 0) AS project,
  1459. COALESCE(t7.execution, 0) AS execution,
  1460. COALESCE(t7.task, 0) AS task
  1461. FROM zt_project AS t1
  1462. LEFT JOIN (
  1463. SELECT
  1464. CAST(SUBSTRING(path FROM 2 FOR (POSITION(',' IN SUBSTRING(path FROM 2)) - 1)) AS DECIMAL) AS topProgram,
  1465. COUNT(1) AS subProgram
  1466. FROM zt_project
  1467. WHERE deleted = '0' AND type = 'program' AND grade > 1
  1468. GROUP BY topProgram
  1469. ) AS t2 ON t1.id = t2.topProgram
  1470. LEFT JOIN zt_product AS t3
  1471. ON t1.id = t3.program
  1472. AND t3.deleted = '0'
  1473. AND t3.shadow = '0'
  1474. AND t3.vision = 'rnd'
  1475. LEFT JOIN (
  1476. SELECT
  1477. product,
  1478. COUNT(1) AS story,
  1479. COUNT(CASE WHEN status = 'done' THEN 1 END) AS finishedStory
  1480. FROM zt_story
  1481. WHERE deleted = '0' AND type = 'story'
  1482. GROUP BY product
  1483. ) AS t4 ON t3.id = t4.product
  1484. LEFT JOIN (
  1485. SELECT product, COUNT(1) AS `release`
  1486. FROM zt_release
  1487. WHERE deleted = '0'
  1488. GROUP BY product
  1489. ) AS t5 ON t3.id = t5.product
  1490. LEFT JOIN (
  1491. SELECT
  1492. product,
  1493. COUNT(1) AS bug,
  1494. COUNT(CASE WHEN status = 'fixed' THEN 1 END) AS fixedBug
  1495. FROM zt_bug
  1496. WHERE deleted = '0'
  1497. GROUP BY product
  1498. ) AS t6 ON t3.id = t6.product
  1499. LEFT JOIN (
  1500. SELECT
  1501. t1.topProgram,
  1502. COUNT(DISTINCT t1.project) AS project,
  1503. SUM(COALESCE(t2.task, 0)) AS task,
  1504. SUM(COALESCE(t3.execution, 0)) AS execution
  1505. FROM (
  1506. SELECT
  1507. CAST(SUBSTRING(path FROM 2 FOR (POSITION(',' IN SUBSTRING(path FROM 2)) - 1)) AS DECIMAL) AS topProgram,
  1508. id AS project
  1509. FROM zt_project
  1510. WHERE deleted = '0' AND type = 'project'
  1511. ) AS t1
  1512. LEFT JOIN (
  1513. SELECT COUNT(1) AS task, project
  1514. FROM zt_task
  1515. WHERE deleted = '0'
  1516. GROUP BY project
  1517. ) AS t2 ON t1.project = t2.project
  1518. LEFT JOIN (
  1519. SELECT COUNT(1) AS execution, project
  1520. FROM zt_project
  1521. WHERE deleted = '0'
  1522. AND type IN ('sprint', 'stage', 'kanban')
  1523. AND multiple = '1'
  1524. GROUP BY project
  1525. ) AS t3 ON t1.project = t3.project
  1526. GROUP BY t1.topProgram
  1527. ) AS t7 ON t1.id = t7.topProgram
  1528. WHERE t1.deleted = '0' AND t1.type = 'program' AND t1.grade = 1
  1529. GROUP BY t1.name
  1530. EOT
  1531. ,
  1532. 'settings' => array
  1533. (
  1534. 'group' => array(),
  1535. 'column' => array
  1536. (
  1537. array('field' => 'topProgram', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  1538. array('field' => 'subProgram', 'valOrAgg' => 'value', 'name' => '子项目集数'),
  1539. array('field' => 'product', 'valOrAgg' => 'value', 'name' => '产品数'),
  1540. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '研发需求数'),
  1541. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数'),
  1542. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数'),
  1543. array('field' => 'project', 'valOrAgg' => 'value', 'name' => '项目数'),
  1544. array('field' => 'execution', 'valOrAgg' => 'value', 'name' => '执行数'),
  1545. array('field' => 'task', 'valOrAgg' => 'value', 'name' => '任务数')
  1546. ),
  1547. 'filter' => array()
  1548. ),
  1549. 'filters' => array(),
  1550. 'stage' => 'published',
  1551. 'builtin' => '1'
  1552. );
  1553. $config->bi->builtin->charts[] = array
  1554. (
  1555. 'id' => 1042,
  1556. 'name' => '宏观数据-项目集需求完成率与Bug修复率',
  1557. 'code' => 'macro_programStoryFinishedRateAndBugFixedRate',
  1558. 'dimension' => '1',
  1559. 'type' => 'cluBarY',
  1560. 'group' => '45',
  1561. 'sql' => <<<EOT
  1562. SELECT
  1563. t1.name AS topProgram,
  1564. SUM(IFNULL(t3.doneStory, 0)) AS doneStory,
  1565. SUM(IFNULL(t4.allStory, 0)) AS allStory,
  1566. CASE
  1567. WHEN SUM(IFNULL(t4.allStory, 0)) <= 0 THEN CAST(0.00 AS DECIMAL(10,2))
  1568. ELSE CAST((SUM(IFNULL(t3.doneStory, 0)) / SUM(IFNULL(t4.allStory, 0)) * 100) AS DECIMAL(10,2))
  1569. END AS storyDoneRate,
  1570. SUM(IFNULL(t5.solvedBug, 0)) AS solvedBug,
  1571. SUM(IFNULL(t6.allBug, 0)) AS allBug,
  1572. CASE
  1573. WHEN SUM(IFNULL(t6.allBug, 0)) <= 0 THEN CAST(0.00 AS DECIMAL(10,2))
  1574. ELSE CAST((SUM(IFNULL(t5.solvedBug, 0)) / SUM(IFNULL(t6.allBug, 0)) * 100) AS DECIMAL(10,2))
  1575. END AS bugSolvedRate
  1576. FROM zt_project AS t1
  1577. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  1578. LEFT JOIN (
  1579. SELECT COUNT(1) AS doneStory, product
  1580. FROM zt_story
  1581. WHERE deleted = '0' AND closedReason = 'done' AND status = 'closed'
  1582. GROUP BY product
  1583. ) AS t3 ON t2.id = t3.product
  1584. LEFT JOIN (
  1585. SELECT COUNT(1) AS allStory, product
  1586. FROM zt_story
  1587. WHERE deleted = '0' AND ((closedReason = 'done' AND status = 'closed') OR status != 'closed')
  1588. GROUP BY product
  1589. ) AS t4 ON t2.id = t4.product
  1590. LEFT JOIN (
  1591. SELECT COUNT(1) AS solvedBug, product
  1592. FROM zt_bug
  1593. WHERE deleted = '0' AND resolution = 'fixed' AND status = 'closed'
  1594. GROUP BY product
  1595. ) AS t5 ON t2.id = t5.product
  1596. LEFT JOIN (
  1597. SELECT COUNT(1) AS allBug, product
  1598. FROM zt_bug
  1599. WHERE deleted = '0' AND (resolution IN ('fixed', 'postponed') OR status = 'active')
  1600. GROUP BY product
  1601. ) AS t6 ON t2.id = t6.product
  1602. WHERE t1.type = 'program' AND t1.grade = 1 AND t1.deleted = '0'
  1603. AND t2.deleted = '0'
  1604. GROUP BY t1.name, t1.`order`
  1605. ORDER BY t1.`order` DESC LIMIT 999999
  1606. EOT
  1607. ,
  1608. 'settings' => array
  1609. (
  1610. array
  1611. (
  1612. 'type' => 'cluBarY',
  1613. 'xaxis' => array
  1614. (
  1615. array('field' => 'topProgram', 'name' => 'topProgram', 'group' => '')
  1616. ),
  1617. 'yaxis' => array
  1618. (
  1619. array('field' => 'storyDoneRate', 'name' => 'storyDoneRate', 'valOrAgg' => 'sum'),
  1620. array('field' => 'bugSolvedRate', 'name' => 'bugSolvedRate', 'valOrAgg' => 'sum')
  1621. )
  1622. )
  1623. ),
  1624. 'filters' => array(),
  1625. 'fields' => array
  1626. (
  1627. 'topProgram' => array('name' => 'topProgram', 'object' => 'bug', 'field' => 'topProgram', 'type' => 'string'),
  1628. 'doneStory' => array('name' => 'doneStory', 'object' => 'bug', 'field' => 'doneStory', 'type' => 'number'),
  1629. 'allStory' => array('name' => 'allStory', 'object' => 'bug', 'field' => 'allStory', 'type' => 'number'),
  1630. 'storyDoneRate' => array('name' => 'storyDoneRate', 'object' => 'bug', 'field' => 'storyDoneRate', 'type' => 'number'),
  1631. 'solvedBug' => array('name' => 'solvedBug', 'object' => 'bug', 'field' => 'solvedBug', 'type' => 'number'),
  1632. 'allBug' => array('name' => 'allBug', 'object' => 'bug', 'field' => 'allBug', 'type' => 'number'),
  1633. 'bugSolvedRate' => array('name' => 'bugSolvedRate', 'object' => 'bug', 'field' => 'bugSolvedRate', 'type' => 'number')
  1634. ),
  1635. 'langs' => array
  1636. (
  1637. 'topProgram' => array('zh-cn' => '一级项目集', 'zh-tw' => '', 'en' => 'topProgram', 'de' => '', 'fr' => ''),
  1638. 'doneStory' => array('zh-cn' => '完成需求数', 'zh-tw' => '', 'en' => 'doneStory', 'de' => '', 'fr' => ''),
  1639. 'allStory' => array('zh-cn' => '需求数', 'zh-tw' => '', 'en' => 'allStory', 'de' => '', 'fr' => ''),
  1640. 'storyDoneRate' => array('zh-cn' => '需求完成率', 'zh-tw' => '', 'en' => 'storyDoneRate', 'de' => '', 'fr' => ''),
  1641. 'solvedBug' => array('zh-cn' => '解决bug数', 'zh-tw' => '', 'en' => 'solvedBug', 'de' => '', 'fr' => ''),
  1642. 'allBug' => array('zh-cn' => 'bug数', 'zh-tw' => '', 'en' => 'allBug', 'de' => '', 'fr' => ''),
  1643. 'bugSolvedRate' => array('zh-cn' => 'bug修复率', 'zh-tw' => '', 'en' => 'bugSolvedRate', 'de' => '', 'fr' => '')
  1644. ),
  1645. 'stage' => 'published',
  1646. 'builtin' => '0'
  1647. );
  1648. $config->bi->builtin->charts[] = array
  1649. (
  1650. 'id' => 1043,
  1651. 'name' => '宏观数据-公司项目集状态分布',
  1652. 'code' => 'macro_programStatus',
  1653. 'dimension' => '1',
  1654. 'type' => 'pie',
  1655. 'group' => '45',
  1656. 'sql' => <<<EOT
  1657. SELECT id, CASE `status` WHEN 'wait' then '未开始' WHEN 'doing' THEN '进行中' WHEN 'suspended' THEN '已挂起' ELSE '已关闭' END status FROM zt_project WHERE type = 'program' AND grade = 1 AND deleted = '0'
  1658. EOT
  1659. ,
  1660. 'settings' => array
  1661. (
  1662. array
  1663. (
  1664. 'type' => 'pie',
  1665. 'group' => array
  1666. (
  1667. array('field' => 'status', 'name' => '状态', 'group' => '')
  1668. ),
  1669. 'metric' => array
  1670. (
  1671. array('field' => 'id', 'name' => '项目ID', 'valOrAgg' => 'count')
  1672. )
  1673. )
  1674. ),
  1675. 'filters' => array(),
  1676. 'fields' => array
  1677. (
  1678. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  1679. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option')
  1680. ),
  1681. 'langs' => array
  1682. (
  1683. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  1684. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => '')
  1685. ),
  1686. 'stage' => 'published',
  1687. 'builtin' => '0'
  1688. );
  1689. $config->bi->builtin->charts[] = array
  1690. (
  1691. 'id' => 1044,
  1692. 'name' => '宏观数据-公司项目状态分布',
  1693. 'code' => 'macro_projectStatus',
  1694. 'dimension' => '1',
  1695. 'type' => 'pie',
  1696. 'group' => '38',
  1697. 'sql' => <<<EOT
  1698. SELECT id, CASE `status` WHEN 'wait' then '未开始' WHEN 'doing' THEN '进行中' WHEN 'suspended' THEN '已挂起' ELSE '已关闭' END status FROM zt_project WHERE type = 'project' AND deleted = '0' AND isTpl = '0'
  1699. EOT
  1700. ,
  1701. 'settings' => array
  1702. (
  1703. array
  1704. (
  1705. 'type' => 'pie',
  1706. 'group' => array
  1707. (
  1708. array('field' => 'status', 'name' => '状态', 'group' => '')
  1709. ),
  1710. 'metric' => array
  1711. (
  1712. array('field' => 'id', 'name' => '项目ID', 'valOrAgg' => 'count')
  1713. )
  1714. )
  1715. ),
  1716. 'filters' => array(),
  1717. 'fields' => array
  1718. (
  1719. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  1720. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option')
  1721. ),
  1722. 'langs' => array
  1723. (
  1724. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  1725. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => '')
  1726. ),
  1727. 'stage' => 'published',
  1728. 'builtin' => '0'
  1729. );
  1730. $config->bi->builtin->charts[] = array
  1731. (
  1732. 'id' => 1045,
  1733. 'name' => '宏观数据-产品数据概览',
  1734. 'code' => 'macro_productOverview',
  1735. 'dimension' => '1',
  1736. 'type' => 'table',
  1737. 'group' => '63',
  1738. 'sql' => <<<EOT
  1739. SELECT
  1740. t1.name AS product,
  1741. COALESCE(t2.name, '/') AS program,
  1742. COALESCE(t3.name, '/') AS productLine,
  1743. COALESCE(t4.plan, 0) AS plan,
  1744. COALESCE(t5.release, 0) AS `release`,
  1745. COALESCE(t6.story, 0) AS story,
  1746. COALESCE(t7.bug, 0) AS bug
  1747. FROM
  1748. zt_product AS t1
  1749. LEFT JOIN zt_project AS t2 ON t1.program = t2.id AND t2.type = 'program' AND t2.grade = 1
  1750. LEFT JOIN zt_module AS t3 ON t1.line = t3.id AND t3.type = 'line'
  1751. LEFT JOIN (SELECT product, COUNT(1) AS plan FROM zt_productplan WHERE deleted = '0' GROUP BY product) AS t4 ON t1.id = t4.product
  1752. LEFT JOIN (SELECT product, COUNT(1) AS `release` FROM zt_release WHERE deleted = '0' GROUP BY product) AS t5 ON t1.id = t5.product
  1753. LEFT JOIN (SELECT product, COUNT(1) AS story FROM zt_story WHERE deleted = '0' GROUP BY product) AS t6 ON t1.id = t6.product
  1754. LEFT JOIN (SELECT product, COUNT(1) AS bug FROM zt_bug WHERE deleted = '0' GROUP BY product) AS t7 ON t1.id = t7.product
  1755. WHERE t1.deleted = '0' AND t1.status != 'closed' AND t1.shadow = '0' AND t1.vision = 'rnd'
  1756. ORDER BY t1.`order` LIMIT 999999
  1757. EOT
  1758. ,
  1759. 'settings' => array
  1760. (
  1761. 'group' => array(),
  1762. 'column' => array
  1763. (
  1764. array('field' => 'program', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  1765. array('field' => 'productLine', 'valOrAgg' => 'value', 'name' => '产品线'),
  1766. array('field' => 'product', 'valOrAgg' => 'value', 'name' => '产品'),
  1767. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '需求数'),
  1768. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数'),
  1769. array('field' => 'plan', 'valOrAgg' => 'value', 'name' => '计划数'),
  1770. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数')
  1771. ),
  1772. 'filter' => array()
  1773. ),
  1774. 'filters' => array(),
  1775. 'stage' => 'published',
  1776. 'builtin' => '1'
  1777. );
  1778. $config->bi->builtin->charts[] = array
  1779. (
  1780. 'id' => 1046,
  1781. 'name' => '宏观数据-产品需求完成率',
  1782. 'code' => 'macro_productStoryFinishedRate',
  1783. 'dimension' => '1',
  1784. 'type' => 'cluBarY',
  1785. 'group' => '36',
  1786. 'sql' => <<<EOT
  1787. SELECT
  1788. t1.name AS product,
  1789. IFNULL(t2.name, '/') AS program,
  1790. IFNULL(t3.name, '/') AS productLine,
  1791. IFNULL(t4.story, 0) AS closedStory,
  1792. t5.story AS totalStory,
  1793. ROUND(IFNULL(t4.story, 0) / t5.story * 100, 2) AS closedRate
  1794. FROM zt_product AS t1
  1795. LEFT JOIN zt_project AS t2 ON t1.program = t2.id AND t2.type = 'program' AND t2.grade = 1
  1796. LEFT JOIN zt_module AS t3 ON t1.line = t3.id AND t3.type = 'line'
  1797. LEFT JOIN (SELECT product, COUNT(1) AS story FROM zt_story WHERE deleted = '0' AND closedReason = 'done' GROUP BY product) AS t4 ON t1.id = t4.product
  1798. LEFT JOIN (SELECT product, COUNT(1) AS story FROM zt_story WHERE deleted = '0' AND ( closedReason = 'done' OR status != 'closed') GROUP BY product) AS t5 ON t1.id = t5.product
  1799. WHERE t1.deleted = '0' AND t1.status != 'closed' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t5.story IS NOT NULL
  1800. ORDER BY t1.order DESC LIMIT 999999
  1801. EOT
  1802. ,
  1803. 'settings' => array
  1804. (
  1805. array
  1806. (
  1807. 'type' => 'cluBarY',
  1808. 'xaxis' => array
  1809. (
  1810. array('field' => 'product', 'name' => '所属产品', 'group' => '')
  1811. ),
  1812. 'yaxis' => array
  1813. (
  1814. array('field' => 'closedRate', 'name' => 'closedRate', 'valOrAgg' => 'sum')
  1815. )
  1816. )
  1817. ),
  1818. 'filters' => array(),
  1819. 'fields' => array
  1820. (
  1821. 'product' => array('name' => '所属产品', 'object' => 'story', 'field' => 'product', 'type' => 'string'),
  1822. 'program' => array('name' => 'program', 'object' => 'story', 'field' => 'program', 'type' => 'string'),
  1823. 'productLine' => array('name' => 'productLine', 'object' => 'story', 'field' => 'productLine', 'type' => 'string'),
  1824. 'closedStory' => array('name' => '需求:%s 已关闭,将不会被关闭。', 'object' => 'story', 'field' => 'closedStory', 'type' => 'string'),
  1825. 'totalStory' => array('name' => 'totalStory', 'object' => 'story', 'field' => 'totalStory', 'type' => 'string'),
  1826. 'closedRate' => array('name' => 'closedRate', 'object' => 'story', 'field' => 'closedRate', 'type' => 'number')
  1827. ),
  1828. 'langs' => array
  1829. (
  1830. 'product' => array('zh-cn' => '所属产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  1831. 'program' => array('zh-cn' => '项目集', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  1832. 'productLine' => array('zh-cn' => '产品线', 'zh-tw' => '', 'en' => 'productLine', 'de' => '', 'fr' => ''),
  1833. 'closedStory' => array('zh-cn' => '完成需求数', 'zh-tw' => '', 'en' => 'closedStory', 'de' => '', 'fr' => ''),
  1834. 'totalStory' => array('zh-cn' => '需求数', 'zh-tw' => '', 'en' => 'totalStory', 'de' => '', 'fr' => ''),
  1835. 'closedRate' => array('zh-cn' => '需求完成率', 'zh-tw' => '', 'en' => 'closedRate', 'de' => '', 'fr' => '')
  1836. ),
  1837. 'stage' => 'published',
  1838. 'builtin' => '0'
  1839. );
  1840. $config->bi->builtin->charts[] = array
  1841. (
  1842. 'id' => 1047,
  1843. 'name' => '宏观数据-产品Bug修复率',
  1844. 'code' => 'macro_productBugFixedRate',
  1845. 'dimension' => '1',
  1846. 'type' => 'cluBarY',
  1847. 'group' => '44',
  1848. 'sql' => <<<EOT
  1849. SELECT
  1850. t1.name AS product,
  1851. IFNULL(t2.name, '/') AS program,
  1852. IFNULL(t3.name, '/') AS productLine,
  1853. IFNULL(t4.bug, 0) AS fixedBug,
  1854. t5.bug AS totalBug,
  1855. ROUND(IFNULL(t4.bug, 0) / t5.bug * 100, 2) AS fixedRate
  1856. FROM zt_product AS t1
  1857. LEFT JOIN zt_project AS t2 ON t1.program = t2.id AND t2.type = 'program' AND t2.grade = 1
  1858. LEFT JOIN zt_module AS t3 ON t1.line = t3.id AND t3.type = 'line'
  1859. LEFT JOIN (SELECT product, COUNT(1) AS bug FROM zt_bug WHERE deleted = '0' AND resolution = 'fixed' AND status = 'closed' GROUP BY product) AS t4 ON t1.id = t4.product
  1860. LEFT JOIN (SELECT product, COUNT(1) AS bug FROM zt_bug WHERE deleted = '0' AND (resolution = 'fixed' OR resolution = 'postponed' OR status = 'active') GROUP BY product) AS t5 ON t1.id = t5.product
  1861. WHERE t1.deleted = '0' AND t1.status != 'closed' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t5.bug IS NOT NULL
  1862. ORDER BY t1.order DESC LIMIT 999999
  1863. EOT
  1864. ,
  1865. 'settings' => array
  1866. (
  1867. array
  1868. (
  1869. 'type' => 'cluBarY',
  1870. 'xaxis' => array
  1871. (
  1872. array('field' => 'product', 'name' => '所属产品', 'group' => '')
  1873. ),
  1874. 'yaxis' => array
  1875. (
  1876. array('field' => 'fixedRate', 'name' => '修复率', 'valOrAgg' => 'sum')
  1877. )
  1878. )
  1879. ),
  1880. 'filters' => array(),
  1881. 'fields' => array
  1882. (
  1883. 'product' => array('name' => '所属产品', 'object' => 'bug', 'field' => 'product', 'type' => 'string'),
  1884. 'program' => array('name' => 'program', 'object' => 'bug', 'field' => 'program', 'type' => 'string'),
  1885. 'productLine' => array('name' => 'productLine', 'object' => 'bug', 'field' => 'productLine', 'type' => 'string'),
  1886. 'fixedBug' => array('name' => 'fixedBug', 'object' => 'bug', 'field' => 'fixedBug', 'type' => 'string'),
  1887. 'totalBug' => array('name' => 'totalBug', 'object' => 'bug', 'field' => 'totalBug', 'type' => 'string'),
  1888. 'fixedRate' => array('name' => '修复率', 'object' => 'bug', 'field' => 'fixedRate', 'type' => 'number')
  1889. ),
  1890. 'langs' => array
  1891. (
  1892. 'product' => array('zh-cn' => '所属产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  1893. 'program' => array('zh-cn' => '项目集', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  1894. 'productLine' => array('zh-cn' => '产品线', 'zh-tw' => '', 'en' => 'productLine', 'de' => '', 'fr' => ''),
  1895. 'fixedBug' => array('zh-cn' => '修复bug数', 'zh-tw' => '', 'en' => 'fixedBug', 'de' => '', 'fr' => ''),
  1896. 'totalBug' => array('zh-cn' => 'bug数', 'zh-tw' => '', 'en' => 'totalBug', 'de' => '', 'fr' => ''),
  1897. 'fixedRate' => array('zh-cn' => 'bug修复率', 'zh-tw' => '', 'en' => 'fixedRate', 'de' => '', 'fr' => '')
  1898. ),
  1899. 'stage' => 'published',
  1900. 'builtin' => '0'
  1901. );
  1902. $config->bi->builtin->charts[] = array
  1903. (
  1904. 'id' => 1049,
  1905. 'name' => '宏观数据-部门人员分布图',
  1906. 'code' => 'macro_deptAccountStatus',
  1907. 'dimension' => '1',
  1908. 'type' => 'cluBarY',
  1909. 'group' => '56',
  1910. 'sql' => <<<EOT
  1911. SELECT IF(t3.id IS NOT NULL, t3.`name`, '空') AS deptName,count(1) as count,
  1912. IF(t3.id IS NOT NULL, t3.`order`, 9999) AS deptOrder
  1913. FROM zt_user AS t1
  1914. LEFT JOIN zt_dept AS t2 ON t1.dept = t2.id
  1915. LEFT JOIN zt_dept AS t3 ON FIND_IN_SET(TRIM(',' FROM t3.path), TRIM(',' FROM t2.path)) AND t3.grade = '1'
  1916. WHERE t1.deleted = '0'
  1917. GROUP BY deptName, deptOrder
  1918. ORDER BY deptOrder ASC
  1919. LIMIT 999999
  1920. EOT
  1921. ,
  1922. 'settings' => array
  1923. (
  1924. array
  1925. (
  1926. 'type' => 'cluBarY',
  1927. 'xaxis' => array
  1928. (
  1929. array('field' => 'deptName', 'name' => 'deptName', 'group' => '')
  1930. ),
  1931. 'yaxis' => array
  1932. (
  1933. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  1934. )
  1935. )
  1936. ),
  1937. 'filters' => array(),
  1938. 'fields' => array
  1939. (
  1940. 'deptName' => array('name' => 'deptName', 'object' => 'false', 'field' => 'deptName', 'type' => 'object'),
  1941. 'count' => array('name' => 'count', 'object' => 'false', 'field' => 'count', 'type' => 'object'),
  1942. 'deptOrder' => array('name' => 'deptOrder', 'object' => 'false', 'field' => 'deptOrder', 'type' => 'object')
  1943. ),
  1944. 'langs' => array
  1945. (
  1946. 'deptName' => array('zh-cn' => '部门', 'zh-tw' => '', 'en' => 'deptName', 'de' => '', 'fr' => ''),
  1947. 'count' => array('zh-cn' => '人数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => ''),
  1948. 'deptOrder' => array('zh-cn' => '顺序', 'zh-tw' => '', 'en' => 'deptOrder', 'de' => '', 'fr' => '')
  1949. ),
  1950. 'stage' => 'published',
  1951. 'builtin' => '0'
  1952. );
  1953. $config->bi->builtin->charts[] = array
  1954. (
  1955. 'id' => 1050,
  1956. 'name' => '宏观数据-公司角色分布图',
  1957. 'code' => 'macro_roleStatus',
  1958. 'dimension' => '1',
  1959. 'type' => 'pie',
  1960. 'group' => '56',
  1961. 'sql' => <<<EOT
  1962. SELECT
  1963. account,
  1964. CASE
  1965. ROLE
  1966. WHEN 'dev' THEN
  1967. '研发'
  1968. WHEN 'qa' THEN
  1969. '测试'
  1970. WHEN 'pm' THEN
  1971. '项目经理'
  1972. WHEN 'others' THEN
  1973. '其他'
  1974. WHEN 'td' THEN
  1975. '研发主管'
  1976. WHEN 'pd' THEN
  1977. '产品主管'
  1978. WHEN 'po' THEN
  1979. '产品经理'
  1980. WHEN 'qd' THEN
  1981. '测试主管'
  1982. WHEN 'top' THEN
  1983. '高层管理' ELSE '未知'
  1984. END `role`
  1985. FROM
  1986. zt_user
  1987. WHERE
  1988. deleted = '0'
  1989. EOT
  1990. ,
  1991. 'settings' => array
  1992. (
  1993. array
  1994. (
  1995. 'type' => 'pie',
  1996. 'group' => array
  1997. (
  1998. array('field' => 'role', 'name' => '职位', 'group' => '')
  1999. ),
  2000. 'metric' => array
  2001. (
  2002. array('field' => 'account', 'name' => '用户名', 'valOrAgg' => 'count')
  2003. )
  2004. )
  2005. ),
  2006. 'filters' => array(),
  2007. 'fields' => array
  2008. (
  2009. 'account' => array('name' => '用户名', 'object' => 'user', 'field' => 'account', 'type' => 'string'),
  2010. 'role' => array('name' => '职位', 'object' => 'user', 'field' => 'role', 'type' => 'string')
  2011. ),
  2012. 'langs' => array
  2013. (
  2014. 'account' => array('zh-cn' => '用户名', 'zh-tw' => '', 'en' => 'account', 'de' => '', 'fr' => ''),
  2015. 'role' => array('zh-cn' => '职位', 'zh-tw' => '', 'en' => 'role', 'de' => '', 'fr' => '')
  2016. ),
  2017. 'stage' => 'published',
  2018. 'builtin' => '0'
  2019. );
  2020. $config->bi->builtin->charts[] = array
  2021. (
  2022. 'id' => 1051,
  2023. 'name' => '宏观数据-人员工龄分布图',
  2024. 'code' => 'macro_workingStatus',
  2025. 'dimension' => '1',
  2026. 'type' => 'cluBarY',
  2027. 'group' => '56',
  2028. 'sql' => <<<EOT
  2029. SELECT count(1) as count, '0-1年' as joinDate FROM zt_user WHERE deleted = '0' AND `join` > DATE_SUB(NOW(), INTERVAL 1 YEAR)
  2030. union
  2031. SELECT count(1) as count, '1-3年' as joinDate FROM zt_user WHERE deleted = '0' AND `join` > DATE_SUB(NOW(), INTERVAL 3 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 1 YEAR)
  2032. union
  2033. SELECT count(1) as count, '3-5年' as joinDate FROM zt_user WHERE deleted = '0' AND `join` > DATE_SUB(NOW(), INTERVAL 5 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 3 YEAR)
  2034. union
  2035. SELECT count(1) as count, '5-10年' as joinDate FROM zt_user WHERE deleted = '0' AND `join` > DATE_SUB(NOW(), INTERVAL 10 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 5 YEAR)
  2036. union
  2037. SELECT count(1) as count, '10年以上' as joinDate FROM zt_user WHERE deleted = '0' AND `join` < DATE_SUB(NOW(), INTERVAL 10 YEAR) AND LEFT(`join`, 4) != '0000'
  2038. union
  2039. SELECT count(1) as count, '未知' as joinDate FROM zt_user WHERE deleted = '0' AND LEFT(`join`, 4) = '0000'
  2040. EOT
  2041. ,
  2042. 'settings' => array
  2043. (
  2044. array
  2045. (
  2046. 'type' => 'cluBarY',
  2047. 'xaxis' => array
  2048. (
  2049. array('field' => 'joinDate', 'name' => 'joinDate', 'group' => '')
  2050. ),
  2051. 'yaxis' => array
  2052. (
  2053. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  2054. )
  2055. )
  2056. ),
  2057. 'filters' => array(),
  2058. 'fields' => array
  2059. (
  2060. 'count' => array('name' => 'count', 'object' => 'user', 'field' => 'count', 'type' => 'string'),
  2061. 'joinDate' => array('name' => 'joinDate', 'object' => 'user', 'field' => 'joinDate', 'type' => 'string')
  2062. ),
  2063. 'langs' => array
  2064. (
  2065. 'count' => array('zh-cn' => '人数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => ''),
  2066. 'joinDate' => array('zh-cn' => '工龄', 'zh-tw' => '', 'en' => 'joinDate', 'de' => '', 'fr' => '')
  2067. ),
  2068. 'stage' => 'published',
  2069. 'builtin' => '0'
  2070. );
  2071. $config->bi->builtin->charts[] = array
  2072. (
  2073. 'id' => 1055,
  2074. 'name' => '年度新增-一级项目集个数',
  2075. 'code' => 'annualCreated_countTopProgram',
  2076. 'dimension' => '1',
  2077. 'type' => 'card',
  2078. 'group' => '45',
  2079. 'sql' => <<<EOT
  2080. SELECT
  2081. t1.`year`,
  2082. t2.id,
  2083. t2.name
  2084. FROM
  2085. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2086. LEFT JOIN (
  2087. SELECT
  2088. id, name,
  2089. YEAR ( `openedDate` ) AS `year`
  2090. FROM
  2091. zt_project
  2092. WHERE
  2093. `type` = 'program'
  2094. AND deleted = '0'
  2095. AND grade = '1'
  2096. ) t2 ON t1.`year` = t2.`year`
  2097. WHERE t2.id IS NOT NULL
  2098. EOT
  2099. ,
  2100. 'settings' => array
  2101. (
  2102. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2103. 'title' => array('type' => 'text', 'name' => ''),
  2104. 'type' => 'value'
  2105. ),
  2106. 'stage' => 'published',
  2107. 'builtin' => '1'
  2108. );
  2109. $config->bi->builtin->charts[] = array
  2110. (
  2111. 'id' => 1056,
  2112. 'name' => '年度新增-产品个数',
  2113. 'code' => 'annualCreated_countProduct',
  2114. 'dimension' => '1',
  2115. 'type' => 'card',
  2116. 'group' => '47',
  2117. 'sql' => <<<EOT
  2118. SELECT
  2119. t1.`year`,
  2120. t2.id,
  2121. t2.name
  2122. FROM
  2123. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2124. LEFT JOIN (
  2125. SELECT
  2126. id, name,
  2127. YEAR ( createdDate ) AS `year`
  2128. FROM
  2129. zt_product
  2130. WHERE
  2131. deleted = '0'
  2132. AND shadow = '0'
  2133. ) t2 ON t1.`year` = t2.`year`
  2134. WHERE t2.id IS NOT NULL
  2135. EOT
  2136. ,
  2137. 'settings' => array
  2138. (
  2139. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2140. 'title' => array('type' => 'text', 'name' => ''),
  2141. 'type' => 'value'
  2142. ),
  2143. 'stage' => 'published',
  2144. 'builtin' => '1'
  2145. );
  2146. $config->bi->builtin->charts[] = array
  2147. (
  2148. 'id' => 1057,
  2149. 'name' => '年度新增-需求个数',
  2150. 'code' => 'annualCreated_countStory',
  2151. 'dimension' => '1',
  2152. 'type' => 'card',
  2153. 'group' => '51',
  2154. 'sql' => <<<EOT
  2155. SELECT
  2156. t1.`year`,
  2157. t2.id,
  2158. t2.title
  2159. FROM
  2160. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2161. LEFT JOIN ( SELECT id, title, YEAR ( `openedDate` ) AS `year` FROM zt_story WHERE deleted = '0' ) AS t2 ON t1.`year` = t2.`year`
  2162. WHERE t2.id IS NOT NULL
  2163. EOT
  2164. ,
  2165. 'settings' => array
  2166. (
  2167. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2168. 'title' => array('type' => 'text', 'name' => ''),
  2169. 'type' => 'value'
  2170. ),
  2171. 'stage' => 'published',
  2172. 'builtin' => '1'
  2173. );
  2174. $config->bi->builtin->charts[] = array
  2175. (
  2176. 'id' => 1058,
  2177. 'name' => '年度新增-Bug个数',
  2178. 'code' => 'annualCreated_countBug',
  2179. 'dimension' => '1',
  2180. 'type' => 'card',
  2181. 'group' => '53',
  2182. 'sql' => <<<EOT
  2183. SELECT
  2184. t1.`year`,
  2185. t2.id,
  2186. t2.title
  2187. FROM
  2188. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2189. LEFT JOIN ( SELECT id, title, YEAR ( `openedDate` ) AS `year` FROM zt_bug WHERE deleted = '0' ) AS t2 ON t1.`year` = t2.`year`
  2190. WHERE t2.id IS NOT NULL
  2191. EOT
  2192. ,
  2193. 'settings' => array
  2194. (
  2195. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2196. 'title' => array('type' => 'text', 'name' => ''),
  2197. 'type' => 'value'
  2198. ),
  2199. 'stage' => 'published',
  2200. 'builtin' => '1'
  2201. );
  2202. $config->bi->builtin->charts[] = array
  2203. (
  2204. 'id' => 1059,
  2205. 'name' => '年度新增-计划个数',
  2206. 'code' => 'annualCreated_countPlan',
  2207. 'dimension' => '1',
  2208. 'type' => 'card',
  2209. 'group' => '48',
  2210. 'sql' => <<<EOT
  2211. SELECT
  2212. t1.`year`,
  2213. t2.id,
  2214. t2.title
  2215. FROM
  2216. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2217. LEFT JOIN ( SELECT id, title, YEAR ( createdDate ) AS `year` FROM zt_productplan WHERE deleted = '0') AS t2 ON t1.`year` = t2.`year`
  2218. WHERE t2.id IS NOT NULL
  2219. EOT
  2220. ,
  2221. 'settings' => array
  2222. (
  2223. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2224. 'title' => array('type' => 'text', 'name' => ''),
  2225. 'type' => 'value'
  2226. ),
  2227. 'stage' => 'published',
  2228. 'builtin' => '1'
  2229. );
  2230. $config->bi->builtin->charts[] = array
  2231. (
  2232. 'id' => 1060,
  2233. 'name' => '年度新增-项目个数',
  2234. 'code' => 'annualCreated_countProject',
  2235. 'dimension' => '1',
  2236. 'type' => 'card',
  2237. 'group' => '46',
  2238. 'sql' => <<<EOT
  2239. SELECT
  2240. t1.`year`,
  2241. t2.id,
  2242. t2.name
  2243. FROM
  2244. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2245. LEFT JOIN (
  2246. SELECT
  2247. id, name,
  2248. YEAR ( `openedDate` ) AS `year`
  2249. FROM
  2250. zt_project
  2251. WHERE
  2252. `type` = 'project'
  2253. AND deleted = '0'
  2254. AND market = 0
  2255. ) t2 ON t1.`year` = t2.`year`
  2256. WHERE t2.id IS NOT NULL
  2257. EOT
  2258. ,
  2259. 'settings' => array
  2260. (
  2261. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2262. 'title' => array('type' => 'text', 'name' => ''),
  2263. 'type' => 'value'
  2264. ),
  2265. 'stage' => 'published',
  2266. 'builtin' => '1'
  2267. );
  2268. $config->bi->builtin->charts[] = array
  2269. (
  2270. 'id' => 1061,
  2271. 'name' => '年度新增-执行个数',
  2272. 'code' => 'annualCreated_countExecution',
  2273. 'dimension' => '1',
  2274. 'type' => 'card',
  2275. 'group' => '49',
  2276. 'sql' => <<<EOT
  2277. SELECT t1.`year`, t2.id, t2.name
  2278. FROM (SELECT DISTINCT YEAR(`date`) AS `year` FROM zt_action) AS t1
  2279. LEFT JOIN (SELECT id,name, YEAR(openedDate) AS `year` FROM zt_project WHERE `type` IN ( 'sprint', 'stage', 'kanban' ) AND deleted = '0' AND multiple = '1' AND market = 0) AS t2 ON t1.`year` = t2.`year`
  2280. WHERE t2.id IS NOT NULL
  2281. EOT
  2282. ,
  2283. 'settings' => array
  2284. (
  2285. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2286. 'title' => array('type' => 'text', 'name' => ''),
  2287. 'type' => 'value'
  2288. ),
  2289. 'stage' => 'published',
  2290. 'builtin' => '1'
  2291. );
  2292. $config->bi->builtin->charts[] = array
  2293. (
  2294. 'id' => 1062,
  2295. 'name' => '年度新增-任务数',
  2296. 'code' => 'annualCreated_countTask',
  2297. 'dimension' => '1',
  2298. 'type' => 'card',
  2299. 'group' => '52',
  2300. 'sql' => <<<EOT
  2301. SELECT
  2302. t1.`year`,
  2303. t2.id,
  2304. t2.name
  2305. FROM
  2306. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2307. LEFT JOIN ( SELECT id, name, YEAR ( `openedDate` ) AS `year` FROM zt_task WHERE deleted = '0' AND type != 'research') AS t2 ON t1.`year` = t2.`year`
  2308. WHERE t2.id IS NOT NULL
  2309. EOT
  2310. ,
  2311. 'settings' => array
  2312. (
  2313. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2314. 'title' => array('type' => 'text', 'name' => ''),
  2315. 'type' => 'value'
  2316. ),
  2317. 'stage' => 'published',
  2318. 'builtin' => '1'
  2319. );
  2320. $config->bi->builtin->charts[] = array
  2321. (
  2322. 'id' => 1063,
  2323. 'name' => '年度新增-文档个数',
  2324. 'code' => 'annualCreated_countDoc',
  2325. 'dimension' => '1',
  2326. 'type' => 'card',
  2327. 'group' => '54',
  2328. 'sql' => <<<EOT
  2329. SELECT
  2330. t1.`year`,
  2331. t2.id,
  2332. t2.title
  2333. FROM
  2334. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2335. LEFT JOIN ( SELECT id, title, YEAR ( addedDate ) AS `year` FROM zt_doc WHERE deleted = '0') AS t2 ON t1.`year` = t2.`year`
  2336. WHERE t2.id IS NOT NULL
  2337. EOT
  2338. ,
  2339. 'settings' => array
  2340. (
  2341. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2342. 'title' => array('type' => 'text', 'name' => ''),
  2343. 'type' => 'value'
  2344. ),
  2345. 'stage' => 'published',
  2346. 'builtin' => '1'
  2347. );
  2348. $config->bi->builtin->charts[] = array
  2349. (
  2350. 'id' => 1064,
  2351. 'name' => '年度新增-发布个数',
  2352. 'code' => 'annualCreated_countRelease',
  2353. 'dimension' => '1',
  2354. 'type' => 'card',
  2355. 'group' => '50',
  2356. 'sql' => <<<EOT
  2357. SELECT
  2358. t1.`year`,
  2359. t2.id,
  2360. t2.name
  2361. FROM
  2362. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2363. LEFT JOIN ( SELECT id, name, YEAR ( `date` ) AS `year` FROM zt_release WHERE deleted = '0') AS t2 ON t1.`year` = t2.`year`
  2364. WHERE t2.id IS NOT NULL
  2365. EOT
  2366. ,
  2367. 'settings' => array
  2368. (
  2369. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2370. 'title' => array('type' => 'text', 'name' => ''),
  2371. 'type' => 'value'
  2372. ),
  2373. 'stage' => 'published',
  2374. 'builtin' => '1'
  2375. );
  2376. $config->bi->builtin->charts[] = array
  2377. (
  2378. 'id' => 1065,
  2379. 'name' => '年度新增-人员个数',
  2380. 'code' => 'annualCreated_countAccount',
  2381. 'dimension' => '1',
  2382. 'type' => 'card',
  2383. 'group' => '56',
  2384. 'sql' => <<<EOT
  2385. SELECT
  2386. t1.`year`,
  2387. t2.account,
  2388. t2.realname
  2389. FROM
  2390. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2391. LEFT JOIN (
  2392. SELECT
  2393. account, realname,
  2394. YEAR ( t112.`date` ) AS `year`
  2395. FROM
  2396. zt_user AS t111
  2397. LEFT JOIN zt_action t112 ON t111.id = t112.objectID
  2398. AND t112.objectType = 'user'
  2399. WHERE
  2400. t111.deleted = '0'
  2401. AND t112.action = 'created'
  2402. ) AS t2 ON t1.`year` = t2.`year`
  2403. WHERE t2.account IS NOT NULL
  2404. EOT
  2405. ,
  2406. 'settings' => array
  2407. (
  2408. 'value' => array('type' => 'agg', 'field' => 'account', 'agg' => 'count'),
  2409. 'title' => array('type' => 'text', 'realname' => ''),
  2410. 'type' => 'value'
  2411. ),
  2412. 'stage' => 'published',
  2413. 'builtin' => '1'
  2414. );
  2415. $config->bi->builtin->charts[] = array
  2416. (
  2417. 'id' => 1066,
  2418. 'name' => '年度新增-完成项目数',
  2419. 'code' => 'annualCreated_countPorject_finished',
  2420. 'dimension' => '1',
  2421. 'type' => 'card',
  2422. 'group' => '46',
  2423. 'sql' => <<<EOT
  2424. SELECT
  2425. t1.`year`,
  2426. t2.id,
  2427. t2.name
  2428. FROM
  2429. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2430. LEFT JOIN (
  2431. SELECT
  2432. id, name,
  2433. YEAR ( closedDate ) AS `year`
  2434. FROM
  2435. zt_project
  2436. WHERE
  2437. `type` = 'project'
  2438. AND deleted = '0'
  2439. AND isTpl = '0'
  2440. ) t2 ON t1.`year` = t2.`year`
  2441. WHERE t2.id IS NOT NULL
  2442. EOT
  2443. ,
  2444. 'settings' => array
  2445. (
  2446. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2447. 'title' => array('type' => 'text', 'name' => ''),
  2448. 'type' => 'value'
  2449. ),
  2450. 'stage' => 'published',
  2451. 'builtin' => '1'
  2452. );
  2453. $config->bi->builtin->charts[] = array
  2454. (
  2455. 'id' => 1067,
  2456. 'name' => '年度新增-完成执行数',
  2457. 'code' => 'annualCreated_countExecution_finished',
  2458. 'dimension' => '1',
  2459. 'type' => 'card',
  2460. 'group' => '49',
  2461. 'sql' => <<<EOT
  2462. SELECT t1.`year`, t2.id, t2.name
  2463. FROM (SELECT DISTINCT YEAR(date) AS `year` FROM zt_action) AS t1
  2464. LEFT JOIN (SELECT id, name, YEAR(closedDate) AS `year` FROM zt_project WHERE `type` IN ( 'sprint', 'stage', 'kanban' ) AND deleted = '0' AND multiple = '1' AND status = 'closed' AND isTpl = '0') AS t2 ON t1.`year` = t2.`year`
  2465. WHERE t2.id IS NOT NULL
  2466. EOT
  2467. ,
  2468. 'settings' => array
  2469. (
  2470. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2471. 'title' => array('type' => 'text', 'name' => ''),
  2472. 'type' => 'value'
  2473. ),
  2474. 'stage' => 'published',
  2475. 'builtin' => '1'
  2476. );
  2477. $config->bi->builtin->charts[] = array
  2478. (
  2479. 'id' => 1068,
  2480. 'name' => '年度新增-完成发布数',
  2481. 'code' => 'annualCreated_countRelease_finished',
  2482. 'dimension' => '1',
  2483. 'type' => 'card',
  2484. 'group' => '50',
  2485. 'sql' => <<<EOT
  2486. SELECT
  2487. t1.`year`,
  2488. t2.id,
  2489. t2.name
  2490. FROM
  2491. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2492. LEFT JOIN ( SELECT id, name, YEAR ( `date` ) AS `year` FROM zt_release WHERE deleted = '0') AS t2 ON t1.`year` = t2.`year`
  2493. WHERE t2.id IS NOT NULL
  2494. EOT
  2495. ,
  2496. 'settings' => array
  2497. (
  2498. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2499. 'title' => array('type' => 'text', 'name' => ''),
  2500. 'type' => 'value'
  2501. ),
  2502. 'stage' => 'published',
  2503. 'builtin' => '1'
  2504. );
  2505. $config->bi->builtin->charts[] = array
  2506. (
  2507. 'id' => 1069,
  2508. 'name' => '年度新增-完成需求数',
  2509. 'code' => 'annualCreated_countStory_finished',
  2510. 'dimension' => '1',
  2511. 'type' => 'card',
  2512. 'group' => '51',
  2513. 'sql' => <<<EOT
  2514. SELECT
  2515. t1.`year`,
  2516. t2.id,
  2517. t2.title
  2518. FROM
  2519. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2520. LEFT JOIN (
  2521. SELECT
  2522. id, title,
  2523. YEAR ( closedDate ) AS `year`
  2524. FROM
  2525. zt_story
  2526. WHERE
  2527. deleted = '0'
  2528. AND closedReason = 'done'
  2529. AND STATUS = 'closed'
  2530. ) AS t2 ON t1.`year` = t2.`year`
  2531. WHERE t2.id IS NOT NULL
  2532. EOT
  2533. ,
  2534. 'settings' => array
  2535. (
  2536. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2537. 'title' => array('type' => 'text', 'name' => ''),
  2538. 'type' => 'value'
  2539. ),
  2540. 'stage' => 'published',
  2541. 'builtin' => '1'
  2542. );
  2543. $config->bi->builtin->charts[] = array
  2544. (
  2545. 'id' => 1070,
  2546. 'name' => '年度新增-解决Bug数',
  2547. 'code' => 'annualCreated_countBug_fixed',
  2548. 'dimension' => '1',
  2549. 'type' => 'card',
  2550. 'group' => '53',
  2551. 'sql' => <<<EOT
  2552. SELECT
  2553. t1.`year`,
  2554. t2.id,
  2555. t2.title
  2556. FROM
  2557. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2558. LEFT JOIN (
  2559. SELECT
  2560. id, title,
  2561. YEAR ( closedDate ) AS `year`
  2562. FROM
  2563. zt_bug
  2564. WHERE
  2565. deleted = '0'
  2566. AND resolution = 'fixed'
  2567. AND STATUS = 'closed'
  2568. ) AS t2 ON t1.`year` = t2.`year`
  2569. WHERE t2.id IS NOT NULL
  2570. EOT
  2571. ,
  2572. 'settings' => array
  2573. (
  2574. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2575. 'title' => array('type' => 'text', 'name' => ''),
  2576. 'type' => 'value'
  2577. ),
  2578. 'stage' => 'published',
  2579. 'builtin' => '1'
  2580. );
  2581. $config->bi->builtin->charts[] = array
  2582. (
  2583. 'id' => 1071,
  2584. 'name' => '年度新增-完成任务数',
  2585. 'code' => 'annualCreated_countTask_finished',
  2586. 'dimension' => '1',
  2587. 'type' => 'card',
  2588. 'group' => '52',
  2589. 'sql' => <<<EOT
  2590. SELECT
  2591. t1.`year`,
  2592. t2.id,
  2593. t2.name
  2594. FROM
  2595. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2596. LEFT JOIN (
  2597. SELECT
  2598. id, name,
  2599. YEAR ( finishedDate ) AS `year`
  2600. FROM
  2601. zt_task
  2602. WHERE
  2603. deleted = '0'
  2604. AND STATUS = 'closed'
  2605. AND closedReason = 'done'
  2606. AND isTpl = '0'
  2607. ) AS t2 ON t1.`year` = t2.`year`
  2608. WHERE t2.id IS NOT NULL
  2609. EOT
  2610. ,
  2611. 'settings' => array
  2612. (
  2613. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  2614. 'title' => array('type' => 'text', 'name' => ''),
  2615. 'type' => 'value'
  2616. ),
  2617. 'stage' => 'published',
  2618. 'builtin' => '1'
  2619. );
  2620. $config->bi->builtin->charts[] = array
  2621. (
  2622. 'id' => 1072,
  2623. 'name' => '年度新增-投入工时数',
  2624. 'code' => 'annualCreated_consumed',
  2625. 'dimension' => '1',
  2626. 'type' => 'card',
  2627. 'group' => '57',
  2628. 'sql' => <<<EOT
  2629. SELECT
  2630. t1.`year`,
  2631. IFNULL( t2.consumed, 0 ) AS consumed
  2632. FROM
  2633. ( SELECT DISTINCT YEAR ( `date` ) AS `year` FROM zt_action ) AS t1
  2634. LEFT JOIN ( SELECT ROUND( SUM( consumed )) AS consumed, YEAR ( `date` ) AS `year` FROM zt_effort WHERE deleted = '0' GROUP BY `year`) AS t2 ON t1.`year` = t2.`year`
  2635. EOT
  2636. ,
  2637. 'settings' => array
  2638. (
  2639. 'value' => array('type' => 'value', 'field' => 'consumed', 'agg' => 'value'),
  2640. 'title' => array('type' => 'text', 'name' => ''),
  2641. 'type' => 'value'
  2642. ),
  2643. 'stage' => 'published',
  2644. 'builtin' => '1'
  2645. );
  2646. $config->bi->builtin->charts[] = array
  2647. (
  2648. 'id' => 1073,
  2649. 'name' => '年度新增-项目集年度新增数据汇总表',
  2650. 'code' => 'annualCreated_programOverview_created',
  2651. 'dimension' => '1',
  2652. 'type' => 'table',
  2653. 'group' => '64',
  2654. 'sql' => <<<EOT
  2655. select tt.topProgram,tt.programID as id,tt.`year`,sum(tt.product) as product,sum(tt.plan) as plan,sum(tt.`release`) as `release`,sum(tt.story) as story,sum(tt.bug) as bug,sum(tt.doc) as doc
  2656. from (
  2657. select t2.name as topProgram,t2.id as programID,t0.`year`,count(1) as product,0 as plan,0 as story,0 as bug,0 as `release`, 0 as doc
  2658. from zt_product t1
  2659. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.createdDate) = t0.`year`
  2660. left join zt_project t2 on t1.program = t2.id
  2661. where t1.deleted = '0' and t1.shadow = '0'
  2662. and t2.type = 'program' and t2.grade = 1 and t2.deleted = '0'
  2663. group by t2.id, t0.`year`
  2664. union all
  2665. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,count(1) as plan,0 as story,0 as bug,0 as `release`, 0 as doc
  2666. from zt_productplan t1
  2667. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.createdDate) = t0.`year`
  2668. left join zt_product t2 on t2.id = t1.product
  2669. left join zt_project t3 on t2.program = t3.id
  2670. where t1.deleted = '0'
  2671. and t2.deleted = '0'
  2672. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2673. group by t3.id, t0.`year`
  2674. union all
  2675. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,0 as plan,0 as story,0 as bug,0 as `release`, count(1) as doc
  2676. from zt_doc t1
  2677. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.addedDate) = t0.`year`
  2678. left join zt_product t2 on t2.id = t1.product
  2679. left join zt_project t3 on t2.program = t3.id
  2680. where t1.deleted = '0'
  2681. and t2.deleted = '0'
  2682. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2683. group by t3.id, t0.`year`
  2684. union all
  2685. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,0 as plan,0 as story,0 as bug,0 as `release`, count(distinct t1.id) as doc
  2686. from zt_doc t1
  2687. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.addedDate) = t0.`year`
  2688. left join zt_projectproduct t4 on t1.project = t4.project
  2689. left join zt_product t2 on t2.id = t4.product
  2690. left join zt_project t3 on t2.program = t3.id
  2691. where t1.deleted = '0'
  2692. and t2.deleted = '0'
  2693. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2694. group by t3.id, t0.`year`
  2695. union all
  2696. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,0 as plan,0 as story,0 as bug,count(1) as `release`, 0 as doc
  2697. from zt_release t1
  2698. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.date) = t0.`year`
  2699. left join zt_product t2 on t2.id = t1.product
  2700. left join zt_project t3 on t2.program = t3.id
  2701. where t1.deleted = '0'
  2702. and t2.deleted = '0'
  2703. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2704. group by t3.id, t0.`year`
  2705. union all
  2706. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,0 as plan,count(1) as story,0 as bug,0 as `release`, 0 as doc
  2707. from zt_story t1
  2708. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.openedDate) = t0.`year`
  2709. left join zt_product t2 on t2.id = t1.product
  2710. left join zt_project t3 on t2.program = t3.id
  2711. where t1.deleted = '0'
  2712. and t2.deleted = '0'
  2713. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2714. group by t3.id, t0.`year`
  2715. union all
  2716. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as product,0 as plan,0 as story,count(1) as bug,0 as `release`, 0 as doc
  2717. from zt_bug t1
  2718. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.openedDate) = t0.`year`
  2719. left join zt_product t2 on t2.id = t1.product
  2720. left join zt_project t3 on t2.program = t3.id
  2721. where t1.deleted = '0'
  2722. and t2.deleted = '0'
  2723. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2724. group by t3.id, t0.`year`
  2725. ) tt
  2726. group by tt.programID, tt.`year`
  2727. EOT
  2728. ,
  2729. 'settings' => array
  2730. (
  2731. 'group' => array(),
  2732. 'column' => array
  2733. (
  2734. array('field' => 'topProgram', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  2735. array('field' => 'product', 'valOrAgg' => 'value', 'name' => '产品数'),
  2736. array('field' => 'plan', 'valOrAgg' => 'value', 'name' => '计划数'),
  2737. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '需求数'),
  2738. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数'),
  2739. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数'),
  2740. array('field' => 'doc', 'valOrAgg' => 'value', 'name' => '文档数')
  2741. ),
  2742. 'filter' => array()
  2743. ),
  2744. 'stage' => 'published',
  2745. 'builtin' => '1'
  2746. );
  2747. $config->bi->builtin->charts[] = array
  2748. (
  2749. 'id' => 1074,
  2750. 'name' => '年度新增-项目集年度完成数据概览',
  2751. 'code' => 'annualCreated_programOverview_finished',
  2752. 'dimension' => '1',
  2753. 'type' => 'table',
  2754. 'group' => '64',
  2755. 'sql' => <<<EOT
  2756. select tt.topProgram,tt.programID as id,tt.`year`,sum(tt.projectA) as projectA,sum(tt.executionA) as executionA,sum(tt.releaseA) as `release`,sum(tt.storyA) as story,sum(tt.bugA) as bug
  2757. from (
  2758. select t2.name as topProgram,t2.id as programID,t0.`year`,count(1) as projectA,0 as executionA,0 as releaseA,0 as storyA,0 as bugA
  2759. from zt_project t1
  2760. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.closedDate) = t0.`year`
  2761. left join zt_project t2 on FIND_IN_SET(t2.id, t1.path)
  2762. where t1.type = 'project' and t1.deleted = '0'
  2763. and t2.type = 'program' and t2.grade = 1 and t2.deleted = '0'
  2764. and t1.`status` = 'closed'
  2765. group by t2.id, t0.`year`
  2766. union all
  2767. select t3.name as topProgram, t3.id as programID,t0.`year`,0 as projectA,count(1) as executionA,0 as releaseA,0 as storyA,0 as bugA
  2768. from zt_project t1
  2769. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.closedDate) = t0.`year`
  2770. left join zt_project t2 on t1.parent = t2.id
  2771. left join zt_project t3 on FIND_IN_SET(t3.id, t2.path)
  2772. where t1.type in ('sprint', 'stage', 'kanban') and t1.deleted = '0'
  2773. and t2.type = 'project' and t2.deleted = '0'
  2774. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2775. and t1.`status` = 'closed'
  2776. group by t3.id, t0.`year`
  2777. union all
  2778. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as projectA,0 as executionA,count(1) as releaseA,0 as storyA,0 as bugA
  2779. from zt_release t1
  2780. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.date) = t0.`year`
  2781. left join zt_product t2 on t2.id = t1.product
  2782. left join zt_project t3 on t2.program = t3.id
  2783. where t1.deleted = '0'
  2784. and t2.deleted = '0'
  2785. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2786. group by t3.id, t0.`year`
  2787. union all
  2788. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as projectA,0 as executionA,0 as releaseA,count(1) as storyA,0 as bugA
  2789. from zt_story t1
  2790. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.closedDate) = t0.`year`
  2791. left join zt_product t2 on t2.id = t1.product
  2792. left join zt_project t3 on t2.program = t3.id
  2793. where t1.deleted = '0' and t1.closedReason = 'done' and t1.status = 'closed'
  2794. and t2.deleted = '0'
  2795. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2796. group by t3.id, t0.`year`
  2797. union all
  2798. select t3.name as topProgram,t3.id as programID,t0.`year`,0 as projectA,0 as executionA,0 as releaseA,0 as storyA,count(1) as bugA
  2799. from zt_bug t1
  2800. left join (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) t0 on YEAR(t1.resolvedDate) = t0.`year`
  2801. left join zt_product t2 on t2.id = t1.product
  2802. left join zt_project t3 on t2.program = t3.id
  2803. where t1.deleted = '0' and t1.resolution = 'fixed' and t1.status = 'closed'
  2804. and t2.deleted = '0'
  2805. and t3.type = 'program' and t3.grade = 1 and t3.deleted = '0'
  2806. group by t3.id, t0.`year`
  2807. ) tt
  2808. group by tt.programID, tt.`year`
  2809. EOT
  2810. ,
  2811. 'settings' => array
  2812. (
  2813. 'group' => array(),
  2814. 'column' => array
  2815. (
  2816. array('field' => 'topProgram', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  2817. array('field' => 'projectA', 'valOrAgg' => 'value', 'name' => '项目数'),
  2818. array('field' => 'executionA', 'valOrAgg' => 'value', 'name' => '执行数'),
  2819. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数'),
  2820. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '需求数'),
  2821. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数')
  2822. ),
  2823. 'filter' => array()
  2824. ),
  2825. 'stage' => 'published',
  2826. 'builtin' => '1'
  2827. );
  2828. $config->bi->builtin->charts[] = array
  2829. (
  2830. 'id' => 1075,
  2831. 'name' => '年度新增-产品年度新增数据汇总表',
  2832. 'code' => 'annualCreated_productOverview_created',
  2833. 'dimension' => '1',
  2834. 'type' => 'table',
  2835. 'group' => '63',
  2836. 'sql' => <<<EOT
  2837. SELECT
  2838. t1.name,t1.id,t2.`year`,IF(YEAR(t1.createdDate) = t2.`year`, 1, 0) as newProduct,
  2839. SUM(IFNULL(t3.story, 0)) AS story,
  2840. SUM(IFNULL(t4.bug, 0)) AS bug,
  2841. SUM(IFNULL(t5.`plan`, 0)) AS `plan`,
  2842. SUM(IFNULL(t6.`release`, 0)) AS `release`
  2843. FROM zt_product AS t1
  2844. LEFT JOIN (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) as t2 ON 1 = 1
  2845. LEFT JOIN (SELECT COUNT(1) as `story`, product, YEAR(openedDate) as `year` FROM zt_story WHERE deleted = '0' GROUP BY product, `year`) AS t3 on t1.id = t3.product AND t3.`year` = t2.`year`
  2846. LEFT JOIN (SELECT COUNT(1) as `bug`, product, YEAR(openedDate) as `year` FROM zt_bug WHERE deleted = '0' GROUP BY product, `year`) AS t4 on t1.id = t4.product AND t4.`year` = t2.`year`
  2847. LEFT JOIN (SELECT COUNT(1) as `plan`, product, YEAR(createdDate) AS `year` FROM zt_productplan WHERE deleted = '0' GROUP BY product,`year`) AS t5 on t1.id = t5.product AND t5.`year` = t2.`year`
  2848. LEFT JOIN (SELECT COUNT(1) as `release`, product, YEAR(`date`) as `year` FROM zt_release WHERE deleted = '0' GROUP BY product, `year`) AS t6 ON t1.id = t6.product AND t6.`year` = t2.`year`
  2849. WHERE t1.deleted = '0' AND t1.status != 'closed' AND t1.shadow = '0'
  2850. GROUP BY t1.name,t1.id,t2.`year`,newProduct
  2851. EOT
  2852. ,
  2853. 'settings' => array
  2854. (
  2855. 'group' => array(),
  2856. 'column' => array
  2857. (
  2858. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '产品'),
  2859. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '需求数'),
  2860. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数'),
  2861. array('field' => 'plan', 'valOrAgg' => 'value', 'name' => '计划数'),
  2862. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数')
  2863. ),
  2864. 'filter' => array()
  2865. ),
  2866. 'stage' => 'published',
  2867. 'builtin' => '1'
  2868. );
  2869. $config->bi->builtin->charts[] = array
  2870. (
  2871. 'id' => 1076,
  2872. 'name' => '年度新增-产品年度完成数据汇总表',
  2873. 'code' => 'annualCreated_productOverview_finished',
  2874. 'dimension' => '1',
  2875. 'type' => 'table',
  2876. 'group' => '63',
  2877. 'sql' => <<<EOT
  2878. SELECT
  2879. t1.name,t1.id,t2.`year`,IF(YEAR(t1.createdDate) = t2.`year`, 1, 0) as newProduct,
  2880. SUM(IFNULL(t3.story, 0)) AS story,
  2881. SUM(IFNULL(t4.bug, 0)) AS bug,
  2882. SUM(IFNULL(t5.`plan`, 0)) AS `plan`,
  2883. SUM(IFNULL(t6.`release`, 0)) AS `release`
  2884. FROM zt_product AS t1
  2885. LEFT JOIN (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) as t2 ON 1 = 1
  2886. LEFT JOIN (SELECT COUNT(1) as `story`, product, YEAR(closedDate) as `year` FROM zt_story WHERE deleted = '0' AND closedReason = 'done' AND status = 'closed' GROUP BY product, `year`) AS t3 on t1.id = t3.product AND t3.`year` = t2.`year`
  2887. LEFT JOIN (SELECT COUNT(1) as `bug`, product, YEAR(resolvedDate) as `year` FROM zt_bug WHERE deleted = '0' AND resolution = 'fixed' AND status = 'closed' GROUP BY product, `year`) AS t4 on t1.id = t4.product AND t4.`year` = t2.`year`
  2888. LEFT JOIN (
  2889. SELECT COUNT(DISTINCT t51.id) as `plan`, t51.product, YEAR(t52.`date`) AS `year`
  2890. FROM zt_productplan AS t51
  2891. LEFT JOIN (SELECT objectID,objectType,action,MAX(`date`) as `date` FROM zt_action GROUP BY objectID,objectType, action) AS t52 ON t51.id = t52.objectID AND t52.objectType = 'productplan'
  2892. WHERE t51.deleted = '0' AND t51.closedReason = 'done' AND t51.status = 'closed'
  2893. AND t52.action = 'closed'
  2894. GROUP BY t51.product,`year`
  2895. ) AS t5 on t1.id = t5.product AND t5.`year` = t2.`year`
  2896. LEFT JOIN (SELECT COUNT(1) as `release`, product, YEAR(`date`) as `year` FROM zt_release WHERE deleted = '0' GROUP BY product, `year`) AS t6 ON t1.id = t6.product AND t6.`year` = t2.`year`
  2897. WHERE t1.deleted = '0' AND t1.status != 'closed' AND t1.shadow = '0'
  2898. GROUP BY t1.name,t1.id,t2.`year`,newProduct
  2899. EOT
  2900. ,
  2901. 'settings' => array
  2902. (
  2903. 'group' => array(),
  2904. 'column' => array
  2905. (
  2906. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '产品'),
  2907. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '需求数'),
  2908. array('field' => 'bug', 'valOrAgg' => 'value', 'name' => 'Bug数'),
  2909. array('field' => 'plan', 'valOrAgg' => 'value', 'name' => '计划数'),
  2910. array('field' => 'release', 'valOrAgg' => 'value', 'name' => '发布数')
  2911. ),
  2912. 'filter' => array()
  2913. ),
  2914. 'stage' => 'published',
  2915. 'builtin' => '1'
  2916. );
  2917. $config->bi->builtin->charts[] = array
  2918. (
  2919. 'id' => 1077,
  2920. 'name' => '年度新增-需求年度新增和完成趋势图',
  2921. 'code' => 'annualCreated_storyTendency',
  2922. 'dimension' => '1',
  2923. 'type' => 'line',
  2924. 'group' => '36',
  2925. 'sql' => <<<EOT
  2926. SELECT t1.YEARMONTH, t1.year, t1.month AS `month`, IFNULL(t2.story, 0) AS newStory, IFNULL(t3.story, 0) AS closedStory
  2927. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH, Year(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  2928. LEFT JOIN (SELECT YEAR(openedDate) AS `year`, MONTH(openedDate) AS `month`, COUNT(1) AS story FROM zt_story WHERE deleted = '0' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  2929. LEFT JOIN (SELECT YEAR(closedDate) AS `year`, MONTH(closedDate) AS `month`, COUNT(1) AS story FROM zt_story WHERE deleted = '0' AND closedReason = 'done' GROUP BY `year`, `month`) AS t3 ON t1.year = t3.year AND t1.month = t3.month
  2930. ORDER BY `year`, t1.month LIMIT 999999
  2931. EOT
  2932. ,
  2933. 'settings' => array
  2934. (
  2935. array
  2936. (
  2937. 'type' => 'line',
  2938. 'xaxis' => array
  2939. (
  2940. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  2941. ),
  2942. 'yaxis' => array
  2943. (
  2944. array('field' => 'newStory', 'name' => '继续添加研发需求', 'valOrAgg' => 'sum'),
  2945. array('field' => 'closedStory', 'name' => '需求:%s 已关闭,将不会被关闭。', 'valOrAgg' => 'sum')
  2946. ),
  2947. 'rotateX' => 'notuse'
  2948. )
  2949. ),
  2950. 'filters' => array
  2951. (
  2952. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  2953. ),
  2954. 'fields' => array
  2955. (
  2956. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'story', 'field' => 'YEARMONTH', 'type' => 'string'),
  2957. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  2958. 'month' => array('name' => 'month', 'object' => 'story', 'field' => 'month', 'type' => 'number'),
  2959. 'newStory' => array('name' => '继续添加研发需求', 'object' => 'story', 'field' => 'newStory', 'type' => 'string'),
  2960. 'closedStory' => array('name' => '需求:%s 已关闭,将不会被关闭。', 'object' => 'story', 'field' => 'closedStory', 'type' => 'string')
  2961. ),
  2962. 'langs' => array
  2963. (
  2964. 'YEARMONTH' => array('zh-cn' => 'YEARMONTH', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  2965. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  2966. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  2967. 'newStory' => array('zh-cn' => '新增需求数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  2968. 'closedStory' => array('zh-cn' => '完成需求数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  2969. ),
  2970. 'stage' => 'published',
  2971. 'builtin' => '0'
  2972. );
  2973. $config->bi->builtin->charts[] = array
  2974. (
  2975. 'id' => 1078,
  2976. 'name' => '年度新增-Bug年度新增和解决趋势图',
  2977. 'code' => 'annualCreated_bugTendency',
  2978. 'dimension' => '1',
  2979. 'type' => 'line',
  2980. 'group' => '44',
  2981. 'sql' => <<<EOT
  2982. SELECT YEARMONTH, t1.year, t1.month AS `month`, IFNULL(t2.bug, 0) AS newBug, IFNULL(t3.bug, 0) AS fixedBug
  2983. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH, Year(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  2984. LEFT JOIN (SELECT YEAR(openedDate) AS `year`, MONTH(openedDate) AS `month`, COUNT(1) AS bug FROM zt_bug WHERE deleted = '0' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  2985. LEFT JOIN (SELECT YEAR(closedDate) AS `year`, MONTH(closedDate) AS `month`, COUNT(1) AS bug FROM zt_bug WHERE deleted = '0' AND resolution = 'fixed' AND status = 'closed' GROUP BY `year`, `month`) AS t3 ON t1.year = t3.year AND t1.month = t3.month
  2986. ORDER BY `year`, t1.month LIMIT 999999
  2987. EOT
  2988. ,
  2989. 'settings' => array
  2990. (
  2991. array
  2992. (
  2993. 'type' => 'line',
  2994. 'xaxis' => array
  2995. (
  2996. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  2997. ),
  2998. 'yaxis' => array
  2999. (
  3000. array('field' => 'newBug', 'name' => 'newBug', 'valOrAgg' => 'sum'),
  3001. array('field' => 'fixedBug', 'name' => 'fixedBug', 'valOrAgg' => 'sum')
  3002. )
  3003. )
  3004. ),
  3005. 'filters' => array
  3006. (
  3007. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  3008. ),
  3009. 'fields' => array
  3010. (
  3011. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'bug', 'field' => 'YEARMONTH', 'type' => 'string'),
  3012. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  3013. 'month' => array('name' => 'month', 'object' => 'bug', 'field' => 'month', 'type' => 'number'),
  3014. 'newBug' => array('name' => 'newBug', 'object' => 'bug', 'field' => 'newBug', 'type' => 'string'),
  3015. 'fixedBug' => array('name' => 'fixedBug', 'object' => 'bug', 'field' => 'fixedBug', 'type' => 'string')
  3016. ),
  3017. 'langs' => array
  3018. (
  3019. 'YEARMONTH' => array('zh-cn' => '', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3020. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3021. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3022. 'newBug' => array('zh-cn' => '新增Bug数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3023. 'fixedBug' => array('zh-cn' => '解决Bug数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3024. ),
  3025. 'stage' => 'published',
  3026. 'builtin' => '0'
  3027. );
  3028. $config->bi->builtin->charts[] = array
  3029. (
  3030. 'id' => 1079,
  3031. 'name' => '年度新增-任务年度新增和完成趋势图',
  3032. 'code' => 'annualCreated_taskTendency',
  3033. 'dimension' => '1',
  3034. 'type' => 'line',
  3035. 'group' => '39',
  3036. 'sql' => <<<EOT
  3037. SELECT YEARMONTH, t1.year, CONCAT(t1.month, '月') AS `month`, IFNULL(t2.task, 0) AS newTask, IFNULL(t3.task, 0) AS closedTask
  3038. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH, Year(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  3039. LEFT JOIN (SELECT YEAR(openedDate) AS `year`, MONTH(openedDate) AS `month`, COUNT(1) AS task FROM zt_task WHERE deleted = '0' AND isTpl = '0' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  3040. LEFT JOIN (SELECT YEAR(closedDate) AS `year`, MONTH(closedDate) AS `month`, COUNT(1) AS task FROM zt_task WHERE deleted = '0' AND status = 'closed' AND isTpl = '0' GROUP BY `year`, `month`) AS t3 ON t1.year = t3.year AND t1.month = t3.month
  3041. ORDER BY `year`, t1.month LIMIT 999999
  3042. EOT
  3043. ,
  3044. 'settings' => array
  3045. (
  3046. array
  3047. (
  3048. 'type' => 'line',
  3049. 'xaxis' => array
  3050. (
  3051. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  3052. ),
  3053. 'yaxis' => array
  3054. (
  3055. array('field' => 'newTask', 'name' => 'newTask', 'valOrAgg' => 'sum'),
  3056. array('field' => 'closedTask', 'name' => 'closedTask', 'valOrAgg' => 'sum')
  3057. )
  3058. )
  3059. ),
  3060. 'filters' => array
  3061. (
  3062. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  3063. ),
  3064. 'fields' => array
  3065. (
  3066. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'task', 'field' => 'YEARMONTH', 'type' => 'string'),
  3067. 'year' => array('name' => 'year', 'object' => 'task', 'field' => 'year', 'type' => 'number'),
  3068. 'month' => array('name' => 'month', 'object' => 'task', 'field' => 'month', 'type' => 'string'),
  3069. 'newTask' => array('name' => 'newTask', 'object' => 'task', 'field' => 'newTask', 'type' => 'string'),
  3070. 'closedTask' => array('name' => 'closedTask', 'object' => 'task', 'field' => 'closedTask', 'type' => 'string')
  3071. ),
  3072. 'langs' => array
  3073. (
  3074. 'YEARMONTH' => array('zh-cn' => 'YEARMONTH', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3075. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3076. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3077. 'newTask' => array('zh-cn' => '新增任务数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3078. 'closedTask' => array('zh-cn' => '完成任务数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3079. ),
  3080. 'stage' => 'published',
  3081. 'builtin' => '0'
  3082. );
  3083. $config->bi->builtin->charts[] = array
  3084. (
  3085. 'id' => 1080,
  3086. 'name' => '年度新增-项目年度新增和完成趋势图',
  3087. 'code' => 'annualCreated_projectTendency',
  3088. 'dimension' => '1',
  3089. 'type' => 'line',
  3090. 'group' => '38',
  3091. 'sql' => <<<EOT
  3092. SELECT YEARMONTH, t1.year, CONCAT(t1.month, '月') AS `month`, IFNULL(t2.project, 0) AS newProject, IFNULL(t3.project, 0) AS closedProject
  3093. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH, Year(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  3094. LEFT JOIN (SELECT YEAR(openedDate) AS `year`, MONTH(openedDate) AS `month`, COUNT(1) AS project FROM zt_project WHERE deleted = '0' AND type = 'project' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  3095. LEFT JOIN (SELECT YEAR(closedDate) AS `year`, MONTH(closedDate) AS `month`, COUNT(1) AS project FROM zt_project WHERE deleted = '0' AND type = 'project' AND status = 'closed' GROUP BY `year`, `month`) AS t3 ON t1.year = t3.year AND t1.month = t3.month
  3096. ORDER BY `year`, t1.month LIMIT 999999
  3097. EOT
  3098. ,
  3099. 'settings' => array
  3100. (
  3101. array
  3102. (
  3103. 'type' => 'line',
  3104. 'xaxis' => array
  3105. (
  3106. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  3107. ),
  3108. 'yaxis' => array
  3109. (
  3110. array('field' => 'newProject', 'name' => 'newProject', 'valOrAgg' => 'sum'),
  3111. array('field' => 'closedProject', 'name' => '已关闭的项目', 'valOrAgg' => 'sum')
  3112. )
  3113. )
  3114. ),
  3115. 'filters' => array
  3116. (
  3117. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  3118. ),
  3119. 'fields' => array
  3120. (
  3121. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'project', 'field' => 'YEARMONTH', 'type' => 'string'),
  3122. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'number'),
  3123. 'month' => array('name' => 'month', 'object' => 'project', 'field' => 'month', 'type' => 'string'),
  3124. 'newProject' => array('name' => 'newProject', 'object' => 'project', 'field' => 'newProject', 'type' => 'string'),
  3125. 'closedProject' => array('name' => '已关闭的项目', 'object' => 'project', 'field' => 'closedProject', 'type' => 'string')
  3126. ),
  3127. 'langs' => array
  3128. (
  3129. 'YEARMONTH' => array('zh-cn' => 'YEARMONTH', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3130. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3131. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3132. 'newProject' => array('zh-cn' => '新增项目数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3133. 'closedProject' => array('zh-cn' => '完成项目数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3134. ),
  3135. 'stage' => 'published',
  3136. 'builtin' => '0'
  3137. );
  3138. $config->bi->builtin->charts[] = array
  3139. (
  3140. 'id' => 1081,
  3141. 'name' => '年度新增-执行年度新增和完成趋势图',
  3142. 'code' => 'annualCreated_executionTendency',
  3143. 'dimension' => '1',
  3144. 'type' => 'line',
  3145. 'group' => '40',
  3146. 'sql' => <<<EOT
  3147. SELECT YEARMONTH, t1.year, CONCAT(t1.month, '月') AS `month`, IFNULL(t2.execution, 0) AS newExecution, IFNULL(t3.execution, 0) AS closedExecution
  3148. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH,YEAR(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  3149. LEFT JOIN (SELECT YEAR(openedDate) AS `year`, MONTH(openedDate) AS `month`, COUNT(1) AS execution FROM zt_project WHERE deleted = '0' AND type IN ('sprint', 'stage', 'kanban') AND multiple = '1' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  3150. LEFT JOIN (SELECT YEAR(closedDate) AS `year`, MONTH(closedDate) AS `month`, COUNT(1) AS execution FROM zt_project WHERE deleted = '0' AND type IN ('sprint', 'stage', 'kanban') AND status = 'closed' AND multiple = '1' GROUP BY `year`, `month`) AS t3 ON t1.year = t3.year AND t1.month = t3.month
  3151. ORDER BY `year`, t1.month LIMIT 999999
  3152. EOT
  3153. ,
  3154. 'settings' => array
  3155. (
  3156. array
  3157. (
  3158. 'type' => 'line',
  3159. 'xaxis' => array
  3160. (
  3161. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  3162. ),
  3163. 'yaxis' => array
  3164. (
  3165. array('field' => 'newExecution', 'name' => 'newExecution', 'valOrAgg' => 'sum'),
  3166. array('field' => 'closedExecution', 'name' => 'closedExecution', 'valOrAgg' => 'sum')
  3167. )
  3168. )
  3169. ),
  3170. 'filters' => array
  3171. (
  3172. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  3173. ),
  3174. 'fields' => array
  3175. (
  3176. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'project', 'field' => 'YEARMONTH', 'type' => 'string'),
  3177. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'number'),
  3178. 'month' => array('name' => 'month', 'object' => 'project', 'field' => 'month', 'type' => 'string'),
  3179. 'newExecution' => array('name' => 'newExecution', 'object' => 'project', 'field' => 'newExecution', 'type' => 'string'),
  3180. 'closedExecution' => array('name' => 'closedExecution', 'object' => 'project', 'field' => 'closedExecution', 'type' => 'string')
  3181. ),
  3182. 'langs' => array
  3183. (
  3184. 'YEARMONTH' => array('zh-cn' => 'YEARMONTH', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3185. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3186. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3187. 'newExecution' => array('zh-cn' => '新增执行数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3188. 'closedExecution' => array('zh-cn' => '完成执行数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3189. ),
  3190. 'stage' => 'published',
  3191. 'builtin' => '0'
  3192. );
  3193. $config->bi->builtin->charts[] = array
  3194. (
  3195. 'id' => 1082,
  3196. 'name' => '年度新增-产品发布次数年度趋势图',
  3197. 'code' => 'annualCreated_releaseTendency',
  3198. 'dimension' => '1',
  3199. 'type' => 'line',
  3200. 'group' => '37',
  3201. 'sql' => <<<EOT
  3202. SELECT YEARMONTH, t1.year, CONCAT(t1.month, '月') AS `month`, IFNULL(t2.release, 0) AS `release`
  3203. FROM (SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') YEARMONTH,Year(date) AS `year`, MONTH(date) AS `month` FROM zt_action) AS t1
  3204. LEFT JOIN (SELECT YEAR(createdDate) AS `year`, MONTH(createdDate) AS `month`, COUNT(1) AS `release` FROM zt_release WHERE deleted = '0' GROUP BY `year`, `month`) AS t2 ON t1.year = t2.year AND t1.month = t2.month
  3205. ORDER BY `year`, t1.month LIMIT 999999
  3206. EOT
  3207. ,
  3208. 'settings' => array
  3209. (
  3210. array
  3211. (
  3212. 'type' => 'line',
  3213. 'xaxis' => array
  3214. (
  3215. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  3216. ),
  3217. 'yaxis' => array
  3218. (
  3219. array('field' => 'release', 'name' => 'release', 'valOrAgg' => 'sum')
  3220. )
  3221. )
  3222. ),
  3223. 'filters' => array
  3224. (
  3225. array('field' => 'year', 'type' => 'select', 'name' => '年度')
  3226. ),
  3227. 'fields' => array
  3228. (
  3229. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'release', 'field' => 'YEARMONTH', 'type' => 'string'),
  3230. 'year' => array('name' => 'year', 'object' => 'release', 'field' => 'year', 'type' => 'number'),
  3231. 'month' => array('name' => 'month', 'object' => 'release', 'field' => 'month', 'type' => 'string'),
  3232. 'release' => array('name' => 'release', 'object' => 'release', 'field' => 'release', 'type' => 'string')
  3233. ),
  3234. 'langs' => array
  3235. (
  3236. 'YEARMONTH' => array('zh-cn' => 'YEARMONTH', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3237. 'year' => array('zh-cn' => '年度', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3238. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  3239. 'release' => array('zh-cn' => '发布次数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3240. ),
  3241. 'stage' => 'published',
  3242. 'builtin' => '0'
  3243. );
  3244. $config->bi->builtin->charts[] = array
  3245. (
  3246. 'id' => 1083,
  3247. 'name' => '年度新增-年度投入产出比',
  3248. 'code' => 'annualCreated_IORatio',
  3249. 'dimension' => '1',
  3250. 'type' => 'line',
  3251. 'group' => '45',
  3252. 'sql' => <<<EOT
  3253. SELECT
  3254. t1.`year`,
  3255. CONCAT(t1.`month`, '月') AS `month`,
  3256. IFNULL(t2.story, 0) AS story,
  3257. IFNULL(t3.consumed, 0) AS consumed,
  3258. ROUND(
  3259. CASE
  3260. WHEN IFNULL(t3.consumed, 0) = 0 THEN 0
  3261. ELSE IFNULL(t2.story, 0) / IFNULL(t3.consumed, 0)
  3262. END,
  3263. 2
  3264. ) AS ratio
  3265. FROM (
  3266. SELECT YEAR(`date`) AS `year`, MONTH(`date`) AS `month`
  3267. FROM zt_action
  3268. GROUP BY `year`, `month`
  3269. ) AS t1
  3270. LEFT JOIN (
  3271. SELECT
  3272. ROUND(SUM(estimate)) AS story,
  3273. YEAR(`closedDate`) AS `year`,
  3274. MONTH(`closedDate`) AS `month`
  3275. FROM zt_story
  3276. WHERE deleted = '0'
  3277. AND closedReason = 'done'
  3278. AND status = 'closed'
  3279. AND isParent = '0'
  3280. GROUP BY `year`, `month`
  3281. ) AS t2 ON t1.`year` = t2.`year` AND t1.`month` = t2.`month`
  3282. LEFT JOIN (
  3283. SELECT
  3284. ROUND(SUM(consumed)) as consumed,
  3285. YEAR(`date`) as `year`,
  3286. MONTH(`date`) AS `month`
  3287. FROM zt_effort
  3288. WHERE deleted = '0'
  3289. GROUP BY `year`, `month`
  3290. ) AS t3 ON t1.`year` = t3.`year` AND t1.`month` = t3.`month`;
  3291. EOT
  3292. ,
  3293. 'settings' => array
  3294. (
  3295. 'xaxis' => array
  3296. (
  3297. array('field' => 'month', 'name' => '月份', 'group' => 'value')
  3298. ),
  3299. 'yaxis' => array
  3300. (
  3301. array('type' => 'value', 'field' => 'ratio', 'agg' => 'value', 'name' => '投入产出比', 'valOrAgg' => 'value'),
  3302. array('type' => 'value', 'field' => 'story', 'agg' => 'value', 'name' => '需求交付', 'valOrAgg' => 'value'),
  3303. array('type' => 'value', 'field' => 'consumed', 'agg' => 'value', 'name' => '工时消耗', 'valOrAgg' => 'value')
  3304. )
  3305. ),
  3306. 'stage' => 'published',
  3307. 'builtin' => '1'
  3308. );
  3309. $config->bi->builtin->charts[] = array
  3310. (
  3311. 'id' => 1085,
  3312. 'name' => '年度排行-项目集-预算投入榜',
  3313. 'code' => 'annualRank_programBudget',
  3314. 'dimension' => '1',
  3315. 'type' => 'cluBarY',
  3316. 'group' => '41',
  3317. 'sql' => <<<EOT
  3318. SELECT
  3319. YEAR(t2.openedDate) AS `year`,
  3320. t1.id,
  3321. t1.name AS program,
  3322. ROUND(
  3323. SUM(
  3324. IFNULL(t2.budget, '0')
  3325. ) / 10000,
  3326. 2
  3327. ) AS budget
  3328. FROM
  3329. zt_project AS t1
  3330. LEFT JOIN zt_project AS t2 ON FIND_IN_SET(t1.id, t2.path)
  3331. AND t2.deleted = '0'
  3332. AND t2.type = 'project'
  3333. WHERE
  3334. t1.deleted = '0'
  3335. AND t1.type = 'program'
  3336. AND t1.grade = 1
  3337. GROUP BY
  3338. `year`,
  3339. t1.id,
  3340. program
  3341. ORDER BY
  3342. `year`,
  3343. budget DESC
  3344. LIMIT 999999
  3345. EOT
  3346. ,
  3347. 'settings' => array
  3348. (
  3349. array
  3350. (
  3351. 'type' => 'cluBarY',
  3352. 'xaxis' => array
  3353. (
  3354. array('field' => 'program', 'name' => 'program', 'group' => '')
  3355. ),
  3356. 'yaxis' => array
  3357. (
  3358. array('field' => 'budget', 'name' => '预算', 'valOrAgg' => 'sum')
  3359. )
  3360. )
  3361. ),
  3362. 'filters' => array
  3363. (
  3364. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3365. ),
  3366. 'fields' => array
  3367. (
  3368. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'number'),
  3369. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3370. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3371. 'budget' => array('name' => '预算', 'object' => 'project', 'field' => 'budget', 'type' => 'number')
  3372. ),
  3373. 'langs' => array
  3374. (
  3375. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3376. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3377. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3378. 'budget' => array('zh-cn' => '项目集预算', 'zh-tw' => '', 'en' => 'budget', 'de' => '', 'fr' => '')
  3379. ),
  3380. 'stage' => 'published',
  3381. 'builtin' => '0'
  3382. );
  3383. $config->bi->builtin->charts[] = array
  3384. (
  3385. 'id' => 1086,
  3386. 'name' => '年度排行-项目集-人员投入榜',
  3387. 'code' => 'annualRank_programPersonnel',
  3388. 'dimension' => '1',
  3389. 'type' => 'cluBarY',
  3390. 'group' => '41',
  3391. 'sql' => <<<EOT
  3392. SELECT tt.join as `year`, count(1) as number, tt.setName from (
  3393. select
  3394. YEAR(t1.join) as `join`, t4.name as setName
  3395. from zt_team t1
  3396. RIGHT JOIN zt_project t2 on t2.id = t1.root
  3397. LEFT JOIN zt_project t4 on FIND_IN_SET(t4.id,t2.path) and t4.grade = 1
  3398. RIGHT JOIN zt_user t3 on t3.account = t1.account
  3399. WHERE t1.type = 'project'
  3400. AND t2.deleted = '0'
  3401. AND t3.deleted = '0'
  3402. ) tt
  3403. GROUP BY tt.setName, tt.join
  3404. ORDER BY tt.join, number desc, tt.setName LIMIT 999999
  3405. EOT
  3406. ,
  3407. 'settings' => array
  3408. (
  3409. array
  3410. (
  3411. 'type' => 'cluBarY',
  3412. 'xaxis' => array
  3413. (
  3414. array('field' => 'setName', 'name' => 'setName', 'group' => '')
  3415. ),
  3416. 'yaxis' => array
  3417. (
  3418. array('field' => 'number', 'name' => 'number', 'valOrAgg' => 'sum')
  3419. )
  3420. )
  3421. ),
  3422. 'filters' => array
  3423. (
  3424. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3425. ),
  3426. 'fields' => array
  3427. (
  3428. 'year' => array('name' => 'year', 'object' => 'user', 'field' => 'year', 'type' => 'number'),
  3429. 'number' => array('name' => 'number', 'object' => 'user', 'field' => 'number', 'type' => 'string'),
  3430. 'setName' => array('name' => 'setName', 'object' => 'user', 'field' => 'setName', 'type' => 'string')
  3431. ),
  3432. 'langs' => array
  3433. (
  3434. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3435. 'number' => array('zh-cn' => '人员数量', 'zh-tw' => '', 'en' => 'number', 'de' => '', 'fr' => ''),
  3436. 'setName' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'setName', 'de' => '', 'fr' => '')
  3437. ),
  3438. 'stage' => 'published',
  3439. 'builtin' => '0'
  3440. );
  3441. $config->bi->builtin->charts[] = array
  3442. (
  3443. 'id' => 1087,
  3444. 'name' => '年度排行-项目集-工时消耗榜',
  3445. 'code' => 'annualRank_programConsumed',
  3446. 'dimension' => '1',
  3447. 'type' => 'cluBarY',
  3448. 'group' => '41',
  3449. 'sql' => <<<EOT
  3450. SELECT
  3451. YEAR(t5.date) AS `year`,
  3452. t1.id,
  3453. t1.name AS program,
  3454. ROUND(SUM(t5.consumed), 2) AS consumed
  3455. FROM zt_project AS t1
  3456. LEFT JOIN zt_project AS t2 ON FIND_IN_SET(t1.id, t2.path) AND t2.deleted = '0' AND t2.type = 'project'
  3457. LEFT JOIN zt_project AS t3 ON t2.id = t3.project AND t3.deleted = '0' AND t3.type IN ('sprint', 'stage', 'kanban')
  3458. LEFT JOIN zt_task AS t4 ON t3.id = t4.execution AND t4.deleted = '0' AND t4.status != 'cancel'
  3459. LEFT JOIN zt_effort AS t5 ON t4.id = t5.objectID AND t5.deleted = '0' AND t5.objectType = 'task'
  3460. WHERE
  3461. t1.deleted = '0'
  3462. AND t1.type = 'program'
  3463. AND t1.grade = 1
  3464. AND t5.id IS NOT NULL
  3465. GROUP BY
  3466. `year`,
  3467. t1.id,
  3468. program
  3469. ORDER BY
  3470. `year`,
  3471. consumed DESC
  3472. LIMIT 999999
  3473. EOT
  3474. ,
  3475. 'settings' => array
  3476. (
  3477. array
  3478. (
  3479. 'type' => 'cluBarY',
  3480. 'xaxis' => array
  3481. (
  3482. array('field' => 'program', 'name' => 'program', 'group' => '')
  3483. ),
  3484. 'yaxis' => array
  3485. (
  3486. array('field' => 'consumed', 'name' => '总计消耗', 'valOrAgg' => 'sum')
  3487. )
  3488. )
  3489. ),
  3490. 'filters' => array
  3491. (
  3492. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3493. ),
  3494. 'fields' => array
  3495. (
  3496. 'year' => array('name' => 'year', 'object' => 'effort', 'field' => 'year', 'type' => 'number'),
  3497. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3498. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3499. 'consumed' => array('name' => '总计消耗', 'object' => 'task', 'field' => 'consumed', 'type' => 'string')
  3500. ),
  3501. 'langs' => array
  3502. (
  3503. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3504. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3505. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3506. 'consumed' => array('zh-cn' => '项目集总计消耗', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => '')
  3507. ),
  3508. 'stage' => 'published',
  3509. 'builtin' => '0'
  3510. );
  3511. $config->bi->builtin->charts[] = array
  3512. (
  3513. 'id' => 1088,
  3514. 'name' => '年度排行-项目集-新增需求条目榜',
  3515. 'code' => 'annualRank_programStoryCount_created',
  3516. 'dimension' => '1',
  3517. 'type' => 'cluBarY',
  3518. 'group' => '36',
  3519. 'sql' => <<<EOT
  3520. SELECT
  3521. YEAR(t3.openedDate) AS `year`,
  3522. t1.id,
  3523. t1.name AS program,
  3524. COUNT(1) AS story
  3525. FROM
  3526. zt_project AS t1
  3527. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3528. AND t2.deleted = '0'
  3529. LEFT JOIN zt_story AS t3 ON t2.id = t3.product
  3530. AND t3.deleted = '0'
  3531. WHERE
  3532. t1.deleted = '0'
  3533. AND t1.type = 'program'
  3534. AND t1.grade = 1
  3535. AND t3.type = 'story'
  3536. AND t3.id IS NOT NULL
  3537. GROUP BY
  3538. `year`,
  3539. t1.id,
  3540. program
  3541. ORDER BY
  3542. `year`,
  3543. story DESC
  3544. LIMIT 999999
  3545. EOT
  3546. ,
  3547. 'settings' => array
  3548. (
  3549. array
  3550. (
  3551. 'type' => 'cluBarY',
  3552. 'xaxis' => array
  3553. (
  3554. array('field' => 'program', 'name' => 'program', 'group' => '')
  3555. ),
  3556. 'yaxis' => array
  3557. (
  3558. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  3559. )
  3560. )
  3561. ),
  3562. 'filters' => array
  3563. (
  3564. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3565. ),
  3566. 'fields' => array
  3567. (
  3568. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  3569. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3570. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3571. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'string')
  3572. ),
  3573. 'langs' => array
  3574. (
  3575. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3576. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3577. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3578. 'story' => array('zh-cn' => '新增研发需求计数', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  3579. ),
  3580. 'stage' => 'published',
  3581. 'builtin' => '0'
  3582. );
  3583. $config->bi->builtin->charts[] = array
  3584. (
  3585. 'id' => 1089,
  3586. 'name' => '年度排行-项目集-新增需求规模榜',
  3587. 'code' => 'annualRank_programStoryEstimate_created',
  3588. 'dimension' => '1',
  3589. 'type' => 'cluBarY',
  3590. 'group' => '36',
  3591. 'sql' => <<<EOT
  3592. SELECT
  3593. YEAR(t3.openedDate) AS `year`,
  3594. t1.id,
  3595. t1.name AS program,
  3596. ROUND(
  3597. SUM(t3.estimate),
  3598. 2
  3599. ) AS story
  3600. FROM
  3601. zt_project AS t1
  3602. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3603. AND t2.deleted = '0'
  3604. LEFT JOIN zt_story AS t3 ON t2.id = t3.product
  3605. AND t3.deleted = '0'
  3606. WHERE
  3607. t1.deleted = '0'
  3608. AND t1.type = 'program'
  3609. AND t1.grade = 1
  3610. AND t3.type = 'story'
  3611. AND t3.id IS NOT NULL
  3612. GROUP BY
  3613. `year`,
  3614. t1.id,
  3615. program
  3616. ORDER BY
  3617. `year`,
  3618. story DESC
  3619. LIMIT 999999
  3620. EOT
  3621. ,
  3622. 'settings' => array
  3623. (
  3624. array
  3625. (
  3626. 'type' => 'cluBarY',
  3627. 'xaxis' => array
  3628. (
  3629. array('field' => 'program', 'name' => 'program', 'group' => '')
  3630. ),
  3631. 'yaxis' => array
  3632. (
  3633. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  3634. )
  3635. )
  3636. ),
  3637. 'filters' => array
  3638. (
  3639. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3640. ),
  3641. 'fields' => array
  3642. (
  3643. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  3644. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3645. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3646. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'number')
  3647. ),
  3648. 'langs' => array
  3649. (
  3650. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3651. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3652. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3653. 'story' => array('zh-cn' => '新增研发需求规模', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  3654. ),
  3655. 'stage' => 'published',
  3656. 'builtin' => '0'
  3657. );
  3658. $config->bi->builtin->charts[] = array
  3659. (
  3660. 'id' => 1090,
  3661. 'name' => '年度排行-项目集-新增Bug条目榜',
  3662. 'code' => 'annualRank_programBug_created',
  3663. 'dimension' => '1',
  3664. 'type' => 'cluBarY',
  3665. 'group' => '44',
  3666. 'sql' => <<<EOT
  3667. SELECT
  3668. YEAR(t3.openedDate) AS `year`,
  3669. t1.id,
  3670. t1.name AS program,
  3671. COUNT(1) AS bug
  3672. FROM
  3673. zt_project AS t1
  3674. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3675. AND t2.deleted = '0'
  3676. LEFT JOIN zt_bug AS t3 ON t2.id = t3.product
  3677. AND t3.deleted = '0'
  3678. WHERE
  3679. t1.deleted = '0'
  3680. AND t1.type = 'program'
  3681. AND t1.grade = 1
  3682. AND t3.id IS NOT NULL
  3683. GROUP BY
  3684. `year`,
  3685. t1.id,
  3686. program
  3687. ORDER BY
  3688. `year`,
  3689. bug DESC
  3690. LIMIT 999999
  3691. EOT
  3692. ,
  3693. 'settings' => array
  3694. (
  3695. array
  3696. (
  3697. 'type' => 'cluBarY',
  3698. 'xaxis' => array
  3699. (
  3700. array('field' => 'program', 'name' => 'program', 'group' => '')
  3701. ),
  3702. 'yaxis' => array
  3703. (
  3704. array('field' => 'bug', 'name' => 'Bug列表', 'valOrAgg' => 'sum')
  3705. )
  3706. )
  3707. ),
  3708. 'filters' => array
  3709. (
  3710. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3711. ),
  3712. 'fields' => array
  3713. (
  3714. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  3715. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3716. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3717. 'bug' => array('name' => 'Bug列表', 'object' => 'project', 'field' => 'bug', 'type' => 'string')
  3718. ),
  3719. 'langs' => array
  3720. (
  3721. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3722. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3723. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3724. 'bug' => array('zh-cn' => '新增Bug计数', 'zh-tw' => '', 'en' => 'bug', 'de' => '', 'fr' => '')
  3725. ),
  3726. 'stage' => 'published',
  3727. 'builtin' => '0'
  3728. );
  3729. $config->bi->builtin->charts[] = array
  3730. (
  3731. 'id' => 1091,
  3732. 'name' => '年度排行-项目集-完成需求条目榜',
  3733. 'code' => 'annualRank_programStoryCount_finished',
  3734. 'dimension' => '1',
  3735. 'type' => 'cluBarY',
  3736. 'group' => '43',
  3737. 'sql' => <<<EOT
  3738. SELECT
  3739. YEAR(t3.closedDate) AS `year`,
  3740. t1.id,
  3741. t1.name AS program,
  3742. COUNT(1) AS story
  3743. FROM
  3744. zt_project AS t1
  3745. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3746. AND t2.deleted = '0'
  3747. LEFT JOIN zt_story AS t3 ON t2.id = t3.product
  3748. AND t3.deleted = '0'
  3749. AND t3.closedReason = 'done'
  3750. WHERE
  3751. t1.deleted = '0'
  3752. AND t1.type = 'program'
  3753. AND t1.grade = 1
  3754. AND t3.type = 'story'
  3755. AND t3.id IS NOT NULL
  3756. GROUP BY
  3757. `year`,
  3758. t1.id,
  3759. program
  3760. ORDER BY
  3761. `year`,
  3762. story DESC
  3763. LIMIT 999999
  3764. EOT
  3765. ,
  3766. 'settings' => array
  3767. (
  3768. array
  3769. (
  3770. 'type' => 'cluBarY',
  3771. 'xaxis' => array
  3772. (
  3773. array('field' => 'program', 'name' => 'program', 'group' => '')
  3774. ),
  3775. 'yaxis' => array
  3776. (
  3777. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  3778. )
  3779. )
  3780. ),
  3781. 'filters' => array
  3782. (
  3783. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3784. ),
  3785. 'fields' => array
  3786. (
  3787. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  3788. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3789. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3790. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'string')
  3791. ),
  3792. 'langs' => array
  3793. (
  3794. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3795. 'id' => array('zh-cn' => '项目集编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3796. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3797. 'story' => array('zh-cn' => '完成研发需求求和', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  3798. ),
  3799. 'stage' => 'published',
  3800. 'builtin' => '0'
  3801. );
  3802. $config->bi->builtin->charts[] = array
  3803. (
  3804. 'id' => 1092,
  3805. 'name' => '年度排行-项目集-完成需求规模榜',
  3806. 'code' => 'annualRank_programStoryEstimate_finished',
  3807. 'dimension' => '1',
  3808. 'type' => 'cluBarY',
  3809. 'group' => '36',
  3810. 'sql' => <<<EOT
  3811. SELECT
  3812. YEAR(t3.closedDate) AS `year`,
  3813. t1.id,
  3814. t1.name AS program,
  3815. ROUND(
  3816. SUM(t3.estimate),
  3817. 2
  3818. ) AS story
  3819. FROM
  3820. zt_project AS t1
  3821. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3822. AND t2.deleted = '0'
  3823. LEFT JOIN zt_story AS t3 ON t2.id = t3.product
  3824. AND t3.deleted = '0'
  3825. AND t3.closedReason = 'done'
  3826. WHERE
  3827. t1.deleted = '0'
  3828. AND t1.type = 'program'
  3829. AND t1.grade = 1
  3830. AND t3.type = 'story'
  3831. AND t3.id IS NOT NULL
  3832. GROUP BY
  3833. `year`,
  3834. t1.id,
  3835. program
  3836. ORDER BY
  3837. `year`,
  3838. story DESC
  3839. LIMIT 999999
  3840. EOT
  3841. ,
  3842. 'settings' => array
  3843. (
  3844. array
  3845. (
  3846. 'type' => 'cluBarY',
  3847. 'xaxis' => array
  3848. (
  3849. array('field' => 'program', 'name' => 'program', 'group' => '')
  3850. ),
  3851. 'yaxis' => array
  3852. (
  3853. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  3854. )
  3855. )
  3856. ),
  3857. 'filters' => array
  3858. (
  3859. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3860. ),
  3861. 'fields' => array
  3862. (
  3863. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  3864. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3865. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3866. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'number')
  3867. ),
  3868. 'langs' => array
  3869. (
  3870. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3871. 'id' => array('zh-cn' => '编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3872. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3873. 'story' => array('zh-cn' => '研发需求预计工时求和', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  3874. ),
  3875. 'stage' => 'published',
  3876. 'builtin' => '0'
  3877. );
  3878. $config->bi->builtin->charts[] = array
  3879. (
  3880. 'id' => 1093,
  3881. 'name' => '年度排行-项目集-修复Bug条目榜',
  3882. 'code' => 'annualRank_programBug_fixed',
  3883. 'dimension' => '1',
  3884. 'type' => 'cluBarY',
  3885. 'group' => '44',
  3886. 'sql' => <<<EOT
  3887. SELECT
  3888. YEAR(t3.closedDate) AS `year`,
  3889. t1.id,
  3890. t1.name AS program,
  3891. COUNT(1) AS bug
  3892. FROM
  3893. zt_project AS t1
  3894. LEFT JOIN zt_product AS t2 ON t1.id = t2.program
  3895. AND t2.deleted = '0'
  3896. LEFT JOIN zt_bug AS t3 ON t2.id = t3.product
  3897. AND t3.deleted = '0'
  3898. AND t3.resolution = 'fixed'
  3899. AND t3.status = 'closed'
  3900. WHERE
  3901. t1.deleted = '0'
  3902. AND t1.type = 'program'
  3903. AND t1.grade = 1
  3904. AND t3.id IS NOT NULL
  3905. GROUP BY
  3906. `year`,
  3907. t1.id,
  3908. program
  3909. ORDER BY
  3910. `year`,
  3911. bug DESC
  3912. LIMIT 999999
  3913. EOT
  3914. ,
  3915. 'settings' => array
  3916. (
  3917. array
  3918. (
  3919. 'type' => 'cluBarY',
  3920. 'xaxis' => array
  3921. (
  3922. array('field' => 'program', 'name' => 'program', 'group' => '')
  3923. ),
  3924. 'yaxis' => array
  3925. (
  3926. array('field' => 'bug', 'name' => 'Bug列表', 'valOrAgg' => 'sum')
  3927. )
  3928. )
  3929. ),
  3930. 'filters' => array
  3931. (
  3932. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3933. ),
  3934. 'fields' => array
  3935. (
  3936. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  3937. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  3938. 'program' => array('name' => 'program', 'object' => 'zt_project', 'field' => 'program', 'type' => 'string'),
  3939. 'bug' => array('name' => 'Bug列表', 'object' => 'project', 'field' => 'bug', 'type' => 'string')
  3940. ),
  3941. 'langs' => array
  3942. (
  3943. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3944. 'id' => array('zh-cn' => '编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3945. 'program' => array('zh-cn' => '项目集名称', 'zh-tw' => '', 'en' => 'program', 'de' => '', 'fr' => ''),
  3946. 'bug' => array('zh-cn' => 'Bug计数', 'zh-tw' => '', 'en' => 'bug', 'de' => '', 'fr' => '')
  3947. ),
  3948. 'stage' => 'published',
  3949. 'builtin' => '0'
  3950. );
  3951. $config->bi->builtin->charts[] = array
  3952. (
  3953. 'id' => 1094,
  3954. 'name' => '年度排行-项目-工期榜',
  3955. 'code' => 'annualRank_projectDuration',
  3956. 'dimension' => '1',
  3957. 'type' => 'cluBarY',
  3958. 'group' => '42',
  3959. 'sql' => <<<EOT
  3960. SELECT `year`, id,name,status,realBegan,realEnd,IF(status = 'closed', DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) as duration
  3961. FROM (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) AS t1
  3962. LEFT JOIN zt_project AS t2 ON 1 = 1 WHERE deleted = '0' AND type = 'project' AND YEAR(realBegan) <= `year` AND LEFT(realBegan, 4) != '0000' AND (status ='doing' OR (status = 'suspended' AND YEAR(suspendedDate) >= `year`) OR (status = 'closed' AND YEAR(realEnd) >= `year`)) ORDER BY `year`, duration desc LIMIT 999999
  3963. EOT
  3964. ,
  3965. 'settings' => array
  3966. (
  3967. array
  3968. (
  3969. 'type' => 'cluBarY',
  3970. 'xaxis' => array
  3971. (
  3972. array('field' => 'name', 'name' => '项目名称', 'group' => '')
  3973. ),
  3974. 'yaxis' => array
  3975. (
  3976. array('field' => 'duration', 'name' => 'duration', 'valOrAgg' => 'sum')
  3977. )
  3978. )
  3979. ),
  3980. 'filters' => array
  3981. (
  3982. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  3983. ),
  3984. 'fields' => array
  3985. (
  3986. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'number'),
  3987. 'id' => array('name' => '编号', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  3988. 'name' => array('name' => '项目名称', 'object' => 'project', 'field' => 'name', 'type' => 'string'),
  3989. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option'),
  3990. 'realBegan' => array('name' => '实际开始日期', 'object' => 'project', 'field' => 'realBegan', 'type' => 'date'),
  3991. 'realEnd' => array('name' => '实际完成日期', 'object' => 'project', 'field' => 'realEnd', 'type' => 'date'),
  3992. 'duration' => array('name' => 'duration', 'object' => 'project', 'field' => 'duration', 'type' => 'number')
  3993. ),
  3994. 'langs' => array
  3995. (
  3996. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  3997. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  3998. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  3999. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => ''),
  4000. 'realBegan' => array('zh-cn' => '实际开始日期', 'zh-tw' => '', 'en' => 'realBegan', 'de' => '', 'fr' => ''),
  4001. 'realEnd' => array('zh-cn' => '实际完成日期', 'zh-tw' => '', 'en' => 'realEnd', 'de' => '', 'fr' => ''),
  4002. 'duration' => array('zh-cn' => '工期', 'zh-tw' => '', 'en' => 'duration', 'de' => '', 'fr' => '')
  4003. ),
  4004. 'stage' => 'published',
  4005. 'builtin' => '0'
  4006. );
  4007. $config->bi->builtin->charts[] = array
  4008. (
  4009. 'id' => 1096,
  4010. 'name' => '年度排行-项目-工期偏差榜',
  4011. 'code' => 'annualRank_projectDurationDeviation',
  4012. 'dimension' => '1',
  4013. 'type' => 'cluBarY',
  4014. 'group' => '42',
  4015. 'sql' => <<<EOT
  4016. SELECT `year`, id,name,status,`begin`,`end`,realBegan,realEnd,
  4017. ROUND((IF(LEFT(realEnd,4) != '0000', DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) - DATEDIFF(`end`, `begin`)) / DATEDIFF(`end`,`begin`) * 100) as duration
  4018. FROM (SELECT DISTINCT YEAR(`date`) as `year` FROM zt_action) AS t1
  4019. LEFT JOIN zt_project AS t2 ON 1 = 1
  4020. WHERE deleted = '0' AND type = 'project'
  4021. AND YEAR(realBegan) <= `year` AND LEFT(realBegan, 4) != '0000'
  4022. AND (YEAR(realEnd) >= `year` OR LEFT(realEnd, 4) = '0000') AND YEAR(`end`) != '2059'
  4023. ORDER BY duration ASC LIMIT 999999
  4024. EOT
  4025. ,
  4026. 'settings' => array
  4027. (
  4028. array
  4029. (
  4030. 'type' => 'cluBarY',
  4031. 'xaxis' => array
  4032. (
  4033. array('field' => 'name', 'name' => '项目名称', 'group' => '')
  4034. ),
  4035. 'yaxis' => array
  4036. (
  4037. array('field' => 'duration', 'name' => 'duration', 'valOrAgg' => 'sum')
  4038. )
  4039. )
  4040. ),
  4041. 'filters' => array
  4042. (
  4043. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4044. ),
  4045. 'fields' => array
  4046. (
  4047. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'number'),
  4048. 'id' => array('name' => '编号', 'object' => 'action', 'field' => 'id', 'type' => 'number'),
  4049. 'name' => array('name' => '项目名称', 'object' => 'project', 'field' => 'name', 'type' => 'string'),
  4050. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option'),
  4051. 'begin' => array('name' => '计划开始', 'object' => 'project', 'field' => 'begin', 'type' => 'date'),
  4052. 'end' => array('name' => '计划完成', 'object' => 'project', 'field' => 'end', 'type' => 'date'),
  4053. 'realBegan' => array('name' => '实际开始日期', 'object' => 'project', 'field' => 'realBegan', 'type' => 'date'),
  4054. 'realEnd' => array('name' => '实际完成日期', 'object' => 'project', 'field' => 'realEnd', 'type' => 'date'),
  4055. 'duration' => array('name' => 'duration', 'object' => 'project', 'field' => 'duration', 'type' => 'number')
  4056. ),
  4057. 'langs' => array
  4058. (
  4059. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4060. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4061. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  4062. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => ''),
  4063. 'begin' => array('zh-cn' => '计划开始', 'zh-tw' => '', 'en' => 'begin', 'de' => '', 'fr' => ''),
  4064. 'end' => array('zh-cn' => '计划完成', 'zh-tw' => '', 'en' => 'end', 'de' => '', 'fr' => ''),
  4065. 'realBegan' => array('zh-cn' => '实际开始日期', 'zh-tw' => '', 'en' => 'realBegan', 'de' => '', 'fr' => ''),
  4066. 'realEnd' => array('zh-cn' => '实际完成日期', 'zh-tw' => '', 'en' => 'realEnd', 'de' => '', 'fr' => ''),
  4067. 'duration' => array('zh-cn' => '工期偏差', 'zh-tw' => '', 'en' => 'duration', 'de' => '', 'fr' => '')
  4068. ),
  4069. 'stage' => 'published',
  4070. 'builtin' => '0'
  4071. );
  4072. $config->bi->builtin->charts[] = array
  4073. (
  4074. 'id' => 1097,
  4075. 'name' => '年度排行-项目-人员投入榜',
  4076. 'code' => 'annualRank_projectPersonnel',
  4077. 'dimension' => '1',
  4078. 'type' => 'cluBarY',
  4079. 'group' => '41',
  4080. 'sql' => <<<EOT
  4081. SELECT tt.join as `year`, count(1) as number, tt.name from (
  4082. select
  4083. t2.name, YEAR(t1.join) as `join`
  4084. from zt_team t1
  4085. RIGHT JOIN zt_project t2 on t2.id = t1.root
  4086. RIGHT JOIN zt_user t3 on t3.account = t1.account
  4087. WHERE t1.type = 'project'
  4088. AND t2.deleted = '0'
  4089. ) tt
  4090. GROUP BY tt.`name`, tt.join
  4091. ORDER BY tt.join, number desc, tt.name LIMIT 999999
  4092. EOT
  4093. ,
  4094. 'settings' => array
  4095. (
  4096. array
  4097. (
  4098. 'type' => 'cluBarY',
  4099. 'xaxis' => array
  4100. (
  4101. array('field' => 'name', 'name' => '项目名称', 'group' => '')
  4102. ),
  4103. 'yaxis' => array
  4104. (
  4105. array('field' => 'number', 'name' => 'number', 'valOrAgg' => 'sum')
  4106. )
  4107. )
  4108. ),
  4109. 'filters' => array
  4110. (
  4111. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4112. ),
  4113. 'fields' => array
  4114. (
  4115. 'year' => array('name' => 'year', 'object' => 'user', 'field' => 'year', 'type' => 'number'),
  4116. 'number' => array('name' => 'number', 'object' => 'user', 'field' => 'number', 'type' => 'string'),
  4117. 'name' => array('name' => '项目名称', 'object' => 'project', 'field' => 'name', 'type' => 'string')
  4118. ),
  4119. 'langs' => array
  4120. (
  4121. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4122. 'number' => array('zh-cn' => '人员个数', 'zh-tw' => '', 'en' => 'number', 'de' => '', 'fr' => ''),
  4123. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => '')
  4124. ),
  4125. 'stage' => 'published',
  4126. 'builtin' => '0'
  4127. );
  4128. $config->bi->builtin->charts[] = array
  4129. (
  4130. 'id' => 1098,
  4131. 'name' => '年度排行-项目-工时消耗榜',
  4132. 'code' => 'annualRank_projectConsumed',
  4133. 'dimension' => '1',
  4134. 'type' => 'cluBarY',
  4135. 'group' => '41',
  4136. 'sql' => <<<EOT
  4137. SELECT
  4138. YEAR(t4.date) AS `year`,
  4139. t1.id,
  4140. t1.name AS project,
  4141. ROUND(SUM(t4.consumed), 2) AS consumed
  4142. FROM zt_project AS t1
  4143. LEFT JOIN zt_project AS t2 ON t1.id = t2.project AND t2.deleted = '0' AND t2.type IN ('sprint', 'stage', 'kanban')
  4144. LEFT JOIN zt_task AS t3 ON t2.id = t3.execution AND t3.deleted = '0' AND t3.status != 'cancel'
  4145. LEFT JOIN zt_effort AS t4 ON t3.id = t4.objectID AND t4.deleted = '0' AND t4.objectType = 'task'
  4146. WHERE
  4147. t1.deleted = '0'
  4148. AND t1.type = 'project'
  4149. AND t4.id IS NOT NULL
  4150. GROUP BY
  4151. `year`,
  4152. t1.id,
  4153. t1.name
  4154. ORDER BY
  4155. `year`,
  4156. consumed DESC
  4157. LIMIT 999999
  4158. EOT
  4159. ,
  4160. 'settings' => array
  4161. (
  4162. array
  4163. (
  4164. 'type' => 'cluBarY',
  4165. 'xaxis' => array
  4166. (
  4167. array('field' => 'project', 'name' => 'project', 'group' => '')
  4168. ),
  4169. 'yaxis' => array
  4170. (
  4171. array('field' => 'consumed', 'name' => '总计消耗', 'valOrAgg' => 'sum')
  4172. )
  4173. )
  4174. ),
  4175. 'filters' => array
  4176. (
  4177. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4178. ),
  4179. 'fields' => array
  4180. (
  4181. 'year' => array('name' => 'year', 'object' => 'effort', 'field' => 'year', 'type' => 'number'),
  4182. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  4183. 'project' => array('name' => 'project', 'object' => 'zt_project', 'field' => 'project', 'type' => 'string'),
  4184. 'consumed' => array('name' => '总计消耗', 'object' => 'task', 'field' => 'consumed', 'type' => 'string')
  4185. ),
  4186. 'langs' => array
  4187. (
  4188. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4189. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4190. 'project' => array('zh-cn' => '项目', 'zh-tw' => '', 'en' => 'project', 'de' => '', 'fr' => ''),
  4191. 'consumed' => array('zh-cn' => '任务总计消耗', 'zh-tw' => '', 'en' => 'consumed', 'de' => '', 'fr' => '')
  4192. ),
  4193. 'stage' => 'published',
  4194. 'builtin' => '0'
  4195. );
  4196. $config->bi->builtin->charts[] = array
  4197. (
  4198. 'id' => 1099,
  4199. 'name' => '年度排行-项目-完成需求条目榜',
  4200. 'code' => 'annualRank_projectStoryCount_finished',
  4201. 'dimension' => '1',
  4202. 'type' => 'cluBarY',
  4203. 'group' => '36',
  4204. 'sql' => <<<EOT
  4205. SELECT
  4206. YEAR(t1.closedDate) AS `year`,
  4207. t1.id,
  4208. t1.project,
  4209. COUNT(1) AS story
  4210. FROM
  4211. (
  4212. SELECT
  4213. DISTINCT t1.id,
  4214. t1.name AS project,
  4215. t5.id AS story,
  4216. t5.closedDate
  4217. FROM
  4218. zt_project AS t1
  4219. LEFT JOIN zt_project AS t2 ON t1.id = t2.parent
  4220. AND t2.deleted = '0'
  4221. AND t2.type IN ('sprint', 'stage', 'kanban')
  4222. LEFT JOIN zt_projectstory AS t3 ON t1.id = t3.project
  4223. LEFT JOIN zt_projectstory AS t4 ON t2.id = t4.project
  4224. LEFT JOIN zt_story AS t5 ON t3.story = t5.id
  4225. AND t5.deleted = '0'
  4226. AND t5.closedReason = 'done'
  4227. WHERE
  4228. t1.deleted = '0'
  4229. AND t1.type = 'project'
  4230. AND t5.type = 'story'
  4231. AND t5.id IS NOT NULL
  4232. ) AS t1
  4233. GROUP BY
  4234. `year`,
  4235. t1.id,
  4236. project
  4237. ORDER BY
  4238. `year`,
  4239. story DESC
  4240. LIMIT 999999
  4241. EOT
  4242. ,
  4243. 'settings' => array
  4244. (
  4245. array
  4246. (
  4247. 'type' => 'cluBarY',
  4248. 'xaxis' => array
  4249. (
  4250. array('field' => 'project', 'name' => '所属项目', 'group' => '')
  4251. ),
  4252. 'yaxis' => array
  4253. (
  4254. array('field' => 'story', 'name' => '研发需求列表', 'valOrAgg' => 'sum')
  4255. )
  4256. )
  4257. ),
  4258. 'filters' => array
  4259. (
  4260. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4261. ),
  4262. 'fields' => array
  4263. (
  4264. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  4265. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  4266. 'project' => array('name' => '所属项目', 'object' => 'project', 'field' => 'project', 'type' => 'string'),
  4267. 'story' => array('name' => '研发需求列表', 'object' => 'projectstory', 'field' => 'story', 'type' => 'string')
  4268. ),
  4269. 'langs' => array
  4270. (
  4271. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4272. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4273. 'project' => array('zh-cn' => '所属项目', 'zh-tw' => '', 'en' => 'project', 'de' => '', 'fr' => ''),
  4274. 'story' => array('zh-cn' => '研发需求计数', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  4275. ),
  4276. 'stage' => 'published',
  4277. 'builtin' => '0'
  4278. );
  4279. $config->bi->builtin->charts[] = array
  4280. (
  4281. 'id' => 1100,
  4282. 'name' => '年度排行-项目-完成需求规模榜',
  4283. 'code' => 'annualRank_projectStoryEstimate_finished',
  4284. 'dimension' => '1',
  4285. 'type' => 'cluBarY',
  4286. 'group' => '43',
  4287. 'sql' => <<<EOT
  4288. SELECT
  4289. YEAR(t1.closedDate) AS `year`,
  4290. t1.id,
  4291. t1.project,
  4292. ROUND(
  4293. SUM(t1.estimate),
  4294. 2
  4295. ) AS story
  4296. FROM
  4297. (
  4298. SELECT
  4299. DISTINCT t1.id,
  4300. t1.name AS project,
  4301. t5.id AS story,
  4302. t5.estimate,
  4303. t5.closedDate
  4304. FROM
  4305. zt_project AS t1
  4306. LEFT JOIN zt_project AS t2 ON t1.id = t2.parent
  4307. AND t2.deleted = '0'
  4308. AND t2.type IN ('sprint', 'stage', 'kanban')
  4309. LEFT JOIN zt_projectstory AS t3 ON t1.id = t3.project
  4310. LEFT JOIN zt_projectstory AS t4 ON t2.id = t4.project
  4311. LEFT JOIN zt_story AS t5 ON t3.story = t5.id
  4312. AND t5.deleted = '0'
  4313. AND t5.closedReason = 'done'
  4314. WHERE
  4315. t1.deleted = '0'
  4316. AND t1.type = 'project'
  4317. AND t5.type = 'story'
  4318. AND t5.id IS NOT NULL
  4319. ) AS t1
  4320. GROUP BY
  4321. `year`,
  4322. t1.id,
  4323. project
  4324. ORDER BY
  4325. `year`,
  4326. story DESC
  4327. LIMIT 999999
  4328. EOT
  4329. ,
  4330. 'settings' => array
  4331. (
  4332. array
  4333. (
  4334. 'type' => 'cluBarY',
  4335. 'xaxis' => array
  4336. (
  4337. array('field' => 'project', 'name' => '所属项目', 'group' => '')
  4338. ),
  4339. 'yaxis' => array
  4340. (
  4341. array('field' => 'story', 'name' => '研发需求列表', 'valOrAgg' => 'sum')
  4342. )
  4343. )
  4344. ),
  4345. 'filters' => array
  4346. (
  4347. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4348. ),
  4349. 'fields' => array
  4350. (
  4351. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  4352. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  4353. 'project' => array('name' => '所属项目', 'object' => 'project', 'field' => 'project', 'type' => 'string'),
  4354. 'story' => array('name' => '研发需求列表', 'object' => 'projectstory', 'field' => 'story', 'type' => 'number')
  4355. ),
  4356. 'langs' => array
  4357. (
  4358. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4359. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4360. 'project' => array('zh-cn' => '所属项目', 'zh-tw' => '', 'en' => 'project', 'de' => '', 'fr' => ''),
  4361. 'story' => array('zh-cn' => '需求预计工时', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  4362. ),
  4363. 'stage' => 'published',
  4364. 'builtin' => '0'
  4365. );
  4366. $config->bi->builtin->charts[] = array
  4367. (
  4368. 'id' => 1101,
  4369. 'name' => '年度排行-产品-新增需求条目榜',
  4370. 'code' => 'annualRank_productStoryCount_created',
  4371. 'dimension' => '1',
  4372. 'type' => 'cluBarY',
  4373. 'group' => '36',
  4374. 'sql' => <<<EOT
  4375. SELECT YEAR(t2.openedDate) AS `year`, t1.id, t1.name AS product, COUNT(1) AS story
  4376. FROM zt_product AS t1
  4377. LEFT JOIN zt_story AS t2 ON t1.id = t2.product AND t2.deleted = '0'
  4378. WHERE t1.deleted = '0' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t2.type = 'story' AND t2.id IS NOT NULL
  4379. GROUP BY `year`, t1.id, product
  4380. ORDER BY `year`, story DESC LIMIT 999999
  4381. EOT
  4382. ,
  4383. 'settings' => array
  4384. (
  4385. array
  4386. (
  4387. 'type' => 'cluBarY',
  4388. 'xaxis' => array
  4389. (
  4390. array('field' => 'product', 'name' => 'product', 'group' => '')
  4391. ),
  4392. 'yaxis' => array
  4393. (
  4394. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  4395. )
  4396. )
  4397. ),
  4398. 'filters' => array
  4399. (
  4400. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4401. ),
  4402. 'fields' => array
  4403. (
  4404. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  4405. 'id' => array('name' => 'id', 'object' => 'zt_product', 'field' => 'id', 'type' => 'number'),
  4406. 'product' => array('name' => 'product', 'object' => 'zt_product', 'field' => 'product', 'type' => 'string'),
  4407. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'string')
  4408. ),
  4409. 'langs' => array
  4410. (
  4411. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4412. 'id' => array('zh-cn' => '产品编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4413. 'product' => array('zh-cn' => '产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  4414. 'story' => array('zh-cn' => '研发需求计数', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  4415. ),
  4416. 'stage' => 'published',
  4417. 'builtin' => '0'
  4418. );
  4419. $config->bi->builtin->charts[] = array
  4420. (
  4421. 'id' => 1102,
  4422. 'name' => '年度排行-产品-完成需求规模榜',
  4423. 'code' => 'annualRank_productStoryEstimate_finished',
  4424. 'dimension' => '1',
  4425. 'type' => 'cluBarY',
  4426. 'group' => '36',
  4427. 'sql' => <<<EOT
  4428. SELECT YEAR(t2.closedDate) AS `year`, t1.id, t1.name AS product, ROUND(SUM(t2.estimate), 1) AS story
  4429. FROM zt_product AS t1
  4430. LEFT JOIN zt_story AS t2 ON t1.id = t2.product AND t2.deleted = '0' AND t2.`closedReason` = 'done'
  4431. WHERE t1.deleted = '0' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t2.type = 'story' AND t2.id IS NOT NULL
  4432. GROUP BY `year`, t1.id, product
  4433. ORDER BY `year`, story DESC LIMIT 999999
  4434. EOT
  4435. ,
  4436. 'settings' => array
  4437. (
  4438. array
  4439. (
  4440. 'type' => 'cluBarY',
  4441. 'xaxis' => array
  4442. (
  4443. array('field' => 'product', 'name' => 'product', 'group' => '')
  4444. ),
  4445. 'yaxis' => array
  4446. (
  4447. array('field' => 'story', 'name' => '研发需求', 'valOrAgg' => 'sum')
  4448. )
  4449. )
  4450. ),
  4451. 'filters' => array
  4452. (
  4453. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4454. ),
  4455. 'fields' => array
  4456. (
  4457. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  4458. 'id' => array('name' => 'id', 'object' => 'zt_product', 'field' => 'id', 'type' => 'number'),
  4459. 'product' => array('name' => 'product', 'object' => 'zt_product', 'field' => 'product', 'type' => 'string'),
  4460. 'story' => array('name' => '研发需求', 'object' => 'story', 'field' => 'story', 'type' => 'number')
  4461. ),
  4462. 'langs' => array
  4463. (
  4464. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4465. 'id' => array('zh-cn' => '产品编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4466. 'product' => array('zh-cn' => '产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  4467. 'story' => array('zh-cn' => '研发需求预计工时求和', 'zh-tw' => '', 'en' => 'story', 'de' => '', 'fr' => '')
  4468. ),
  4469. 'stage' => 'published',
  4470. 'builtin' => '0'
  4471. );
  4472. $config->bi->builtin->charts[] = array
  4473. (
  4474. 'id' => 1103,
  4475. 'name' => '年度排行-产品-新增Bug条目榜',
  4476. 'code' => 'annualRank_productBug_created',
  4477. 'dimension' => '1',
  4478. 'type' => 'cluBarY',
  4479. 'group' => '44',
  4480. 'sql' => <<<EOT
  4481. SELECT YEAR(t2.openedDate) AS `year`, t1.id, t1.name AS product, COUNT(1) AS bug
  4482. FROM zt_product AS t1
  4483. LEFT JOIN zt_bug AS t2 ON t1.id = t2.product AND t2.deleted = '0'
  4484. WHERE t1.deleted = '0' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t2.id IS NOT NULL
  4485. GROUP BY `year`, t1.id, product
  4486. ORDER BY `year`, bug DESC LIMIT 999999
  4487. EOT
  4488. ,
  4489. 'settings' => array
  4490. (
  4491. array
  4492. (
  4493. 'type' => 'cluBarY',
  4494. 'xaxis' => array
  4495. (
  4496. array('field' => 'product', 'name' => 'product', 'group' => '')
  4497. ),
  4498. 'yaxis' => array
  4499. (
  4500. array('field' => 'bug', 'name' => 'bug', 'valOrAgg' => 'sum')
  4501. )
  4502. )
  4503. ),
  4504. 'filters' => array
  4505. (
  4506. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4507. ),
  4508. 'fields' => array
  4509. (
  4510. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  4511. 'id' => array('name' => 'id', 'object' => 'zt_product', 'field' => 'id', 'type' => 'number'),
  4512. 'product' => array('name' => 'product', 'object' => 'zt_product', 'field' => 'product', 'type' => 'string'),
  4513. 'bug' => array('name' => 'bug', 'object' => 'bug', 'field' => 'bug', 'type' => 'string')
  4514. ),
  4515. 'langs' => array
  4516. (
  4517. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4518. 'id' => array('zh-cn' => '产品编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4519. 'product' => array('zh-cn' => '产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  4520. 'bug' => array('zh-cn' => 'Bug计数', 'zh-tw' => '', 'en' => 'bug', 'de' => '', 'fr' => '')
  4521. ),
  4522. 'stage' => 'published',
  4523. 'builtin' => '0'
  4524. );
  4525. $config->bi->builtin->charts[] = array
  4526. (
  4527. 'id' => 1104,
  4528. 'name' => '年度排行-产品-修复Bug条目榜',
  4529. 'code' => 'annualRank_productBug_fixed',
  4530. 'dimension' => '1',
  4531. 'type' => 'cluBarY',
  4532. 'group' => '44',
  4533. 'sql' => <<<EOT
  4534. SELECT YEAR(t2.closedDate) AS `year`, t1.id, t1.name AS product, COUNT(1) AS bug
  4535. FROM zt_product AS t1
  4536. LEFT JOIN zt_bug AS t2 ON t1.id = t2.product AND t2.deleted = '0' AND t2.resolution = 'fixed' AND t2.status = 'closed'
  4537. WHERE t1.deleted = '0' AND t1.shadow = '0' AND t1.vision = 'rnd' AND t2.id IS NOT NULL
  4538. GROUP BY `year`, t1.id, product
  4539. ORDER BY `year`, bug DESC LIMIT 999999
  4540. EOT
  4541. ,
  4542. 'settings' => array
  4543. (
  4544. array
  4545. (
  4546. 'type' => 'cluBarY',
  4547. 'xaxis' => array
  4548. (
  4549. array('field' => 'product', 'name' => 'product', 'group' => '')
  4550. ),
  4551. 'yaxis' => array
  4552. (
  4553. array('field' => 'bug', 'name' => 'bug', 'valOrAgg' => 'sum')
  4554. )
  4555. )
  4556. ),
  4557. 'filters' => array
  4558. (
  4559. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4560. ),
  4561. 'fields' => array
  4562. (
  4563. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  4564. 'id' => array('name' => 'id', 'object' => 'zt_product', 'field' => 'id', 'type' => 'number'),
  4565. 'product' => array('name' => 'product', 'object' => 'zt_product', 'field' => 'product', 'type' => 'string'),
  4566. 'bug' => array('name' => 'bug', 'object' => 'bug', 'field' => 'bug', 'type' => 'string')
  4567. ),
  4568. 'langs' => array
  4569. (
  4570. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4571. 'id' => array('zh-cn' => '产品编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  4572. 'product' => array('zh-cn' => '产品', 'zh-tw' => '', 'en' => 'product', 'de' => '', 'fr' => ''),
  4573. 'bug' => array('zh-cn' => 'Bug计数', 'zh-tw' => '', 'en' => 'bug', 'de' => '', 'fr' => '')
  4574. ),
  4575. 'stage' => 'published',
  4576. 'builtin' => '0'
  4577. );
  4578. $config->bi->builtin->charts[] = array
  4579. (
  4580. 'id' => 1105,
  4581. 'name' => '年度排行-个人-创建需求条目榜',
  4582. 'code' => 'annualRank_personalStoryCount_created',
  4583. 'dimension' => '1',
  4584. 'type' => 'cluBarY',
  4585. 'group' => '56',
  4586. 'sql' => <<<EOT
  4587. SELECT
  4588. YEAR(t3.openedDate) AS `year`,t2.realname,count(1) AS count
  4589. FROM zt_action AS t1 RIGHT JOIN zt_user AS t2 ON t1.actor=t2.account LEFT JOIN zt_story AS t3 ON t1.objectID=t3.id
  4590. WHERE t1.objectType='story' AND t1.action='opened' AND t3.deleted='0'
  4591. GROUP BY `year`,t2.account ORDER BY `year`,count DESC LIMIT 999999
  4592. EOT
  4593. ,
  4594. 'settings' => array
  4595. (
  4596. array
  4597. (
  4598. 'type' => 'cluBarY',
  4599. 'xaxis' => array
  4600. (
  4601. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4602. ),
  4603. 'yaxis' => array
  4604. (
  4605. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  4606. )
  4607. )
  4608. ),
  4609. 'filters' => array
  4610. (
  4611. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4612. ),
  4613. 'fields' => array
  4614. (
  4615. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'number'),
  4616. 'realname' => array('name' => 'realname', 'object' => 'zt_user', 'field' => 'realname', 'type' => 'string'),
  4617. 'count' => array('name' => 'count', 'object' => 'story', 'field' => 'count', 'type' => 'string')
  4618. ),
  4619. 'langs' => array
  4620. (
  4621. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4622. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4623. 'count' => array('zh-cn' => '计数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => '')
  4624. ),
  4625. 'stage' => 'published',
  4626. 'builtin' => '0'
  4627. );
  4628. $config->bi->builtin->charts[] = array
  4629. (
  4630. 'id' => 1106,
  4631. 'name' => '年度排行-个人-创建用例条目榜',
  4632. 'code' => 'annualRank_personalCaseCount_created',
  4633. 'dimension' => '1',
  4634. 'type' => 'cluBarY',
  4635. 'group' => '56',
  4636. 'sql' => <<<EOT
  4637. SELECT
  4638. YEAR(t3.openedDate) AS `year`,t2.realname,count(1) AS count
  4639. FROM zt_action AS t1 RIGHT JOIN zt_user AS t2 ON t1.actor=t2.account LEFT JOIN zt_case AS t3 ON t1.objectID=t3.id
  4640. WHERE t1.objectType='case' AND t1.action='opened' AND t3.deleted='0'
  4641. GROUP BY `year`,t2.account ORDER BY `year`,count DESC LIMIT 999999
  4642. EOT
  4643. ,
  4644. 'settings' => array
  4645. (
  4646. array
  4647. (
  4648. 'type' => 'cluBarY',
  4649. 'xaxis' => array
  4650. (
  4651. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4652. ),
  4653. 'yaxis' => array
  4654. (
  4655. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  4656. )
  4657. )
  4658. ),
  4659. 'filters' => array
  4660. (
  4661. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4662. ),
  4663. 'fields' => array
  4664. (
  4665. 'year' => array('name' => 'year', 'object' => 'testcase', 'field' => 'year', 'type' => 'number'),
  4666. 'realname' => array('name' => 'realname', 'object' => 'zt_user', 'field' => 'realname', 'type' => 'string'),
  4667. 'count' => array('name' => 'count', 'object' => 'testcase', 'field' => 'count', 'type' => 'string')
  4668. ),
  4669. 'langs' => array
  4670. (
  4671. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4672. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4673. 'count' => array('zh-cn' => '计数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => '')
  4674. ),
  4675. 'stage' => 'published',
  4676. 'builtin' => '0'
  4677. );
  4678. $config->bi->builtin->charts[] = array
  4679. (
  4680. 'id' => 1107,
  4681. 'name' => '年度排行-个人-创建Bug条目榜',
  4682. 'code' => 'annualRank_personalBug_created',
  4683. 'dimension' => '1',
  4684. 'type' => 'cluBarY',
  4685. 'group' => '56',
  4686. 'sql' => <<<EOT
  4687. SELECT
  4688. YEAR(t3.openedDate) AS `year`,t2.realname,count(1) AS count
  4689. FROM zt_action AS t1 RIGHT JOIN zt_user AS t2 ON t1.actor=t2.account LEFT JOIN zt_bug AS t3 ON t1.objectID=t3.id
  4690. WHERE t1.objectType='bug' AND t1.action='opened' AND t3.deleted='0'
  4691. GROUP BY `year`,t2.account ORDER BY `year`,count DESC LIMIT 999999
  4692. EOT
  4693. ,
  4694. 'settings' => array
  4695. (
  4696. array
  4697. (
  4698. 'type' => 'cluBarY',
  4699. 'xaxis' => array
  4700. (
  4701. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4702. ),
  4703. 'yaxis' => array
  4704. (
  4705. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  4706. )
  4707. )
  4708. ),
  4709. 'filters' => array
  4710. (
  4711. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4712. ),
  4713. 'fields' => array
  4714. (
  4715. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  4716. 'realname' => array('name' => 'realname', 'object' => 'zt_user', 'field' => 'realname', 'type' => 'string'),
  4717. 'count' => array('name' => 'count', 'object' => 'bug', 'field' => 'count', 'type' => 'string')
  4718. ),
  4719. 'langs' => array
  4720. (
  4721. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4722. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4723. 'count' => array('zh-cn' => '计数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => '')
  4724. ),
  4725. 'stage' => 'published',
  4726. 'builtin' => '0'
  4727. );
  4728. $config->bi->builtin->charts[] = array
  4729. (
  4730. 'id' => 1108,
  4731. 'name' => '年度排行-个人-修复Bug条目榜',
  4732. 'code' => 'annualRank_personalBug_Fixed',
  4733. 'dimension' => '1',
  4734. 'type' => 'cluBarY',
  4735. 'group' => '56',
  4736. 'sql' => <<<EOT
  4737. SELECT
  4738. YEAR(t3.openedDate) AS `year`,t2.realname,count(DISTINCT t3.id) AS count
  4739. FROM zt_action AS t1 RIGHT JOIN zt_user AS t2 ON t1.actor=t2.account LEFT JOIN zt_bug AS t3 ON t1.objectID=t3.id
  4740. WHERE t1.objectType='bug' AND t1.action='resolved' AND t3.deleted='0'
  4741. GROUP BY `year`,t2.account ORDER BY `year`,count DESC LIMIT 999999
  4742. EOT
  4743. ,
  4744. 'settings' => array
  4745. (
  4746. array
  4747. (
  4748. 'type' => 'cluBarY',
  4749. 'xaxis' => array
  4750. (
  4751. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4752. ),
  4753. 'yaxis' => array
  4754. (
  4755. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  4756. )
  4757. )
  4758. ),
  4759. 'filters' => array
  4760. (
  4761. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4762. ),
  4763. 'fields' => array
  4764. (
  4765. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  4766. 'realname' => array('name' => 'realname', 'object' => 'zt_user', 'field' => 'realname', 'type' => 'string'),
  4767. 'count' => array('name' => 'count', 'object' => 'bug', 'field' => 'count', 'type' => 'string')
  4768. ),
  4769. 'langs' => array
  4770. (
  4771. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4772. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4773. 'count' => array('zh-cn' => '计数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => '')
  4774. ),
  4775. 'stage' => 'published',
  4776. 'builtin' => '0'
  4777. );
  4778. $config->bi->builtin->charts[] = array
  4779. (
  4780. 'id' => 1109,
  4781. 'name' => '年度排行-个人-工时消耗榜',
  4782. 'code' => 'annualRank_personalConsumed',
  4783. 'dimension' => '1',
  4784. 'type' => 'cluBarY',
  4785. 'group' => '56',
  4786. 'sql' => <<<EOT
  4787. SELECT YEAR(t1.date) AS `year`, t2.realname, ROUND(SUM(t1.consumed),1) AS consumed
  4788. FROM zt_effort AS t1 LEFT JOIN zt_user AS t2 ON t1.account = t2.account
  4789. WHERE t1.deleted = '0' AND t2.deleted = '0'
  4790. GROUP BY `year`, realname
  4791. ORDER BY `year`, consumed DESC LIMIT 999999
  4792. EOT
  4793. ,
  4794. 'settings' => array
  4795. (
  4796. array
  4797. (
  4798. 'type' => 'cluBarY',
  4799. 'xaxis' => array
  4800. (
  4801. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4802. ),
  4803. 'yaxis' => array
  4804. (
  4805. array('field' => 'consumed', 'name' => '耗时', 'valOrAgg' => 'sum')
  4806. )
  4807. )
  4808. ),
  4809. 'filters' => array
  4810. (
  4811. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4812. ),
  4813. 'fields' => array
  4814. (
  4815. 'year' => array('name' => 'year', 'object' => 'user', 'field' => 'year', 'type' => 'number'),
  4816. 'realname' => array('name' => 'realname', 'object' => 'zt_user', 'field' => 'realname', 'type' => 'string'),
  4817. 'consumed' => array('name' => '耗时', 'object' => 'effort', 'field' => 'consumed', 'type' => 'number')
  4818. ),
  4819. 'langs' => array
  4820. (
  4821. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4822. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4823. 'consumed' => array('zh-cn' => '耗时', 'zh-tw' => '', 'en' => 'consumed', 'de' => '', 'fr' => '')
  4824. ),
  4825. 'stage' => 'published',
  4826. 'builtin' => '0'
  4827. );
  4828. $config->bi->builtin->charts[] = array
  4829. (
  4830. 'id' => 1110,
  4831. 'name' => '年度排行-个人-禅道操作次数榜',
  4832. 'code' => 'annualRank_personalAction',
  4833. 'dimension' => '1',
  4834. 'type' => 'cluBarY',
  4835. 'group' => '56',
  4836. 'sql' => <<<EOT
  4837. SELECT YEAR(t1.date) AS `year`,IFNULL(t2.realname,t1.actor) AS realname,count(1) AS count FROM zt_action t1 LEFT JOIN zt_user AS t2 ON t1.actor=t2.account where t1.actor is not null and t1.actor not in('', 'system') GROUP BY `year`,t1.actor ORDER BY `year`, `count` DESC LIMIT 999999
  4838. EOT
  4839. ,
  4840. 'settings' => array
  4841. (
  4842. array
  4843. (
  4844. 'type' => 'cluBarY',
  4845. 'xaxis' => array
  4846. (
  4847. array('field' => 'realname', 'name' => 'realname', 'group' => '')
  4848. ),
  4849. 'yaxis' => array
  4850. (
  4851. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  4852. )
  4853. )
  4854. ),
  4855. 'filters' => array
  4856. (
  4857. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  4858. ),
  4859. 'fields' => array
  4860. (
  4861. 'year' => array('name' => 'year', 'object' => 'user', 'field' => 'year', 'type' => 'number'),
  4862. 'realname' => array('name' => 'realname', 'object' => 'zt_action', 'field' => 'realname', 'type' => 'string'),
  4863. 'count' => array('name' => 'count', 'object' => 'user', 'field' => 'count', 'type' => 'string')
  4864. ),
  4865. 'langs' => array
  4866. (
  4867. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => ''),
  4868. 'realname' => array('zh-cn' => '姓名', 'zh-tw' => '', 'en' => 'realname', 'de' => '', 'fr' => ''),
  4869. 'count' => array('zh-cn' => '计数', 'zh-tw' => '', 'en' => 'count', 'de' => '', 'fr' => '')
  4870. ),
  4871. 'stage' => 'published',
  4872. 'builtin' => '0'
  4873. );
  4874. $config->bi->builtin->charts[] = array
  4875. (
  4876. 'id' => 10000,
  4877. 'name' => '年度完成项目-完成项目数',
  4878. 'code' => 'annualFinishedProject_countProject',
  4879. 'dimension' => '2',
  4880. 'type' => 'card',
  4881. 'group' => '72',
  4882. 'sql' => <<<EOT
  4883. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM zt_project WHERE type='project' AND status='closed' AND deleted='0' GROUP BY `year`
  4884. EOT
  4885. ,
  4886. 'settings' => array
  4887. (
  4888. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4889. 'title' => array('type' => 'text', 'name' => ''),
  4890. 'type' => 'value'
  4891. ),
  4892. 'filters' => array(),
  4893. 'stage' => 'published',
  4894. 'builtin' => '1'
  4895. );
  4896. $config->bi->builtin->charts[] = array
  4897. (
  4898. 'id' => 10001,
  4899. 'name' => '年度完成项目-按时完成项目数',
  4900. 'code' => 'annualFinishedProject_countProject_finished_ontime',
  4901. 'dimension' => '2',
  4902. 'type' => 'card',
  4903. 'group' => '72',
  4904. 'sql' => <<<EOT
  4905. SELECT COUNT(1) AS number,YEAR(`closedDate`) as `year` FROM (SELECT id, begin, `end`, IF(left(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted='0' AND type='project' AND status='closed') t1 WHERE t1.realEnd<=t1.`end` GROUP BY `year`
  4906. EOT
  4907. ,
  4908. 'settings' => array
  4909. (
  4910. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4911. 'title' => array('type' => 'text', 'name' => ''),
  4912. 'type' => 'value'
  4913. ),
  4914. 'filters' => array(),
  4915. 'stage' => 'published',
  4916. 'builtin' => '1'
  4917. );
  4918. $config->bi->builtin->charts[] = array
  4919. (
  4920. 'id' => 10002,
  4921. 'name' => '年度完成项目-延期完成项目数',
  4922. 'code' => 'annualFinishedProject_countProject_finished_delay',
  4923. 'dimension' => '2',
  4924. 'type' => 'card',
  4925. 'group' => '72',
  4926. 'sql' => <<<EOT
  4927. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM (SELECT id, begin, `end`, IF(left(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted='0' AND type='project' AND status='closed') t1 WHERE t1.realEnd>t1.`end` GROUP BY `year`
  4928. EOT
  4929. ,
  4930. 'settings' => array
  4931. (
  4932. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4933. 'title' => array('type' => 'text', 'name' => ''),
  4934. 'type' => 'value'
  4935. ),
  4936. 'filters' => array(),
  4937. 'stage' => 'published',
  4938. 'builtin' => '1'
  4939. );
  4940. $config->bi->builtin->charts[] = array
  4941. (
  4942. 'id' => 10003,
  4943. 'name' => '年度完成项目-完成需求条目数',
  4944. 'code' => 'annualFinishedProject_storyCount_finished',
  4945. 'dimension' => '2',
  4946. 'type' => 'card',
  4947. 'group' => '75',
  4948. 'sql' => <<<EOT
  4949. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM zt_story WHERE deleted='0' AND status='closed' AND closedReason='done' GROUP BY `year`
  4950. EOT
  4951. ,
  4952. 'settings' => array
  4953. (
  4954. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4955. 'title' => array('type' => 'text', 'name' => ''),
  4956. 'type' => 'value'
  4957. ),
  4958. 'filters' => array(),
  4959. 'stage' => 'published',
  4960. 'builtin' => '1'
  4961. );
  4962. $config->bi->builtin->charts[] = array
  4963. (
  4964. 'id' => 10004,
  4965. 'name' => '年度完成项目-完成需求规模数',
  4966. 'code' => 'annualFinishedProject_storyEstimate_finished',
  4967. 'dimension' => '2',
  4968. 'type' => 'card',
  4969. 'group' => '75',
  4970. 'sql' => <<<EOT
  4971. SELECT ROUND(SUM(estimate),2) AS number,YEAR(`closedDate`) AS `year` FROM zt_story WHERE deleted='0' AND status='closed' AND closedReason='done' GROUP BY `year`
  4972. EOT
  4973. ,
  4974. 'settings' => array
  4975. (
  4976. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4977. 'title' => array('type' => 'text', 'name' => ''),
  4978. 'type' => 'value'
  4979. ),
  4980. 'filters' => array(),
  4981. 'stage' => 'published',
  4982. 'builtin' => '1'
  4983. );
  4984. $config->bi->builtin->charts[] = array
  4985. (
  4986. 'id' => 10005,
  4987. 'name' => '年度完成项目-完成发布数',
  4988. 'code' => 'annualFinishedProject_release_finished',
  4989. 'dimension' => '2',
  4990. 'type' => 'card',
  4991. 'group' => '74',
  4992. 'sql' => <<<EOT
  4993. SELECT COUNT(1) AS number,YEAR(`date`) AS `year` FROM zt_release WHERE deleted='0' GROUP BY `year`
  4994. EOT
  4995. ,
  4996. 'settings' => array
  4997. (
  4998. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  4999. 'title' => array('type' => 'text', 'name' => ''),
  5000. 'type' => 'value'
  5001. ),
  5002. 'filters' => array(),
  5003. 'stage' => 'published',
  5004. 'builtin' => '1'
  5005. );
  5006. $config->bi->builtin->charts[] = array
  5007. (
  5008. 'id' => 10006,
  5009. 'name' => '年度完成项目-解决bug数',
  5010. 'code' => 'annualFinishedProject_bug_fixed',
  5011. 'dimension' => '2',
  5012. 'type' => 'card',
  5013. 'group' => '77',
  5014. 'sql' => <<<EOT
  5015. SELECT SUM(CASE WHEN resolution='fixed' THEN 1 ELSE 0 END) AS number,YEAR(`resolvedDate`) AS `year` FROM zt_bug WHERE deleted='0' GROUP BY `year`
  5016. EOT
  5017. ,
  5018. 'settings' => array
  5019. (
  5020. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5021. 'title' => array('type' => 'text', 'name' => ''),
  5022. 'type' => 'value'
  5023. ),
  5024. 'filters' => array(),
  5025. 'stage' => 'published',
  5026. 'builtin' => '1'
  5027. );
  5028. $config->bi->builtin->charts[] = array
  5029. (
  5030. 'id' => 10007,
  5031. 'name' => '年度完成项目-完成执行数',
  5032. 'code' => 'annualFinishedProject_execution_finished',
  5033. 'dimension' => '2',
  5034. 'type' => 'card',
  5035. 'group' => '73',
  5036. 'sql' => <<<EOT
  5037. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM zt_project WHERE type='sprint' AND status='closed' AND deleted='0' GROUP BY `year`
  5038. EOT
  5039. ,
  5040. 'settings' => array
  5041. (
  5042. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5043. 'title' => array('type' => 'text', 'name' => ''),
  5044. 'type' => 'value'
  5045. ),
  5046. 'filters' => array(),
  5047. 'stage' => 'published',
  5048. 'builtin' => '1'
  5049. );
  5050. $config->bi->builtin->charts[] = array
  5051. (
  5052. 'id' => 10008,
  5053. 'name' => '年度完成项目-按时完成执行数',
  5054. 'code' => 'annualFinishedProject_execution_finished_ontime',
  5055. 'dimension' => '2',
  5056. 'type' => 'card',
  5057. 'group' => '73',
  5058. 'sql' => <<<EOT
  5059. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM (SELECT id, begin, `end`, IF(LEFT(realEnd,4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted='0' AND type='sprint' AND status='closed') t1 WHERE t1.realEnd<=t1.`end` GROUP BY `year`
  5060. EOT
  5061. ,
  5062. 'settings' => array
  5063. (
  5064. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5065. 'title' => array('type' => 'text', 'name' => ''),
  5066. 'type' => 'value'
  5067. ),
  5068. 'filters' => array(),
  5069. 'stage' => 'published',
  5070. 'builtin' => '1'
  5071. );
  5072. $config->bi->builtin->charts[] = array
  5073. (
  5074. 'id' => 10009,
  5075. 'name' => '年度完成项目-延期完成执行数',
  5076. 'code' => 'annualFinishedProject_execution_finished_delay',
  5077. 'dimension' => '2',
  5078. 'type' => 'card',
  5079. 'group' => '73',
  5080. 'sql' => <<<EOT
  5081. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM (SELECT id, begin, `end`, IF(LEFT(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' AND type='sprint' AND status='closed') t1 WHERE t1.realEnd>t1.`end` GROUP BY `year`
  5082. EOT
  5083. ,
  5084. 'settings' => array
  5085. (
  5086. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5087. 'title' => array('type' => 'text', 'name' => ''),
  5088. 'type' => 'value'
  5089. ),
  5090. 'filters' => array(),
  5091. 'stage' => 'published',
  5092. 'builtin' => '1'
  5093. );
  5094. $config->bi->builtin->charts[] = array
  5095. (
  5096. 'id' => 10010,
  5097. 'name' => '年度完成项目-完成任务条目数',
  5098. 'code' => 'annualFinishedProject_taskCount_finished',
  5099. 'dimension' => '2',
  5100. 'type' => 'card',
  5101. 'group' => '76',
  5102. 'sql' => <<<EOT
  5103. SELECT COUNT(1) AS number,YEAR(`closedDate`) AS `year` FROM zt_task WHERE deleted='0' AND status='closed' AND closedReason='done' GROUP BY `year`
  5104. EOT
  5105. ,
  5106. 'settings' => array
  5107. (
  5108. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5109. 'title' => array('type' => 'text', 'name' => ''),
  5110. 'type' => 'value'
  5111. ),
  5112. 'filters' => array(),
  5113. 'stage' => 'published',
  5114. 'builtin' => '1'
  5115. );
  5116. $config->bi->builtin->charts[] = array
  5117. (
  5118. 'id' => 10011,
  5119. 'name' => '年度完成项目-完成任务预计工时数',
  5120. 'code' => 'annualFinishedProject_taskEstimate_finished',
  5121. 'dimension' => '2',
  5122. 'type' => 'card',
  5123. 'group' => '78',
  5124. 'sql' => <<<EOT
  5125. SELECT ROUND(SUM(estimate),2) AS number,YEAR(`closedDate`) AS `year` FROM zt_task WHERE deleted='0' AND status='closed' AND closedReason='done' GROUP BY `year`
  5126. EOT
  5127. ,
  5128. 'settings' => array
  5129. (
  5130. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5131. 'title' => array('type' => 'text', 'name' => ''),
  5132. 'type' => 'value'
  5133. ),
  5134. 'filters' => array(),
  5135. 'stage' => 'published',
  5136. 'builtin' => '1'
  5137. );
  5138. $config->bi->builtin->charts[] = array
  5139. (
  5140. 'id' => 10012,
  5141. 'name' => '年度完成项目-完成任务消耗工时数',
  5142. 'code' => 'annualFinishedProject_taskConsumed_finished',
  5143. 'dimension' => '2',
  5144. 'type' => 'card',
  5145. 'group' => '78',
  5146. 'sql' => <<<EOT
  5147. SELECT ROUND(SUM(consumed),2) AS number,YEAR(`closedDate`) AS `year` FROM zt_task WHERE deleted='0' AND status='closed' AND closedReason='done' GROUP BY `year`
  5148. EOT
  5149. ,
  5150. 'settings' => array
  5151. (
  5152. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5153. 'title' => array('type' => 'text', 'name' => ''),
  5154. 'type' => 'value'
  5155. ),
  5156. 'filters' => array(),
  5157. 'stage' => 'published',
  5158. 'builtin' => '1'
  5159. );
  5160. $config->bi->builtin->charts[] = array
  5161. (
  5162. 'id' => 10013,
  5163. 'name' => '年度完成项目-投入的总人天',
  5164. 'code' => 'annualFinishedProject_workingDayConsumed',
  5165. 'dimension' => '2',
  5166. 'type' => 'card',
  5167. 'group' => '78',
  5168. 'sql' => <<<EOT
  5169. SELECT SUM(t2.people*DATEDIFF(t1.realEnd,t1.realBegan)) AS number,YEAR(`closedDate`) AS `year` FROM (SELECT id, realBegan, IF(LEFT(realEnd, 4) = '0000', CAST(closedDate AS DATE), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' AND status='closed' AND type='project' AND realBegan != '1970-01-01') t1 LEFT JOIN (SELECT root, COUNT(id) people FROM zt_team WHERE type='project' GROUP BY `root`) t2 ON t1.id=t2.root GROUP BY `year`
  5170. EOT
  5171. ,
  5172. 'settings' => array
  5173. (
  5174. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  5175. 'title' => array('type' => 'text', 'name' => ''),
  5176. 'type' => 'value'
  5177. ),
  5178. 'filters' => array(),
  5179. 'stage' => 'published',
  5180. 'builtin' => '1'
  5181. );
  5182. $config->bi->builtin->charts[] = array
  5183. (
  5184. 'id' => 10014,
  5185. 'name' => '年度完成项目-项目按期完成率',
  5186. 'code' => 'annualFinishedProject_projectFinishedRatio',
  5187. 'dimension' => '2',
  5188. 'type' => 'waterpolo',
  5189. 'group' => '71',
  5190. 'sql' => <<<EOT
  5191. SELECT t1.id,IF(t1.realEnd<=t1.`end`,'done','undone') AS `projectstatus`, YEAR(`closedDate`) AS `year` FROM(SELECT id, begin, `end`, IF(LEFT(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' AND type='project' AND status='closed') t1
  5192. EOT
  5193. ,
  5194. 'settings' => array
  5195. (
  5196. array
  5197. (
  5198. 'type' => 'waterpolo',
  5199. 'calc' => 'count',
  5200. 'goal' => 'id',
  5201. 'conditions' => array
  5202. (
  5203. array('field' => 'projectstatus', 'condition' => 'eq', 'value' => 'done')
  5204. )
  5205. )
  5206. ),
  5207. 'filters' => array(),
  5208. 'fields' => array
  5209. (
  5210. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5211. 'projectstatus' => array('name' => 'projectstatus', 'object' => 'project', 'field' => 'projectstatus', 'type' => 'string'),
  5212. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'string')
  5213. ),
  5214. 'langs' => array
  5215. (
  5216. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5217. 'projectstatus' => array('zh-cn' => '项目状态', 'zh-tw' => '', 'en' => 'projectstatus', 'de' => '', 'fr' => ''),
  5218. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => '')
  5219. ),
  5220. 'stage' => 'published',
  5221. 'builtin' => '0'
  5222. );
  5223. $config->bi->builtin->charts[] = array
  5224. (
  5225. 'id' => 10015,
  5226. 'name' => '年度完成项目-执行按期完成率',
  5227. 'code' => 'annualFinishedProject_executionFinishedRatio',
  5228. 'dimension' => '2',
  5229. 'type' => 'waterpolo',
  5230. 'group' => '71',
  5231. 'sql' => <<<EOT
  5232. SELECT t1.id,IF(t1.realEnd<=t1.`end`,'done','undone') AS `projectstatus`, YEAR(`closedDate`) AS `year` FROM (SELECT id, begin, `end`, IF(LEFT(realEnd,4)='0000',LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' and type='sprint' and status='closed') t1
  5233. EOT
  5234. ,
  5235. 'settings' => array
  5236. (
  5237. array
  5238. (
  5239. 'type' => 'waterpolo',
  5240. 'calc' => 'count',
  5241. 'goal' => 'id',
  5242. 'conditions' => array
  5243. (
  5244. array('field' => 'projectstatus', 'condition' => 'eq', 'value' => 'done')
  5245. )
  5246. )
  5247. ),
  5248. 'filters' => array(),
  5249. 'fields' => array
  5250. (
  5251. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5252. 'projectstatus' => array('name' => 'projectstatus', 'object' => 'project', 'field' => 'projectstatus', 'type' => 'string'),
  5253. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'string')
  5254. ),
  5255. 'langs' => array
  5256. (
  5257. 'id' => array('zh-cn' => '执行ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5258. 'projectstatus' => array('zh-cn' => '执行状态', 'zh-tw' => '', 'en' => 'projectstatus', 'de' => '', 'fr' => ''),
  5259. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => '')
  5260. ),
  5261. 'stage' => 'published',
  5262. 'builtin' => '0'
  5263. );
  5264. $config->bi->builtin->charts[] = array
  5265. (
  5266. 'id' => 10016,
  5267. 'name' => '年度完成项目-项目延期率',
  5268. 'code' => 'annualFinishedProject_projectDelayRatio',
  5269. 'dimension' => '2',
  5270. 'type' => 'waterpolo',
  5271. 'group' => '71',
  5272. 'sql' => <<<EOT
  5273. SELECT t1.id,IF(t1.realEnd>t1.`end` ,'done','undone') AS `projectstatus`, YEAR(`closedDate`) AS `year` FROM (SELECT id, begin, `end`, IF(LEFT(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' AND type='project' AND status='closed') t1
  5274. EOT
  5275. ,
  5276. 'settings' => array
  5277. (
  5278. array
  5279. (
  5280. 'type' => 'waterpolo',
  5281. 'calc' => 'count',
  5282. 'goal' => 'id',
  5283. 'conditions' => array
  5284. (
  5285. array('field' => 'projectstatus', 'condition' => 'eq', 'value' => 'done')
  5286. )
  5287. )
  5288. ),
  5289. 'filters' => array(),
  5290. 'fields' => array
  5291. (
  5292. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5293. 'projectstatus' => array('name' => 'projectstatus', 'object' => 'project', 'field' => 'projectstatus', 'type' => 'string'),
  5294. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'string')
  5295. ),
  5296. 'langs' => array
  5297. (
  5298. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5299. 'projectstatus' => array('zh-cn' => '项目状态', 'zh-tw' => '', 'en' => 'projectstatus', 'de' => '', 'fr' => ''),
  5300. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => '')
  5301. ),
  5302. 'stage' => 'published',
  5303. 'builtin' => '0'
  5304. );
  5305. $config->bi->builtin->charts[] = array
  5306. (
  5307. 'id' => 10017,
  5308. 'name' => '年度完成项目-执行延期率',
  5309. 'code' => 'annualFinishedProject_executionDelayRatio',
  5310. 'dimension' => '2',
  5311. 'type' => 'waterpolo',
  5312. 'group' => '71',
  5313. 'sql' => <<<EOT
  5314. SELECT t1.id,IF(t1.realEnd>t1.`end`,'done','undone') AS `projectstatus`, YEAR(`closedDate`) AS `year` FROM(SELECT id, begin, `end`, IF(LEFT(realEnd, 4) = '0000', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted='0' and type='sprint' and status='closed') t1
  5315. EOT
  5316. ,
  5317. 'settings' => array
  5318. (
  5319. array
  5320. (
  5321. 'type' => 'waterpolo',
  5322. 'calc' => 'count',
  5323. 'goal' => 'id',
  5324. 'conditions' => array
  5325. (
  5326. array('field' => 'projectstatus', 'condition' => 'eq', 'value' => 'done')
  5327. )
  5328. )
  5329. ),
  5330. 'filters' => array(),
  5331. 'fields' => array
  5332. (
  5333. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5334. 'projectstatus' => array('name' => 'projectstatus', 'object' => 'project', 'field' => 'projectstatus', 'type' => 'string'),
  5335. 'year' => array('name' => 'year', 'object' => 'project', 'field' => 'year', 'type' => 'string')
  5336. ),
  5337. 'langs' => array
  5338. (
  5339. 'id' => array('zh-cn' => '执行ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5340. 'projectstatus' => array('zh-cn' => '执行状态', 'zh-tw' => '', 'en' => 'projectstatus', 'de' => '', 'fr' => ''),
  5341. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'year', 'de' => '', 'fr' => '')
  5342. ),
  5343. 'stage' => 'published',
  5344. 'builtin' => '0'
  5345. );
  5346. $config->bi->builtin->charts[] = array
  5347. (
  5348. 'id' => 10018,
  5349. 'name' => '年度完成项目-完成项目工期偏差条形图',
  5350. 'code' => 'annualFinishedProject_projectFinishedDurationDeviation',
  5351. 'dimension' => '2',
  5352. 'type' => 'cluBarY',
  5353. 'group' => '71',
  5354. 'sql' => <<<EOT
  5355. select
  5356. t1.name,
  5357. t1.closedDate,
  5358. round(t1.realduration-t1.planduration)/t1.planduration as daterate
  5359. from(
  5360. select
  5361. name,
  5362. id,
  5363. closedDate,
  5364. begin,
  5365. `end`,
  5366. datediff(`end`,`begin`) planduration,
  5367. realBegan,
  5368. realEnd,
  5369. ifnull(if(left(realEnd,4) != '0000',datediff(`realEnd`,`realBegan`),datediff(`closedDate`,`realBegan`)),0) realduration
  5370. from
  5371. zt_project
  5372. where deleted='0'
  5373. and status='closed'
  5374. and type='project'
  5375. ) t1
  5376. EOT
  5377. ,
  5378. 'settings' => array
  5379. (
  5380. array
  5381. (
  5382. 'type' => 'cluBarY',
  5383. 'xaxis' => array
  5384. (
  5385. array('field' => 'name', 'name' => '项目名称', 'group' => '')
  5386. ),
  5387. 'yaxis' => array
  5388. (
  5389. array('field' => 'daterate', 'name' => 'daterate', 'valOrAgg' => 'max')
  5390. )
  5391. )
  5392. ),
  5393. 'filters' => array
  5394. (
  5395. array
  5396. (
  5397. 'field' => 'closedDate',
  5398. 'type' => 'date',
  5399. 'name' => '关闭日期',
  5400. 'default' => array('begin' => '', 'end' => '')
  5401. )
  5402. ),
  5403. 'fields' => array
  5404. (
  5405. 'name' => array('name' => '项目名称', 'object' => 'project', 'field' => 'name', 'type' => 'string'),
  5406. 'closedDate' => array('name' => '关闭日期', 'object' => 'project', 'field' => 'closedDate', 'type' => 'date'),
  5407. 'daterate' => array('name' => 'daterate', 'object' => 'project', 'field' => 'daterate', 'type' => 'number')
  5408. ),
  5409. 'langs' => array
  5410. (
  5411. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  5412. 'closedDate' => array('zh-cn' => '关闭日期', 'zh-tw' => '', 'en' => 'closedDate', 'de' => '', 'fr' => ''),
  5413. 'daterate' => array('zh-cn' => '工期偏差率', 'zh-tw' => '', 'en' => 'daterate', 'de' => '', 'fr' => '')
  5414. ),
  5415. 'stage' => 'published',
  5416. 'builtin' => '0'
  5417. );
  5418. $config->bi->builtin->charts[] = array
  5419. (
  5420. 'id' => 10019,
  5421. 'name' => '年度完成项目-单位工时交付需求规模数对比图',
  5422. 'code' => 'annualFinishedProject_storyEstimatePerHour',
  5423. 'dimension' => '2',
  5424. 'type' => 'pie',
  5425. 'group' => '71',
  5426. 'sql' => <<<EOT
  5427. select tt.*,
  5428. tt.`故事点` / tt.`工时` as `单位时间交付需求规模数`
  5429. from (
  5430. select
  5431. t1.name as project,
  5432. (
  5433. select round(sum(t3.estimate), 1) from zt_projectstory t2
  5434. left join zt_story t3 on t3.id= t2.story and t3.status='closed' and t3.closedReason = 'done'
  5435. where t2.project = t1.id
  5436. ) as `故事点`,
  5437. (
  5438. select round(sum(t5.consumed), 1) from zt_project t4
  5439. left join zt_task t5 on t5.execution = t4.id and t5.deleted = '0' and t5.parent in (0, -1)
  5440. where t4.project = t1.id and t4.type = 'sprint'
  5441. ) as `工时`
  5442. from zt_project t1
  5443. where t1.status = 'closed'
  5444. and t1.deleted = '0'
  5445. and t1.type = 'project'
  5446. group by t1.id) tt
  5447. EOT
  5448. ,
  5449. 'settings' => array
  5450. (
  5451. array
  5452. (
  5453. 'type' => 'cluBarX',
  5454. 'xaxis' => array
  5455. (
  5456. array('field' => 'project', 'name' => '所属项目', 'group' => '')
  5457. ),
  5458. 'yaxis' => array
  5459. (
  5460. array('field' => '单位时间交付需求规模数', 'name' => '单位时间交付需求规模数', 'valOrAgg' => 'sum')
  5461. )
  5462. )
  5463. ),
  5464. 'filters' => array
  5465. (
  5466. array('field' => 'project', 'type' => 'input', 'name' => '所属项目', 'default' => '')
  5467. ),
  5468. 'fields' => array
  5469. (
  5470. 'project' => array('name' => '所属项目', 'object' => 'project', 'field' => 'project', 'type' => 'string'),
  5471. '故事点' => array('name' => '故事点', 'object' => 'project', 'field' => '故事点', 'type' => 'number'),
  5472. '工时' => array('name' => '工时', 'object' => 'project', 'field' => '工时', 'type' => 'number'),
  5473. '单位时间交付需求规模数' => array('name' => '单位时间交付需求规模数', 'object' => 'project', 'field' => '单位时间交付需求规模数', 'type' => 'number')
  5474. ),
  5475. 'stage' => 'published',
  5476. 'builtin' => '1'
  5477. );
  5478. $config->bi->builtin->charts[] = array
  5479. (
  5480. 'id' => 10020,
  5481. 'name' => '年度完成项目-项目完成分布图',
  5482. 'code' => 'annualFinishedProject_projectStatus_finished',
  5483. 'dimension' => '2',
  5484. 'type' => 'pie',
  5485. 'group' => '71',
  5486. 'sql' => <<<EOT
  5487. select
  5488. t1.id,
  5489. (case when t1.realEnd<t1.end then '提前完成项目' when t1.realEnd=t1.end then '正常完成项目' else '延期完成项目' end) `completeStatus`,
  5490. t1.closedDate
  5491. from(
  5492. select
  5493. id,
  5494. closedDate,
  5495. `end`,
  5496. if(left(realEnd, 4) = '0000', closedDate, realEnd) as realEnd
  5497. from
  5498. zt_project
  5499. where deleted='0'
  5500. and status='closed'
  5501. and type='project') t1
  5502. EOT
  5503. ,
  5504. 'settings' => array
  5505. (
  5506. array
  5507. (
  5508. 'type' => 'pie',
  5509. 'group' => array
  5510. (
  5511. array('field' => 'completeStatus', 'name' => 'completeStatus', 'group' => '')
  5512. ),
  5513. 'metric' => array
  5514. (
  5515. array('field' => 'id', 'name' => '项目ID', 'valOrAgg' => 'count')
  5516. )
  5517. )
  5518. ),
  5519. 'filters' => array
  5520. (
  5521. array
  5522. (
  5523. 'field' => 'closedDate',
  5524. 'type' => 'date',
  5525. 'name' => '关闭日期',
  5526. 'default' => array('begin' => '', 'end' => '')
  5527. )
  5528. ),
  5529. 'fields' => array
  5530. (
  5531. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5532. 'completeStatus' => array('name' => 'completeStatus', 'object' => 'project', 'field' => 'completeStatus', 'type' => 'string'),
  5533. 'closedDate' => array('name' => '关闭日期', 'object' => 'project', 'field' => 'closedDate', 'type' => 'date')
  5534. ),
  5535. 'langs' => array
  5536. (
  5537. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5538. 'completeStatus' => array('zh-cn' => '项目完成情况', 'zh-tw' => '', 'en' => 'completeStatus', 'de' => '', 'fr' => ''),
  5539. 'closedDate' => array('zh-cn' => '关闭日期', 'zh-tw' => '', 'en' => 'closedDate', 'de' => '', 'fr' => '')
  5540. ),
  5541. 'stage' => 'published',
  5542. 'builtin' => '0'
  5543. );
  5544. $config->bi->builtin->charts[] = array
  5545. (
  5546. 'id' => 10021,
  5547. 'name' => '年度完成项目-执行完成分布图',
  5548. 'code' => 'annualFinishedProject_executionStatus_finished',
  5549. 'dimension' => '2',
  5550. 'type' => 'pie',
  5551. 'group' => '71',
  5552. 'sql' => <<<EOT
  5553. select
  5554. t1.id,
  5555. (case when t1.realEnd<t1.end then '提前完成执行' when t1.realEnd=t1.end then '正常完成执行' else '延期完成执行' end) `completeStatus`,
  5556. t1.closedDate
  5557. from(
  5558. select
  5559. id,
  5560. closedDate,
  5561. `end`,
  5562. if(left(realEnd, 4) = '0000', closedDate, realEnd) as realEnd
  5563. from
  5564. zt_project
  5565. where deleted='0'
  5566. and status='closed'
  5567. and type='sprint') t1
  5568. EOT
  5569. ,
  5570. 'settings' => array
  5571. (
  5572. array
  5573. (
  5574. 'type' => 'pie',
  5575. 'group' => array
  5576. (
  5577. array('field' => 'completeStatus', 'name' => 'completeStatus', 'group' => '')
  5578. ),
  5579. 'metric' => array
  5580. (
  5581. array('field' => 'id', 'name' => '项目ID', 'valOrAgg' => 'count')
  5582. )
  5583. )
  5584. ),
  5585. 'filters' => array
  5586. (
  5587. array
  5588. (
  5589. 'field' => 'closedDate',
  5590. 'type' => 'date',
  5591. 'name' => '关闭日期',
  5592. 'default' => array('begin' => '', 'end' => '')
  5593. )
  5594. ),
  5595. 'fields' => array
  5596. (
  5597. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5598. 'completeStatus' => array('name' => 'completeStatus', 'object' => 'project', 'field' => 'completeStatus', 'type' => 'string'),
  5599. 'closedDate' => array('name' => '关闭日期', 'object' => 'project', 'field' => 'closedDate', 'type' => 'date')
  5600. ),
  5601. 'langs' => array
  5602. (
  5603. 'id' => array('zh-cn' => '执行ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5604. 'completeStatus' => array('zh-cn' => '完成情况', 'zh-tw' => '', 'en' => 'completeStatus', 'de' => '', 'fr' => ''),
  5605. 'closedDate' => array('zh-cn' => '关闭日期', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  5606. ),
  5607. 'stage' => 'published',
  5608. 'builtin' => '0'
  5609. );
  5610. $config->bi->builtin->charts[] = array
  5611. (
  5612. 'id' => 10022,
  5613. 'name' => '年度完成项目-完成项目工时偏差条形图',
  5614. 'code' => 'annualFinishedProject_projectHourDeviation_finished',
  5615. 'dimension' => '2',
  5616. 'type' => 'cluBarY',
  5617. 'group' => '70',
  5618. 'sql' => <<<EOT
  5619. select
  5620. *,
  5621. round(tt.deviation/tt.estimate,3) rate
  5622. from(
  5623. select
  5624. t1.name,
  5625. t1.id,
  5626. t1.closedDate,
  5627. t2.estimate estimate,
  5628. t2.consumed consumed,
  5629. t2.`left`,
  5630. t2.consumed-t2.estimate deviation
  5631. from
  5632. zt_project t1
  5633. left join
  5634. (select
  5635. project,
  5636. sum(estimate) estimate,
  5637. sum(consumed) consumed,
  5638. sum(`left`) `left`
  5639. from
  5640. zt_task
  5641. group by project) t2
  5642. on t1.id=t2.project
  5643. where t1.deleted='0'
  5644. and t1.status='closed'
  5645. and t1.type='project') tt
  5646. EOT
  5647. ,
  5648. 'settings' => array
  5649. (
  5650. array
  5651. (
  5652. 'type' => 'cluBarY',
  5653. 'xaxis' => array
  5654. (
  5655. array('field' => 'name', 'name' => '任务名称', 'group' => '')
  5656. ),
  5657. 'yaxis' => array
  5658. (
  5659. array('field' => 'rate', 'name' => 'rate', 'valOrAgg' => 'sum')
  5660. )
  5661. )
  5662. ),
  5663. 'filters' => array
  5664. (
  5665. array
  5666. (
  5667. 'field' => 'closedDate',
  5668. 'type' => 'date',
  5669. 'name' => '关闭时间',
  5670. 'default' => array('begin' => '', 'end' => '')
  5671. )
  5672. ),
  5673. 'fields' => array
  5674. (
  5675. 'name' => array('name' => '任务名称', 'object' => 'project', 'field' => 'name', 'type' => 'string'),
  5676. 'id' => array('name' => '编号', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  5677. 'closedDate' => array('name' => '关闭时间', 'object' => 'task', 'field' => 'closedDate', 'type' => 'date'),
  5678. 'estimate' => array('name' => '最初预计', 'object' => 'task', 'field' => 'estimate', 'type' => 'string'),
  5679. 'consumed' => array('name' => '总计消耗', 'object' => 'task', 'field' => 'consumed', 'type' => 'string'),
  5680. 'left' => array('name' => '预计剩余', 'object' => 'task', 'field' => 'left', 'type' => 'string'),
  5681. 'deviation' => array('name' => 'deviation', 'object' => 'task', 'field' => 'deviation', 'type' => 'number'),
  5682. 'rate' => array('name' => 'rate', 'object' => 'task', 'field' => 'rate', 'type' => 'number')
  5683. ),
  5684. 'langs' => array
  5685. (
  5686. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  5687. 'id' => array('zh-cn' => '项目编号', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  5688. 'closedDate' => array('zh-cn' => '关闭时间', 'zh-tw' => '', 'en' => 'closedDate', 'de' => '', 'fr' => ''),
  5689. 'estimate' => array('zh-cn' => '最初预计', 'zh-tw' => '', 'en' => 'estimate', 'de' => '', 'fr' => ''),
  5690. 'consumed' => array('zh-cn' => '总计消耗', 'zh-tw' => '', 'en' => 'consumed', 'de' => '', 'fr' => ''),
  5691. 'left' => array('zh-cn' => '预计剩余', 'zh-tw' => '', 'en' => 'left', 'de' => '', 'fr' => ''),
  5692. 'deviation' => array('zh-cn' => '偏差', 'zh-tw' => '', 'en' => 'deviation', 'de' => '', 'fr' => ''),
  5693. 'rate' => array('zh-cn' => '偏差比率', 'zh-tw' => '', 'en' => 'rate', 'de' => '', 'fr' => '')
  5694. ),
  5695. 'stage' => 'published',
  5696. 'builtin' => '0'
  5697. );
  5698. $config->bi->builtin->charts[] = array
  5699. (
  5700. 'id' => 10101,
  5701. 'name' => '年度进行中项目-进行中的项目数',
  5702. 'code' => 'annualDoingProject_countProject',
  5703. 'dimension' => '2',
  5704. 'type' => 'card',
  5705. 'group' => '72',
  5706. 'sql' => <<<EOT
  5707. SELECT id FROM zt_project WHERE deleted = '0' AND status = 'doing' AND type = 'project'
  5708. EOT
  5709. ,
  5710. 'settings' => array
  5711. (
  5712. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5713. 'title' => array('type' => 'text', 'name' => ''),
  5714. 'type' => 'value'
  5715. ),
  5716. 'filters' => array(),
  5717. 'stage' => 'published',
  5718. 'builtin' => '1'
  5719. );
  5720. $config->bi->builtin->charts[] = array
  5721. (
  5722. 'id' => 10102,
  5723. 'name' => '年度进行中项目-进行中的迭代数',
  5724. 'code' => 'annualDoingProject_countExecution',
  5725. 'dimension' => '2',
  5726. 'type' => 'card',
  5727. 'group' => '73',
  5728. 'sql' => <<<EOT
  5729. SELECT id,type FROM zt_project WHERE deleted = '0' AND status = 'doing' AND type IN ('sprint', 'stage', 'kanban') AND multiple = '1'
  5730. EOT
  5731. ,
  5732. 'settings' => array
  5733. (
  5734. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5735. 'title' => array('type' => 'text', 'name' => ''),
  5736. 'type' => 'value'
  5737. ),
  5738. 'filters' => array(),
  5739. 'stage' => 'published',
  5740. 'builtin' => '1'
  5741. );
  5742. $config->bi->builtin->charts[] = array
  5743. (
  5744. 'id' => 10103,
  5745. 'name' => '年度进行中项目-进展顺利项目数',
  5746. 'code' => 'annualDoingProject_countProject_good',
  5747. 'dimension' => '2',
  5748. 'type' => 'card',
  5749. 'group' => '72',
  5750. 'sql' => <<<EOT
  5751. SELECT t1.id, t1.name, IFNULL(prograss, 0) AS prograss, ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,LEFT(t1.`end`, 4) AS endYear
  5752. FROM zt_project AS t1
  5753. LEFT JOIN (
  5754. SELECT t22.project,
  5755. ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))), 0) * 100, 2) AS prograss
  5756. FROM zt_project AS t21
  5757. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  5758. WHERE t21.deleted = '0' AND t21.type IN ('sprint', 'kanban')
  5759. AND t22.deleted = '0' AND t22.parent < 1
  5760. GROUP BY t22.project
  5761. UNION
  5762. SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss
  5763. FROM (
  5764. SELECT t21.id,t21.percent, t22.project,
  5765. IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss
  5766. FROM zt_project AS t21
  5767. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  5768. WHERE t21.deleted = '0' AND t21.type = 'stage'
  5769. AND t22.deleted = '0' AND t22.parent < 1
  5770. AND t22.id IS NOT NULL
  5771. GROUP BY t21.id, t21.percent, t22.project
  5772. ) t
  5773. GROUP BY t.project
  5774. ) AS t2 ON t1.id = t2.project
  5775. WHERE t1.deleted = '0'
  5776. AND t1.status = 'doing'
  5777. AND t1.type = 'project'
  5778. AND ((IFNULL(prograss, 0) >= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != '2059' AND DATEDIFF(`end`, NOW()) >= 0) OR LEFT(t1.`end`, 4) = '2059' )
  5779. EOT
  5780. ,
  5781. 'settings' => array
  5782. (
  5783. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5784. 'title' => array('type' => 'text', 'name' => ''),
  5785. 'type' => 'value'
  5786. ),
  5787. 'filters' => array(),
  5788. 'stage' => 'published',
  5789. 'builtin' => '1'
  5790. );
  5791. $config->bi->builtin->charts[] = array
  5792. (
  5793. 'id' => 10104,
  5794. 'name' => '年度进行中项目-进展顺利迭代数',
  5795. 'code' => 'annualDoingProject_countExecution_good',
  5796. 'dimension' => '2',
  5797. 'type' => 'card',
  5798. 'group' => '73',
  5799. 'sql' => <<<EOT
  5800. SELECT id, prograss, planPrograss, `end`
  5801. FROM (
  5802. SELECT t1.id,ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,t1.`end`,
  5803. ROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0))), 0) * 100, 2) AS prograss
  5804. FROM zt_project AS t1
  5805. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution
  5806. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  5807. AND t2.deleted = '0' AND t2.parent < 1
  5808. GROUP BY t1.id
  5809. ) AS t
  5810. WHERE prograss >= planPrograss AND DATEDIFF(`end`, NOW()) >= 0
  5811. EOT
  5812. ,
  5813. 'settings' => array
  5814. (
  5815. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5816. 'title' => array('type' => 'text', 'name' => ''),
  5817. 'type' => 'value'
  5818. ),
  5819. 'filters' => array(),
  5820. 'stage' => 'published',
  5821. 'builtin' => '1'
  5822. );
  5823. $config->bi->builtin->charts[] = array
  5824. (
  5825. 'id' => 10105,
  5826. 'name' => '年度进行中项目-进度滞后项目数',
  5827. 'code' => 'annualDoingProject_countProject_bad',
  5828. 'dimension' => '2',
  5829. 'type' => 'card',
  5830. 'group' => '72',
  5831. 'sql' => <<<EOT
  5832. SELECT t1.id, t1.name, IFNULL(prograss, 0) AS prograss, ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss
  5833. , LEFT(t1.`end`, 4) AS endYear
  5834. FROM zt_project AS t1
  5835. LEFT JOIN (
  5836. SELECT t22.project,
  5837. ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))), 0) * 100, 2) AS prograss
  5838. FROM zt_project AS t21
  5839. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  5840. WHERE t21.deleted = '0' AND t21.type IN ('sprint', 'kanban')
  5841. AND t22.deleted = '0' AND t22.parent < 1
  5842. GROUP BY t22.project
  5843. UNION
  5844. SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss
  5845. FROM (
  5846. SELECT t21.id,t21.percent, t22.project,
  5847. IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss
  5848. FROM zt_project AS t21
  5849. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  5850. WHERE t21.deleted = '0' AND t21.type = 'stage'
  5851. AND t22.deleted = '0' AND t22.parent < 1
  5852. AND t22.id IS NOT NULL
  5853. GROUP BY t21.id, t21.percent, t22.project
  5854. ) t
  5855. GROUP BY t.project
  5856. ) AS t2 ON t1.id = t2.project
  5857. WHERE t1.deleted = '0'
  5858. AND t1.status = 'doing'
  5859. AND t1.type = 'project'
  5860. AND LEFT(t1.`end`, 4) != '2059'
  5861. AND IFNULL(prograss, 0) < (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND DATEDIFF(`end`, NOW()) >= 0
  5862. EOT
  5863. ,
  5864. 'settings' => array
  5865. (
  5866. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5867. 'title' => array('type' => 'text', 'name' => ''),
  5868. 'type' => 'value'
  5869. ),
  5870. 'filters' => array(),
  5871. 'stage' => 'published',
  5872. 'builtin' => '1'
  5873. );
  5874. $config->bi->builtin->charts[] = array
  5875. (
  5876. 'id' => 10106,
  5877. 'name' => '年度进行中项目-进度滞后迭代数',
  5878. 'code' => 'annualDoingProject_countExecution_bad',
  5879. 'dimension' => '2',
  5880. 'type' => 'card',
  5881. 'group' => '73',
  5882. 'sql' => <<<EOT
  5883. SELECT id, prograss, planPrograss
  5884. FROM (
  5885. SELECT t1.id,ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,
  5886. ROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0))), 0) * 100, 2) AS prograss
  5887. FROM zt_project AS t1
  5888. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution
  5889. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1' AND DATEDIFF(t1.`end`, NOW()) >= 0
  5890. AND t2.deleted = '0' AND t2.parent < 1
  5891. GROUP BY t1.id
  5892. ) AS t
  5893. WHERE prograss < planPrograss
  5894. EOT
  5895. ,
  5896. 'settings' => array
  5897. (
  5898. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5899. 'title' => array('type' => 'text', 'name' => ''),
  5900. 'type' => 'value'
  5901. ),
  5902. 'filters' => array(),
  5903. 'stage' => 'published',
  5904. 'builtin' => '1'
  5905. );
  5906. $config->bi->builtin->charts[] = array
  5907. (
  5908. 'id' => 10107,
  5909. 'name' => '年度进行中项目-已延期项目数',
  5910. 'code' => 'annualDoingProject_countPorject_delay',
  5911. 'dimension' => '2',
  5912. 'type' => 'card',
  5913. 'group' => '72',
  5914. 'sql' => <<<EOT
  5915. SELECT id, name FROM zt_project WHERE deleted = '0' AND status = 'doing' AND type = 'project' AND LEFT(`end`, 4) != '2059' AND DATEDIFF(`end`, NOW()) < 0
  5916. EOT
  5917. ,
  5918. 'settings' => array
  5919. (
  5920. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5921. 'title' => array('type' => 'text', 'name' => ''),
  5922. 'type' => 'value'
  5923. ),
  5924. 'filters' => array(),
  5925. 'stage' => 'published',
  5926. 'builtin' => '1'
  5927. );
  5928. $config->bi->builtin->charts[] = array
  5929. (
  5930. 'id' => 10108,
  5931. 'name' => '年度进行中项目-已延期迭代数',
  5932. 'code' => 'annualDoingProject_countExecution_delay',
  5933. 'dimension' => '2',
  5934. 'type' => 'card',
  5935. 'group' => '73',
  5936. 'sql' => <<<EOT
  5937. SELECT id, name FROM zt_project WHERE deleted = '0' AND status = 'doing' AND type IN ('sprint', 'stage', 'kanban') AND DATEDIFF(`end`, NOW()) < 0 AND multiple = '1'
  5938. EOT
  5939. ,
  5940. 'settings' => array
  5941. (
  5942. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5943. 'title' => array('type' => 'text', 'name' => ''),
  5944. 'type' => 'value'
  5945. ),
  5946. 'filters' => array(),
  5947. 'stage' => 'published',
  5948. 'builtin' => '1'
  5949. );
  5950. $config->bi->builtin->charts[] = array
  5951. (
  5952. 'id' => 10109,
  5953. 'name' => '年度进行中项目-未完成需求条目数',
  5954. 'code' => 'annualDoingProject_storyCount_undone',
  5955. 'dimension' => '2',
  5956. 'type' => 'card',
  5957. 'group' => '75',
  5958. 'sql' => <<<EOT
  5959. SELECT DISTINCT t3.id, t3.estimate
  5960. FROM zt_project AS t1
  5961. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project
  5962. LEFT JOIN zt_story AS t3 ON t2.story = t3.id
  5963. WHERE t1.deleted = '0' AND t1.status = 'doing' AND t1.type = 'project'
  5964. AND t3.deleted = '0' AND t3.stage NOT IN ('verified', 'released', 'closed')
  5965. EOT
  5966. ,
  5967. 'settings' => array
  5968. (
  5969. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5970. 'title' => array('type' => 'text', 'name' => ''),
  5971. 'type' => 'value'
  5972. ),
  5973. 'filters' => array(),
  5974. 'stage' => 'published',
  5975. 'builtin' => '1'
  5976. );
  5977. $config->bi->builtin->charts[] = array
  5978. (
  5979. 'id' => 10110,
  5980. 'name' => '年度进行中项目-未完成任务数',
  5981. 'code' => 'annualDoingProject_countTask_undone',
  5982. 'dimension' => '2',
  5983. 'type' => 'card',
  5984. 'group' => '76',
  5985. 'sql' => <<<EOT
  5986. SELECT DISTINCT t2.id
  5987. FROM zt_project AS t1
  5988. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution
  5989. WHERE t1.deleted = '0' AND t1.status = 'doing' AND t1.type IN ('sprint', 'stage', 'kanban')
  5990. AND t2.deleted = '0' AND t2.status IN ('wait', 'doing', 'pause') AND t2.id IS NOT NULL
  5991. EOT
  5992. ,
  5993. 'settings' => array
  5994. (
  5995. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  5996. 'title' => array('type' => 'text', 'name' => ''),
  5997. 'type' => 'value'
  5998. ),
  5999. 'filters' => array(),
  6000. 'stage' => 'published',
  6001. 'builtin' => '1'
  6002. );
  6003. $config->bi->builtin->charts[] = array
  6004. (
  6005. 'id' => 10111,
  6006. 'name' => '年度进行中项目-未完成需求规模数',
  6007. 'code' => 'annualDoingProject_storyEstimate_undone',
  6008. 'dimension' => '2',
  6009. 'type' => 'card',
  6010. 'group' => '75',
  6011. 'sql' => <<<EOT
  6012. SELECT DISTINCT t3.id, t3.estimate
  6013. FROM zt_project AS t1
  6014. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project
  6015. LEFT JOIN zt_story AS t3 ON t2.story = t3.id
  6016. WHERE t1.deleted = '0' AND t1.status = 'doing' AND t1.type = 'project'
  6017. AND t3.deleted = '0' AND t3.stage NOT IN ('verified', 'released', 'closed')
  6018. EOT
  6019. ,
  6020. 'settings' => array
  6021. (
  6022. 'value' => array('type' => 'agg', 'field' => 'estimate', 'agg' => 'sum'),
  6023. 'title' => array('type' => 'text', 'name' => ''),
  6024. 'type' => 'value'
  6025. ),
  6026. 'filters' => array(),
  6027. 'stage' => 'published',
  6028. 'builtin' => '1'
  6029. );
  6030. $config->bi->builtin->charts[] = array
  6031. (
  6032. 'id' => 10112,
  6033. 'name' => '年度进行中项目-剩余工时数',
  6034. 'code' => 'annualDoingProject_leftEffort',
  6035. 'dimension' => '2',
  6036. 'type' => 'card',
  6037. 'group' => '78',
  6038. 'sql' => <<<EOT
  6039. SELECT t1.id, t1.name, `taskleft`
  6040. FROM zt_project AS t1
  6041. LEFT JOIN (
  6042. SELECT t22.project,
  6043. ROUND(SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)), 2) AS `taskleft`
  6044. FROM zt_project AS t21
  6045. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  6046. WHERE t21.deleted = '0' AND t21.type IN ('sprint', 'stage', 'kanban')
  6047. AND t22.deleted = '0' AND t22.parent < 1
  6048. GROUP BY t22.project
  6049. ) AS t2 ON t1.id = t2.project
  6050. WHERE t1.deleted = '0'
  6051. AND t1.status = 'doing'
  6052. AND t1.type = 'project'
  6053. EOT
  6054. ,
  6055. 'settings' => array
  6056. (
  6057. 'value' => array('type' => 'agg', 'field' => 'taskleft', 'agg' => 'sum'),
  6058. 'title' => array('type' => 'text', 'name' => ''),
  6059. 'type' => 'value'
  6060. ),
  6061. 'filters' => array(),
  6062. 'stage' => 'published',
  6063. 'builtin' => '1'
  6064. );
  6065. $config->bi->builtin->charts[] = array
  6066. (
  6067. 'id' => 10113,
  6068. 'name' => '年度进行中项目-投入总人次',
  6069. 'code' => 'annualDoingProject_investedPeople',
  6070. 'dimension' => '2',
  6071. 'type' => 'card',
  6072. 'group' => '78',
  6073. 'sql' => <<<EOT
  6074. SELECT t1.id,t1.type,t1.account
  6075. FROM zt_team AS t1
  6076. LEFT JOIN zt_user AS t2 on t1.account = t2.account
  6077. WHERE t1.type = 'project' AND t2.deleted = '0'
  6078. EOT
  6079. ,
  6080. 'settings' => array
  6081. (
  6082. 'value' => array('type' => 'agg', 'field' => 'id', 'agg' => 'count'),
  6083. 'title' => array('type' => 'text', 'name' => ''),
  6084. 'type' => 'value'
  6085. ),
  6086. 'filters' => array(),
  6087. 'stage' => 'published',
  6088. 'builtin' => '1'
  6089. );
  6090. $config->bi->builtin->charts[] = array
  6091. (
  6092. 'id' => 10114,
  6093. 'name' => '年度进行中项目-项目进度分布图',
  6094. 'code' => 'annualDoingProject_projectProgressChart',
  6095. 'dimension' => '2',
  6096. 'type' => 'pie',
  6097. 'group' => '69',
  6098. 'sql' => <<<EOT
  6099. SELECT t1.id, t1.name,
  6100. IF(
  6101. DATEDIFF(t1.`end`, NOW()) < 0,
  6102. '延期',
  6103. (IF(
  6104. (IFNULL(prograss, 0) >= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != '2059')
  6105. OR LEFT(t1.`end`, 4) = '2059' ,
  6106. '顺利',
  6107. '滞后'
  6108. ))) AS `status`,
  6109. IFNULL(prograss, 0) AS prograss, ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,LEFT(t1.`end`, 4) AS endYear
  6110. FROM zt_project AS t1
  6111. LEFT JOIN (
  6112. SELECT t22.project,
  6113. ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))), 0) * 100, 2) AS prograss
  6114. FROM zt_project AS t21
  6115. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  6116. WHERE t21.deleted = '0' AND t21.type IN ('sprint', 'kanban')
  6117. AND t22.deleted = '0' AND t22.parent < 1
  6118. GROUP BY t22.project
  6119. UNION
  6120. SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss
  6121. FROM (
  6122. SELECT t21.id,t21.percent, t22.project,
  6123. IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss
  6124. FROM zt_project AS t21
  6125. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  6126. WHERE t21.deleted = '0' AND t21.type = 'stage'
  6127. AND t22.deleted = '0' AND t22.parent < 1
  6128. AND t22.id IS NOT NULL
  6129. GROUP BY t21.id, t21.percent, t22.project
  6130. ) t
  6131. GROUP BY t.project
  6132. ) AS t2 ON t1.id = t2.project
  6133. WHERE t1.deleted = '0'
  6134. AND t1.status = 'doing'
  6135. AND t1.type = 'project'
  6136. EOT
  6137. ,
  6138. 'settings' => array
  6139. (
  6140. array
  6141. (
  6142. 'type' => 'pie',
  6143. 'group' => array
  6144. (
  6145. array('field' => 'status', 'name' => '状态', 'group' => '')
  6146. ),
  6147. 'metric' => array
  6148. (
  6149. array('field' => 'id', 'name' => 'id', 'valOrAgg' => 'count')
  6150. )
  6151. )
  6152. ),
  6153. 'filters' => array(),
  6154. 'fields' => array
  6155. (
  6156. 'id' => array('name' => 'id', 'object' => 'zt_project', 'field' => 'id', 'type' => 'number'),
  6157. 'name' => array('name' => 'name', 'object' => 'zt_project', 'field' => 'name', 'type' => 'string'),
  6158. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option'),
  6159. 'prograss' => array('name' => 'prograss', 'object' => 'task', 'field' => 'prograss', 'type' => 'number'),
  6160. 'planPrograss' => array('name' => 'planPrograss', 'object' => 'task', 'field' => 'planPrograss', 'type' => 'number'),
  6161. 'endYear' => array('name' => 'endYear', 'object' => 'task', 'field' => 'endYear', 'type' => 'string')
  6162. ),
  6163. 'langs' => array
  6164. (
  6165. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  6166. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  6167. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => ''),
  6168. 'prograss' => array('zh-cn' => '项目进度', 'zh-tw' => '', 'en' => 'prograss', 'de' => '', 'fr' => ''),
  6169. 'planPrograss' => array('zh-cn' => '计划进度', 'zh-tw' => '', 'en' => 'planPrograss', 'de' => '', 'fr' => ''),
  6170. 'endYear' => array('zh-cn' => '结束年份', 'zh-tw' => '', 'en' => 'endYear', 'de' => '', 'fr' => '')
  6171. ),
  6172. 'stage' => 'published',
  6173. 'builtin' => '0'
  6174. );
  6175. $config->bi->builtin->charts[] = array
  6176. (
  6177. 'id' => 10115,
  6178. 'name' => '年度进行中项目-迭代进度分布图',
  6179. 'code' => 'annualDoingProject_executionProgressChart',
  6180. 'dimension' => '2',
  6181. 'type' => 'pie',
  6182. 'group' => '69',
  6183. 'sql' => <<<EOT
  6184. SELECT id, name,IF(
  6185. DATEDIFF(`end`, NOW()) < 0,
  6186. '延期',
  6187. (IF(
  6188. prograss >= planPrograss,
  6189. '顺利',
  6190. '滞后'
  6191. ))
  6192. ) AS status,
  6193. prograss, planPrograss, `end`
  6194. FROM (
  6195. SELECT t1.id,t1.name,ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,t1.`end`,
  6196. ROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0))), 0) * 100, 2) AS prograss
  6197. FROM zt_project AS t1
  6198. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution
  6199. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  6200. AND ((t2.deleted = '0' AND t2.parent < 1) OR t2.id IS NULL)
  6201. GROUP BY t1.id
  6202. ) AS t
  6203. EOT
  6204. ,
  6205. 'settings' => array
  6206. (
  6207. array
  6208. (
  6209. 'type' => 'pie',
  6210. 'group' => array
  6211. (
  6212. array('field' => 'status', 'name' => '状态', 'group' => '')
  6213. ),
  6214. 'metric' => array
  6215. (
  6216. array('field' => 'id', 'name' => '项目ID', 'valOrAgg' => 'count')
  6217. )
  6218. )
  6219. ),
  6220. 'filters' => array(),
  6221. 'fields' => array
  6222. (
  6223. 'id' => array('name' => '项目ID', 'object' => 'project', 'field' => 'id', 'type' => 'number'),
  6224. 'name' => array('name' => '项目名称', 'object' => 'project', 'field' => 'name', 'type' => 'string'),
  6225. 'status' => array('name' => '状态', 'object' => 'project', 'field' => 'status', 'type' => 'option'),
  6226. 'prograss' => array('name' => 'prograss', 'object' => 'task', 'field' => 'prograss', 'type' => 'number'),
  6227. 'planPrograss' => array('name' => 'planPrograss', 'object' => 'task', 'field' => 'planPrograss', 'type' => 'number'),
  6228. 'end' => array('name' => '计划完成', 'object' => 'project', 'field' => 'end', 'type' => 'date')
  6229. ),
  6230. 'langs' => array
  6231. (
  6232. 'id' => array('zh-cn' => '项目ID', 'zh-tw' => '', 'en' => 'id', 'de' => '', 'fr' => ''),
  6233. 'name' => array('zh-cn' => '项目名称', 'zh-tw' => '', 'en' => 'name', 'de' => '', 'fr' => ''),
  6234. 'status' => array('zh-cn' => '状态', 'zh-tw' => '', 'en' => 'status', 'de' => '', 'fr' => ''),
  6235. 'prograss' => array('zh-cn' => '项目进度', 'zh-tw' => '', 'en' => 'prograss', 'de' => '', 'fr' => ''),
  6236. 'planPrograss' => array('zh-cn' => '计划进度', 'zh-tw' => '', 'en' => 'planPrograss', 'de' => '', 'fr' => ''),
  6237. 'end' => array('zh-cn' => '计划完成', 'zh-tw' => '', 'en' => 'end', 'de' => '', 'fr' => '')
  6238. ),
  6239. 'stage' => 'published',
  6240. 'builtin' => '0'
  6241. );
  6242. $config->bi->builtin->charts[] = array
  6243. (
  6244. 'id' => 10116,
  6245. 'name' => '年度进行中项目-项目进度透视表',
  6246. 'code' => 'annualDoingProject_projectProgressPivot',
  6247. 'dimension' => '2',
  6248. 'type' => 'table',
  6249. 'group' => '84',
  6250. 'sql' => <<<EOT
  6251. SELECT t1.id, t1.name, IFNULL(t3.name, '/') AS program,t1.`begin`, IF(YEAR(t1.`end`) = '2059', '长期', CAST(t1.`end` AS CHAR)) AS `end`,
  6252. IF(YEAR(t1.`end`) = '2059', '长期', CAST((DATEDIFF(t1.`end`, t1.`begin`) + 1) AS CHAR)) AS planDuration,
  6253. IF(LEFT(t1.realBegan, 4) = '0000', '/', CAST(t1.realBegan AS CHAR)) AS realBegan,
  6254. IF(
  6255. YEAR(t1.`end`) = '2059',
  6256. '长期',
  6257. IF(
  6258. DATEDIFF(t1.`end`, NOW()) >= 0,
  6259. CAST((DATEDIFF(t1.`end`, NOW()) + 1) AS CHAR),
  6260. '0'
  6261. )
  6262. ) AS realDuration,
  6263. IF(
  6264. DATEDIFF(t1.`end`, NOW()) < 0,
  6265. '延期',
  6266. (IF(
  6267. (IFNULL(prograss, 0) >= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != '2059')
  6268. OR LEFT(t1.`end`, 4) = '2059' ,
  6269. '顺利',
  6270. '滞后'
  6271. ))) AS `status`,
  6272. CONCAT(IFNULL(prograss, 0), '%') AS prograss
  6273. FROM zt_project AS t1
  6274. LEFT JOIN (
  6275. SELECT t22.project,
  6276. ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != 'closed' AND t22.status != 'cancel', t22.`left`, 0))), 0) * 100, 2) AS prograss
  6277. FROM zt_project AS t21
  6278. LEFT JOIN zt_task AS t22 ON t21.id = t22.execution
  6279. WHERE t21.deleted = '0' AND t21.type IN ('sprint', 'kanban', 'stage')
  6280. AND t22.deleted = '0' AND t22.parent < 1
  6281. GROUP BY t22.project
  6282. ) AS t2 ON t1.id = t2.project
  6283. LEFT JOIN zt_project AS t3 ON SUBSTR(t1.path, 2, POSITION(',' IN SUBSTR(t1.path, 2)) -1) = CAST(t3.id AS CHAR) AND t3.type = 'program' AND t3.deleted = '0'
  6284. WHERE t1.deleted = '0'
  6285. AND t1.status = 'doing'
  6286. AND t1.type = 'project'
  6287. AND FIND_IN_SET('rnd', t1.vision)
  6288. EOT
  6289. ,
  6290. 'settings' => array
  6291. (
  6292. 'group' => array(),
  6293. 'column' => array
  6294. (
  6295. array('field' => 'program', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  6296. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '项目'),
  6297. array('field' => 'begin', 'valOrAgg' => 'value', 'name' => '计划开始日期'),
  6298. array('field' => 'end', 'valOrAgg' => 'value', 'name' => '计划完成日期'),
  6299. array('field' => 'planDuration', 'valOrAgg' => 'value', 'name' => '计划工期'),
  6300. array('field' => 'realBegan', 'valOrAgg' => 'value', 'name' => '实际开始日期'),
  6301. array('field' => 'realDuration', 'valOrAgg' => 'value', 'name' => '剩余工期天数'),
  6302. array('field' => 'prograss', 'valOrAgg' => 'value', 'name' => '工期进度'),
  6303. array('field' => 'status', 'valOrAgg' => 'value', 'name' => '进度状态')
  6304. ),
  6305. 'filter' => array()
  6306. ),
  6307. 'filters' => array(),
  6308. 'stage' => 'published',
  6309. 'builtin' => '1'
  6310. );
  6311. $config->bi->builtin->charts[] = array
  6312. (
  6313. 'id' => 10117,
  6314. 'name' => '年度进行中项目-迭代进度透视表',
  6315. 'code' => 'annualDoingProject_executionProgressPivot',
  6316. 'dimension' => '2',
  6317. 'type' => 'table',
  6318. 'group' => '84',
  6319. 'sql' => <<<EOT
  6320. SELECT id, name,project,`begin`, `end`, planDuration, IF(LEFT(realBegan, 4) = '0000', '/', realBegan) as realBegan, realDuration, CONCAT(prograss, '%') as prograss,
  6321. IF(
  6322. DATEDIFF(`end`, NOW()) < 0,
  6323. '延期',
  6324. (IF(
  6325. prograss >= planPrograss,
  6326. '顺利',
  6327. '滞后'
  6328. ))
  6329. ) AS status
  6330. FROM (
  6331. SELECT t1.id,t1.name,t1.`begin`,t1.`end`,t1.`realBegan`,IFNULL(t3.name, '/') AS project,t3.id AS projectID,
  6332. DATEDIFF(t1.`end`, t1.`begin`) + 1 AS planDuration, IF(DATEDIFF(t1.`end`, NOW()) >= 0, DATEDIFF(t1.`end`, NOW()) + 1, 0) AS realDuration,
  6333. ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,
  6334. ROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != 'closed' AND t2.status != 'cancel', t2.`left`, 0))), 0) * 100, 2) AS prograss
  6335. FROM zt_project AS t1
  6336. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution
  6337. LEFT JOIN zt_project AS t3 on t1.project = t3.id AND t3.type = 'project' AND t3.deleted = '0'
  6338. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  6339. AND t2.deleted = '0' AND t2.parent < 1
  6340. GROUP BY t1.id
  6341. ) AS t
  6342. ORDER BY projectID ASC, id ASC LIMIT 999999
  6343. EOT
  6344. ,
  6345. 'settings' => array
  6346. (
  6347. 'group' => array(),
  6348. 'column' => array
  6349. (
  6350. array('field' => 'project', 'valOrAgg' => 'value', 'name' => '项目'),
  6351. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '迭代'),
  6352. array('field' => 'begin', 'valOrAgg' => 'value', 'name' => '计划开始日期'),
  6353. array('field' => 'end', 'valOrAgg' => 'value', 'name' => '计划完成日期'),
  6354. array('field' => 'planDuration', 'valOrAgg' => 'value', 'name' => '计划工期'),
  6355. array('field' => 'realBegan', 'valOrAgg' => 'value', 'name' => '实际开始日期'),
  6356. array('field' => 'realDuration', 'valOrAgg' => 'value', 'name' => '剩余工期天数'),
  6357. array('field' => 'prograss', 'valOrAgg' => 'value', 'name' => '工期进度'),
  6358. array('field' => 'status', 'valOrAgg' => 'value', 'name' => '进度状态')
  6359. ),
  6360. 'filter' => array()
  6361. ),
  6362. 'filters' => array(),
  6363. 'stage' => 'published',
  6364. 'builtin' => '1'
  6365. );
  6366. $config->bi->builtin->charts[] = array
  6367. (
  6368. 'id' => 10118,
  6369. 'name' => '年度进行中项目-项目剩余工作量透视表',
  6370. 'code' => 'annualDoingProject_porjectLeftPivot',
  6371. 'dimension' => '2',
  6372. 'type' => 'table',
  6373. 'group' => '83',
  6374. 'sql' => <<<EOT
  6375. SELECT t1.id, t1.NAME AS project, IFNULL( t2.NAME, '/') AS program, IFNULL( t3.story, 0 ) AS story, IFNULL( t3.estimate, 0 ) AS estimate, IFNULL( t4.execution, 0 ) AS execution, IFNULL( t5.workhour, 0 ) AS workhour FROM zt_project AS t1 LEFT JOIN zt_project AS t2 ON FIND_IN_SET( t2.id, t1.path ) AND t2.deleted = '0' AND t2.type = 'program' AND t2.grade = 1 LEFT JOIN( SELECT t1.parent AS project, COUNT( 1 ) AS story, ROUND( SUM( t1.estimate ), 1 ) AS estimate FROM ( SELECT DISTINCT t1.parent, t3.id, t3.estimate FROM zt_project AS t1 LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project LEFT JOIN zt_story AS t3 ON t2.story = t3.id AND t3.deleted = '0' AND t3.stage NOT IN ( 'verified', 'released', 'closed' ) WHERE t1.deleted = '0' AND t1.type IN ( 'sprint', 'stage', 'kanban' ) AND t3.id IS NOT NULL ) AS t1 GROUP BY project ) AS t3 ON t1.id = t3.project LEFT JOIN ( SELECT parent AS project, COUNT( 1 ) AS execution FROM zt_project WHERE deleted = '0' AND type IN ( 'sprint', 'stage', 'kanban' ) AND multiple = '1' AND STATUS NOT IN ( 'done', 'closed' ) GROUP BY parent ) AS t4 ON t1.id = t4.project LEFT JOIN ( SELECT t1.parent AS project, ROUND( SUM( t2.LEFT ), 1 ) AS workhour FROM zt_project AS t1 LEFT JOIN zt_task AS t2 ON t1.id = t2.execution AND t2.deleted = '0' AND t2.parent < 1 WHERE t1.deleted = '0' AND t1.type IN ( 'sprint', 'stage', 'kanban' ) AND t1.STATUS NOT IN ( 'done', 'closed' ) AND t2.id IS NOT NULL GROUP BY t1.parent ) AS t5 ON t1.id = t5.project WHERE t1.deleted = '0' AND t1.type = 'project' AND t1.STATUS = 'doing'
  6376. EOT
  6377. ,
  6378. 'settings' => array
  6379. (
  6380. 'group' => array(),
  6381. 'column' => array
  6382. (
  6383. array('field' => 'program', 'valOrAgg' => 'value', 'name' => '一级项目集'),
  6384. array('field' => 'project', 'valOrAgg' => 'value', 'name' => '项目'),
  6385. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '剩余需求数'),
  6386. array('field' => 'estimate', 'valOrAgg' => 'value', 'name' => '剩余需求规模数'),
  6387. array('field' => 'execution', 'valOrAgg' => 'value', 'name' => '剩余执行数'),
  6388. array('field' => 'workhour', 'valOrAgg' => 'value', 'name' => '剩余工时')
  6389. ),
  6390. 'filter' => array()
  6391. ),
  6392. 'filters' => array(),
  6393. 'stage' => 'published',
  6394. 'builtin' => '1'
  6395. );
  6396. $config->bi->builtin->charts[] = array
  6397. (
  6398. 'id' => 10119,
  6399. 'name' => '年度进行中项目-迭代剩余工作量透视表',
  6400. 'code' => 'annualDoingProject_executionLeftPivot',
  6401. 'dimension' => '2',
  6402. 'type' => 'table',
  6403. 'group' => '83',
  6404. 'sql' => <<<EOT
  6405. SELECT
  6406. t1.id,
  6407. t1.name AS execution,
  6408. IFNULL(t2.name, '/') AS project,
  6409. IFNULL(t3.story, 0) AS story,
  6410. IFNULL(t3.estimate, 0) AS estimate,
  6411. IFNULL(t4.task, 0) AS task,
  6412. IFNULL(t4.workhour, 0) AS workhour
  6413. FROM zt_project AS t1
  6414. LEFT JOIN zt_project AS t2 ON t1.project = t2.id AND t2.type = 'project'
  6415. LEFT JOIN (
  6416. SELECT t1.id AS execution, COUNT(t3.id) AS story, ROUND(SUM(t3.estimate), 1) AS estimate
  6417. FROM zt_project AS t1
  6418. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project
  6419. LEFT JOIN zt_story AS t3 ON t2.story = t3.id AND t3.deleted = '0' AND t3.stage NOT IN ('verified', 'released', 'closed')
  6420. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  6421. GROUP BY execution
  6422. ) AS t3 ON t1.id = t3.execution
  6423. LEFT JOIN (
  6424. SELECT t1.id AS execution, SUM(IF(t2.status IN ('wait', 'doing'), 1, 0)) AS task, ROUND(SUM(IF(t2.status IN ('wait', 'doing', 'pause'), t2.left, 0)), 1) AS workhour
  6425. FROM zt_project AS t1
  6426. LEFT JOIN zt_task AS t2 ON t1.id = t2.execution AND t2.deleted = '0' AND t2.parent < 1
  6427. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  6428. GROUP BY execution
  6429. ) AS t4 ON t1.id = t4.execution
  6430. WHERE t1.deleted = '0' AND t1.type IN ('sprint', 'stage', 'kanban') AND t1.status = 'doing' AND t1.multiple = '1'
  6431. ORDER BY t2.id ASC, t1.id ASC LIMIT 999999
  6432. EOT
  6433. ,
  6434. 'settings' => array
  6435. (
  6436. 'group' => array(),
  6437. 'column' => array
  6438. (
  6439. array('field' => 'project', 'valOrAgg' => 'value', 'name' => '项目'),
  6440. array('field' => 'execution', 'valOrAgg' => 'value', 'name' => '迭代'),
  6441. array('field' => 'story', 'valOrAgg' => 'value', 'name' => '剩余需求数'),
  6442. array('field' => 'estimate', 'valOrAgg' => 'value', 'name' => '剩余需求规模数'),
  6443. array('field' => 'task', 'valOrAgg' => 'value', 'name' => '剩余任务数'),
  6444. array('field' => 'workhour', 'valOrAgg' => 'value', 'name' => '剩余工时')
  6445. ),
  6446. 'filter' => array()
  6447. ),
  6448. 'filters' => array(),
  6449. 'stage' => 'published',
  6450. 'builtin' => '1'
  6451. );
  6452. $config->bi->builtin->charts[] = array
  6453. (
  6454. 'id' => 10201,
  6455. 'name' => '质量数据-研发完成需求数',
  6456. 'code' => 'quality_storyCount_finished',
  6457. 'dimension' => '3',
  6458. 'type' => 'card',
  6459. 'group' => '93',
  6460. 'sql' => <<<EOT
  6461. SELECT COUNT(id) AS number FROM zt_story WHERE deleted='0' AND (stage IN ('developed','testing','verified','released') OR (status='closed' AND closedReason='done'))
  6462. EOT
  6463. ,
  6464. 'settings' => array
  6465. (
  6466. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6467. 'title' => array('type' => 'text', 'name' => ''),
  6468. 'type' => 'value'
  6469. ),
  6470. 'filters' => array(),
  6471. 'stage' => 'published',
  6472. 'builtin' => '1'
  6473. );
  6474. $config->bi->builtin->charts[] = array
  6475. (
  6476. 'id' => 10202,
  6477. 'name' => '质量数据-研发完成需求规模数',
  6478. 'code' => 'quality_storyEstimate_finished',
  6479. 'dimension' => '3',
  6480. 'type' => 'card',
  6481. 'group' => '93',
  6482. 'sql' => <<<EOT
  6483. SELECT ROUND(SUM(estimate),2) AS number FROM zt_story WHERE deleted='0' AND (stage IN ('developed','testing','verified','released') OR (status='closed' AND closedReason='done'))
  6484. EOT
  6485. ,
  6486. 'settings' => array
  6487. (
  6488. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6489. 'title' => array('type' => 'text', 'name' => ''),
  6490. 'type' => 'value'
  6491. ),
  6492. 'filters' => array(),
  6493. 'stage' => 'published',
  6494. 'builtin' => '1'
  6495. );
  6496. $config->bi->builtin->charts[] = array
  6497. (
  6498. 'id' => 10203,
  6499. 'name' => '质量数据-研发完成需求用例数',
  6500. 'code' => 'quality_storyCaseCount_finished',
  6501. 'dimension' => '3',
  6502. 'type' => 'card',
  6503. 'group' => '95',
  6504. 'sql' => <<<EOT
  6505. SELECT SUM(t2.cases) AS number FROM (SELECT t1.story story, COUNT(t1.id) cases FROM (SELECT story,id FROM zt_case WHERE deleted='0') t1 GROUP BY t1.story) t2 LEFT JOIN (SELECT id,stage,status,closedReason,deleted FROM zt_story) t3 ON t2.story=t3.id WHERE t3.deleted='0' AND (t3.stage IN ('developed','testing','verified','released') OR (t3.status='closed' AND t3.closedReason='done'))
  6506. EOT
  6507. ,
  6508. 'settings' => array
  6509. (
  6510. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6511. 'title' => array('type' => 'text', 'name' => ''),
  6512. 'type' => 'value'
  6513. ),
  6514. 'filters' => array(),
  6515. 'stage' => 'published',
  6516. 'builtin' => '1'
  6517. );
  6518. $config->bi->builtin->charts[] = array
  6519. (
  6520. 'id' => 10204,
  6521. 'name' => '质量数据-Bug总数',
  6522. 'code' => 'quality_bugCount',
  6523. 'dimension' => '3',
  6524. 'type' => 'card',
  6525. 'group' => '94',
  6526. 'sql' => <<<EOT
  6527. SELECT COUNT(id) AS number FROM zt_bug WHERE deleted='0'
  6528. EOT
  6529. ,
  6530. 'settings' => array
  6531. (
  6532. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6533. 'title' => array('type' => 'text', 'name' => ''),
  6534. 'type' => 'value'
  6535. ),
  6536. 'filters' => array(),
  6537. 'stage' => 'published',
  6538. 'builtin' => '1'
  6539. );
  6540. $config->bi->builtin->charts[] = array
  6541. (
  6542. 'id' => 10205,
  6543. 'name' => '质量数据-有效Bug数',
  6544. 'code' => 'quality_bugCount_valid',
  6545. 'dimension' => '3',
  6546. 'type' => 'card',
  6547. 'group' => '94',
  6548. 'sql' => <<<EOT
  6549. SELECT SUM(CASE WHEN resolution IN ('fixed','postponed') OR status='active' THEN 1 ELSE 0 END) AS number FROM zt_bug WHERE deleted='0'
  6550. EOT
  6551. ,
  6552. 'settings' => array
  6553. (
  6554. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6555. 'title' => array('type' => 'text', 'name' => ''),
  6556. 'type' => 'value'
  6557. ),
  6558. 'filters' => array(),
  6559. 'stage' => 'published',
  6560. 'builtin' => '1'
  6561. );
  6562. $config->bi->builtin->charts[] = array
  6563. (
  6564. 'id' => 10206,
  6565. 'name' => '质量数据-修复Bug数',
  6566. 'code' => 'quality_bugCount_fixed',
  6567. 'dimension' => '3',
  6568. 'type' => 'card',
  6569. 'group' => '94',
  6570. 'sql' => <<<EOT
  6571. SELECT SUM(CASE WHEN resolution='fixed' AND status='closed' THEN 1 ELSE 0 END) AS number FROM zt_bug WHERE deleted='0'
  6572. EOT
  6573. ,
  6574. 'settings' => array
  6575. (
  6576. 'value' => array('type' => 'agg', 'field' => 'number', 'agg' => 'sum'),
  6577. 'title' => array('type' => 'text', 'name' => ''),
  6578. 'type' => 'value'
  6579. ),
  6580. 'filters' => array(),
  6581. 'stage' => 'published',
  6582. 'builtin' => '1'
  6583. );
  6584. $config->bi->builtin->charts[] = array
  6585. (
  6586. 'id' => 10207,
  6587. 'name' => '质量数据-研发完成需求用例覆盖率',
  6588. 'code' => 'quality_storyCaseCoverage_finished',
  6589. 'dimension' => '3',
  6590. 'type' => 'waterpolo',
  6591. 'group' => '92',
  6592. 'sql' => <<<EOT
  6593. SELECT ROUND(SUM(t3.havecasefixstory)/COUNT(t3.fixstory),4) AS fixpercent, 'havecase' as havecase FROM (SELECT t2.storyid `fixstory`, (CASE WHEN t2.cases=0 THEN 0 ELSE 1 END) havecasefixstory FROM (SELECT t1.storyid, SUM(t1.iscase) cases FROM (SELECT zt_story.id storyid, (CASE WHEN zt_case.id is null THEN 0 ELSE 1 END) iscase FROM zt_story LEFT JOIN zt_case ON zt_story.id=zt_case.story WHERE zt_story.deleted='0' AND (zt_story.stage IN ('developed','testing','verified','released') OR (zt_story.status='closed' AND zt_story.closedReason='done'))) t1 GROUP BY t1.storyid ORDER BY cases DESC LIMIT 999999) t2) t3
  6594. union
  6595. SELECT ROUND(1-SUM(t3.havecasefixstory)/COUNT(t3.fixstory),4) AS fixpercent, 'nocase' as havecase FROM (SELECT t2.storyid `fixstory`, (CASE WHEN t2.cases=0 THEN 0 ELSE 1 END) havecasefixstory FROM (SELECT t1.storyid, SUM(t1.iscase) cases FROM (SELECT zt_story.id storyid, (CASE WHEN zt_case.id is null THEN 0 ELSE 1 END) iscase FROM zt_story LEFT JOIN zt_case ON zt_story.id=zt_case.story WHERE zt_story.deleted='0' AND (zt_story.stage IN ('developed','testing','verified','released') OR (zt_story.status='closed' AND zt_story.closedReason='done'))) t1 GROUP BY t1.storyid ORDER BY cases DESC LIMIT 999999) t2) t3
  6596. EOT
  6597. ,
  6598. 'settings' => array
  6599. (
  6600. array
  6601. (
  6602. 'type' => 'waterpolo',
  6603. 'calc' => 'sum',
  6604. 'goal' => 'fixpercent',
  6605. 'conditions' => array
  6606. (
  6607. array('field' => 'havecase', 'condition' => 'eq', 'value' => 'havecase')
  6608. )
  6609. )
  6610. ),
  6611. 'filters' => array(),
  6612. 'fields' => array
  6613. (
  6614. 'fixpercent' => array('name' => 'fixpercent', 'object' => 'testcase', 'field' => 'fixpercent', 'type' => 'number'),
  6615. 'havecase' => array('name' => 'havecase', 'object' => 'testcase', 'field' => 'havecase', 'type' => 'string')
  6616. ),
  6617. 'langs' => array
  6618. (
  6619. 'fixpercent' => array('zh-cn' => '用例覆盖率', 'zh-tw' => '', 'en' => 'fixpercent', 'de' => '', 'fr' => ''),
  6620. 'havecase' => array('zh-cn' => '是否有用例', 'zh-tw' => '', 'en' => 'havecase', 'de' => '', 'fr' => '')
  6621. ),
  6622. 'stage' => 'published',
  6623. 'builtin' => '0'
  6624. );
  6625. $config->bi->builtin->charts[] = array
  6626. (
  6627. 'id' => 10208,
  6628. 'name' => '质量数据-研发完成需求用例密度',
  6629. 'code' => 'quality_storyCaseDensity_finished',
  6630. 'dimension' => '3',
  6631. 'type' => 'waterpolo',
  6632. 'group' => '92',
  6633. 'sql' => <<<EOT
  6634. SELECT ROUND(SUM(t2.cases)/SUM(t2.estimate),4) AS casedensity, 'havecase' as havecase FROM (SELECT t1.storyid, t1.estimate, SUM(t1.iscase) cases FROM (SELECT zt_story.id storyid, zt_story.estimate, (CASE WHEN zt_case.id is null THEN 0 ELSE 1 END) iscase FROM zt_story LEFT JOIN zt_case ON zt_story.id=zt_case.story WHERE zt_story.deleted='0' AND (zt_story.stage IN ('developed','testing','verified','released') OR (zt_story.status='closed' AND zt_story.closedReason='done'))) t1 GROUP BY t1.storyid, t1.estimate ORDER BY cases DESC LIMIT 999999) t2
  6635. union
  6636. SELECT ROUND(1-SUM(t2.cases)/SUM(t2.estimate),4) AS casedensity, 'nocase' as havecase FROM (SELECT t1.storyid, t1.estimate, SUM(t1.iscase) cases FROM (SELECT zt_story.id storyid, zt_story.estimate, (CASE WHEN zt_case.id is null THEN 0 ELSE 1 END) iscase FROM zt_story LEFT JOIN zt_case ON zt_story.id=zt_case.story WHERE zt_story.deleted='0' AND (zt_story.stage IN ('developed','testing','verified','released') OR (zt_story.status='closed' AND zt_story.closedReason='done'))) t1 GROUP BY t1.storyid, t1.estimate ORDER BY cases DESC LIMIT 999999) t2
  6637. EOT
  6638. ,
  6639. 'settings' => array
  6640. (
  6641. array
  6642. (
  6643. 'type' => 'waterpolo',
  6644. 'calc' => 'sum',
  6645. 'goal' => 'casedensity',
  6646. 'conditions' => array
  6647. (
  6648. array('field' => 'havecase', 'condition' => 'eq', 'value' => 'havecase')
  6649. )
  6650. )
  6651. ),
  6652. 'filters' => array(),
  6653. 'fields' => array
  6654. (
  6655. 'casedensity' => array('name' => 'casedensity', 'object' => 'testcase', 'field' => 'casedensity', 'type' => 'number'),
  6656. 'havecase' => array('name' => 'havecase', 'object' => 'testcase', 'field' => 'havecase', 'type' => 'string')
  6657. ),
  6658. 'langs' => array
  6659. (
  6660. 'casedensity' => array('zh-cn' => '用例密度', 'zh-tw' => '', 'en' => 'casedensity', 'de' => '', 'fr' => ''),
  6661. 'havecase' => array('zh-cn' => '是否有用例', 'zh-tw' => '', 'en' => 'havecase', 'de' => '', 'fr' => '')
  6662. ),
  6663. 'stage' => 'published',
  6664. 'builtin' => '0'
  6665. );
  6666. $config->bi->builtin->charts[] = array
  6667. (
  6668. 'id' => 10209,
  6669. 'name' => '质量数据-Bug密度',
  6670. 'code' => 'quality_bugDensity',
  6671. 'dimension' => '3',
  6672. 'type' => 'waterpolo',
  6673. 'group' => '91',
  6674. 'sql' => <<<EOT
  6675. SELECT ROUND(SUM(t3.bug)/SUM(t3.estimate), 4) AS bugdensity, 'havebug' as havebug FROM (SELECT t1.product product, IFNULL(t1.estimate,0) estimate, IFNULL(t2.bug,0) bug FROM (SELECT product, ROUND(SUM(estimate),2) estimate FROM zt_story WHERE deleted='0' AND (stage IN ('developed','testing','verified','released') OR (status='closed' AND closedReason='done')) GROUP BY product) t1 LEFT JOIN (SELECT product, COUNT(id) bug FROM zt_bug WHERE deleted='0' GROUP BY product) t2 ON t1.product=t2.product) t3
  6676. union
  6677. SELECT ROUND(1-SUM(t3.bug)/SUM(t3.estimate), 4) AS bugdensity, 'nobug' as havebug FROM (SELECT t1.product product, IFNULL(t1.estimate,0) estimate, IFNULL(t2.bug,0) bug FROM (SELECT product, ROUND(SUM(estimate),2) estimate FROM zt_story WHERE deleted='0' AND (stage IN ('developed','testing','verified','released') OR (status='closed' AND closedReason='done')) GROUP BY product) t1 LEFT JOIN (SELECT product, COUNT(id) bug FROM zt_bug WHERE deleted='0' GROUP BY product) t2 ON t1.product=t2.product) t3
  6678. EOT
  6679. ,
  6680. 'settings' => array
  6681. (
  6682. array
  6683. (
  6684. 'type' => 'waterpolo',
  6685. 'calc' => 'sum',
  6686. 'goal' => 'bugdensity',
  6687. 'conditions' => array
  6688. (
  6689. array('field' => 'havebug', 'condition' => 'eq', 'value' => 'havebug')
  6690. )
  6691. )
  6692. ),
  6693. 'filters' => array(),
  6694. 'fields' => array
  6695. (
  6696. 'bugdensity' => array('name' => 'bugdensity', 'object' => 'bug', 'field' => 'bugdensity', 'type' => 'number'),
  6697. 'havebug' => array('name' => 'havebug', 'object' => 'bug', 'field' => 'havebug', 'type' => 'string')
  6698. ),
  6699. 'langs' => array
  6700. (
  6701. 'bugdensity' => array('zh-cn' => 'Bug密度', 'zh-tw' => '', 'en' => 'bugdensity', 'de' => '', 'fr' => ''),
  6702. 'havebug' => array('zh-cn' => '是否有Bug', 'zh-tw' => '', 'en' => 'havebug', 'de' => '', 'fr' => '')
  6703. ),
  6704. 'stage' => 'published',
  6705. 'builtin' => '0'
  6706. );
  6707. $config->bi->builtin->charts[] = array
  6708. (
  6709. 'id' => 10210,
  6710. 'name' => '质量数据-Bug修复率',
  6711. 'code' => 'quality_bugFixedRatio',
  6712. 'dimension' => '3',
  6713. 'type' => 'waterpolo',
  6714. 'group' => '91',
  6715. 'sql' => <<<EOT
  6716. SELECT ROUND(SUM(CASE WHEN resolution='fixed' AND status = 'closed' THEN 1 ELSE 0 END)/COUNT(id),4) AS fixpercent, 'havebug' as havebug FROM zt_bug WHERE deleted = '0'
  6717. union
  6718. SELECT ROUND(1-SUM(CASE WHEN resolution='fixed' AND status = 'closed' THEN 1 ELSE 0 END)/COUNT(id),4) AS fixpercent, 'nobug' as havebug FROM zt_bug WHERE deleted = '0'
  6719. EOT
  6720. ,
  6721. 'settings' => array
  6722. (
  6723. array
  6724. (
  6725. 'type' => 'waterpolo',
  6726. 'calc' => 'sum',
  6727. 'goal' => 'fixpercent',
  6728. 'conditions' => array
  6729. (
  6730. array('field' => 'havebug', 'condition' => 'eq', 'value' => 'havebug')
  6731. )
  6732. )
  6733. ),
  6734. 'filters' => array(),
  6735. 'fields' => array
  6736. (
  6737. 'fixpercent' => array('name' => 'fixpercent', 'object' => 'bug', 'field' => 'fixpercent', 'type' => 'number'),
  6738. 'havebug' => array('name' => 'havebug', 'object' => 'bug', 'field' => 'havebug', 'type' => 'string')
  6739. ),
  6740. 'langs' => array
  6741. (
  6742. 'fixpercent' => array('zh-cn' => 'Bug修复率', 'zh-tw' => '', 'en' => 'fixpercent', 'de' => '', 'fr' => ''),
  6743. 'havebug' => array('zh-cn' => '是否有Bug', 'zh-tw' => '', 'en' => 'havebug', 'de' => '', 'fr' => '')
  6744. ),
  6745. 'stage' => 'published',
  6746. 'builtin' => '0'
  6747. );
  6748. $config->bi->builtin->charts[] = array
  6749. (
  6750. 'id' => 10211,
  6751. 'name' => '质量数据-Bug总数、有效Bug与解决Bug数近30天统计柱形图',
  6752. 'code' => 'quality_bugDailyChart',
  6753. 'dimension' => '3',
  6754. 'type' => 'cluBarX',
  6755. 'group' => '91',
  6756. 'sql' => <<<EOT
  6757. select
  6758. id `Bug总数`,
  6759. (case when resolution in ('fixed','postponed') or status='active' then 1 else 0 end) `有效Bug`,
  6760. (case when resolution='fixed' then 1 else 0 end) `已解决Bug`,
  6761. openedDate `日期`
  6762. from zt_bug
  6763. where CAST(left(openedDate,10) AS DATE) > (select DATE_sub(MAX(NOW()), INTERVAL '30' DAY))
  6764. and CAST(left(openedDate, 10) AS DATE) < NOW()
  6765. and deleted='0'
  6766. EOT
  6767. ,
  6768. 'settings' => array
  6769. (
  6770. array
  6771. (
  6772. 'type' => 'cluBarX',
  6773. 'xaxis' => array
  6774. (
  6775. array('field' => '日期', 'name' => '日期', 'group' => 'day')
  6776. ),
  6777. 'yaxis' => array
  6778. (
  6779. array('field' => 'Bug总数', 'name' => 'Bug总数', 'valOrAgg' => 'count'),
  6780. array('field' => '有效Bug', 'name' => '有效Bug', 'valOrAgg' => 'sum'),
  6781. array('field' => '已解决Bug', 'name' => '已解决Bug', 'valOrAgg' => 'sum')
  6782. )
  6783. )
  6784. ),
  6785. 'filters' => array(),
  6786. 'fields' => array
  6787. (
  6788. 'Bug总数' => array('name' => 'Bug总数', 'object' => 'bug', 'field' => 'Bug总数', 'type' => 'number'),
  6789. '有效Bug' => array('name' => '有效Bug', 'object' => 'bug', 'field' => '有效Bug', 'type' => 'string'),
  6790. '已解决Bug' => array('name' => '已解决Bug', 'object' => 'bug', 'field' => '已解决Bug', 'type' => 'string'),
  6791. '日期' => array('name' => '日期', 'object' => 'bug', 'field' => '日期', 'type' => 'date')
  6792. ),
  6793. 'stage' => 'published',
  6794. 'builtin' => '1'
  6795. );
  6796. $config->bi->builtin->charts[] = array
  6797. (
  6798. 'id' => 10212,
  6799. 'name' => '质量数据-有效Bug率年度趋势图',
  6800. 'code' => 'quality_validBugTendency',
  6801. 'dimension' => '3',
  6802. 'type' => 'line',
  6803. 'group' => '91',
  6804. 'sql' => <<<EOT
  6805. select
  6806. year,
  6807. count(a.id) as totalBugCount,
  6808. sum(a.effectivebug) as effectiveBugCount,
  6809. sum(a.effectivebug)/count(a.id) effectiveBugRate
  6810. from(
  6811. select
  6812. left(openedDate,4) `year`,
  6813. id,
  6814. (case when resolution in ('fixed','postponed') or status='active' then 1 else 0 end) effectivebug,
  6815. (case when resolution='fixed' then 1 else 0 end) fixedBug
  6816. from zt_bug
  6817. where zt_bug.deleted='0'
  6818. ) a
  6819. group by a.`year`
  6820. order by a.`year`
  6821. EOT
  6822. ,
  6823. 'settings' => array
  6824. (
  6825. array
  6826. (
  6827. 'type' => 'line',
  6828. 'xaxis' => array
  6829. (
  6830. array('field' => 'year', 'name' => 'year', 'group' => '')
  6831. ),
  6832. 'yaxis' => array
  6833. (
  6834. array('field' => 'effectiveBugRate', 'name' => 'effectiveBugRate', 'valOrAgg' => 'sum')
  6835. )
  6836. )
  6837. ),
  6838. 'filters' => array
  6839. (
  6840. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  6841. ),
  6842. 'fields' => array
  6843. (
  6844. 'year' => array('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'string'),
  6845. 'totalBugCount' => array('name' => 'totalBugCount', 'object' => 'bug', 'field' => 'totalBugCount', 'type' => 'string'),
  6846. 'effectiveBugCount' => array('name' => 'effectiveBugCount', 'object' => 'bug', 'field' => 'effectiveBugCount', 'type' => 'number'),
  6847. 'effectiveBugRate' => array('name' => 'effectiveBugRate', 'object' => 'bug', 'field' => 'effectiveBugRate', 'type' => 'number')
  6848. ),
  6849. 'langs' => array
  6850. (
  6851. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'Year', 'de' => '', 'fr' => ''),
  6852. 'totalBugCount' => array('zh-cn' => 'Bug总数', 'zh-tw' => '', 'en' => 'Total Bug Count', 'de' => '', 'fr' => ''),
  6853. 'effectiveBugCount' => array('zh-cn' => '有效Bug数', 'zh-tw' => '', 'en' => 'Effective Bug Count', 'de' => '', 'fr' => ''),
  6854. 'effectiveBugRate' => array('zh-cn' => '有效Bug率', 'zh-tw' => '', 'en' => 'Effective Bug Rate', 'de' => '', 'fr' => '')
  6855. ),
  6856. 'stage' => 'published',
  6857. 'builtin' => '0'
  6858. );
  6859. $config->bi->builtin->charts[] = array
  6860. (
  6861. 'id' => 10213,
  6862. 'name' => '质量数据-Bug密度年度趋势图',
  6863. 'code' => 'quality_bugDensityTendency',
  6864. 'dimension' => '3',
  6865. 'type' => 'line',
  6866. 'group' => '91',
  6867. 'sql' => <<<EOT
  6868. select
  6869. bug.`year` as `year`,
  6870. createdBugs,
  6871. exfixedstoryestimate,
  6872. round(createdBugs/exfixedstoryestimate,2) as bugCount
  6873. from
  6874. (select
  6875. left(openedDate,4) `year`,
  6876. count(id) createdBugs
  6877. from zt_bug
  6878. where zt_bug.deleted='0'
  6879. group by `year`
  6880. ) bug
  6881. left join
  6882. (select
  6883. sum(estimate) exfixedstoryestimate,
  6884. left(closedDate,4) `year`
  6885. from
  6886. zt_story
  6887. where zt_story.deleted='0' and zt_story.status='closed' and zt_story.closedReason='done'
  6888. group by `year`
  6889. ) story
  6890. on story.`year`=bug.`year`
  6891. order by bug.`year`
  6892. EOT
  6893. ,
  6894. 'settings' => array
  6895. (
  6896. array
  6897. (
  6898. 'type' => 'line',
  6899. 'xaxis' => array
  6900. (
  6901. array('field' => 'year', 'name' => 'year', 'group' => '')
  6902. ),
  6903. 'yaxis' => array
  6904. (
  6905. array('field' => 'bugCount', 'name' => 'Bug数', 'valOrAgg' => 'sum')
  6906. )
  6907. )
  6908. ),
  6909. 'filters' => array
  6910. (
  6911. array('field' => 'year', 'type' => 'select', 'name' => '年份')
  6912. ),
  6913. 'fields' => array
  6914. (
  6915. 'year' => array('name' => 'year', 'object' => 'story', 'field' => 'year', 'type' => 'string'),
  6916. 'createdBugs' => array('name' => 'createdBugs', 'object' => 'story', 'field' => 'createdBugs', 'type' => 'string'),
  6917. 'exfixedstoryestimate' => array('name' => 'exfixedstoryestimate', 'object' => 'story', 'field' => 'exfixedstoryestimate', 'type' => 'number'),
  6918. 'bugCount' => array('name' => 'Bug数', 'object' => 'story', 'field' => 'bugCount', 'type' => 'number')
  6919. ),
  6920. 'langs' => array
  6921. (
  6922. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => 'Year', 'de' => '', 'fr' => ''),
  6923. 'createdBugs' => array('zh-cn' => '产生Bug', 'zh-tw' => '', 'en' => 'Created Bug', 'de' => '', 'fr' => ''),
  6924. 'exfixedstoryestimate' => array('zh-cn' => '完成需求数', 'zh-tw' => '', 'en' => 'Finished Story', 'de' => '', 'fr' => ''),
  6925. 'bugCount' => array('zh-cn' => '单位完成需求规模产生的Bug数', 'zh-tw' => '', 'en' => 'Bug Density', 'de' => '', 'fr' => '')
  6926. ),
  6927. 'stage' => 'published',
  6928. 'builtin' => '0'
  6929. );
  6930. $config->bi->builtin->charts[] = array
  6931. (
  6932. 'id' => 10214,
  6933. 'name' => '质量数据-Bug严重程度年度堆积柱状图',
  6934. 'code' => 'quality_bugAnnualSeverityChart',
  6935. 'dimension' => '3',
  6936. 'type' => 'stackedBar',
  6937. 'group' => '91',
  6938. 'sql' => <<<EOT
  6939. select
  6940. count(id) `所有Bug数`,
  6941. sum(case when severity=1 then 1 else 0 end) `严重程度为1级的Bug`,
  6942. sum(case when severity=2 then 1 else 0 end) `严重程度为2级的Bug`,
  6943. sum(case when severity not in (1,2) then 1 else 0 end) `严重程度低于2级的Bug`,
  6944. left(openedDate,4) `年份`
  6945. from
  6946. zt_bug
  6947. where deleted='0'
  6948. group by left(openedDate,4)
  6949. order by left(openedDate,4)
  6950. EOT
  6951. ,
  6952. 'settings' => array
  6953. (
  6954. array
  6955. (
  6956. 'type' => 'stackedBar',
  6957. 'xaxis' => array
  6958. (
  6959. array('field' => '年份', 'name' => '年份', 'group' => '')
  6960. ),
  6961. 'yaxis' => array
  6962. (
  6963. array('field' => '严重程度为1级的Bug', 'name' => '严重程度为1级的Bug', 'valOrAgg' => 'sum'),
  6964. array('field' => '严重程度为2级的Bug', 'name' => '严重程度为2级的Bug', 'valOrAgg' => 'sum'),
  6965. array('field' => '严重程度低于2级的Bug', 'name' => '严重程度低于2级的Bug', 'valOrAgg' => 'sum')
  6966. )
  6967. )
  6968. ),
  6969. 'filters' => array
  6970. (
  6971. array('field' => '年份', 'type' => 'select', 'name' => '年份')
  6972. ),
  6973. 'fields' => array
  6974. (
  6975. '所有Bug数' => array('name' => '所有Bug数', 'object' => 'bug', 'field' => '所有Bug数', 'type' => 'string'),
  6976. '严重程度为1级的Bug' => array('name' => '严重程度为1级的Bug', 'object' => 'bug', 'field' => '严重程度为1级的Bug', 'type' => 'number'),
  6977. '严重程度为2级的Bug' => array('name' => '严重程度为2级的Bug', 'object' => 'bug', 'field' => '严重程度为2级的Bug', 'type' => 'number'),
  6978. '严重程度低于2级的Bug' => array('name' => '严重程度低于2级的Bug', 'object' => 'bug', 'field' => '严重程度低于2级的Bug', 'type' => 'number'),
  6979. '年份' => array('name' => '年份', 'object' => 'bug', 'field' => '年份', 'type' => 'string')
  6980. ),
  6981. 'stage' => 'published',
  6982. 'builtin' => '1'
  6983. );
  6984. $config->bi->builtin->charts[] = array
  6985. (
  6986. 'id' => 10215,
  6987. 'name' => '质量数据-产品用例数量统计条形图',
  6988. 'code' => 'quality_productCaseCountChart',
  6989. 'dimension' => '3',
  6990. 'type' => 'cluBarY',
  6991. 'group' => '91',
  6992. 'sql' => <<<EOT
  6993. select
  6994. t1.name,
  6995. ifnull(t2.cases,0) as count
  6996. from
  6997. zt_product t1
  6998. left join
  6999. (
  7000. select
  7001. product,
  7002. count(id) cases
  7003. from
  7004. zt_case
  7005. where deleted='0'
  7006. group by product )
  7007. t2 on t1.id=t2.product
  7008. EOT
  7009. ,
  7010. 'settings' => array
  7011. (
  7012. array
  7013. (
  7014. 'type' => 'cluBarY',
  7015. 'xaxis' => array
  7016. (
  7017. array('field' => 'name', 'name' => 'name', 'group' => '')
  7018. ),
  7019. 'yaxis' => array
  7020. (
  7021. array('field' => 'count', 'name' => 'count', 'valOrAgg' => 'sum')
  7022. )
  7023. )
  7024. ),
  7025. 'filters' => array
  7026. (
  7027. array('field' => 'name', 'type' => 'select', 'name' => '产品')
  7028. ),
  7029. 'fields' => array
  7030. (
  7031. 'name' => array('name' => 'name', 'object' => 'product', 'field' => 'name', 'type' => 'string'),
  7032. 'count' => array('name' => 'count', 'object' => 'testcase', 'field' => 'id', 'type' => 'string')
  7033. ),
  7034. 'langs' => array
  7035. (
  7036. 'name' => array('zh-cn' => '产品名称', 'zh-tw' => '', 'en' => 'Product', 'de' => '', 'fr' => ''),
  7037. 'count' => array('zh-cn' => '用例计数', 'zh-tw' => '', 'en' => 'Case Count', 'de' => '', 'fr' => '')
  7038. ),
  7039. 'stage' => 'published',
  7040. 'builtin' => '0'
  7041. );
  7042. $config->bi->builtin->charts[] = array
  7043. (
  7044. 'id' => 10216,
  7045. 'name' => '质量数据-产品Bug数量统计条形图',
  7046. 'code' => 'quality_productBugCountChart',
  7047. 'dimension' => '3',
  7048. 'type' => 'cluBarY',
  7049. 'group' => '91',
  7050. 'sql' => <<<EOT
  7051. select
  7052. t1.name,
  7053. ifnull(t2.bugs,0) bug
  7054. from
  7055. zt_product t1
  7056. left join
  7057. (
  7058. select
  7059. product,
  7060. count(id) bugs
  7061. from
  7062. zt_bug
  7063. where zt_bug.deleted='0'
  7064. group by product )
  7065. t2 on t1.id=t2.product
  7066. EOT
  7067. ,
  7068. 'settings' => array
  7069. (
  7070. array
  7071. (
  7072. 'type' => 'cluBarY',
  7073. 'xaxis' => array
  7074. (
  7075. array('field' => 'name', 'name' => 'name', 'group' => '')
  7076. ),
  7077. 'yaxis' => array
  7078. (
  7079. array('field' => 'bug', 'name' => 'bug', 'valOrAgg' => 'sum')
  7080. ),
  7081. 'rotateX' => 'notuse'
  7082. )
  7083. ),
  7084. 'filters' => array
  7085. (
  7086. array('field' => 'name', 'type' => 'select', 'name' => '产品')
  7087. ),
  7088. 'fields' => array
  7089. (
  7090. 'name' => array('name' => 'name', 'object' => 'product', 'field' => 'name', 'type' => 'string'),
  7091. 'bug' => array('name' => 'bug', 'object' => 'bug', 'field' => 'id', 'type' => 'string')
  7092. ),
  7093. 'langs' => array
  7094. (
  7095. 'name' => array('zh-cn' => '产品名称', 'zh-tw' => '', 'en' => 'Product', 'de' => '', 'fr' => ''),
  7096. 'bug' => array('zh-cn' => 'Bug计数', 'zh-tw' => '', 'en' => 'Bug Count', 'de' => '', 'fr' => '')
  7097. ),
  7098. 'stage' => 'published',
  7099. 'builtin' => '0'
  7100. );
  7101. $config->bi->builtin->charts[] = array
  7102. (
  7103. 'id' => 10217,
  7104. 'name' => '质量数据-Bug状态分布图',
  7105. 'code' => 'quality_bugStatus',
  7106. 'dimension' => '3',
  7107. 'type' => 'pie',
  7108. 'group' => '91',
  7109. 'sql' => <<<EOT
  7110. select
  7111. id,status,openedDate
  7112. from zt_bug
  7113. where deleted='0'
  7114. EOT
  7115. ,
  7116. 'settings' => array
  7117. (
  7118. array
  7119. (
  7120. 'type' => 'pie',
  7121. 'group' => array
  7122. (
  7123. array('field' => 'status', 'name' => 'Bug状态', 'group' => '')
  7124. ),
  7125. 'metric' => array
  7126. (
  7127. array('field' => 'id', 'name' => 'Bug编号', 'valOrAgg' => 'count')
  7128. )
  7129. )
  7130. ),
  7131. 'filters' => array
  7132. (
  7133. array
  7134. (
  7135. 'field' => 'openedDate',
  7136. 'type' => 'date',
  7137. 'name' => '创建日期',
  7138. 'default' => array('begin' => '', 'end' => '')
  7139. )
  7140. ),
  7141. 'fields' => array
  7142. (
  7143. 'id' => array('name' => 'Bug编号', 'object' => 'bug', 'field' => 'id', 'type' => 'number'),
  7144. 'status' => array('name' => 'Bug状态', 'object' => 'bug', 'field' => 'status', 'type' => 'option'),
  7145. 'openedDate' => array('name' => '创建日期', 'object' => 'bug', 'field' => 'openedDate', 'type' => 'date')
  7146. ),
  7147. 'langs' => array
  7148. (
  7149. 'id' => array('zh-cn' => 'Bug编号', 'zh-tw' => '', 'en' => 'Bug ID', 'de' => '', 'fr' => ''),
  7150. 'status' => array('zh-cn' => 'Bug状态', 'zh-tw' => '', 'en' => 'Status', 'de' => '', 'fr' => ''),
  7151. 'openedDate' => array('zh-cn' => '创建日期', 'zh-tw' => '', 'en' => 'Opened Date', 'de' => '', 'fr' => '')
  7152. ),
  7153. 'stage' => 'published',
  7154. 'builtin' => '0'
  7155. );
  7156. $config->bi->builtin->charts[] = array
  7157. (
  7158. 'id' => 10218,
  7159. 'name' => '质量数据-Bug类型分布',
  7160. 'code' => 'quality_bugType',
  7161. 'dimension' => '3',
  7162. 'type' => 'pie',
  7163. 'group' => '91',
  7164. 'sql' => <<<EOT
  7165. select
  7166. id,type,openedDate
  7167. from
  7168. zt_bug
  7169. where deleted='0'
  7170. EOT
  7171. ,
  7172. 'settings' => array
  7173. (
  7174. array
  7175. (
  7176. 'type' => 'pie',
  7177. 'group' => array
  7178. (
  7179. array('field' => 'type', 'name' => 'Bug类型', 'group' => '')
  7180. ),
  7181. 'metric' => array
  7182. (
  7183. array('field' => 'id', 'name' => 'Bug编号', 'valOrAgg' => 'count')
  7184. )
  7185. )
  7186. ),
  7187. 'filters' => array
  7188. (
  7189. array
  7190. (
  7191. 'field' => 'openedDate',
  7192. 'type' => 'date',
  7193. 'name' => '创建日期',
  7194. 'default' => array('begin' => '', 'end' => '')
  7195. )
  7196. ),
  7197. 'fields' => array
  7198. (
  7199. 'id' => array('name' => 'Bug编号', 'object' => 'bug', 'field' => 'id', 'type' => 'number'),
  7200. 'type' => array('name' => 'Bug类型', 'object' => 'bug', 'field' => 'type', 'type' => 'option'),
  7201. 'openedDate' => array('name' => '创建日期', 'object' => 'bug', 'field' => 'openedDate', 'type' => 'date')
  7202. ),
  7203. 'langs' => array
  7204. (
  7205. 'id' => array('zh-cn' => 'Bug编号', 'zh-tw' => '', 'en' => 'Bug ID', 'de' => '', 'fr' => ''),
  7206. 'type' => array('zh-cn' => 'Bug类型', 'zh-tw' => '', 'en' => 'Type', 'de' => '', 'fr' => ''),
  7207. 'openedDate' => array('zh-cn' => '创建日期', 'zh-tw' => '', 'en' => 'Opened Date', 'de' => '', 'fr' => '')
  7208. ),
  7209. 'stage' => 'published',
  7210. 'builtin' => '0'
  7211. );
  7212. $config->bi->builtin->charts[] = array
  7213. (
  7214. 'id' => 10219,
  7215. 'name' => '质量数据-Bug严重程度分布',
  7216. 'code' => 'quality_bugSeverity',
  7217. 'dimension' => '3',
  7218. 'type' => 'pie',
  7219. 'group' => '91',
  7220. 'sql' => <<<EOT
  7221. select
  7222. id,severity,openedDate
  7223. from
  7224. zt_bug
  7225. where deleted='0'
  7226. EOT
  7227. ,
  7228. 'settings' => array
  7229. (
  7230. array
  7231. (
  7232. 'type' => 'pie',
  7233. 'group' => array
  7234. (
  7235. array('field' => 'severity', 'name' => '严重程度', 'group' => '')
  7236. ),
  7237. 'metric' => array
  7238. (
  7239. array('field' => 'id', 'name' => 'Bug编号', 'valOrAgg' => 'count')
  7240. )
  7241. )
  7242. ),
  7243. 'filters' => array
  7244. (
  7245. array
  7246. (
  7247. 'field' => 'openedDate',
  7248. 'type' => 'date',
  7249. 'name' => '创建日期',
  7250. 'default' => array('begin' => '', 'end' => '')
  7251. )
  7252. ),
  7253. 'fields' => array
  7254. (
  7255. 'id' => array('name' => 'Bug编号', 'object' => 'bug', 'field' => 'id', 'type' => 'number'),
  7256. 'severity' => array('name' => '严重程度', 'object' => 'bug', 'field' => 'severity', 'type' => 'option'),
  7257. 'openedDate' => array('name' => '创建日期', 'object' => 'bug', 'field' => 'openedDate', 'type' => 'date')
  7258. ),
  7259. 'langs' => array
  7260. (
  7261. 'id' => array('zh-cn' => 'Bug编号', 'zh-tw' => '', 'en' => 'Bug ID', 'de' => '', 'fr' => ''),
  7262. 'severity' => array('zh-cn' => '严重程度', 'zh-tw' => '', 'en' => 'Severity', 'de' => '', 'fr' => ''),
  7263. 'openedDate' => array('zh-cn' => '创建日期', 'zh-tw' => '', 'en' => 'Opened Date', 'de' => '', 'fr' => '')
  7264. ),
  7265. 'stage' => 'published',
  7266. 'builtin' => '0'
  7267. );
  7268. $config->bi->builtin->charts[] = array
  7269. (
  7270. 'id' => 10220,
  7271. 'name' => '质量数据-Bug解决方案分布',
  7272. 'code' => 'quality_bugResolution',
  7273. 'dimension' => '3',
  7274. 'type' => 'pie',
  7275. 'group' => '91',
  7276. 'sql' => <<<EOT
  7277. select id,resolution,resolvedDate from zt_bug
  7278. where deleted='0' and resolution!=' '
  7279. EOT
  7280. ,
  7281. 'settings' => array
  7282. (
  7283. array
  7284. (
  7285. 'type' => 'pie',
  7286. 'group' => array
  7287. (
  7288. array('field' => 'resolution', 'name' => '解决方案', 'group' => '')
  7289. ),
  7290. 'metric' => array
  7291. (
  7292. array('field' => 'id', 'name' => 'Bug编号', 'valOrAgg' => 'count')
  7293. )
  7294. )
  7295. ),
  7296. 'filters' => array
  7297. (
  7298. array
  7299. (
  7300. 'field' => 'resolvedDate',
  7301. 'type' => 'date',
  7302. 'name' => '解决日期',
  7303. 'default' => array('begin' => '', 'end' => '')
  7304. )
  7305. ),
  7306. 'fields' => array
  7307. (
  7308. 'id' => array('name' => 'Bug编号', 'object' => 'bug', 'field' => 'id', 'type' => 'number'),
  7309. 'resolution' => array('name' => '解决方案', 'object' => 'bug', 'field' => 'resolution', 'type' => 'option'),
  7310. 'resolvedDate' => array('name' => '解决日期', 'object' => 'bug', 'field' => 'resolvedDate', 'type' => 'date')
  7311. ),
  7312. 'langs' => array
  7313. (
  7314. 'id' => array('zh-cn' => 'Bug编号', 'zh-tw' => '', 'en' => 'Bug ID', 'de' => '', 'fr' => ''),
  7315. 'resolution' => array('zh-cn' => '解决方案', 'zh-tw' => '', 'en' => 'Resolution', 'de' => '', 'fr' => ''),
  7316. 'resolvedDate' => array('zh-cn' => '解决日期', 'zh-tw' => '', 'en' => 'Resolved Date', 'de' => '', 'fr' => '')
  7317. ),
  7318. 'stage' => 'published',
  7319. 'builtin' => '0'
  7320. );
  7321. $config->bi->builtin->charts[] = array
  7322. (
  7323. 'id' => 20002,
  7324. 'name' => '活跃账号情况-活跃账号数项目间对比',
  7325. 'code' => 'activeAccount_projectCompare',
  7326. 'dimension' => '1',
  7327. 'type' => 'table',
  7328. 'group' => '62',
  7329. 'sql' => <<<EOT
  7330. SELECT t1.id, t1.name, t1.year, t1.month, t1.totalAccount, ifnull(t2.activeAccount,0) as activeAccount, ifnull(concat(truncate(t2.activeAccount/t1.totalAccount*100,2),'%'), 0) as ratio
  7331. FROM (
  7332. select t1.id, t1.name, t3.year, t3.month, count(distinct t2.`account`) as totalAccount
  7333. from zt_project as t1
  7334. left join zt_team as t2 on t1.id = t2.root
  7335. left join (
  7336. SELECT DISTINCT YEAR(`date`) AS `year`, MONTH(`date`) AS `month`, cast(`date` as DATE) as date
  7337. FROM zt_action
  7338. ) as t3 on t2.`join` <= t3.date
  7339. left join zt_user as t4 on t2.account = t4.account
  7340. where t1.type = 'project'
  7341. and t4.deleted = '0'
  7342. group by t1.id, t3.year, t3.month
  7343. ) AS t1 LEFT JOIN (
  7344. SELECT t1.id, t1.name, t4.year,t4.month, COUNT(DISTINCT t3.id) AS activeAccount
  7345. FROM
  7346. zt_project AS t1
  7347. LEFT JOIN zt_team AS t2 ON t1.id = t2.root
  7348. LEFT JOIN zt_user AS t3 ON t2.account = t3.account
  7349. LEFT JOIN (
  7350. SELECT objectID, YEAR(date) AS `year`, MONTH(date) AS month, cast(`date` as DATE) as date
  7351. FROM zt_action
  7352. WHERE objectType = 'user' AND action = 'login'
  7353. ) AS t4 ON t3.id = t4.objectID and t2.`join` <= t4.date
  7354. WHERE
  7355. t3.deleted = '0' AND t1.type = 'project'
  7356. GROUP BY t1.id, t4.year, t4.month
  7357. ) AS t2 ON t1.year = t2.year AND t1.month = t2.month AND t1.id = t2.id
  7358. ORDER BY t2.activeAccount DESC LIMIT 999999
  7359. EOT
  7360. ,
  7361. 'settings' => array
  7362. (
  7363. 'group' => array(),
  7364. 'column' => array
  7365. (
  7366. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '项目'),
  7367. array('field' => 'activeAccount', 'valOrAgg' => 'value', 'name' => '活跃账号数'),
  7368. array('field' => 'totalAccount', 'valOrAgg' => 'value', 'name' => '团队账号数'),
  7369. array('field' => 'ratio', 'valOrAgg' => 'value', 'name' => '活跃账号比')
  7370. ),
  7371. 'filter' => array()
  7372. ),
  7373. 'filters' => array(),
  7374. 'stage' => 'published',
  7375. 'builtin' => '1'
  7376. );
  7377. $config->bi->builtin->charts[] = array
  7378. (
  7379. 'id' => 20003,
  7380. 'name' => '活跃账号情况-公司账号日活跃度趋势',
  7381. 'code' => 'activeAccount_activeTendency',
  7382. 'dimension' => '1',
  7383. 'type' => 'line',
  7384. 'group' => '56',
  7385. 'sql' => <<<EOT
  7386. SELECT YEAR(t2.date) AS `year`, MONTH(t2.date) AS month, DAY(t2.date) AS day, COUNT(DISTINCT t1.account) AS count FROM zt_user AS t1
  7387. LEFT JOIN zt_action AS t2 ON t1.account = t2.actor
  7388. WHERE t2.objectType = 'user' AND t2.action = 'login'
  7389. GROUP BY YEAR(t2.date), MONTH(t2.date), DAY(t2.date)
  7390. EOT
  7391. ,
  7392. 'settings' => array
  7393. (
  7394. 'xaxis' => array
  7395. (
  7396. array('field' => 'day', 'name' => '日期', 'group' => 'value')
  7397. ),
  7398. 'yaxis' => array
  7399. (
  7400. array('type' => 'value', 'field' => 'count', 'agg' => 'value', 'name' => '数量', 'valOrAgg' => 'value')
  7401. )
  7402. ),
  7403. 'filters' => array(),
  7404. 'stage' => 'published',
  7405. 'builtin' => '1'
  7406. );
  7407. $config->bi->builtin->charts[] = array
  7408. (
  7409. 'id' => 20004,
  7410. 'name' => '应用数据-活跃产品数',
  7411. 'code' => 'appData_activeProduct',
  7412. 'dimension' => '1',
  7413. 'type' => 'card',
  7414. 'group' => '47',
  7415. 'sql' => <<<EOT
  7416. select count(distinct REPLACE(product, ',', '')) as count, year(date) as `year`, month(date) as month
  7417. from zt_action
  7418. where objectType not in ('project','execution','task')
  7419. and product != ',0,'
  7420. and product != ','
  7421. and product != ''
  7422. group by year(date), month(date)
  7423. EOT
  7424. ,
  7425. 'settings' => array
  7426. (
  7427. 'value' => array('type' => 'value', 'field' => 'count', 'agg' => 'value'),
  7428. 'title' => array('type' => 'text', 'name' => ''),
  7429. 'type' => 'value'
  7430. ),
  7431. 'filters' => array(),
  7432. 'stage' => 'published',
  7433. 'builtin' => '1'
  7434. );
  7435. $config->bi->builtin->charts[] = array
  7436. (
  7437. 'id' => 20005,
  7438. 'name' => '应用数据-本月新增产品数',
  7439. 'code' => 'appData_createdProductCount',
  7440. 'dimension' => '1',
  7441. 'type' => 'card',
  7442. 'group' => '47',
  7443. 'sql' => <<<EOT
  7444. SELECT DISTINCT YEAR(createdDate) AS `year`, MONTH(createdDate) AS month, count(id) as count FROM zt_product
  7445. WHERE deleted = '0' AND shadow = '0'
  7446. GROUP BY YEAR(createdDate), MONTH(createdDate)
  7447. EOT
  7448. ,
  7449. 'settings' => array
  7450. (
  7451. 'value' => array('type' => 'value', 'field' => 'count', 'agg' => 'value'),
  7452. 'title' => array('type' => 'text', 'name' => ''),
  7453. 'type' => 'value'
  7454. ),
  7455. 'filters' => array(),
  7456. 'stage' => 'published',
  7457. 'builtin' => '1'
  7458. );
  7459. $config->bi->builtin->charts[] = array
  7460. (
  7461. 'id' => 20006,
  7462. 'name' => '应用数据-本月新增产品名',
  7463. 'code' => 'appData_createdProductName',
  7464. 'dimension' => '1',
  7465. 'type' => 'card',
  7466. 'group' => '47',
  7467. 'sql' => <<<EOT
  7468. SELECT DISTINCT GROUP_CONCAT(name) AS name, YEAR(createdDate) AS `year`, MONTH(createdDate) AS month FROM zt_product
  7469. WHERE deleted = '0' AND shadow = '0'
  7470. GROUP BY YEAR(createdDate), MONTH(createdDate)
  7471. EOT
  7472. ,
  7473. 'settings' => array
  7474. (
  7475. 'value' => array('type' => 'text', 'field' => 'name', 'agg' => 'value'),
  7476. 'title' => array('type' => 'text', 'name' => ''),
  7477. 'type' => 'value'
  7478. ),
  7479. 'filters' => array(),
  7480. 'stage' => 'published',
  7481. 'builtin' => '1'
  7482. );
  7483. $config->bi->builtin->charts[] = array
  7484. (
  7485. 'id' => 20007,
  7486. 'name' => '应用数据-活跃项目数',
  7487. 'code' => 'appData_activeProject',
  7488. 'dimension' => '1',
  7489. 'type' => 'card',
  7490. 'group' => '46',
  7491. 'sql' => <<<EOT
  7492. select year(date) as `year`, month(date) as month, count(distinct project) as count
  7493. from zt_action
  7494. where project != 0
  7495. group by year(date), month(date)
  7496. EOT
  7497. ,
  7498. 'settings' => array
  7499. (
  7500. 'value' => array('type' => 'value', 'field' => 'count', 'agg' => 'value'),
  7501. 'title' => array('type' => 'text', 'name' => ''),
  7502. 'type' => 'value'
  7503. ),
  7504. 'filters' => array(),
  7505. 'stage' => 'published',
  7506. 'builtin' => '1'
  7507. );
  7508. $config->bi->builtin->charts[] = array
  7509. (
  7510. 'id' => 20008,
  7511. 'name' => '应用数据-本月新增项目数',
  7512. 'code' => 'appData_createdProjectCount',
  7513. 'dimension' => '1',
  7514. 'type' => 'card',
  7515. 'group' => '46',
  7516. 'sql' => <<<EOT
  7517. SELECT COUNT(id) as count, YEAR(openedDate) AS `year`, MONTH(openedDate) AS month FROM zt_project
  7518. WHERE deleted = '0' AND type = 'project'
  7519. GROUP BY YEAR(openedDate), MONTH(openedDate)
  7520. EOT
  7521. ,
  7522. 'settings' => array
  7523. (
  7524. 'value' => array('type' => 'value', 'field' => 'count', 'agg' => 'value'),
  7525. 'title' => array('type' => 'text', 'name' => ''),
  7526. 'type' => 'value'
  7527. ),
  7528. 'filters' => array(),
  7529. 'stage' => 'published',
  7530. 'builtin' => '1'
  7531. );
  7532. $config->bi->builtin->charts[] = array
  7533. (
  7534. 'id' => 20009,
  7535. 'name' => '应用数据-本月新增项目名 ',
  7536. 'code' => 'appData_createdProjectName',
  7537. 'dimension' => '1',
  7538. 'type' => 'card',
  7539. 'group' => '46',
  7540. 'sql' => <<<EOT
  7541. SELECT DISTINCT GROUP_CONCAT(name) AS name, YEAR(openedDate) AS `year`, MONTH(openedDate) AS month FROM zt_project
  7542. WHERE deleted = '0' AND type = 'project'
  7543. GROUP BY YEAR(openedDate), MONTH(openedDate)
  7544. EOT
  7545. ,
  7546. 'settings' => array
  7547. (
  7548. 'value' => array('type' => 'text', 'field' => 'name', 'agg' => 'value'),
  7549. 'title' => array('type' => 'text', 'name' => ''),
  7550. 'type' => 'value'
  7551. ),
  7552. 'filters' => array(),
  7553. 'stage' => 'published',
  7554. 'builtin' => '1'
  7555. );
  7556. $config->bi->builtin->charts[] = array
  7557. (
  7558. 'id' => 20010,
  7559. 'name' => '应用数据-项目任务概况表',
  7560. 'code' => 'appData_projectTaskOverview',
  7561. 'dimension' => '1',
  7562. 'type' => 'table',
  7563. 'group' => '60',
  7564. 'sql' => <<<EOT
  7565. SELECT
  7566. t1.name,
  7567. t4.year,
  7568. t4.month,
  7569. t1.createdTasks,
  7570. t2.finishedTasks,
  7571. t3.contributors
  7572. FROM
  7573. (
  7574. select distinct year(date) as `year`, month(date) as month
  7575. from zt_action
  7576. ) as t4
  7577. left join
  7578. (
  7579. SELECT
  7580. t1.id,
  7581. t1.NAME,
  7582. YEAR ( t2.openedDate ) AS YEAR,
  7583. MONTH ( t2.openedDate ) AS MONTH,
  7584. COUNT( t2.id ) AS createdTasks
  7585. FROM
  7586. zt_project AS t1
  7587. LEFT JOIN zt_task AS t2 ON t1.id = t2.project
  7588. WHERE
  7589. t1.type = 'project'
  7590. GROUP BY
  7591. t1.id,
  7592. YEAR ( t2.openedDate ),
  7593. MONTH ( t2.openedDate )
  7594. ) AS t1 on t4.year = t1.year and t4.month = t1.month
  7595. LEFT JOIN (
  7596. SELECT
  7597. t1.id,
  7598. t1.NAME,
  7599. YEAR ( t2.finishedDate ) AS YEAR,
  7600. MONTH ( t2.finishedDate ) AS MONTH,
  7601. COUNT( t2.id ) AS finishedTasks
  7602. FROM
  7603. zt_project AS t1
  7604. LEFT JOIN zt_task AS t2 ON t1.id = t2.project
  7605. WHERE
  7606. t1.type = 'project'
  7607. AND t2.finishedDate IS NOT NULL
  7608. GROUP BY
  7609. t1.id,
  7610. YEAR ( t2.finishedDate ),
  7611. MONTH ( t2.finishedDate )
  7612. ) AS t2 ON t1.id = t2.id
  7613. AND t4.YEAR = t2.YEAR
  7614. AND t4.MONTH = t2.
  7615. MONTH LEFT JOIN (
  7616. SELECT
  7617. t1.id,
  7618. t1.NAME,
  7619. YEAR ( t3.date ) AS YEAR,
  7620. MONTH ( t3.date ) AS MONTH,
  7621. COUNT( DISTINCT t3.actor ) AS CONTRIBUTORS
  7622. FROM
  7623. zt_project AS t1
  7624. LEFT JOIN zt_task AS t2 ON t1.id = t2.project
  7625. LEFT JOIN zt_action AS t3 ON t2.id = t3.objectID
  7626. WHERE
  7627. t1.type = 'project'
  7628. AND t3.objectType = 'task'
  7629. AND t3.action IN ( 'opened', 'closed', 'finished', 'canceled', 'assigned' )
  7630. GROUP BY
  7631. t1.id,
  7632. YEAR ( t3.date ),
  7633. MONTH ( t3.date )
  7634. ) AS t3 ON t1.id = t3.id
  7635. AND t4.YEAR = t3.YEAR
  7636. AND t4.MONTH = t3.MONTH
  7637. order by t1.id,t4.year
  7638. EOT
  7639. ,
  7640. 'settings' => array
  7641. (
  7642. 'group' => array(),
  7643. 'column' => array
  7644. (
  7645. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '项目'),
  7646. array('field' => 'createdTasks', 'valOrAgg' => 'value', 'name' => '新增任务数'),
  7647. array('field' => 'contributors', 'valOrAgg' => 'value', 'name' => '新增任务人数'),
  7648. array('field' => 'finishedTasks', 'valOrAgg' => 'value', 'name' => '完成任务数')
  7649. ),
  7650. 'filter' => array()
  7651. ),
  7652. 'filters' => array(),
  7653. 'stage' => 'published',
  7654. 'builtin' => '1'
  7655. );
  7656. $config->bi->builtin->charts[] = array
  7657. (
  7658. 'id' => 20011,
  7659. 'name' => '应用数据-产品测试表',
  7660. 'code' => 'appData_productTest',
  7661. 'dimension' => '1',
  7662. 'type' => 'table',
  7663. 'group' => '63',
  7664. 'sql' => <<<EOT
  7665. SELECT * FROM
  7666. (
  7667. SELECT
  7668. t1.name,
  7669. t6.year,
  7670. t6.month,
  7671. IFNULL(t5.createdCases, 0) AS createdCases,
  7672. IFNULL(t4.relativedBugs / t5.createdCases, 0) AS avgBugsOfCase,
  7673. IFNULL(t1.createdBugs, 0) AS createdBugs,
  7674. IFNULL(t2.fixedBugs, 0) AS fixedBugs,
  7675. IFNULL(t3.fixedCycle / t2.fixedBugs, 0) AS avgFixedCycle
  7676. FROM
  7677. (
  7678. select distinct year(date) as `year`, month(date) as month
  7679. from zt_action
  7680. ) AS t6 left join
  7681. (
  7682. SELECT
  7683. t1.id,
  7684. t1.NAME,
  7685. YEAR ( t2.openedDate ) AS YEAR,
  7686. MONTH ( t2.openedDate ) AS MONTH,
  7687. COUNT( t2.id ) AS createdBugs
  7688. FROM
  7689. zt_product AS t1
  7690. LEFT JOIN zt_bug AS t2 ON t1.id = t2.product
  7691. WHERE
  7692. t1.deleted = '0'
  7693. AND t2.deleted = '0'
  7694. GROUP BY
  7695. t1.id,
  7696. YEAR ( t2.openedDate ),
  7697. MONTH ( t2.openedDate )
  7698. ) AS t1 on t1.year = t6.year AND t1.month = t6.month
  7699. LEFT JOIN (
  7700. SELECT
  7701. t1.id,
  7702. t1.NAME,
  7703. YEAR ( t2.resolvedDate ) AS YEAR,
  7704. MONTH ( t2.resolvedDate ) AS MONTH,
  7705. COUNT( t2.id ) AS fixedBugs
  7706. FROM
  7707. zt_product AS t1
  7708. LEFT JOIN zt_bug AS t2 ON t1.id = t2.product
  7709. WHERE
  7710. t1.deleted = '0'
  7711. AND t2.deleted = '0'
  7712. AND t2.`status` = 'closed'
  7713. AND t2.resolution = 'fixed'
  7714. GROUP BY
  7715. t1.id,
  7716. YEAR ( t2.resolvedDate ),
  7717. MONTH ( t2.resolvedDate )
  7718. ) AS t2 ON t1.id = t2.id
  7719. AND t6.YEAR = t2.YEAR
  7720. AND t6.MONTH = t2.MONTH
  7721. LEFT JOIN (
  7722. SELECT
  7723. t1.id,
  7724. t1.NAME,
  7725. YEAR ( t2.resolvedDate ) AS YEAR,
  7726. MONTH ( t2.resolvedDate ) AS MONTH,
  7727. SUM( DATEDIFF( t2.resolvedDate, t2.openedDate ) ) AS fixedCycle
  7728. FROM
  7729. zt_product AS t1
  7730. LEFT JOIN zt_bug AS t2 ON t1.id = t2.product
  7731. WHERE
  7732. t1.deleted = '0'
  7733. AND t2.deleted = '0'
  7734. AND t2.`status` = 'closed'
  7735. AND t2.resolution = 'fixed'
  7736. GROUP BY
  7737. t1.id,
  7738. YEAR ( t2.resolvedDate ),
  7739. MONTH ( t2.resolvedDate )
  7740. ) AS t3 ON t1.id = t3.id
  7741. AND t6.YEAR = t3.YEAR
  7742. AND t6.MONTH = t3.
  7743. MONTH LEFT JOIN (
  7744. SELECT
  7745. t1.id,
  7746. t1.NAME,
  7747. YEAR ( t2.openedDate ) AS YEAR,
  7748. MONTH ( t2.openedDate ) AS MONTH,
  7749. COUNT( t3.id ) AS relativedBugs
  7750. FROM
  7751. zt_product AS t1
  7752. LEFT JOIN zt_case AS t2 ON t1.id = t2.product
  7753. LEFT JOIN zt_bug AS t3 ON t2.id = t3.`case`
  7754. WHERE
  7755. t2.id IS NOT NULL
  7756. AND t3.id IS NOT NULL
  7757. AND t1.deleted = '0'
  7758. AND t2.deleted = '0'
  7759. AND t3.deleted = '0'
  7760. GROUP BY
  7761. t1.id,
  7762. YEAR ( t2.openedDate ),
  7763. MONTH ( t2.openedDate )
  7764. ) AS t4 ON t1.id = t4.id
  7765. AND t6.YEAR = t4.YEAR
  7766. AND t6.MONTH = t4.
  7767. MONTH LEFT JOIN (
  7768. SELECT
  7769. t1.id,
  7770. t1.NAME,
  7771. YEAR ( t2.openedDate ) AS `YEAR`,
  7772. MONTH ( t2.openedDate ) AS MONTH,
  7773. COUNT( t2.id ) AS createdCases
  7774. FROM
  7775. zt_product AS t1
  7776. LEFT JOIN zt_case AS t2 ON t1.id = t2.product
  7777. WHERE
  7778. t1.deleted = '0'
  7779. AND t2.deleted = '0'
  7780. GROUP BY
  7781. t1.id,
  7782. YEAR ( t2.openedDate ),
  7783. MONTH ( t2.openedDate )
  7784. ) AS t5 ON t1.id = t5.id
  7785. AND t6.YEAR = t5.YEAR
  7786. AND t6.MONTH = t5.MONTH
  7787. ) AS t WHERE t.name IS NOT NULL
  7788. EOT
  7789. ,
  7790. 'settings' => array
  7791. (
  7792. 'group' => array(),
  7793. 'column' => array
  7794. (
  7795. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '产品'),
  7796. array('field' => 'createdCases', 'valOrAgg' => 'value', 'name' => '新增用例数'),
  7797. array('field' => 'avgBugsOfCase', 'valOrAgg' => 'value', 'name' => '用例平均Bug数'),
  7798. array('field' => 'createdBugs', 'valOrAgg' => 'value', 'name' => '新增Bug数'),
  7799. array('field' => 'fixedBugs', 'valOrAgg' => 'value', 'name' => '修复Bug数'),
  7800. array('field' => 'avgFixedCycle', 'valOrAgg' => 'value', 'name' => 'Bug平均修复周期')
  7801. ),
  7802. 'filter' => array()
  7803. ),
  7804. 'filters' => array(),
  7805. 'stage' => 'published',
  7806. 'builtin' => '1'
  7807. );
  7808. $config->bi->builtin->charts[] = array
  7809. (
  7810. 'id' => 20012,
  7811. 'name' => '应用数据-产品需求概况表',
  7812. 'code' => 'appData_productStoryOverview',
  7813. 'dimension' => '1',
  7814. 'type' => 'table',
  7815. 'group' => '63',
  7816. 'sql' => <<<EOT
  7817. SELECT * FROM
  7818. (
  7819. SELECT
  7820. t1.id,
  7821. t1.name,
  7822. t3.year,
  7823. t3.month,
  7824. IFNULL(t1.count, 0) AS createdStories,
  7825. IFNULL(t2.count, 0) AS deliveredStories
  7826. FROM
  7827. (
  7828. select distinct year(date) as `year`, month(date) as month
  7829. from zt_action
  7830. )
  7831. as t3 left join
  7832. (
  7833. SELECT
  7834. t2.id,
  7835. t2.NAME,
  7836. YEAR ( t1.openedDate ) AS YEAR,
  7837. MONTH ( t1.openedDate ) AS MONTH,
  7838. COUNT( t1.id ) AS count
  7839. FROM
  7840. zt_story AS t1
  7841. LEFT JOIN zt_product AS t2 ON t1.product = t2.id
  7842. WHERE
  7843. t2.deleted = '0'
  7844. AND t1.deleted = '0'
  7845. AND t1.type = 'story'
  7846. GROUP BY
  7847. t2.id,
  7848. YEAR,
  7849. MONTH
  7850. ) AS t1 on t3.year = t1.year and t3.month = t1.month
  7851. LEFT JOIN (
  7852. SELECT
  7853. t1.id,
  7854. t1.NAME,
  7855. t1.YEAR,
  7856. t1.MONTH,
  7857. COUNT( distinct t1.story ) AS count
  7858. FROM
  7859. (
  7860. SELECT
  7861. t2.id,
  7862. t2.NAME,
  7863. YEAR ( t3.date ) AS YEAR,
  7864. MONTH ( t3.date ) AS MONTH,
  7865. t1.id AS story
  7866. FROM
  7867. zt_story AS t1
  7868. LEFT JOIN zt_product AS t2 ON t1.product = t2.id
  7869. LEFT JOIN ( SELECT objectID, MAX( date ) AS date FROM zt_action WHERE objectType = 'story' AND action = 'linked2release' GROUP BY objectID ) AS t3 ON t1.id = t3.objectID
  7870. WHERE
  7871. t1.deleted = '0'
  7872. AND t2.deleted = '0'
  7873. AND EXISTS ( SELECT 1 FROM zt_action WHERE objectID = t1.id AND objectType = 'story' AND action = 'linked2release' )
  7874. UNION
  7875. SELECT
  7876. t2.id,
  7877. t2.NAME,
  7878. YEAR ( t1.closedDate ) AS YEAR,
  7879. MONTH ( t1.closedDate ) AS MONTH,
  7880. t1.id AS story
  7881. FROM
  7882. zt_story AS t1
  7883. LEFT JOIN zt_product AS t2 ON t1.product = t2.id
  7884. WHERE
  7885. t1.deleted = '0'
  7886. AND t2.deleted = '0'
  7887. AND t1.status = 'closed'
  7888. AND t1.closedReason = 'done'
  7889. ) AS t1
  7890. GROUP BY
  7891. t1.id,
  7892. t1.name,
  7893. t1.YEAR,
  7894. t1.MONTH order by id asc
  7895. ) AS t2 ON t1.id = t2.id
  7896. AND t3.YEAR = t2.YEAR
  7897. AND t3.MONTH = t2.MONTH
  7898. ) AS t
  7899. WHERE t.name IS NOT NULL
  7900. EOT
  7901. ,
  7902. 'settings' => array
  7903. (
  7904. 'group' => array(),
  7905. 'column' => array
  7906. (
  7907. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '产品'),
  7908. array('field' => 'createdStories', 'valOrAgg' => 'value', 'name' => '新增研发需求数'),
  7909. array('field' => 'deliveredStories', 'valOrAgg' => 'value', 'name' => '交付需求数')
  7910. ),
  7911. 'filter' => array()
  7912. ),
  7913. 'filters' => array(),
  7914. 'stage' => 'published',
  7915. 'builtin' => '1'
  7916. );
  7917. $config->bi->builtin->charts[] = array
  7918. (
  7919. 'id' => 20013,
  7920. 'name' => '应用数据-项目需求概况表',
  7921. 'code' => 'appData_projectStoryOverview',
  7922. 'dimension' => '1',
  7923. 'type' => 'table',
  7924. 'group' => '60',
  7925. 'sql' => <<<EOT
  7926. SELECT * FROM (
  7927. SELECT
  7928. t1.id,
  7929. t1.name,
  7930. t3.year,
  7931. t3.month,
  7932. IFNULL(t1.count, 0) AS createdStories,
  7933. IFNULL(t2.count, 0) AS deliveredStories
  7934. FROM
  7935. (
  7936. select distinct year(date) as `year`, month(date) as month
  7937. from zt_action
  7938. )
  7939. as t3 left join
  7940. (
  7941. SELECT
  7942. t3.id,
  7943. t3.NAME,
  7944. YEAR ( t1.openedDate ) AS YEAR,
  7945. MONTH ( t1.openedDate ) AS MONTH,
  7946. COUNT( t1.id ) AS count
  7947. FROM
  7948. zt_story AS t1
  7949. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.story
  7950. LEFT JOIN zt_project AS t3 ON t2.project = t3.id
  7951. WHERE
  7952. t3.type = 'project'
  7953. AND t1.deleted = '0'
  7954. AND t3.deleted = '0'
  7955. GROUP BY
  7956. t3.id,
  7957. YEAR,
  7958. MONTH
  7959. ) AS t1 on t1.year = t3.year and t1.month = t3.month
  7960. LEFT JOIN (
  7961. SELECT
  7962. t1.id,
  7963. t1.NAME,
  7964. t1.YEAR,
  7965. t1.MONTH,
  7966. COUNT( t1.story ) AS count
  7967. FROM
  7968. (
  7969. SELECT
  7970. t3.id,
  7971. t3.NAME,
  7972. YEAR ( t4.date ) AS YEAR,
  7973. MONTH ( t4.date ) AS MONTH,
  7974. t1.id AS story
  7975. FROM
  7976. zt_story AS t1
  7977. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.story
  7978. LEFT JOIN zt_project AS t3 ON t2.project = t3.id
  7979. LEFT JOIN ( SELECT objectID, MAX( date ) AS date FROM zt_action WHERE objectType = 'story' AND action = 'linked2release' GROUP BY objectID ) AS t4 ON t1.id = t4.objectID
  7980. WHERE
  7981. t3.type = 'project'
  7982. AND t1.deleted = '0'
  7983. AND t3.deleted = '0'
  7984. AND EXISTS ( SELECT 1 FROM zt_action WHERE objectID = t1.id AND objectType = 'story' AND action = 'linked2release' ) UNION
  7985. SELECT
  7986. t3.id,
  7987. t3.NAME,
  7988. YEAR ( t1.closedDate ) AS YEAR,
  7989. MONTH ( t1.closedDate ) AS MONTH,
  7990. t1.id AS story
  7991. FROM
  7992. zt_story AS t1
  7993. LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.story
  7994. LEFT JOIN zt_project AS t3 ON t2.project = t3.id
  7995. WHERE
  7996. t3.type = 'project'
  7997. AND t1.STATUS = 'closed'
  7998. AND t1.closedReason = 'done'
  7999. AND t1.deleted = '0'
  8000. AND t3.deleted = '0'
  8001. ) AS t1
  8002. GROUP BY
  8003. t1.id,
  8004. t1.name,
  8005. t1.YEAR,
  8006. t1.MONTH
  8007. ) AS t2 ON t1.id = t2.id
  8008. AND t3.YEAR = t2.YEAR
  8009. AND t3.MONTH = t2.MONTH
  8010. ) AS t WHERE t.id IS NOT NULL
  8011. EOT
  8012. ,
  8013. 'settings' => array
  8014. (
  8015. 'group' => array(),
  8016. 'column' => array
  8017. (
  8018. array('field' => 'name', 'valOrAgg' => 'value', 'name' => '项目'),
  8019. array('field' => 'createdStories', 'valOrAgg' => 'value', 'name' => '新增研发需求数'),
  8020. array('field' => 'deliveredStories', 'valOrAgg' => 'value', 'name' => '交付需求数')
  8021. ),
  8022. 'filter' => array()
  8023. ),
  8024. 'filters' => array(),
  8025. 'stage' => 'published',
  8026. 'builtin' => '1'
  8027. );
  8028. $config->bi->builtin->charts[] = array
  8029. (
  8030. 'id' => 20014,
  8031. 'name' => '使用数据分析-当前版本',
  8032. 'code' => 'appData_currentVersion',
  8033. 'dimension' => '1',
  8034. 'type' => 'card',
  8035. 'group' => '58',
  8036. 'sql' => <<<EOT
  8037. SELECT REPLACE(REPLACE(REPLACE(value, 'max', '旗舰版'), 'biz', '企业版'), 'pro', '专业版') as version FROM zt_config WHERE owner = 'system' AND module = 'common' AND section = 'global' AND `key` = 'version'
  8038. EOT
  8039. ,
  8040. 'settings' => array
  8041. (
  8042. 'value' => array('type' => 'value', 'field' => 'version', 'agg' => 'value'),
  8043. 'title' => array('type' => 'text', 'name' => ''),
  8044. 'type' => 'value'
  8045. ),
  8046. 'stage' => 'published',
  8047. 'builtin' => '1'
  8048. );
  8049. $config->bi->builtin->charts[] = array
  8050. (
  8051. 'id' => 20015,
  8052. 'name' => '使用数据分析-上线时间',
  8053. 'code' => 'appData_onlineDate',
  8054. 'dimension' => '1',
  8055. 'type' => 'card',
  8056. 'group' => '58',
  8057. 'sql' => <<<EOT
  8058. select `value` as date from zt_config where `owner` = 'system' and `key` = 'installedDate'
  8059. EOT
  8060. ,
  8061. 'settings' => array
  8062. (
  8063. 'value' => array('type' => 'value', 'field' => 'date', 'agg' => 'value'),
  8064. 'title' => array('type' => 'text', 'name' => ''),
  8065. 'type' => 'value'
  8066. ),
  8067. 'filters' => array(),
  8068. 'stage' => 'published',
  8069. 'builtin' => '1'
  8070. );
  8071. $config->bi->builtin->charts[] = array
  8072. (
  8073. 'id' => 30000,
  8074. 'name' => '流水线执行趋势图',
  8075. 'code' => 'pipelineExecTrend',
  8076. 'dimension' => '1',
  8077. 'type' => 'line',
  8078. 'group' => '103',
  8079. 'sql' => <<<EOT
  8080. SELECT
  8081. base.YEARMONTH,
  8082. base.`year`,
  8083. CONCAT(base.`month`, '月') as `month`,
  8084. CONCAT(base.`day`, '日') as `day`,
  8085. IFNULL(compile_stats.execNum, 0) as execNum,
  8086. IFNULL(compile_stats.successNum, 0) as successNum
  8087. FROM (
  8088. SELECT DISTINCT
  8089. DATE_FORMAT(date, '%Y-%m-%d') as YEARMONTH,
  8090. YEAR(date) as `year`,
  8091. MONTH(date) as `month`,
  8092. DAY(date) as `day`
  8093. FROM zt_action
  8094. WHERE date IS NOT NULL
  8095. ) base
  8096. LEFT JOIN (
  8097. SELECT
  8098. DATE_FORMAT(createdDate, '%Y-%m-%d') as YEARMONTH,
  8099. YEAR(createdDate) as `year`,
  8100. MONTH(createdDate) as `month`,
  8101. DAY(createdDate) as `day`,
  8102. COUNT(1) as execNum,
  8103. SUM(CASE WHEN status = 'success' THEN 1 ELSE 0 END) as successNum
  8104. FROM zt_compile
  8105. WHERE deleted = '0'
  8106. GROUP BY
  8107. DATE_FORMAT(createdDate, '%Y-%m-%d'),
  8108. YEAR(createdDate),
  8109. MONTH(createdDate),
  8110. DAY(createdDate)
  8111. ) compile_stats ON base.YEARMONTH = compile_stats.YEARMONTH
  8112. WHERE base.year > 0
  8113. ORDER BY base.`year`, base.`month`, base.`day` LIMIT 999999;
  8114. EOT
  8115. ,
  8116. 'settings' => array(
  8117. array(
  8118. 'type' => 'line',
  8119. 'xaxis' => array(
  8120. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  8121. ),
  8122. 'yaxis' => array(
  8123. array('field' => 'execNum', 'name' => 'execNum', 'valOrAgg' => 'sum'),
  8124. array('field' => 'successNum', 'name' => 'successNum', 'valOrAgg' => 'sum')
  8125. )
  8126. ),
  8127. ),
  8128. 'filters' => array(),
  8129. 'fields' => array(
  8130. 'YEARMONTH' => array('name' => 'YEARMONTH', 'object' => 'compile', 'field' => 'YEARMONTH', 'type' => 'string'),
  8131. 'year' => array('name' => 'year', 'object' => 'compile', 'field' => 'year', 'type' => 'number'),
  8132. 'month' => array('name' => 'month', 'object' => 'compile', 'field' => 'month', 'type' => 'string'),
  8133. 'day' => array('name' => 'day', 'object' => 'compile', 'field' => 'day', 'type' => 'string'),
  8134. 'execNum' => array('name' => 'execNum', 'object' => 'compile', 'field' => 'execNum', 'type' => 'string'),
  8135. 'successNum' => array('name' => 'successNum', 'object' => 'compile', 'field' => 'successNum', 'type' => 'number')
  8136. ),
  8137. 'langs' => array(
  8138. 'YEARMONTH' => array('zh-cn' => '日期', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8139. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8140. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8141. 'day' => array('zh-cn' => '天', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8142. 'execNum' => array('zh-cn' => '执行总数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8143. 'successNum' => array('zh-cn' => '成功数量', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  8144. ),
  8145. 'stage' => 'published',
  8146. 'builtin' => '0'
  8147. );
  8148. $config->bi->builtin->charts[] = array
  8149. (
  8150. 'id' => 30001,
  8151. 'name' => '代码问题趋势图',
  8152. 'code' => 'repoIssueTrend',
  8153. 'dimension' => '1',
  8154. 'type' => 'line',
  8155. 'group' => '103',
  8156. 'sql' => <<<EOT
  8157. SELECT
  8158. DATE_FORMAT(base_dates.date, '%Y-%m-%d') as YEARMONTH,
  8159. YEAR(base_dates.date) as `year`,
  8160. CONCAT(MONTH(base_dates.date), '月') as `month`,
  8161. CONCAT(DAY(base_dates.date), '日') as `day`,
  8162. IFNULL(new_bugs.bug_count, 0) as newIssue,
  8163. IFNULL(resolved_bugs.bug_count, 0) as resolvedIssue
  8164. FROM (
  8165. SELECT DISTINCT DATE(date) as date
  8166. FROM zt_action
  8167. WHERE date IS NOT NULL
  8168. ) base_dates
  8169. LEFT JOIN (
  8170. SELECT
  8171. DATE(openedDate) as bug_date,
  8172. COUNT(1) as bug_count
  8173. FROM zt_bug
  8174. WHERE repo > 0
  8175. AND deleted = '0'
  8176. GROUP BY DATE(openedDate)
  8177. ) new_bugs ON base_dates.date = new_bugs.bug_date
  8178. LEFT JOIN (
  8179. SELECT
  8180. DATE(resolvedDate) as bug_date,
  8181. COUNT(1) as bug_count
  8182. FROM zt_bug
  8183. WHERE repo > 0
  8184. AND deleted = '0'
  8185. GROUP BY DATE(resolvedDate)
  8186. ) resolved_bugs ON base_dates.date = resolved_bugs.bug_date
  8187. WHERE YEAR(base_dates.date) > 0
  8188. ORDER BY base_dates.date LIMIT 999999
  8189. EOT
  8190. ,
  8191. 'settings' => array(
  8192. array(
  8193. 'type' => 'line',
  8194. 'xaxis' => array(
  8195. array('field' => 'YEARMONTH', 'name' => 'YEARMONTH', 'group' => '')
  8196. ),
  8197. 'yaxis' => array(
  8198. array('field' => 'newIssue', 'name' => 'newIssue', 'valOrAgg' => 'sum'),
  8199. array('field' => 'resolvedIssue', 'name' => 'resolvedIssue', 'valOrAgg' => 'sum')
  8200. )
  8201. ),
  8202. ),
  8203. 'filters' => array(),
  8204. 'fields' => array (
  8205. 'YEARMONTH' => array ('name' => 'YEARMONTH', 'object' => 'bug', 'field' => 'YEARMONTH', 'type' => 'string'),
  8206. 'year' => array ('name' => 'year', 'object' => 'bug', 'field' => 'year', 'type' => 'number'),
  8207. 'month' => array ('name' => 'month', 'object' => 'bug', 'field' => 'month', 'type' => 'string'),
  8208. 'day' => array ('name' => 'day', 'object' => 'bug', 'field' => 'day', 'type' => 'string'),
  8209. 'newIssue' => array ('name' => 'newIssue', 'object' => 'bug', 'field' => 'newIssue', 'type' => 'string'),
  8210. 'resolvedIssue' => array ('name' => 'resolvedIssue', 'object' => 'bug', 'field' => 'resolvedIssue', 'type' => 'string')
  8211. ),
  8212. 'langs' => array(
  8213. 'YEARMONTH' => array('zh-cn' => '日期', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8214. 'year' => array('zh-cn' => '年份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8215. 'month' => array('zh-cn' => '月份', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8216. 'day' => array('zh-cn' => '天', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8217. 'newIssue' => array('zh-cn' => '新增问题数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
  8218. 'resolvedIssue' => array('zh-cn' => '解决问题数', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => '')
  8219. ),
  8220. 'stage' => 'published',
  8221. 'builtin' => '0'
  8222. );