12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058 |
- package com.ruoyi.project.pssr.controller;
- import com.ruoyi.common.utils.DateUtils;
- import com.ruoyi.common.utils.StringUtils;
- import com.ruoyi.common.utils.document.ZipUtil;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.framework.aspectj.lang.annotation.Log;
- import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
- import com.ruoyi.framework.web.controller.BaseController;
- import com.ruoyi.framework.web.domain.AjaxResult;
- import com.ruoyi.framework.web.page.TableDataInfo;
- import com.ruoyi.project.approve.damain.DevTask;
- import com.ruoyi.project.listener.pssr.ConfirmTaskCreateListener;
- import com.ruoyi.project.patrol.commonuse.controller.TCommonuseTesterController;
- import com.ruoyi.project.patrol.commonuse.domain.TCommonuseTester;
- import com.ruoyi.project.patrol.emergency.controller.TEmergencyCabinetController;
- import com.ruoyi.project.patrol.emergency.controller.TEmergencyCctvController;
- import com.ruoyi.project.patrol.emergency.controller.TEmergencyEyewashController;
- import com.ruoyi.project.patrol.emergency.controller.TEmergencyPagaController;
- import com.ruoyi.project.patrol.emergency.domain.TEmergencyCabinet;
- import com.ruoyi.project.patrol.emergency.domain.TEmergencyCctv;
- import com.ruoyi.project.patrol.emergency.domain.TEmergencyEyewash;
- import com.ruoyi.project.patrol.emergency.domain.TEmergencyPaga;
- import com.ruoyi.project.patrol.fire.controller.*;
- import com.ruoyi.project.patrol.fire.domain.*;
- import com.ruoyi.project.plant.domain.TStaffmgr;
- import com.ruoyi.project.pssr.domain.*;
- import com.ruoyi.project.pssr.domain.dto.TPssrApproveDto;
- import com.ruoyi.project.pssr.service.*;
- import com.ruoyi.project.system.domain.SysUser;
- import com.ruoyi.project.system.mapper.SysUserMapper;
- import com.ruoyi.project.system.service.ISysUserService;
- import org.activiti.engine.*;
- import org.activiti.engine.impl.identity.Authentication;
- import org.activiti.engine.impl.util.CollectionUtil;
- import org.activiti.engine.runtime.ProcessInstance;
- import org.activiti.engine.task.Task;
- import org.apache.commons.collections4.CollectionUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.io.File;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Paths;
- import java.nio.file.StandardCopyOption;
- import java.util.*;
- import static com.ruoyi.framework.config.RuoYiConfig.getProfile;
- /**
- * pssr审批管理Controller
- *
- * @author ssy
- * @date 2024-09-18
- */
- @RestController
- @RequestMapping("/pssr/approve")
- public class TPssrApproveController extends BaseController {
- @Resource
- private SysUserMapper userMapper;
- @Autowired
- private RuntimeService runtimeService;
- @Autowired
- private HistoryService historyService;
- @Autowired
- private TaskService taskService;
- @Autowired
- private ITPssrApproveService tPssrApproveService;
- @Autowired
- private ITPssrPatrolService tPssrPatrolService;
- @Autowired
- private ITPssrAboveallService tPssrAboveallService;
- @Autowired
- private ITPssrSubcontentService tPssrSubcontentService;
- @Autowired
- private ITPssrOverhaulExchangerService tPssrOverhaulExchangerService;
- @Autowired
- private ITPssrOverhaulFilterService tPssrOverhaulFilterService;
- @Autowired
- private ITPssrOverhaulPipeService tPssrOverhaulPipeService;
- @Autowired
- private ITPssrOverhaulTowerService tPssrOverhaulTowerService;
- @Autowired
- private ITPssrOverhaulPumpService tPssrOverhaulPumpService;
- @Autowired
- private ITPssrOverhaulValveService tPssrOverhaulValveService;
- @Autowired
- private ITPssrBlindService tPssrBlindService;
- @Autowired
- private ITPssrLockService tPssrLockService;
- @Autowired
- private ITPssrPipeService tPssrPipeService;
- @Autowired
- private ISysUserService userService;
- @Autowired
- private ITPssrHygieneService tPssrHygieneService;
- @Autowired
- private ITPssrCleaningService tPssrCleaningService;
- @Autowired
- private ITPssrAirtightService tPssrAirtightService;
- @Autowired
- private ITPssrLaboratoryService tPssrLaboratoryService;
- @Autowired
- private ITPssrMocService tPssrMocService;
- @Autowired
- private ITPssrCircuitService tPssrCircuitService;
- @Autowired
- private ITPssrPublicService tPssrPublicService;
- @Autowired
- private ITPssrSafetyBleedService tPssrSafetyBleedService;
- @Autowired
- private ITPssrSafetyBreathService tPssrSafetyBreathService;
- @Autowired
- private ITPssrSafetyBrustService tPssrSafetyBrustService;
- @Autowired
- private ITPssrSafetyFlamearresterService tPssrSafetyFlamearresterService;
- @Autowired
- private ITPssrSafetyValveService tPssrSafetyValveService;
- @Autowired
- private ITPssrFrameService tPssrFrameService;
- @Autowired
- private ITPssrMotorService tPssrMotorService;
- @Autowired
- private ITPssrInstrumentCalibrationService tPssrInstrumentCalibrationService;
- @Autowired
- private ITPssrNitrogenService tPssrNitrogenService;
- @Autowired
- private ITPssrFranklinismService tPssrFranklinismService;
- @Autowired
- private ITPssrGasdetectorService tPssrGasdetectorService;
- @Autowired
- private ITPssrAnalyzerService tPssrAnalyzerService;
- @Autowired
- private ITPssrMeasureService tPssrMeasureService;
- @Autowired
- private ITPssrProtectionService tPssrProtectionService;
- @Autowired
- private ITPssrTorchvocService tPssrTorchvocService;
- @Autowired
- private ITPssrLightingService tPssrLightingService;
- @Autowired
- private ITPssrMaterialService tPssrMaterialService;
- @Autowired
- private ITPssrMaterialRawService tPssrMaterialRawService;
- @Autowired
- private ITPssrPumpFillService tPssrPumpFillService;
- @Autowired
- private ITPssrPumpCleaningService tPssrPumpCleaningService;
- @Autowired
- private ITPssrPumpOverhaulService tPssrPumpOverhaulService;
- @Autowired
- private ITPssrInstrumentTestService tPssrInstrumentTestService;
- @Autowired
- private ITPssrAlarmService tPssrAlarmService;
- @Autowired
- private ITPssrVesselService tPssrVesselService;
- @Autowired
- private ITPssrProgrammeService tPssrProgrammeService;
- @Autowired
- private ITPssrPowerService tPssrPowerService;
- @Autowired
- private TPssrBlindController blindController;
- @Autowired
- private TPssrAirtightController airtightController;
- @Autowired
- private TPssrAnalyzerController analyzerController;
- @Autowired
- private TPssrFrameController frameController;
- @Autowired
- private TPssrPipeController pipeController;
- @Autowired
- private TPssrVesselController vesselController;
- @Autowired
- private TPssrCircuitController circuitController;
- @Autowired
- private TPssrCleaningController cleaningController;
- @Autowired
- private TPssrFranklinismController franklinismController;
- @Autowired
- private TPssrGasdetectorController gasdetectorController;
- @Autowired
- private TPssrHygieneController hygieneController;
- @Autowired
- private TPssrInstrumentCalibrationController instrumentCalibrationController;
- @Autowired
- private TPssrLaboratoryController laboratoryController;
- @Autowired
- private TPssrLockController lockController;
- @Autowired
- private TPssrMaterialController materialController;
- @Autowired
- private TPssrMaterialRawController materialRawController;
- @Autowired
- private TPssrPumpCleaningController pumpCleaningController;
- @Autowired
- private TPssrPumpFillController pumpFillController;
- @Autowired
- private TPssrPumpOverhaulController pumpOverhaulController;
- @Autowired
- private TPssrMocController mocController;
- @Autowired
- private TPssrMotorController motorController;
- @Autowired
- private TPssrLightingController lightingController;
- @Autowired
- private TPssrNitrogenController nitrogenController;
- @Autowired
- private TPssrSafetyController safetyController;
- @Autowired
- private TPssrPatrolController patrolController;
- @Autowired
- private TPssrPowerController powerController;
- @Autowired
- private TPssrProgrammeController programmeController;
- @Autowired
- private TPssrPublicController publicController;
- @Autowired
- private TCommonuseTesterController testerController;
- @Autowired
- private TEmergencyPagaController pagaController;
- @Autowired
- private TEmergencyCctvController cctvController;
- @Autowired
- private TPssrOverhaulExchangerController exchangerController;
- @Autowired
- private TPssrOverhaulFilterController filterController;
- @Autowired
- private TPssrOverhaulTowerController towerController;
- @Autowired
- private TPssrOverhaulValveController valveController;
- @Autowired
- private TPssrProtectionController protectionController;
- @Autowired
- private TPssrMeasureController measureController;
- @Autowired
- private TPssrSafetyBleedController bleedController;
- @Autowired
- private TFireAidkitController aidkitController;
- @Autowired
- private TFireAlarmController alarmController;
- @Autowired
- private TFireAnnihilatorController annihilatorController;
- @Autowired
- private TFireDoorController doorController;
- @Autowired
- private TFireGasShieldController gasShieldController;
- @Autowired
- private TEmergencyEyewashController eyewashController;
- @Autowired
- private TFireHoseBoxController hoseBoxController;
- @Autowired
- private TFirePostFireController postFireController;
- @Autowired
- private TFireSandboxController sandboxController;
- @Autowired
- private TFireSprinklerController sprinklerController;
- @Autowired
- private TEmergencyCabinetController cabinetController;
- @Autowired
- private TFireStandpipeController standpipeController;
- @Autowired
- private TFireSteamCurtainController steamCurtainController;
- @Autowired
- private TFireWaterCannonController waterCannonController;
- @Autowired
- private TFireWeathervaneController weathervaneController;
- @Autowired
- private TPssrSafetyBreathController breathController;
- @Autowired
- private TPssrSafetyBrustController brustController;
- @Autowired
- private TPssrSafetyFlamearresterController flamearresterController;
- @Autowired
- private TPssrSafetyValveController safetyValveController;
- @Autowired
- private TPssrTorchvocController torchvocController;
- @PutMapping("/handleConfirm")
- public AjaxResult handleConfirm(@RequestBody TPssrApproveDto dto) {
- TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(dto.getSubId());
- switch (tPssrSubcontent.getForShort()) {
- case "jxxm"://检修项目
- switch (dto.getSubName()) {
- case "exchanger":
- TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
- exchanger.setSubId(dto.getSubId());
- exchanger.setIds(dto.getIds());
- return exchangerController.confirmExchanger(exchanger);
- case "filter":
- TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
- filter.setSubId(dto.getSubId());
- filter.setIds(dto.getIds());
- return filterController.confirmFilter(filter);
- case "tower":
- TPssrOverhaulTower tower = new TPssrOverhaulTower();
- tower.setSubId(dto.getSubId());
- tower.setIds(dto.getIds());
- return towerController.confirmTower(tower);
- case "valve":
- TPssrOverhaulValve valve = new TPssrOverhaulValve();
- valve.setSubId(dto.getSubId());
- valve.setIds(dto.getIds());
- return valveController.confirmValve(valve);
- }
- return AjaxResult.error("确认失败!");
- case "kgfa"://开工方案
- TPssrProgramme programme = new TPssrProgramme();
- programme.setSubId(dto.getSubId());
- programme.setIds(dto.getIds());
- programme.setTaskType(dto.getTaskType());
- return programmeController.confirmProgramme(programme);
- case "sjbg"://设计变更
- TPssrMoc moc = new TPssrMoc();
- moc.setSubId(dto.getSubId());
- moc.setIds(dto.getIds());
- moc.setTaskType(dto.getTaskType());
- return mocController.confirmMoc(moc);
- case "mb"://盲板
- TPssrBlind blind = new TPssrBlind();
- blind.setSubId(dto.getSubId());
- blind.setIds(dto.getIds());
- blind.setTaskType(dto.getTaskType());
- return blindController.confirmBlind(blind);
- case "xcws"://现场卫生
- TPssrHygiene hygiene = new TPssrHygiene();
- hygiene.setSubId(dto.getSubId());
- hygiene.setIds(dto.getIds());
- hygiene.setTaskType(dto.getTaskType());
- return hygieneController.confirmHygiene(hygiene);
- case "rsfh"://人身防护
- switch (dto.getSubName()) {
- case "protection":
- TPssrProtection protection = new TPssrProtection();
- protection.setSubId(dto.getSubId());
- protection.setIds(dto.getIds());
- protection.setTaskType(dto.getTaskType());
- return protectionController.confirmProtection(protection);
- case "measure":
- TPssrMeasure measure = new TPssrMeasure();
- measure.setSubId(dto.getSubId());
- measure.setIds(dto.getIds());
- measure.setTaskType(dto.getTaskType());
- return measureController.confirmMeasure(measure);
- }
- return AjaxResult.error("确认失败!");
- case "sbqjd"://设备清洁度
- TPssrCleaning cleaning = new TPssrCleaning();
- cleaning.setSubId(dto.getSubId());
- cleaning.setIds(dto.getIds());
- cleaning.setTaskType(dto.getTaskType());
- return cleaningController.confirmCleaning(cleaning);
- case "qm"://气密
- TPssrAirtight airtight = new TPssrAirtight();
- airtight.setSubId(dto.getSubId());
- airtight.setIds(dto.getIds());
- airtight.setTaskType(dto.getTaskType());
- return airtightController.confirmAirtight(airtight);
- case "sksgfmzt"://锁开锁关阀门状态
- TPssrLock lock = new TPssrLock();
- lock.setSubId(dto.getSubId());
- lock.setIds(dto.getIds());
- lock.setTaskType(dto.getTaskType());
- return lockController.confirmLock(lock);
- case "sys"://实验室
- TPssrLaboratory laboratory = new TPssrLaboratory();
- laboratory.setSubId(dto.getSubId());
- laboratory.setIds(dto.getIds());
- laboratory.setTaskType(dto.getTaskType());
- return laboratoryController.confirmLaboratory(laboratory);
- case "dj"://短接
- TPssrCircuit circuit = new TPssrCircuit();
- circuit.setSubId(dto.getSubId());
- circuit.setIds(dto.getIds());
- circuit.setTaskType(dto.getTaskType());
- return circuitController.confirmCircuit(circuit);
- case "dqzh"://氮气置换
- TPssrNitrogen nitrogen = new TPssrNitrogen();
- nitrogen.setSubId(dto.getSubId());
- nitrogen.setIds(dto.getIds());
- nitrogen.setTaskType(dto.getTaskType());
- return nitrogenController.confirmNitrogen(nitrogen);
- case "xqf"://消气防设施
- return AjaxResult.success();
- case "aqss"://安全设施
- switch (dto.getSubName()) {
- case "bleed":
- TPssrSafetyBleed bleed = new TPssrSafetyBleed();
- bleed.setSubId(dto.getSubId());
- bleed.setIds(dto.getIds());
- bleed.setTaskType(dto.getTaskType());
- return safetyController.confirmBleed(bleed);
- case "breath":
- TPssrSafetyBreath breath = new TPssrSafetyBreath();
- breath.setSubId(dto.getSubId());
- breath.setIds(dto.getIds());
- breath.setTaskType(dto.getTaskType());
- return safetyController.confirmBreath(breath);
- case "brust":
- TPssrSafetyBrust brust = new TPssrSafetyBrust();
- brust.setSubId(dto.getSubId());
- brust.setIds(dto.getIds());
- brust.setTaskType(dto.getTaskType());
- return safetyController.confirmBrust(brust);
- case "flamearrester":
- TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
- flamearrester.setSubId(dto.getSubId());
- flamearrester.setIds(dto.getIds());
- flamearrester.setTaskType(dto.getTaskType());
- return safetyController.confirmFlamearrester(flamearrester);
- case "valve":
- TPssrSafetyValve safetyValve = new TPssrSafetyValve();
- safetyValve.setSubId(dto.getSubId());
- safetyValve.setIds(dto.getIds());
- safetyValve.setTaskType(dto.getTaskType());
- return safetyController.confirmValve(safetyValve);
- }
- case "txjk"://通讯监控
- return AjaxResult.success();
- case "bxsjcy"://便携式检测仪
- return AjaxResult.success();
- case "gygc"://公用工程
- TPssrPublic pssrPublic = new TPssrPublic();
- pssrPublic.setSubId(dto.getSubId());
- pssrPublic.setIds(dto.getIds());
- pssrPublic.setTaskType(dto.getTaskType());
- return publicController.confirmPublic(pssrPublic);
- case "hbss"://环保设施
- TPssrTorchvoc torchvoc = new TPssrTorchvoc();
- torchvoc.setSubId(dto.getSubId());
- torchvoc.setIds(dto.getIds());
- torchvoc.setTaskType(dto.getTaskType());
- torchvoc.setTorchvocType(dto.getTorchvocType());
- return torchvocController.confirmTorchvoc(torchvoc);
- case "yfl"://原辅料
- switch (dto.getSubName()) {
- case "material":
- TPssrMaterial material = new TPssrMaterial();
- material.setSubId(dto.getSubId());
- material.setIds(dto.getIds());
- material.setTaskType(dto.getTaskType());
- return materialController.confirmMaterial(material);
- case "raw":
- TPssrMaterialRaw raw = new TPssrMaterialRaw();
- raw.setSubId(dto.getSubId());
- raw.setIds(dto.getIds());
- raw.setTaskType(dto.getTaskType());
- return materialRawController.confirmMaterialRaw(raw);
- }
- case "jb"://机泵
- switch (dto.getSubName()) {
- case "cleaning":
- TPssrPumpCleaning pumpCleaning = new TPssrPumpCleaning();
- pumpCleaning.setSubId(dto.getSubId());
- pumpCleaning.setIds(dto.getIds());
- pumpCleaning.setTaskType(dto.getTaskType());
- return pumpCleaningController.confirmPumpCleaning(pumpCleaning);
- case "fill":
- TPssrPumpFill pumpFill = new TPssrPumpFill();
- pumpFill.setSubId(dto.getSubId());
- pumpFill.setIds(dto.getIds());
- pumpFill.setTaskType(dto.getTaskType());
- return pumpFillController.confirmPumpFill(pumpFill);
- case "overhaul":
- TPssrPumpOverhaul pumpOverhaul = new TPssrPumpOverhaul();
- pumpOverhaul.setSubId(dto.getSubId());
- pumpOverhaul.setIds(dto.getIds());
- pumpOverhaul.setTaskType(dto.getTaskType());
- return pumpOverhaulController.confirmPumpOverhaul(pumpOverhaul);
- }
- return AjaxResult.error("确认失败!");
- case "zdj"://支吊架
- TPssrFrame frame = new TPssrFrame();
- frame.setSubId(dto.getSubId());
- frame.setIds(dto.getIds());
- frame.setTaskType(dto.getTaskType());
- return frameController.confirmFrame(frame);
- case "tzsb"://特种设备
- switch (dto.getSubName()) {
- case "pipe":
- TPssrPipe pipe = new TPssrPipe();
- pipe.setSubId(dto.getSubId());
- pipe.setIds(dto.getIds());
- pipe.setTaskType(dto.getTaskType());
- return pipeController.confirmPipe(pipe);
- case "vessel":
- TPssrVessel vessel = new TPssrVessel();
- vessel.setSubId(dto.getSubId());
- vessel.setIds(dto.getIds());
- vessel.setTaskType(dto.getTaskType());
- return vesselController.confirmVessel(vessel);
- }
- case "ybjy"://仪表校验
- TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
- calibration.setSubId(dto.getSubId());
- calibration.setIds(dto.getIds());
- calibration.setTaskType(dto.getTaskType());
- return instrumentCalibrationController.confirmInstrumentCalibration(calibration);
- case "yblscs"://仪表联锁测试
- return AjaxResult.success();
- case "bjlszqr"://报警联锁值确认
- return AjaxResult.success();
- case "lsdy"://临时电源
- TPssrPower power = new TPssrPower();
- power.setSubId(dto.getSubId());
- power.setIds(dto.getIds());
- power.setTaskType(dto.getTaskType());
- return powerController.confirmPower(power);
- case "djsb"://电机设备
- TPssrMotor motor = new TPssrMotor();
- motor.setSubId(dto.getSubId());
- motor.setIds(dto.getIds());
- motor.setTaskType(dto.getTaskType());
- return motorController.confirmMotor(motor);
- case "zmdbr"://照明、电伴热
- TPssrLighting lighting = new TPssrLighting();
- lighting.setSubId(dto.getSubId());
- lighting.setIds(dto.getIds());
- lighting.setTaskType(dto.getTaskType());
- lighting.setLightingType(dto.getLightingType());
- return lightingController.Lighting(lighting);
- case "jdjdkj"://静电接地、跨接
- TPssrFranklinism franklinism = new TPssrFranklinism();
- franklinism.setSubId(dto.getSubId());
- franklinism.setIds(dto.getIds());
- franklinism.setTaskType(dto.getTaskType());
- return franklinismController.Franklinism(franklinism);
- case "qtjcy"://气体检测仪
- TPssrGasdetector gasdetector = new TPssrGasdetector();
- gasdetector.setSubId(dto.getSubId());
- gasdetector.setIds(dto.getIds());
- gasdetector.setTaskType(dto.getTaskType());
- return gasdetectorController.Gasdetector(gasdetector);
- case "zxfxy"://在线分析仪
- TPssrAnalyzer analyzer = new TPssrAnalyzer();
- analyzer.setSubId(dto.getSubId());
- analyzer.setIds(dto.getIds());
- analyzer.setTaskType(dto.getTaskType());
- return analyzerController.Analyzer(analyzer);
- default:
- return AjaxResult.error("确认失败!");
- }
- }
- @PutMapping("/handleTurndown")
- public AjaxResult handleTurndown(@RequestBody TPssrApproveDto dto) {
- TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(dto.getSubId());
- switch (tPssrSubcontent.getForShort()) {
- case "jxxm"://检修项目
- switch (dto.getSubName()) {
- case "exchanger":
- List<TPssrOverhaulExchanger> exchangers = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
- exchanger.setSubId(dto.getSubId());
- exchanger.setId(item.getId());
- exchanger.setReason(item.getReason());
- exchangers.add(exchanger);
- }
- return exchangerController.turnDownExchanger(exchangers);
- case "filter":
- List<TPssrOverhaulFilter> filters = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
- filter.setSubId(dto.getSubId());
- filter.setId(item.getId());
- filter.setReason(item.getReason());
- filters.add(filter);
- }
- return filterController.turnDownFilter(filters);
- case "":
- List<TPssrOverhaulTower> towers = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrOverhaulTower tower = new TPssrOverhaulTower();
- tower.setSubId(dto.getSubId());
- tower.setId(item.getId());
- tower.setReason(item.getReason());
- towers.add(tower);
- }
- return towerController.turnDownTower(towers);
- case "valve":
- List<TPssrOverhaulValve> valves = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrOverhaulValve valve = new TPssrOverhaulValve();
- valve.setSubId(dto.getSubId());
- valve.setId(item.getId());
- valve.setReason(item.getReason());
- valves.add(valve);
- }
- return valveController.turnDownValve(valves);
- }
- return AjaxResult.error("驳回失败!");
- case "kgfa"://开工方案
- List<TPssrProgramme> programmes = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrProgramme programme = new TPssrProgramme();
- programme.setSubId(dto.getSubId());
- programme.setId(item.getId());
- programme.setReason(item.getReason());
- programmes.add(programme);
- }
- return programmeController.turnDownProgramme(programmes);
- case "sjbg"://设计变更
- List<TPssrMoc> mocs = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrMoc moc = new TPssrMoc();
- moc.setSubId(dto.getSubId());
- moc.setId(item.getId());
- moc.setReason(item.getReason());
- mocs.add(moc);
- }
- return mocController.turnDownMoc(mocs);
- case "mb"://盲板
- List<TPssrBlind> blinds = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrBlind blind = new TPssrBlind();
- blind.setSubId(dto.getSubId());
- blind.setId(item.getId());
- blind.setReason(item.getReason());
- blinds.add(blind);
- }
- return blindController.turnDownBlind(blinds);
- case "xcws"://现场卫生
- List<TPssrHygiene> hygeins = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrHygiene hygien = new TPssrHygiene();
- hygien.setSubId(dto.getSubId());
- hygien.setId(item.getId());
- hygien.setReason(item.getReason());
- hygeins.add(hygien);
- }
- return hygieneController.turnDownHygiene(hygeins);
- case "rsfh"://人身防护
- switch (dto.getSubName()) {
- case "protection":
- List<TPssrProtection> protections = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrProtection protection = new TPssrProtection();
- protection.setSubId(dto.getSubId());
- protection.setId(item.getId());
- protection.setReason(item.getReason());
- protections.add(protection);
- }
- return protectionController.turnDownProtection(protections);
- case "measure":
- List<TPssrMeasure> measures = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrMeasure measure = new TPssrMeasure();
- measure.setSubId(dto.getSubId());
- measure.setId(item.getId());
- measure.setReason(item.getReason());
- measures.add(measure);
- }
- return measureController.turnDownMeasure(measures);
- }
- return AjaxResult.error("驳回失败!");
- case "sbqjd"://设备清洁度
- List<TPssrCleaning> cleans = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrCleaning clean = new TPssrCleaning();
- clean.setSubId(dto.getSubId());
- clean.setId(item.getId());
- clean.setReason(item.getReason());
- cleans.add(clean);
- }
- return cleaningController.turnDownCleaning(cleans);
- case "qm"://气密
- List<TPssrAirtight> airtights = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrAirtight airtight = new TPssrAirtight();
- airtight.setSubId(dto.getSubId());
- airtight.setId(item.getId());
- airtight.setReason(item.getReason());
- airtights.add(airtight);
- }
- return airtightController.turnDownAirtight(airtights);
- case "sksgfmzt"://锁开锁关阀门状态
- List<TPssrLock> locks = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrLock lock = new TPssrLock();
- lock.setSubId(dto.getSubId());
- lock.setId(item.getId());
- lock.setReason(item.getReason());
- locks.add(lock);
- }
- return lockController.turnDownLock(locks);
- case "sys"://实验室
- List<TPssrLaboratory> laboratories = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrLaboratory laboratory = new TPssrLaboratory();
- laboratory.setSubId(dto.getSubId());
- laboratory.setId(item.getId());
- laboratory.setReason(item.getReason());
- laboratories.add(laboratory);
- }
- return laboratoryController.turnDownLaboratory(laboratories);
- case "dj"://短接
- List<TPssrCircuit> circuits = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrCircuit circuit = new TPssrCircuit();
- circuit.setSubId(dto.getSubId());
- circuit.setId(item.getId());
- circuit.setReason(item.getReason());
- circuits.add(circuit);
- }
- return circuitController.turnDownCircuit(circuits);
- case "dqzh"://氮气置换
- List<TPssrNitrogen> nitrogens = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrNitrogen nitrogen = new TPssrNitrogen();
- nitrogen.setSubId(dto.getSubId());
- nitrogen.setId(item.getId());
- nitrogen.setReason(item.getReason());
- nitrogens.add(nitrogen);
- }
- return nitrogenController.turnDownNitrogen(nitrogens);
- case "xqf"://消气防设施
- return AjaxResult.success();
- case "aqss"://安全设施
- switch (dto.getSubName()) {
- case "bleed":
- List<TPssrSafetyBleed> bleeds = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrSafetyBleed bleed = new TPssrSafetyBleed();
- bleed.setSubId(dto.getSubId());
- bleed.setId(item.getId());
- bleed.setReason(item.getReason());
- bleeds.add(bleed);
- }
- return safetyController.turnDownBleed(bleeds);
- case "breath":
- List<TPssrSafetyBreath> breaths = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrSafetyBreath breath = new TPssrSafetyBreath();
- breath.setSubId(dto.getSubId());
- breath.setId(item.getId());
- breath.setReason(item.getReason());
- breaths.add(breath);
- }
- return safetyController.turnDownBreath(breaths);
- case "brust":
- List<TPssrSafetyBrust> brusts = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrSafetyBrust brust = new TPssrSafetyBrust();
- brust.setSubId(dto.getSubId());
- brust.setId(item.getId());
- brust.setReason(item.getReason());
- brusts.add(brust);
- }
- return safetyController.turnDownBrust(brusts);
- case "flamearrester":
- List<TPssrSafetyFlamearrester> flamearresters = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
- flamearrester.setSubId(dto.getSubId());
- flamearrester.setId(item.getId());
- flamearrester.setReason(item.getReason());
- flamearresters.add(flamearrester);
- }
- return safetyController.turnDownFlamearrester(flamearresters);
- case "valve":
- List<TPssrSafetyValve> valves = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrSafetyValve valve = new TPssrSafetyValve();
- valve.setSubId(dto.getSubId());
- valve.setId(item.getId());
- valve.setReason(item.getReason());
- valves.add(valve);
- }
- return safetyController.turnDownValve(valves);
- }
- return AjaxResult.error("驳回失败!");
- case "txjk"://通讯监控
- return AjaxResult.success();
- case "bxsjcy"://便携式检测仪
- return AjaxResult.success();
- case "gygc"://公用工程
- List<TPssrPublic> publics = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPublic pssrPublic = new TPssrPublic();
- pssrPublic.setSubId(dto.getSubId());
- pssrPublic.setId(item.getId());
- pssrPublic.setReason(item.getReason());
- publics.add(pssrPublic);
- }
- return publicController.turnDownPublic(publics);
- case "hbss"://环保设施
- List<TPssrTorchvoc> torchvocs = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrTorchvoc torchvoc = new TPssrTorchvoc();
- torchvoc.setSubId(dto.getSubId());
- torchvoc.setId(item.getId());
- torchvoc.setReason(item.getReason());
- torchvocs.add(torchvoc);
- }
- return torchvocController.turnDownTorchvoc(torchvocs);
- case "yfl"://原辅料
- switch (dto.getSubName()) {
- case "material":
- List<TPssrMaterial> materials = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrMaterial material = new TPssrMaterial();
- material.setSubId(dto.getSubId());
- material.setId(item.getId());
- material.setReason(item.getReason());
- materials.add(material);
- }
- return materialController.turnDownMaterial(materials);
- case "raw":
- List<TPssrMaterialRaw> raws = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrMaterialRaw raw = new TPssrMaterialRaw();
- raw.setSubId(dto.getSubId());
- raw.setId(item.getId());
- raw.setReason(item.getReason());
- raws.add(raw);
- }
- return materialRawController.turnDownMaterialRaw(raws);
- }
- return AjaxResult.error("驳回失败!");
- case "jb"://机泵
- switch (dto.getSubName()) {
- case "cleaning":
- List<TPssrPumpCleaning> cleanings = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPumpCleaning cleaning = new TPssrPumpCleaning();
- cleaning.setSubId(dto.getSubId());
- cleaning.setId(item.getId());
- cleaning.setReason(item.getReason());
- cleanings.add(cleaning);
- }
- return pumpCleaningController.turnDownPumpCleaning(cleanings);
- case "overhaul":
- List<TPssrPumpOverhaul> overhauls = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPumpOverhaul overhaul = new TPssrPumpOverhaul();
- overhaul.setSubId(dto.getSubId());
- overhaul.setId(item.getId());
- overhaul.setReason(item.getReason());
- overhauls.add(overhaul);
- }
- return pumpOverhaulController.turnDownPumpOverhaul(overhauls);
- case "fill":
- List<TPssrPumpFill> fills = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPumpFill fill = new TPssrPumpFill();
- fill.setSubId(dto.getSubId());
- fill.setId(item.getId());
- fill.setReason(item.getReason());
- fills.add(fill);
- }
- return pumpFillController.turnDownPumpFill(fills);
- }
- return AjaxResult.error("驳回失败!");
- case "zdj"://支吊架
- List<TPssrFrame> frames = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrFrame frame = new TPssrFrame();
- frame.setSubId(dto.getSubId());
- frame.setId(item.getId());
- frame.setReason(item.getReason());
- frames.add(frame);
- }
- return frameController.turnDownFrame(frames);
- case "tzsb"://特种设备
- switch (dto.getSubName()) {
- case "pipe":
- List<TPssrPipe> pipes = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPipe pipe = new TPssrPipe();
- pipe.setSubId(dto.getSubId());
- pipe.setId(item.getId());
- pipe.setReason(item.getReason());
- pipes.add(pipe);
- }
- return pipeController.turnDownPipe(pipes);
- case "vessel":
- List<TPssrVessel> vessels = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrVessel vessel = new TPssrVessel();
- vessel.setSubId(dto.getSubId());
- vessel.setId(item.getId());
- vessel.setReason(item.getReason());
- vessels.add(vessel);
- }
- return vesselController.turnDownVessel(vessels);
- }
- return AjaxResult.error("驳回失败!");
- case "ybjy"://仪表校验
- List<TPssrInstrumentCalibration> calibrations = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
- calibration.setSubId(dto.getSubId());
- calibration.setId(item.getId());
- calibration.setReason(item.getReason());
- calibrations.add(calibration);
- }
- return instrumentCalibrationController.turnDownInstrumentCalibration(calibrations);
- case "yblscs"://仪表联锁测试
- return AjaxResult.success();
- case "bjlszqr"://报警联锁值确认
- return AjaxResult.success();
- case "lsdy"://临时电源
- List<TPssrPower> powers = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrPower power = new TPssrPower();
- power.setSubId(dto.getSubId());
- power.setId(item.getId());
- power.setReason(item.getReason());
- powers.add(power);
- }
- return powerController.turnDownPower(powers);
- case "djsb"://电机设备
- List<TPssrMotor> motors = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrMotor motor = new TPssrMotor();
- motor.setSubId(dto.getSubId());
- motor.setId(item.getId());
- motor.setReason(item.getReason());
- motors.add(motor);
- }
- return motorController.turnDownMotor(motors);
- case "zmdbr"://照明、电伴热
- List<TPssrLighting> lightings = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrLighting lighting = new TPssrLighting();
- lighting.setSubId(dto.getSubId());
- lighting.setId(item.getId());
- lighting.setReason(item.getReason());
- lightings.add(lighting);
- }
- return lightingController.turnDownLighting(lightings);
- case "jdjdkj"://静电接地、跨接
- List<TPssrFranklinism> franklinisms = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrFranklinism franklinism = new TPssrFranklinism();
- franklinism.setSubId(dto.getSubId());
- franklinism.setId(item.getId());
- franklinism.setReason(item.getReason());
- franklinisms.add(franklinism);
- }
- return franklinismController.turnDownFranklinism(franklinisms);
- case "qtjcy"://气体检测仪
- List<TPssrGasdetector> gasdetectors = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrGasdetector gasdetector = new TPssrGasdetector();
- gasdetector.setSubId(dto.getSubId());
- gasdetector.setId(item.getId());
- gasdetector.setReason(item.getReason());
- gasdetectors.add(gasdetector);
- }
- return gasdetectorController.turnDownGasdetector(gasdetectors);
- case "zxfxy"://在线分析仪
- List<TPssrAnalyzer> analyzers = new ArrayList<>();
- for (TPssrApproveDto item : dto.getDataList()) {
- TPssrAnalyzer analyzer = new TPssrAnalyzer();
- analyzer.setSubId(dto.getSubId());
- analyzer.setId(item.getId());
- analyzer.setReason(item.getReason());
- analyzers.add(analyzer);
- }
- return analyzerController.turnDownAnalyzer(analyzers);
- default:
- return AjaxResult.error("驳回失败!");
- }
- }
- /**
- * 子项内容确认
- */
- public static void handleConfirmApprove(TPssrApprove approve, String userId) {
- String processInstancesId = approve.getProcessId();
- ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
- TaskService taskService = processEngine.getTaskService();
- Task task = processEngine.getTaskService()//获取任务service
- .createTaskQuery()//创建查询对象
- .taskAssignee(userId)
- .processInstanceId(processInstancesId).singleResult();
- String taskId = task.getId();
- //处理流程节点
- Map<String, Object> param = new HashMap<>();
- param.put("condition", "0");
- //认领任务
- processEngine.getTaskService().claim(taskId, userId);
- taskService.addComment(taskId, processInstancesId, "通过");
- taskService.complete(taskId, param);
- }
- /**
- * 查询pssr审批管理列表
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:list')")
- @GetMapping("/list")
- public TableDataInfo list(TPssrApprove tPssrApprove) {
- startPage();
- List<TPssrApprove> list = tPssrApproveService.selectTPssrApproveList(tPssrApprove);
- return getDataTable(list);
- }
- /**
- * 导出pssr审批管理列表
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:export')")
- @Log(title = "pssr审批管理", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(TPssrApprove tPssrApprove) {
- List<TPssrApprove> list = tPssrApproveService.selectTPssrApproveList(tPssrApprove);
- ExcelUtil<TPssrApprove> util = new ExcelUtil<TPssrApprove>(TPssrApprove.class);
- return util.exportExcel(list, "approve");
- }
- /**
- * 获取pssr审批管理详细信息
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:query')")
- @GetMapping(value = "/{approveId}")
- public AjaxResult getInfo(@PathVariable("approveId") Long approveId) {
- return AjaxResult.success(tPssrApproveService.selectTPssrApproveById(approveId));
- }
- /**
- * 新增pssr审批管理
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:add')")
- @Log(title = "pssr审批管理", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody TPssrApprove tPssrApprove) {
- return toAjax(tPssrApproveService.insertTPssrApprove(tPssrApprove));
- }
- /**
- * 修改pssr审批管理
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:edit')")
- @Log(title = "pssr审批管理", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody TPssrApprove tPssrApprove) {
- return toAjax(tPssrApproveService.updateTPssrApprove(tPssrApprove));
- }
- /**
- * 删除pssr审批管理
- */
- @PreAuthorize("@ss.hasPermi('pssr:approve:remove')")
- @Log(title = "pssr审批管理", businessType = BusinessType.DELETE)
- @DeleteMapping("/{approveIds}")
- public AjaxResult remove(@PathVariable Long[] approveIds) {
- return toAjax(tPssrApproveService.deleteTPssrApproveByIds(approveIds));
- }
- @Log(title = "pssr发起审批", businessType = BusinessType.INSERT)
- @PostMapping("/doPssrApprove/{subId}")
- public AjaxResult doApprove(@PathVariable Long subId) {
- TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(subId);
- if (judgmentOrder(tPssrSubcontent)) {
- return AjaxResult.error("请先完成前置审批流程");
- }
- switch (tPssrSubcontent.getForShort()) {
- case "jxxm"://检修项目
- if (tPssrOverhaulExchangerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doJxxmApprove(tPssrSubcontent);
- break;
- case "kgfa"://开工方案
- if (tPssrProgrammeService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doKgfaApprove(tPssrSubcontent);
- break;
- case "sjbg"://设计变更
- if (tPssrMocService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doMocApprove(tPssrSubcontent);
- break;
- case "mb"://盲板
- if (tPssrBlindService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doMbApprove(tPssrSubcontent);
- break;
- case "xcws"://现场卫生
- if (tPssrHygieneService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doXcwsApprove(tPssrSubcontent);
- break;
- case "rsfh"://人身防护
- if (tPssrProtectionService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
- || tPssrMeasureService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doRsfhApprove(tPssrSubcontent);
- break;
- case "sbqjd"://设备清洁度
- if (tPssrCleaningService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doSbqjdApprove(tPssrSubcontent);
- break;
- case "qm"://气密
- if (tPssrAirtightService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doQmApprove(tPssrSubcontent);
- break;
- case "sksgfmzt"://锁开锁关阀门状态
- if (tPssrLockService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doSksgApprove(tPssrSubcontent);
- break;
- case "sys"://实验室
- if (tPssrLaboratoryService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doSysApprove(tPssrSubcontent);
- break;
- case "dj"://短接
- if (tPssrCircuitService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doDjApprove(tPssrSubcontent);
- break;
- case "dqzh"://氮气置换
- if (tPssrNitrogenService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doDqzhApprove(tPssrSubcontent);
- break;
- case "xqf"://消气防设施
- if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doPatrolApprove(tPssrSubcontent);
- break;
- case "aqss"://安全设施
- if (tPssrSafetyBleedService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doAqssApprove(tPssrSubcontent);
- break;
- case "txjk"://通讯监控
- if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doPatrolApprove(tPssrSubcontent);
- break;
- case "bxsjcy"://便携式检测仪
- if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doPatrolApprove(tPssrSubcontent);
- break;
- case "gygc"://公用工程
- if (tPssrPublicService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doGygcApprove(tPssrSubcontent);
- break;
- case "hbss"://环保设施
- if (tPssrTorchvocService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doHbssApprove(tPssrSubcontent);
- break;
- case "yfl"://原辅料
- if (tPssrMaterialService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
- || tPssrMaterialRawService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doYflApprove(tPssrSubcontent);
- break;
- case "jb"://机泵
- if (tPssrPumpCleaningService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doJbApprove(tPssrSubcontent);
- break;
- case "zdj"://支吊架
- if (tPssrFrameService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doZdjApprove(tPssrSubcontent);
- break;
- case "tzsb"://特种设备
- if (tPssrPipeService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
- || tPssrVesselService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doTzsbApprove(tPssrSubcontent);
- break;
- case "ybjy"://仪表校验
- if (tPssrInstrumentCalibrationService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doYbjyApprove(tPssrSubcontent);
- break;
- case "yblscs"://仪表联锁测试
- doYblscsApprove(tPssrSubcontent);
- break;
- case "bjlszqr"://报警联锁值确认
- doBjlszqrApprove(tPssrSubcontent);
- break;
- case "lsdy"://临时电源
- if (tPssrPowerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doLsdyApprove(tPssrSubcontent);
- break;
- case "djsb"://电机设备
- if (tPssrMotorService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doDjsbApprove(tPssrSubcontent);
- break;
- case "zmdbr"://照明、电伴热
- if (tPssrLightingService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doZmdbrApprove(tPssrSubcontent);
- break;
- case "jdjdkj"://静电接地、跨接
- if (tPssrFranklinismService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doJdjdkjApprove(tPssrSubcontent);
- break;
- case "qtjcy"://气体检测仪
- if (tPssrGasdetectorService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doQtjcyApprove(tPssrSubcontent);
- break;
- case "zxfxy"://在线分析仪
- if (tPssrAnalyzerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
- return AjaxResult.error("请确认所有确认人都已选择!");
- }
- doZxfxyApprove(tPssrSubcontent);
- break;
- default:
- return AjaxResult.error("申请发起失败!");
- }
- tPssrSubcontent.setApproveStatus(1L);
- tPssrSubcontentService.updateTPssrSubcontent(tPssrSubcontent);
- return AjaxResult.success();
- }
- /**
- * 判断当前发起的审批是否满足前置条件
- */
- private boolean judgmentOrder(TPssrSubcontent sub) {
- TPssrSubcontent subcontent = new TPssrSubcontent();
- subcontent.setAboveallId(sub.getAboveallId());
- List<String> forShorts = new ArrayList<>();
- if ("jb,ybjy".contains(sub.getForShort())) {
- } else if ("sbqjd".contains(sub.getForShort())) {
- forShorts.add("jb");
- forShorts.add("ybjy");
- } else if ("jxxm,kgfa,sjbg".contains(sub.getForShort())) {
- forShorts.add("sbqjd");
- } else if ("mb".contains(sub.getForShort())) {
- forShorts.add("jxxm");
- forShorts.add("kgfa");
- forShorts.add("sjbg");
- } else if ("dj,aqss,sksgfmzt".contains(sub.getForShort())) {
- forShorts.add("mb");
- } else if ("xcws,rsfh,xqf,txjk,bxsjcy,hbss".contains(sub.getForShort())) {
- forShorts.add("dj");
- forShorts.add("aqss");
- forShorts.add("sksgfmzt");
- } else if ("ssy,gygc,yfl".contains(sub.getForShort())) {
- forShorts.add("xcws");
- forShorts.add("rsfh");
- forShorts.add("xqf");
- forShorts.add("txjk");
- forShorts.add("bxsjcy");
- forShorts.add("hbss");
- } else if ("qm,dqzh".contains(sub.getForShort())) {
- forShorts.add("ssy");
- forShorts.add("gygc");
- forShorts.add("yfl");
- }
- if (CollectionUtils.isNotEmpty(forShorts)) {
- subcontent.setForShorts(forShorts);
- for (TPssrSubcontent tPssrSubcontent : tPssrSubcontentService.selectTPssrSubcontentListByForShort(subcontent)) {
- if (tPssrSubcontent.getApproveStatus() != 2) {
- return true;
- }
- }
- }
- return false;
- }
- @Log(title = "pssr负责人审批", businessType = BusinessType.UPDATE)
- @PutMapping("/handlePssrApprove")
- public AjaxResult handlePssrApprove(@RequestBody DevTask devTask) {
- TPssrApprove approve = devTask.gettPssrApprove();
- //使用任务服务完成任务(提交任务)
- String taskId = devTask.getTaskId();
- // 使用任务id,获取任务对象,获取流程实例id
- Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
- //利用任务对象,获取流程实例id
- String taskName = task.getName();//实例名
- String processInstancesId = task.getProcessInstanceId();
- String userId = getUserId().toString();
- String condition = devTask.getCondition();
- boolean allDone = false;
- TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(approve.getSubId());
- String remark = "";
- if (condition.equals("0")) {
- approve.setApproveStatus(2L);
- tPssrSubcontent.setApproveStatus(2L);
- tPssrSubcontent.setConfirmationDate(new Date());
- tPssrSubcontentService.updateTPssrSubcontent(tPssrSubcontent);
- tPssrApproveService.updateTPssrApprove(approve);
- TPssrSubcontent subcontent = new TPssrSubcontent();
- subcontent.setAboveallId(tPssrSubcontent.getAboveallId());
- for (TPssrSubcontent pssrSubcontent : tPssrSubcontentService.selectTPssrSubcontentList(subcontent)) {
- if (pssrSubcontent.getApproveStatus() != 2) {
- allDone = false;
- break;
- }
- allDone = true;
- }
- }
- //处理流程节点
- Map<String, Object> param = new HashMap<>();
- param.put("condition", condition);
- ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
- TaskService taskService = processEngine.getTaskService();
- //认领任务
- processEngine.getTaskService().claim(taskId, userId);
- taskService.addComment(taskId, processInstancesId, remark);
- taskService.complete(taskId, param);
- // 所有流程都结束时,发起经理审批
- if (allDone)
- doMgrApprove(tPssrSubcontent.getAboveallId());
- return AjaxResult.success();
- }
- // pssr发起经理审批
- public void doMgrApprove(Long aboveallId) {
- String userId = getUserId().toString();
- TPssrAboveall aboveall = tPssrAboveallService.selectTPssrAboveallById(aboveallId);
- TStaffmgr tStaffmgr = new TStaffmgr();
- tStaffmgr.setActualposts("24");//装置经理
- tStaffmgr.setDeptId(103L);
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
- aboveall.setPlantMgr(user.getUserId());
- aboveall.setConfirm(user.getUserId().toString());
- }
- tStaffmgr.setActualposts("40");//ctm经理
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
- aboveall.setCtmMgr(user.getUserId());
- }
- tStaffmgr.setActualposts("42");//cta经理
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
- aboveall.setCtaMgr(user.getUserId());
- }
- List<String> executor = new ArrayList<>();
- executor.add(aboveall.getPlantMgr().toString());
- executor.add(aboveall.getCtmMgr().toString());
- executor.add(aboveall.getCtaMgr().toString());
- //设置当前申请人
- Map<String, Object> variables = new HashMap<>();
- variables.put("applyUser", userId);
- variables.put("allJlUsers", executor);
- variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
- variables.put("jlUser", aboveall.getPlantMgr());
- TPssrApprove exist = tPssrApproveService.selectTPssrApproveByAboveallId(aboveallId);
- if (exist == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setAboveallId(aboveallId);
- approve.setApproveStatus(1L);
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- // 开始申请流程
- long businessKey = approve.getApproveId();
- //开始工作流、监听
- Authentication.setAuthenticatedUserId(userId);
- //采用key来启动流程定义并设置流程变量,返回流程实例
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssrMgrConfirm", String.valueOf(businessKey), variables);
- approve.setProcessId(pi.getProcessInstanceId());
- tPssrApproveService.updateTPssrApprove(approve);
- } else {
- delProcess(exist.getProcessId(), "pssrMgrConfirm");
- // 开始申请流程
- long businessKey = exist.getApproveId();
- //开始工作流、监听
- Authentication.setAuthenticatedUserId(userId);
- //采用key来启动流程定义并设置流程变量,返回流程实例
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssrMgrConfirm", String.valueOf(businessKey), variables);
- exist.setProcessId(pi.getProcessInstanceId());
- tPssrApproveService.updateTPssrApprove(exist);
- }
- aboveall.setApproveStatus(1L);
- tPssrAboveallService.updateTPssrAboveall(aboveall);
- }
- @PutMapping("/handleMgrApprove")
- public AjaxResult handleMgrApprove(@RequestBody DevTask devTask) throws Exception {
- TPssrApprove approve = devTask.gettPssrApprove();
- //使用任务服务完成任务(提交任务)
- String taskId = devTask.getTaskId();
- // 使用任务id,获取任务对象,获取流程实例id
- Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
- //利用任务对象,获取流程实例id
- String taskName = task.getName();//实例名
- String processInstancesId = task.getProcessInstanceId();
- String userId = getUserId().toString();
- String condition = devTask.getCondition();
- TPssrAboveall aboveall = tPssrAboveallService.selectTPssrAboveallById(approve.getAboveallId());
- if (taskName.equals("部门经理")) {
- if (condition.equals("0")) {
- if (userId.equals(aboveall.getPlantMgr().toString())) {
- aboveall.setPlantConfirmdate(new Date());
- } else if (userId.equals(aboveall.getCtmMgr().toString())) {
- aboveall.setCtmConfirmdate(new Date());
- } else if (userId.equals(aboveall.getCtaMgr().toString())) {
- aboveall.setCtaConfirmdate(new Date());
- }
- }
- }
- if (taskName.equals("装置经理")) {
- if (condition.equals("0")) {
- aboveall.setApproveStatus(2L);
- aboveall.setConfirmationDate(new Date());
- new Thread(new Runnable() {
- @Override
- public void run() {
- TPssrApproveController controller = new TPssrApproveController();
- try {
- controller.genZip(aboveall);//生成子项文件压缩包
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }).start();
- }
- }
- tPssrAboveallService.updateTPssrAboveall(aboveall);
- //处理流程节点
- Map<String, Object> param = new HashMap<>();
- param.put("condition", condition);
- ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
- TaskService taskService = processEngine.getTaskService();
- //认领任务
- processEngine.getTaskService().claim(taskId, userId);
- taskService.complete(taskId, param);
- return AjaxResult.success();
- }
- /**
- * 生成子项文件压缩包
- */
- @GetMapping("/genZip")
- public void genZip(TPssrAboveall aboveall) throws Exception {
- Long id = aboveall.getId();//主表id
- AjaxResult result = null;
- String msg = "";//导出方法文件名
- String downloadPath = getProfile() + "/download/";//导出方法默认目录
- String path = "";//导出方法默认文件路径=msg+downloadPath
- String rootPath = getProfile() + "/download/pssr_" + id + "_" + UUID.randomUUID().toString() + "/";//即将被打包的根目录
- String subTitle = "";//子表目录字符串
- List<File> files = new ArrayList<>();//文件路径集合
- TPssrSubcontent queryParams = new TPssrSubcontent();
- queryParams.setAboveallId(id);
- List<TPssrSubcontent> tPssrSubcontents = tPssrSubcontentService.selectTPssrSubcontentList(queryParams);//子表集合
- this.createSubitemDirectory(rootPath);//创建子表目录
- for (TPssrSubcontent tPssrSubcontent : tPssrSubcontents) {
- TPssrPatrol patrol = new TPssrPatrol();
- patrol.setSubId(tPssrSubcontent.getId());
- List<TPssrPatrol> tPssrPatrols = tPssrPatrolService.selectTPssrPatrolList(patrol);//巡检集合
- switch (tPssrSubcontent.getForShort()) {
- case "jxxm"://检修项目
- subTitle = "01检修项目/";
- TPssrOverhaulFilter filter = new TPssrOverhaulFilter();//过滤器
- filter.setSubId(tPssrSubcontent.getId());//子表id
- result = filterController.export(filter);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrOverhaulTower tower = new TPssrOverhaulTower();//塔罐
- tower.setSubId(tPssrSubcontent.getId());//子表id
- result = towerController.export(tower);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrOverhaulValve valve = new TPssrOverhaulValve();//阀门
- valve.setSubId(tPssrSubcontent.getId());//子表id
- result = valveController.export(valve);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();//换热器
- exchanger.setSubId(tPssrSubcontent.getId());//子表id
- exchanger.setDevType(1L);
- result = exchangerController.export(exchanger);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- exchanger.setDevType(2L);
- result = exchangerController.export(exchanger);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- exchanger.setDevType(3L);
- result = exchangerController.export(exchanger);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- exchanger.setDevType(4L);
- result = exchangerController.export(exchanger);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- exchanger.setDevType(5L);
- result = exchangerController.export(exchanger);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "kgfa"://开工方案
- subTitle = "02开工方案/";
- TPssrProgramme programme = new TPssrProgramme();
- programme.setSubId(tPssrSubcontent.getId());//子表id
- result = programmeController.export(programme);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- //附件
- List<TPssrProgramme> tPssrProgrammes = tPssrProgrammeService.selectTPssrProgrammeList(programme);
- for (TPssrProgramme tPssrProgramme : tPssrProgrammes) {
- String fileUrl = tPssrProgramme.getFileUrl();
- String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
- Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- }
- break;
- case "sjbg"://设计变更
- subTitle = "03设计变更/";
- TPssrMoc moc = new TPssrMoc();
- moc.setSubId(tPssrSubcontent.getId());//子表id
- result = mocController.export(moc);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- files.add(new File(path));
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "mb"://盲板
- subTitle = "04盲板/";
- TPssrBlind blind = new TPssrBlind();
- blind.setSubId(tPssrSubcontent.getId());//子表id
- result = blindController.export(blind);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "xcws"://现场卫生
- subTitle = "05现场卫生/";
- TPssrHygiene hygiene = new TPssrHygiene();
- hygiene.setSubId(tPssrSubcontent.getId());//子表id
- result = hygieneController.export(hygiene);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "rsfh"://人身防护
- subTitle = "06人身防护/";
- TPssrProtection protection = new TPssrProtection();
- protection.setSubId(tPssrSubcontent.getId());//子表id
- result = protectionController.export(protection);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrMeasure measure = new TPssrMeasure();
- measure.setSubId(tPssrSubcontent.getId());//子表id
- result = measureController.export(measure);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "sbqjd"://设备清洁度
- subTitle = "07设备清洁度/";
- TPssrCleaning cleaning = new TPssrCleaning();
- cleaning.setSubId(tPssrSubcontent.getId());//子表id
- result = cleaningController.export(cleaning);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "qm"://气密
- subTitle = "08气密/";
- TPssrAirtight airtight = new TPssrAirtight();
- airtight.setSubId(tPssrSubcontent.getId());//子表id
- result = airtightController.export(airtight);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- // break;
- case "sksgfmzt"://锁开锁关阀门状态
- subTitle = "09锁开锁关阀门状态/";
- TPssrLock lock = new TPssrLock();
- lock.setSubId(tPssrSubcontent.getId());//子表id
- result = lockController.export(lock);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "sys"://实验室
- subTitle = "10实验室/";
- TPssrLaboratory laboratory = new TPssrLaboratory();
- laboratory.setSubId(tPssrSubcontent.getId());//子表id
- result = laboratoryController.export(laboratory);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "dj"://短接
- subTitle = "11短接/";
- TPssrCircuit circuit = new TPssrCircuit();
- circuit.setSubId(tPssrSubcontent.getId());//子表id
- result = circuitController.export(circuit);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "dqzh"://氮气置换
- subTitle = "12氮气置换/";
- TPssrNitrogen nitrogen = new TPssrNitrogen();
- nitrogen.setSubId(tPssrSubcontent.getId());//子表id
- result = nitrogenController.export(nitrogen);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "xqf"://消气防设施(巡检)
- subTitle = "13消气防设施/";
- for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
- String planType = tPssrPatrol.getPlanType().toString();
- Long planId = tPssrPatrol.getPlanId();
- switch (planType) {
- case "1"://手提式/小推车式灭火器/灭火器材箱检查记录
- TFireAnnihilator annihilator = new TFireAnnihilator();
- annihilator.setPlanId(planId);
- result = annihilatorController.export(annihilator);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "2"://消防水炮检查记录
- TFireWaterCannon waterCannon = new TFireWaterCannon();
- waterCannon.setPlanId(planId);
- result = waterCannonController.export(waterCannon);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "3"://地上消火栓检查记录
- TFirePostFire postFire = new TFirePostFire();
- postFire.setPlanId(planId);
- result = postFireController.export(postFire);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "4"://消防水带箱检查记录
- TFireHoseBox hoseBox = new TFireHoseBox();
- hoseBox.setPlanId(planId);
- result = hoseBoxController.export(hoseBox);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "5"://消防竖管检查记录
- TFireStandpipePatrol standpipe = new TFireStandpipePatrol();
- standpipe.setPlanId(planId);
- result = standpipeController.export(standpipe);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "6"://自动喷淋灭火系统检查记录
- TFireSprinkler sprinkler = new TFireSprinkler();
- sprinkler.setPlanId(planId);
- result = sprinklerController.export(sprinkler);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "7"://应急事故柜检查记录
- TEmergencyCabinet cabinet = new TEmergencyCabinet();
- cabinet.setPlanId(planId);
- result = cabinetController.export(cabinet);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "8"://现场可燃气体检测器/火灾报警系统检查记录
- TFireAlarm alarm = new TFireAlarm();
- alarm.setPlanId(planId);
- result = alarmController.export(alarm);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "9"://CO2气体保护系统检查记录
- TFireGasShield gasShield = new TFireGasShield();
- gasShield.setPlanId(planId);
- result = gasShieldController.export(gasShield);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "12"://淋浴洗眼器检查记录
- TEmergencyEyewash eyewash = new TEmergencyEyewash();
- eyewash.setPlanId(planId);
- result = eyewashController.export(eyewash);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "13"://应急沙箱检查记录
- TFireSandbox sandbox = new TFireSandbox();
- sandbox.setPlanId(planId);
- result = sandboxController.export(sandbox);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "14"://常闭式防爆门/防火门检查记录
- TFireDoor door = new TFireDoor();
- door.setPlanId(planId);
- result = doorController.export(door);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "15"://风向标/风向袋/新风系统正压计检查记录
- TFireWeathervane weathervane = new TFireWeathervane();
- weathervane.setPlanId(planId);
- result = weathervaneController.export(weathervane);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "16"://蒸汽幕检查记录
- TFireSteamCurtain steamCurtain = new TFireSteamCurtain();
- steamCurtain.setPlanId(planId);
- result = steamCurtainController.export(steamCurtain);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "27"://急救箱检查记录
- TFireAidkit aidkit = new TFireAidkit();
- aidkit.setPlanId(planId);
- result = aidkitController.export(aidkit);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- }
- }
- break;
- case "aqss"://安全设施
- subTitle = "14安全设施/";
- TPssrSafetyBleed bleed = new TPssrSafetyBleed();
- bleed.setSubId(tPssrSubcontent.getId());//子表id
- result = bleedController.export(bleed);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrSafetyBreath breath = new TPssrSafetyBreath();
- breath.setSubId(tPssrSubcontent.getId());//子表id
- result = breathController.export(breath);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrSafetyBrust brust = new TPssrSafetyBrust();
- brust.setSubId(tPssrSubcontent.getId());//子表id
- result = brustController.export(brust);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
- flamearrester.setSubId(tPssrSubcontent.getId());//子表id
- result = flamearresterController.export(flamearrester);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrSafetyValve safetyValve = new TPssrSafetyValve();
- safetyValve.setSubId(tPssrSubcontent.getId());//子表id
- result = safetyValveController.export(safetyValve);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "txjk"://通讯监控(巡检)
- subTitle = "15通讯监控/";
- for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
- String planType = tPssrPatrol.getPlanType().toString();
- Long planId = tPssrPatrol.getPlanId();
- switch (planType) {
- case "10"://PAGA系统检查记录
- TEmergencyPaga paga = new TEmergencyPaga();
- paga.setPlanId(planId);
- result = pagaController.export(paga);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "11"://CCTV系统检查记录
- TEmergencyCctv cctv = new TEmergencyCctv();
- cctv.setPlanId(planId);
- result = cctvController.export(cctv);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- }
- }
- break;
- case "bxsjcy"://便携式检测仪(巡检)
- subTitle = "16便携式检测仪/";
- for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
- String planType = tPssrPatrol.getPlanType().toString();
- Long planId = tPssrPatrol.getPlanId();
- switch (planType) {
- case "18"://四合一/苯系物/硫化氢/二氧化碳/射线一氧化碳检测仪检查记录
- TCommonuseTester tester = new TCommonuseTester();
- tester.setPlanId(planId);
- result = testerController.export(tester);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- }
- }
- break;
- case "gygc"://公用工程
- subTitle = "17公用工程/";
- TPssrPublic tPssrPublic = new TPssrPublic();
- tPssrPublic.setSubId(tPssrSubcontent.getId());//子表id
- result = publicController.export(tPssrPublic);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "hbss"://环保设施
- subTitle = "18环保设施/";
- TPssrTorchvoc torchvoc = new TPssrTorchvoc();
- torchvoc.setSubId(tPssrSubcontent.getId());//子表id
- torchvoc.setTorchvocType("1");
- result = torchvocController.export(torchvoc);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- torchvoc.setTorchvocType("2");
- result = torchvocController.export(torchvoc);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "yfl"://原辅料
- subTitle = "19原辅料/";
- TPssrMaterial material = new TPssrMaterial();
- material.setSubId(tPssrSubcontent.getId());//子表id
- result = materialController.export(material);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrMaterialRaw materialRaw = new TPssrMaterialRaw();
- materialRaw.setSubId(tPssrSubcontent.getId());//子表id
- result = materialRawController.export(materialRaw);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "jb"://机泵
- subTitle = "20机泵/";
- TPssrPumpCleaning pumpCleaning = new TPssrPumpCleaning();
- pumpCleaning.setSubId(tPssrSubcontent.getId());//子表id
- result = pumpCleaningController.export(pumpCleaning);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrPumpFill pumpFill = new TPssrPumpFill();
- pumpFill.setSubId(tPssrSubcontent.getId());//子表id
- result = pumpFillController.export(pumpFill);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrPumpOverhaul pumpOverhaul = new TPssrPumpOverhaul();
- pumpOverhaul.setSubId(tPssrSubcontent.getId());//子表id
- result = pumpOverhaulController.export(pumpOverhaul);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "zdj"://支(吊)架
- subTitle = "21支(吊)架/";
- TPssrFrame frame = new TPssrFrame();
- frame.setSubId(tPssrSubcontent.getId());//子表id
- result = frameController.export(frame);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "tzsb"://压力管道/压力容器
- subTitle = "22压力管道、压力容器/";
- TPssrPipe pipe = new TPssrPipe();
- pipe.setSubId(tPssrSubcontent.getId());//子表id
- result = pipeController.export(pipe);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- TPssrVessel vessel = new TPssrVessel();
- vessel.setSubId(tPssrSubcontent.getId());//子表id
- result = vesselController.export(vessel);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "ybjy"://仪表校验
- subTitle = "23仪表校验/";
- TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
- calibration.setSubId(tPssrSubcontent.getId());//子表id
- result = instrumentCalibrationController.export(calibration);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "yblscs"://仪表联锁测试
- subTitle = "24仪表联锁测试/";
- TPssrInstrumentTest instrumentTest = new TPssrInstrumentTest();
- instrumentTest.setSubId(tPssrSubcontent.getId());//子表id
- //附件
- List<TPssrInstrumentTest> instrumentTests = tPssrInstrumentTestService.selectTPssrInstrumentTestList(instrumentTest);
- for (TPssrInstrumentTest test : instrumentTests) {
- String fileUrl = test.getFileUrl();
- String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
- Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- }
- break;
- case "bjlszqr"://报警/联锁值确认
- subTitle = "25报警、联锁值确认/";
- TPssrAlarm pssrAlarm = new TPssrAlarm();
- pssrAlarm.setSubId(tPssrSubcontent.getId());//子表id
- //附件
- List<TPssrAlarm> alarms = tPssrAlarmService.selectTPssrAlarmList(pssrAlarm);
- for (TPssrAlarm a : alarms) {
- String fileUrl = a.getFileUrl();
- String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
- Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- }
- break;
- case "lsdy"://临时电源
- subTitle = "26临时电源/";
- TPssrPower power = new TPssrPower();
- power.setSubId(tPssrSubcontent.getId());//子表id
- result = powerController.export(power);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "djsb"://电机设备
- subTitle = "27电机设备/";
- TPssrMotor motor = new TPssrMotor();
- motor.setSubId(tPssrSubcontent.getId());//子表id
- result = motorController.export(motor);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "zmdbr"://照明、电伴热
- subTitle = "28照明、电伴热/";
- TPssrLighting lighting = new TPssrLighting();
- lighting.setSubId(tPssrSubcontent.getId());//子表id
- lighting.setLightingType("1");
- result = lightingController.export(lighting);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- lighting.setLightingType("2");
- result = lightingController.export(lighting);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "jdjdkj"://静电接地/跨接
- subTitle = "29静电接地、跨接/";
- TPssrFranklinism franklinism = new TPssrFranklinism();
- franklinism.setSubId(tPssrSubcontent.getId());//子表id
- result = franklinismController.export(franklinism);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "qtjcy"://气体检测仪
- subTitle = "30气体检测仪/";
- TPssrGasdetector gasdetector = new TPssrGasdetector();
- gasdetector.setSubId(tPssrSubcontent.getId());//子表id
- result = gasdetectorController.export(gasdetector);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- case "zxfxy"://在线分析仪
- subTitle = "31在线分析仪/";
- TPssrAnalyzer analyzer = new TPssrAnalyzer();
- analyzer.setSubId(tPssrSubcontent.getId());//子表id
- result = analyzerController.export(analyzer);
- msg = (String) result.get("msg");
- path = downloadPath + msg;
- Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
- files.add(new File(rootPath + subTitle + msg));
- break;
- }
- }
- try {
- String zipName = "pssr_" + id + ".zip";
- ZipUtil.toZipWithDirectory(rootPath, downloadPath + zipName);//打包
- aboveall.setZipUrl(zipName);
- tPssrAboveallService.updateTPssrAboveall(aboveall);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- private void createSubitemDirectory(String rootPath) {
- boolean mkdir1 = new File(rootPath + "01检修项目").mkdirs();//子项文件目录
- boolean mkdir2 = new File(rootPath + "02开工方案").mkdirs();
- boolean mkdir3 = new File(rootPath + "03设计变更").mkdirs();
- boolean mkdir4 = new File(rootPath + "04盲板").mkdirs();
- boolean mkdir5 = new File(rootPath + "05现场卫生").mkdirs();
- boolean mkdir6 = new File(rootPath + "06人身防护").mkdirs();
- boolean mkdir7 = new File(rootPath + "07设备清洁度").mkdirs();
- boolean mkdir8 = new File(rootPath + "08气密").mkdirs();
- boolean mkdir9 = new File(rootPath + "09锁开锁关阀门状态").mkdirs();
- boolean mkdir10 = new File(rootPath + "10实验室").mkdirs();
- boolean mkdir11 = new File(rootPath + "11短接").mkdirs();
- boolean mkdir12 = new File(rootPath + "12氮气置换").mkdirs();
- boolean mkdir13 = new File(rootPath + "13消气防设施").mkdirs();
- boolean mkdir14 = new File(rootPath + "14安全设施").mkdirs();
- boolean mkdir15 = new File(rootPath + "15通讯监控").mkdirs();
- boolean mkdir16 = new File(rootPath + "16便携式检测仪").mkdirs();
- boolean mkdir17 = new File(rootPath + "17公用工程").mkdirs();
- boolean mkdir18 = new File(rootPath + "18环保设施").mkdirs();
- boolean mkdir19 = new File(rootPath + "19原辅料").mkdirs();
- boolean mkdir20 = new File(rootPath + "20机泵").mkdirs();
- boolean mkdir21 = new File(rootPath + "21支(吊)架").mkdirs();
- boolean mkdir22 = new File(rootPath + "22压力管道、压力容器").mkdirs();
- boolean mkdir23 = new File(rootPath + "23仪表校验").mkdirs();
- boolean mkdir24 = new File(rootPath + "24仪表联锁测试").mkdirs();
- boolean mkdir25 = new File(rootPath + "25报警、联锁值确认").mkdirs();
- boolean mkdir26 = new File(rootPath + "26临时电源").mkdirs();
- boolean mkdir27 = new File(rootPath + "27电机设备").mkdirs();
- boolean mkdir28 = new File(rootPath + "28照明、电伴热").mkdirs();
- boolean mkdir29 = new File(rootPath + "29静电接地、跨接").mkdirs();
- boolean mkdir30 = new File(rootPath + "30气体检测仪").mkdirs();
- boolean mkdir31 = new File(rootPath + "31在线分析仪").mkdirs();
- }
- /**
- * 氮气置换审批流程发起申请
- *
- * @param sub
- */
- private void doDqzhApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrNitrogen tPssrNitrogen = new TPssrNitrogen();
- tPssrNitrogen.setApproveStatus(0L);
- tPssrNitrogen.setSubId(sub.getId());
- Set<String> confirm1 = new HashSet<>();
- Set<String> confirm2 = new HashSet<>();
- for (TPssrNitrogen item : tPssrNitrogenService.selectTPssrNitrogenList(tPssrNitrogen)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrNitrogenService.updateTPssrNitrogen(item);
- // 确认人1
- confirm1.add(item.getConfirm1());
- //确认人2
- confirm2.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrNitrogen = new TPssrNitrogen();
- tPssrNitrogen.setApproveStatus(1L);
- tPssrNitrogen.setSubId(sub.getId());
- for (TPssrNitrogen item : tPssrNitrogenService.selectTPssrNitrogenList(tPssrNitrogen)) {
- // 确认人1
- confirm1.add(item.getConfirm1());
- //确认人2
- confirm2.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- }
- }
- // 检修项目审批流程发起申请
- public void doJxxmApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改所有表的审批状态
- TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
- exchanger.setSubId(sub.getId());
- exchanger.setApproveStatus(1L);
- exchanger.setUpdaterCode(userId);
- exchanger.setUpdatedate(new Date());
- tPssrOverhaulExchangerService.updateAllBySubId(exchanger);
- TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
- filter.setSubId(sub.getId());
- filter.setApproveStatus(1L);
- filter.setUpdaterCode(userId);
- filter.setUpdatedate(new Date());
- tPssrOverhaulFilterService.updateAllBySubId(filter);
- TPssrOverhaulPipe pipe = new TPssrOverhaulPipe();
- pipe.setSubId(sub.getId());
- pipe.setApproveStatus(1L);
- pipe.setUpdaterCode(userId);
- pipe.setUpdatedate(new Date());
- tPssrOverhaulPipeService.updateAllBySubId(pipe);
- TPssrOverhaulPump pump = new TPssrOverhaulPump();
- pump.setSubId(sub.getId());
- pump.setApproveStatus(1L);
- pump.setUpdaterCode(userId);
- pump.setUpdatedate(new Date());
- tPssrOverhaulPumpService.updateAllBySubId(pump);
- TPssrOverhaulTower tower = new TPssrOverhaulTower();
- tower.setSubId(sub.getId());
- tower.setApproveStatus(1L);
- tower.setUpdaterCode(userId);
- tower.setUpdatedate(new Date());
- tPssrOverhaulTowerService.updateAllBySubId(tower);
- TPssrOverhaulValve valve = new TPssrOverhaulValve();
- valve.setSubId(sub.getId());
- valve.setApproveStatus(1L);
- valve.setUpdaterCode(userId);
- valve.setUpdatedate(new Date());
- tPssrOverhaulValveService.updateAllBySubId(valve);
- //查询所有确认人
- exchanger = new TPssrOverhaulExchanger();
- exchanger.setSubId(sub.getId());
- exchanger.setApproveStatus(1L);
- TPssrOverhaulExchanger tPssrOverhaulExchanger = tPssrOverhaulExchangerService.selectAllConfirmedPersonBySubId(exchanger);
- String confirmers = null;
- if (tPssrOverhaulExchanger != null) {
- confirmers = tPssrOverhaulExchanger.getConfirmedPerson();
- }
- logger.info("=======================confirmers:{}", confirmers);
- List<String> confirmersList = new ArrayList<>();
- if (StringUtils.isNotEmpty(confirmers)) {
- confirmersList.addAll(Arrays.asList(confirmers.split(",")));
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- //如果当前子项没有审批数据
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr1confirm(approve, confirmersList, sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr1confirm");
- pssr1confirm(approve, confirmersList, sub.getConfirm());
- }
- }
- // 盲板审批流程发起申请
- public void doMbApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrBlind tPssrBlind = new TPssrBlind();
- tPssrBlind.setApproveStatus(0L);
- tPssrBlind.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(tPssrBlind)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrBlindService.updateTPssrBlind(item);
- // 拆装人员
- installer.add(item.getInConfirm1());
- //确认人
- remover.add(item.getInConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrBlind = new TPssrBlind();
- tPssrBlind.setApproveStatus(1L);
- tPssrBlind.setSubId(sub.getId());
- for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(tPssrBlind)) {
- // 拆装人员
- installer.add(item.getInConfirm1());
- //确认人
- remover.add(item.getInConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 锁开锁关审批流程发起申请
- public void doSksgApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrLock tPssrLock = new TPssrLock();
- tPssrLock.setApproveStatus(0L);
- tPssrLock.setSubId(sub.getId());
- Set<String> lockeders = new HashSet<>();
- Set<String> confirmers = new HashSet<>();
- for (TPssrLock item : tPssrLockService.selectTPssrLockList(tPssrLock)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrLockService.updateTPssrLock(item);
- // 确认人1
- lockeders.add(item.getLockeder());
- // 确认人2
- confirmers.add(item.getConfirm());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(lockeders), new ArrayList<>(confirmers), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrLock = new TPssrLock();
- tPssrLock.setApproveStatus(1L);
- tPssrLock.setSubId(sub.getId());
- for (TPssrLock item : tPssrLockService.selectTPssrLockList(tPssrLock)) {
- // 确认人1
- lockeders.add(item.getLockeder());
- // 确认人2
- confirmers.add(item.getConfirm());
- }
- pssr2confirm(approve, new ArrayList<>(lockeders), new ArrayList<>(confirmers), sub.getConfirm());
- }
- }
- // 管道审批流程发起申请
- public void doTzsbApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- TPssrPipe pipe = new TPssrPipe();
- pipe.setSubId(sub.getId());
- pipe.setApproveStatus(1L);
- pipe.setUpdatedate(new Date());
- pipe.setUpdaterCode(userId);
- tPssrPipeService.updateAllBySubId(pipe);
- TPssrVessel vessel = new TPssrVessel();
- vessel.setSubId(sub.getId());
- vessel.setApproveStatus(1L);
- vessel.setUpdatedate(new Date());
- vessel.setUpdaterCode(userId);
- tPssrVesselService.updateAllBySubId(vessel);
- //查询确认人
- TPssrPipe entity = new TPssrPipe();
- entity.setSubId(sub.getId());
- entity.setApproveStatus(1L);
- TPssrPipe tPssrPipe = tPssrPipeService.selectAllConfirmedPersonBySubId(entity);
- String confirmer1s = null;
- String confirmer2s = null;
- if (tPssrPipe != null) {
- confirmer1s = tPssrPipe.getConfirmer1();
- confirmer2s = tPssrPipe.getConfirmer2();
- }
- logger.info("=======================confirmer1s:{}", confirmer1s);
- logger.info("=======================confirmer2s:{}", confirmer2s);
- Set<String> confirmerUsers1 = new HashSet<>();
- Set<String> confirmerUsers2 = new HashSet<>();
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
- entity.setApproveStatus(3L);
- tPssrPipe = tPssrPipeService.selectAllConfirmedPersonBySubId(entity);
- if (tPssrPipe != null) {
- confirmer1s = tPssrPipe.getConfirmer1();
- confirmer2s = tPssrPipe.getConfirmer2();
- }
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- }
- }
- //巡检审批流程发起申请
- public void doPatrolApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();//新增审批数据
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
- pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
- }
- }
- /**
- * 安全设施审批流程发起申请
- */
- private void doAqssApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改各表状态
- TPssrSafetyBleed bleed = new TPssrSafetyBleed();
- bleed.setSubId(sub.getId());
- bleed.setApproveStatus(1L);
- bleed.setUpdatedate(new Date());
- bleed.setUpdaterCode(userId);
- tPssrSafetyBleedService.updateAllBySubId(bleed);
- TPssrSafetyBreath breath = new TPssrSafetyBreath();
- breath.setSubId(sub.getId());
- breath.setApproveStatus(1L);
- breath.setUpdatedate(new Date());
- breath.setUpdaterCode(userId);
- tPssrSafetyBreathService.updateAllBySubId(breath);
- TPssrSafetyBrust brust = new TPssrSafetyBrust();
- brust.setSubId(sub.getId());
- brust.setApproveStatus(1L);
- brust.setUpdatedate(new Date());
- brust.setUpdaterCode(userId);
- tPssrSafetyBrustService.updateAllBySubId(brust);
- TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
- flamearrester.setSubId(sub.getId());
- flamearrester.setApproveStatus(1L);
- flamearrester.setUpdatedate(new Date());
- flamearrester.setUpdaterCode(userId);
- tPssrSafetyFlamearresterService.updateAllBySubId(flamearrester);
- TPssrSafetyValve valve = new TPssrSafetyValve();
- valve.setSubId(sub.getId());
- valve.setApproveStatus(1L);
- valve.setUpdatedate(new Date());
- valve.setUpdaterCode(userId);
- tPssrSafetyValveService.updateAllBySubId(valve);
- // 查询确认人
- TPssrSafetyBleed entity = new TPssrSafetyBleed();
- entity.setSubId(sub.getId());
- entity.setApproveStatus(1L);
- TPssrSafetyBleed tPssrSafetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
- String confirmer1s = null;
- String confirmer2s = null;
- if (tPssrSafetyBleed != null) {
- confirmer1s = tPssrSafetyBleed.getConfirmer1();
- confirmer2s = tPssrSafetyBleed.getConfirmer2();
- }
- logger.info("=======================confirmer1s:{}", confirmer1s);
- logger.info("=======================confirmer2s:{}", confirmer2s);
- Set<String> confirmerUsers1 = new HashSet<>();
- Set<String> confirmerUsers2 = new HashSet<>();
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
- entity.setSubId(sub.getId());
- entity.setApproveStatus(3L);
- tPssrSafetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
- if (tPssrSafetyBleed != null) {
- confirmer1s = tPssrSafetyBleed.getConfirmer1();
- confirmer2s = tPssrSafetyBleed.getConfirmer2();
- }
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- }
- }
- // 现场卫生流程发起申请
- public void doXcwsApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrHygiene tPssrHygiene = new TPssrHygiene();
- tPssrHygiene.setApproveStatus(0L);
- tPssrHygiene.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrHygiene item : tPssrHygieneService.selectTPssrHygieneList(tPssrHygiene)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrHygieneService.updateTPssrHygiene(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrHygiene = new TPssrHygiene();
- tPssrHygiene.setApproveStatus(1L);
- tPssrHygiene.setSubId(sub.getId());
- for (TPssrHygiene item : tPssrHygieneService.selectTPssrHygieneList(tPssrHygiene)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 设备清洁度流程发起申请
- public void doSbqjdApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrCleaning tPssrCleaning = new TPssrCleaning();
- tPssrCleaning.setApproveStatus(0L);
- tPssrCleaning.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrCleaning item : tPssrCleaningService.selectTPssrCleaningList(tPssrCleaning)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrCleaningService.updateTPssrCleaning(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrCleaning = new TPssrCleaning();
- tPssrCleaning.setApproveStatus(1L);
- tPssrCleaning.setSubId(sub.getId());
- for (TPssrCleaning item : tPssrCleaningService.selectTPssrCleaningList(tPssrCleaning)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 气密流程发起申请
- public void doQmApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrAirtight tPssrAirtight = new TPssrAirtight();
- tPssrAirtight.setApproveStatus(0L);
- tPssrAirtight.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrAirtight item : tPssrAirtightService.selectTPssrAirtightList(tPssrAirtight)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrAirtightService.updateTPssrAirtight(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrAirtight = new TPssrAirtight();
- tPssrAirtight.setApproveStatus(1L);
- tPssrAirtight.setSubId(sub.getId());
- for (TPssrAirtight item : tPssrAirtightService.selectTPssrAirtightList(tPssrAirtight)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 实验室流程发起申请
- public void doSysApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrLaboratory tPssrLaboratory = new TPssrLaboratory();
- tPssrLaboratory.setApproveStatus(0L);
- tPssrLaboratory.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrLaboratory item : tPssrLaboratoryService.selectTPssrLaboratoryList(tPssrLaboratory)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrLaboratoryService.updateTPssrLaboratory(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrLaboratory = new TPssrLaboratory();
- tPssrLaboratory.setApproveStatus(1L);
- tPssrLaboratory.setSubId(sub.getId());
- for (TPssrLaboratory item : tPssrLaboratoryService.selectTPssrLaboratoryList(tPssrLaboratory)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 短接流程发起申请
- public void doDjApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrCircuit tPssrCircuit = new TPssrCircuit();
- tPssrCircuit.setApproveStatus(0L);
- tPssrCircuit.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrCircuit item : tPssrCircuitService.selectTPssrCircuitList(tPssrCircuit)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrCircuitService.updateTPssrCircuit(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrCircuit = new TPssrCircuit();
- tPssrCircuit.setApproveStatus(1L);
- tPssrCircuit.setSubId(sub.getId());
- for (TPssrCircuit item : tPssrCircuitService.selectTPssrCircuitList(tPssrCircuit)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 公用工程流程发起申请
- public void doGygcApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrPublic tPssrPublic = new TPssrPublic();
- tPssrPublic.setApproveStatus(0L);
- tPssrPublic.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrPublic item : tPssrPublicService.selectTPssrPublicList(tPssrPublic)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrPublicService.updateTPssrPublic(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrPublic = new TPssrPublic();
- tPssrPublic.setApproveStatus(1L);
- tPssrPublic.setSubId(sub.getId());
- for (TPssrPublic item : tPssrPublicService.selectTPssrPublicList(tPssrPublic)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 环保设施流程发起申请
- public void doHbssApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrTorchvoc tPssrTorchvoc = new TPssrTorchvoc();
- tPssrTorchvoc.setApproveStatus(0L);
- tPssrTorchvoc.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrTorchvoc item : tPssrTorchvocService.selectTPssrTorchvocList(tPssrTorchvoc)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrTorchvocService.updateTPssrTorchvoc(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrTorchvoc = new TPssrTorchvoc();
- tPssrTorchvoc.setApproveStatus(1L);
- tPssrTorchvoc.setSubId(sub.getId());
- for (TPssrTorchvoc item : tPssrTorchvocService.selectTPssrTorchvocList(tPssrTorchvoc)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 照明、电伴热流程发起申请
- public void doZmdbrApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrLighting tPssrLighting = new TPssrLighting();
- tPssrLighting.setApproveStatus(0L);
- tPssrLighting.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrLighting item : tPssrLightingService.selectTPssrLightingList(tPssrLighting)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrLightingService.updateTPssrLighting(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrLighting = new TPssrLighting();
- tPssrLighting.setApproveStatus(1L);
- tPssrLighting.setSubId(sub.getId());
- for (TPssrLighting item : tPssrLightingService.selectTPssrLightingList(tPssrLighting)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 支吊架流程发起申请
- public void doZdjApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrFrame tPssrFrame = new TPssrFrame();
- tPssrFrame.setApproveStatus(0L);
- tPssrFrame.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrFrame item : tPssrFrameService.selectTPssrFrameList(tPssrFrame)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrFrameService.updateTPssrFrame(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrFrame = new TPssrFrame();
- tPssrFrame.setApproveStatus(1L);
- tPssrFrame.setSubId(sub.getId());
- for (TPssrFrame item : tPssrFrameService.selectTPssrFrameList(tPssrFrame)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 仪表校验流程发起申请
- public void doYbjyApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrInstrumentCalibration tPssrInstrumentCalibration = new TPssrInstrumentCalibration();
- tPssrInstrumentCalibration.setApproveStatus(0L);
- tPssrInstrumentCalibration.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrInstrumentCalibration item : tPssrInstrumentCalibrationService.selectTPssrInstrumentCalibrationList(tPssrInstrumentCalibration)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrInstrumentCalibrationService.updateTPssrInstrumentCalibration(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrInstrumentCalibration = new TPssrInstrumentCalibration();
- tPssrInstrumentCalibration.setApproveStatus(1L);
- tPssrInstrumentCalibration.setSubId(sub.getId());
- for (TPssrInstrumentCalibration item : tPssrInstrumentCalibrationService.selectTPssrInstrumentCalibrationList(tPssrInstrumentCalibration)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- //临时电源流程发起申请
- public void doLsdyApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrPower tPssrPower = new TPssrPower();
- tPssrPower.setApproveStatus(0L);
- tPssrPower.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrPower item : tPssrPowerService.selectTPssrPowerList(tPssrPower)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrPowerService.updateTPssrPower(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrPower = new TPssrPower();
- tPssrPower.setApproveStatus(1L);
- tPssrPower.setSubId(sub.getId());
- for (TPssrPower item : tPssrPowerService.selectTPssrPowerList(tPssrPower)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- //电机设备流程发起申请
- public void doDjsbApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrMotor tPssrMotor = new TPssrMotor();
- tPssrMotor.setApproveStatus(0L);
- tPssrMotor.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrMotor item : tPssrMotorService.selectTPssrMotorList(tPssrMotor)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrMotorService.updateTPssrMotor(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrMotor = new TPssrMotor();
- tPssrMotor.setApproveStatus(1L);
- tPssrMotor.setSubId(sub.getId());
- for (TPssrMotor item : tPssrMotorService.selectTPssrMotorList(tPssrMotor)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- //静电接地、跨接流程发起申请
- public void doJdjdkjApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrFranklinism tPssrFranklinism = new TPssrFranklinism();
- tPssrFranklinism.setApproveStatus(0L);
- tPssrFranklinism.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrFranklinism item : tPssrFranklinismService.selectTPssrFranklinismList(tPssrFranklinism)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrFranklinismService.updateTPssrFranklinism(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrFranklinism = new TPssrFranklinism();
- tPssrFranklinism.setApproveStatus(1L);
- tPssrFranklinism.setSubId(sub.getId());
- for (TPssrFranklinism item : tPssrFranklinismService.selectTPssrFranklinismList(tPssrFranklinism)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- //气体检测仪流程发起申请
- public void doQtjcyApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrGasdetector tPssrGasdetector = new TPssrGasdetector();
- tPssrGasdetector.setApproveStatus(0L);
- tPssrGasdetector.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrGasdetector item : tPssrGasdetectorService.selectTPssrGasdetectorList(tPssrGasdetector)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrGasdetectorService.updateTPssrGasdetector(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrGasdetector = new TPssrGasdetector();
- tPssrGasdetector.setApproveStatus(1L);
- tPssrGasdetector.setSubId(sub.getId());
- for (TPssrGasdetector item : tPssrGasdetectorService.selectTPssrGasdetectorList(tPssrGasdetector)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- //在线分析仪流程发起申请
- public void doZxfxyApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrAnalyzer tPssrAnalyzer = new TPssrAnalyzer();
- tPssrAnalyzer.setApproveStatus(0L);
- tPssrAnalyzer.setSubId(sub.getId());
- Set<String> installer = new HashSet<>();
- Set<String> remover = new HashSet<>();
- for (TPssrAnalyzer item : tPssrAnalyzerService.selectTPssrAnalyzerList(tPssrAnalyzer)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrAnalyzerService.updateTPssrAnalyzer(item);
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrAnalyzer = new TPssrAnalyzer();
- tPssrAnalyzer.setApproveStatus(1L);
- tPssrAnalyzer.setSubId(sub.getId());
- for (TPssrAnalyzer item : tPssrAnalyzerService.selectTPssrAnalyzerList(tPssrAnalyzer)) {
- // 安装人员
- installer.add(item.getConfirm1());
- //拆除人员
- remover.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
- }
- }
- // 开工方案流程发起申请
- public void doKgfaApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrProgramme tPssrProgramme = new TPssrProgramme();
- tPssrProgramme.setApproveStatus(0L);
- tPssrProgramme.setSubId(sub.getId());
- Set<String> confirm1 = new HashSet<>();
- Set<String> confirm2 = new HashSet<>();
- for (TPssrProgramme item : tPssrProgrammeService.selectTPssrProgrammeList(tPssrProgramme)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrProgrammeService.updateTPssrProgramme(item);
- // 安装人员
- confirm1.add(item.getConfirm1());
- //拆除人员
- confirm2.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrProgramme = new TPssrProgramme();
- tPssrProgramme.setApproveStatus(1L);
- tPssrProgramme.setSubId(sub.getId());
- for (TPssrProgramme item : tPssrProgrammeService.selectTPssrProgrammeList(tPssrProgramme)) {
- // 安装人员
- confirm1.add(item.getConfirm1());
- //拆除人员
- confirm2.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- }
- }
- /**
- * 设计变更发起流程
- */
- private void doMocApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改状态
- TPssrMoc tPssrMoc = new TPssrMoc();
- tPssrMoc.setApproveStatus(0L);
- tPssrMoc.setSubId(sub.getId());
- Set<String> confirm1 = new HashSet<>();
- Set<String> confirm2 = new HashSet<>();
- for (TPssrMoc item : tPssrMocService.selectTPssrMocList(tPssrMoc)) {
- item.setApproveStatus(1L);
- item.setUpdatedate(new Date());
- item.setUpdaterCode(userId);
- tPssrMocService.updateTPssrMoc(item);
- // 安装人员
- confirm1.add(item.getConfirm1());
- //拆除人员
- confirm2.add(item.getConfirm2());
- }
- TPssrApprove exist = new TPssrApprove();
- exist.setSubId(sub.getId());
- List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
- if (CollectionUtil.isEmpty(tPssrApproves)) {
- //新增审批数据
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- } else {
- // 已存在流程时,删除旧流程,重新发起
- TPssrApprove approve = tPssrApproves.get(0);
- delProcess(approve.getProcessId(), "pssr2confirm");
- tPssrMoc = new TPssrMoc();
- tPssrMoc.setApproveStatus(1L);
- tPssrMoc.setSubId(sub.getId());
- for (TPssrMoc item : tPssrMocService.selectTPssrMocList(tPssrMoc)) {
- // 安装人员
- confirm1.add(item.getConfirm1());
- //拆除人员
- confirm2.add(item.getConfirm2());
- }
- pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
- }
- }
- /**
- * 人身防护审批流程发起申请
- *
- * @param sub 子表对象
- */
- private void doRsfhApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改各表状态
- TPssrMeasure measure = new TPssrMeasure();
- measure.setSubId(sub.getId());
- measure.setApproveStatus(1L);
- measure.setUpdatedate(new Date());
- measure.setUpdaterCode(userId);
- tPssrMeasureService.updateAllBySubId(measure);
- TPssrProtection protection = new TPssrProtection();
- protection.setSubId(sub.getId());
- protection.setApproveStatus(1L);
- protection.setUpdatedate(new Date());
- protection.setUpdaterCode(userId);
- tPssrProtectionService.updateAllBySubId(protection);
- // 查询确认人
- TPssrProtection entity = new TPssrProtection();
- entity.setSubId(sub.getId());
- entity.setApproveStatus(1L);
- TPssrProtection tPssrProtection = tPssrProtectionService.selectAllConfirmedPersonBySubId(entity);
- String confirmer1s = null;
- String confirmer2s = null;
- if (tPssrProtection != null) {
- confirmer1s = tPssrProtection.getConfirm1();
- confirmer2s = tPssrProtection.getConfirm2();
- }
- logger.info("=======================confirmer1s:{}", confirmer1s);
- logger.info("=======================confirmer2s:{}", confirmer2s);
- Set<String> confirmerUsers1 = new HashSet<>();
- Set<String> confirmerUsers2 = new HashSet<>();
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
- entity.setSubId(sub.getId());
- entity.setApproveStatus(3L);
- tPssrProtection = tPssrProtectionService.selectAllConfirmedPersonBySubId(entity);
- if (tPssrProtection != null) {
- confirmer1s = tPssrProtection.getConfirm1();
- confirmer2s = tPssrProtection.getConfirm2();
- }
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- }
- }
- /**
- * 原辅料审批发起申请
- */
- private void doYflApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改各表状态
- TPssrMaterial material = new TPssrMaterial();
- material.setSubId(sub.getId());
- material.setApproveStatus(1L);
- material.setUpdatedate(new Date());
- material.setUpdaterCode(userId);
- tPssrMaterialService.updateAllBySubId(material);
- TPssrMaterialRaw materialRaw = new TPssrMaterialRaw();
- materialRaw.setSubId(sub.getId());
- materialRaw.setApproveStatus(1L);
- materialRaw.setUpdatedate(new Date());
- materialRaw.setUpdaterCode(userId);
- tPssrMaterialRawService.updateAllBySubId(materialRaw);
- // 查询确认人
- TPssrMaterial entity = new TPssrMaterial();
- entity.setSubId(sub.getId());
- entity.setApproveStatus(1L);
- TPssrMaterial tPssrMaterial = tPssrMaterialService.selectAllConfirmedPersonBySubId(entity);
- String confirmer1s = null;
- if (tPssrMaterial != null) {
- confirmer1s = tPssrMaterial.getConfirm1();
- }
- logger.info("=======================confirmer1s:{}", confirmer1s);
- Set<String> confirmerUsers1 = new HashSet<>();
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr1confirm(approve, new ArrayList<>(confirmerUsers1), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
- entity.setSubId(sub.getId());
- entity.setApproveStatus(3L);
- tPssrMaterial = tPssrMaterialService.selectAllConfirmedPersonBySubId(entity);
- if (tPssrMaterial != null) {
- confirmer1s = tPssrMaterial.getConfirm1();
- }
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- pssr1confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), sub.getConfirm());
- }
- }
- /**
- * 机泵审批发起申请
- */
- private void doJbApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改各表状态
- TPssrPumpCleaning cleaning = new TPssrPumpCleaning();
- cleaning.setSubId(sub.getId());
- cleaning.setApproveStatus(1L);
- cleaning.setUpdatedate(new Date());
- cleaning.setUpdaterCode(userId);
- tPssrPumpCleaningService.updateAllBySubId(cleaning);
- TPssrPumpFill fill = new TPssrPumpFill();
- fill.setSubId(sub.getId());
- fill.setApproveStatus(1L);
- fill.setUpdatedate(new Date());
- fill.setUpdaterCode(userId);
- tPssrPumpFillService.updateAllBySubId(fill);
- TPssrPumpOverhaul overhaul = new TPssrPumpOverhaul();
- overhaul.setSubId(sub.getId());
- overhaul.setApproveStatus(1L);
- overhaul.setUpdatedate(new Date());
- overhaul.setUpdaterCode(userId);
- tPssrPumpOverhaulService.updateAllBySubId(overhaul);
- // 查询确认人
- TPssrPumpFill entity = new TPssrPumpFill();
- entity.setSubId(sub.getId());
- entity.setApproveStatus(1L);
- TPssrPumpFill queryData = tPssrPumpFillService.selectAllConfirmedPersonBySubId(entity);
- String confirmer1s = null;
- String confirmer2s = null;
- if (queryData != null) {
- confirmer1s = queryData.getConfirmer1();
- confirmer2s = queryData.getConfirmer2();
- }
- logger.info("=======================confirmer1s:{}", confirmer1s);
- logger.info("=======================confirmer2s:{}", confirmer2s);
- Set<String> confirmerUsers1 = new HashSet<>();
- Set<String> confirmerUsers2 = new HashSet<>();
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
- entity.setSubId(sub.getId());
- entity.setApproveStatus(3L);
- queryData = tPssrPumpFillService.selectAllConfirmedPersonBySubId(entity);
- if (queryData != null) {
- confirmer1s = queryData.getConfirmer1();
- confirmer2s = queryData.getConfirmer2();
- }
- if (StringUtils.isNotEmpty(confirmer1s)) {
- confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
- }
- if (StringUtils.isNotEmpty(confirmer2s)) {
- confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
- }
- pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
- }
- }
- /**
- * 仪表联锁测试审批发起申请
- */
- private void doYblscsApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改表状态
- TPssrInstrumentTest instrumentTest = new TPssrInstrumentTest();
- instrumentTest.setSubId(sub.getId());
- for (TPssrInstrumentTest test : tPssrInstrumentTestService.selectTPssrInstrumentTestList(instrumentTest)) {
- test.setApproveStatus(2L);
- test.setUpdatedate(new Date());
- test.setUpdaterCode(userId);
- tPssrInstrumentTestService.updateTPssrInstrumentTest(test);
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
- pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
- }
- }
- /**
- * 仪表联锁测试审批发起申请
- */
- private void doBjlszqrApprove(TPssrSubcontent sub) {
- String userId = getUserId().toString();
- //修改表状态
- TPssrAlarm alarm = new TPssrAlarm();
- alarm.setSubId(sub.getId());
- for (TPssrAlarm test : tPssrAlarmService.selectTPssrAlarmList(alarm)) {
- test.setApproveStatus(2L);
- test.setUpdatedate(new Date());
- test.setUpdaterCode(userId);
- tPssrAlarmService.updateTPssrAlarm(test);
- }
- //查询是否已存在审批流程
- TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
- if (tPssrApprove == null) {
- TPssrApprove approve = new TPssrApprove();
- approve.setSubId(sub.getId());
- approve.setApNo(DateUtils.dateTimeNow() + userId);
- approve.setApproveStatus(1L);
- approve.setSubCharge(sub.getConfirm());
- approve.setCreaterCode(userId);
- approve.setCreatedate(new Date());
- tPssrApproveService.insertTPssrApprove(approve);
- pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
- } else {
- delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
- pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
- }
- }
- /**
- * 单确认人发起流程
- */
- private void pssr1confirm(TPssrApprove approve, List<String> confirmUsers, String confirm) {
- String userId = getUserId().toString();
- // 开始申请流程
- long businessKey = approve.getApproveId();
- //开始工作流、监听
- Authentication.setAuthenticatedUserId(userId);//设置当前申请人
- Map<String, Object> variables = new HashMap<>();
- variables.put("applyUser", userId);
- variables.put("confirmUsers", confirmUsers);
- variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
- variables.put("chargePerson", confirm);
- //采用key来启动流程定义并设置流程变量,返回流程实例
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr1confirm", String.valueOf(businessKey), variables);
- approve.setProcessId(pi.getProcessInstanceId());
- tPssrApproveService.updateTPssrApprove(approve);
- }
- /**
- * 双确认人发起流程
- */
- private void pssr2confirm(TPssrApprove approve, List<String> confirmUsers1, List<String> confirmUsers2, String confirm) {
- String userId = getUserId().toString();
- // 开始申请流程
- long businessKey = approve.getApproveId();
- //开始工作流、监听
- Authentication.setAuthenticatedUserId(userId);//设置当前申请人
- Map<String, Object> variables = new HashMap<>();
- variables.put("applyUser", userId);
- variables.put("confirmUsers1", confirmUsers1);
- variables.put("confirmUsers2", confirmUsers2);
- variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
- variables.put("chargePerson", confirm);
- //采用key来启动流程定义并设置流程变量,返回流程实例
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
- approve.setProcessId(pi.getProcessInstanceId());
- tPssrApproveService.updateTPssrApprove(approve);
- }
- /**
- * 三确认人发起流程
- */
- private void pssr3confirm(TPssrApprove approve, List<String> confirmUsers1, List<String> confirmUsers2, List<String> confirmUsers3, String confirm) {
- String userId = getUserId().toString();
- // 开始申请流程
- long businessKey = approve.getApproveId();
- //开始工作流、监听
- Authentication.setAuthenticatedUserId(userId);//设置当前申请人
- Map<String, Object> variables = new HashMap<>();
- variables.put("applyUser", userId);
- variables.put("confirmUsers1", confirmUsers1);
- variables.put("confirmUsers2", confirmUsers2);
- variables.put("confirmUsers3", confirmUsers3);
- variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
- variables.put("chargePerson", confirm);
- //采用key来启动流程定义并设置流程变量,返回流程实例
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr3confirm", String.valueOf(businessKey), variables);
- approve.setProcessId(pi.getProcessInstanceId());
- tPssrApproveService.updateTPssrApprove(approve);
- }
- /**
- * 删除已存在流程
- */
- private void delProcess(String processId, String processName) {
- try {
- runtimeService.deleteProcessInstance(processId, processName);
- historyService.deleteHistoricProcessInstance(processId);
- } catch (Exception e) {
- logger.info("无运行时流程");
- }
- }
- }
|