TPssrApproveController.java 189 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058
  1. package com.ruoyi.project.pssr.controller;
  2. import com.ruoyi.common.utils.DateUtils;
  3. import com.ruoyi.common.utils.StringUtils;
  4. import com.ruoyi.common.utils.document.ZipUtil;
  5. import com.ruoyi.common.utils.poi.ExcelUtil;
  6. import com.ruoyi.framework.aspectj.lang.annotation.Log;
  7. import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
  8. import com.ruoyi.framework.web.controller.BaseController;
  9. import com.ruoyi.framework.web.domain.AjaxResult;
  10. import com.ruoyi.framework.web.page.TableDataInfo;
  11. import com.ruoyi.project.approve.damain.DevTask;
  12. import com.ruoyi.project.listener.pssr.ConfirmTaskCreateListener;
  13. import com.ruoyi.project.patrol.commonuse.controller.TCommonuseTesterController;
  14. import com.ruoyi.project.patrol.commonuse.domain.TCommonuseTester;
  15. import com.ruoyi.project.patrol.emergency.controller.TEmergencyCabinetController;
  16. import com.ruoyi.project.patrol.emergency.controller.TEmergencyCctvController;
  17. import com.ruoyi.project.patrol.emergency.controller.TEmergencyEyewashController;
  18. import com.ruoyi.project.patrol.emergency.controller.TEmergencyPagaController;
  19. import com.ruoyi.project.patrol.emergency.domain.TEmergencyCabinet;
  20. import com.ruoyi.project.patrol.emergency.domain.TEmergencyCctv;
  21. import com.ruoyi.project.patrol.emergency.domain.TEmergencyEyewash;
  22. import com.ruoyi.project.patrol.emergency.domain.TEmergencyPaga;
  23. import com.ruoyi.project.patrol.fire.controller.*;
  24. import com.ruoyi.project.patrol.fire.domain.*;
  25. import com.ruoyi.project.plant.domain.TStaffmgr;
  26. import com.ruoyi.project.pssr.domain.*;
  27. import com.ruoyi.project.pssr.domain.dto.TPssrApproveDto;
  28. import com.ruoyi.project.pssr.service.*;
  29. import com.ruoyi.project.system.domain.SysUser;
  30. import com.ruoyi.project.system.mapper.SysUserMapper;
  31. import com.ruoyi.project.system.service.ISysUserService;
  32. import org.activiti.engine.*;
  33. import org.activiti.engine.impl.identity.Authentication;
  34. import org.activiti.engine.impl.util.CollectionUtil;
  35. import org.activiti.engine.runtime.ProcessInstance;
  36. import org.activiti.engine.task.Task;
  37. import org.apache.commons.collections4.CollectionUtils;
  38. import org.springframework.beans.factory.annotation.Autowired;
  39. import org.springframework.security.access.prepost.PreAuthorize;
  40. import org.springframework.web.bind.annotation.*;
  41. import javax.annotation.Resource;
  42. import java.io.File;
  43. import java.io.IOException;
  44. import java.nio.file.Files;
  45. import java.nio.file.Paths;
  46. import java.nio.file.StandardCopyOption;
  47. import java.util.*;
  48. import static com.ruoyi.framework.config.RuoYiConfig.getProfile;
  49. /**
  50. * pssr审批管理Controller
  51. *
  52. * @author ssy
  53. * @date 2024-09-18
  54. */
  55. @RestController
  56. @RequestMapping("/pssr/approve")
  57. public class TPssrApproveController extends BaseController {
  58. @Resource
  59. private SysUserMapper userMapper;
  60. @Autowired
  61. private RuntimeService runtimeService;
  62. @Autowired
  63. private HistoryService historyService;
  64. @Autowired
  65. private TaskService taskService;
  66. @Autowired
  67. private ITPssrApproveService tPssrApproveService;
  68. @Autowired
  69. private ITPssrPatrolService tPssrPatrolService;
  70. @Autowired
  71. private ITPssrAboveallService tPssrAboveallService;
  72. @Autowired
  73. private ITPssrSubcontentService tPssrSubcontentService;
  74. @Autowired
  75. private ITPssrOverhaulExchangerService tPssrOverhaulExchangerService;
  76. @Autowired
  77. private ITPssrOverhaulFilterService tPssrOverhaulFilterService;
  78. @Autowired
  79. private ITPssrOverhaulPipeService tPssrOverhaulPipeService;
  80. @Autowired
  81. private ITPssrOverhaulTowerService tPssrOverhaulTowerService;
  82. @Autowired
  83. private ITPssrOverhaulPumpService tPssrOverhaulPumpService;
  84. @Autowired
  85. private ITPssrOverhaulValveService tPssrOverhaulValveService;
  86. @Autowired
  87. private ITPssrBlindService tPssrBlindService;
  88. @Autowired
  89. private ITPssrLockService tPssrLockService;
  90. @Autowired
  91. private ITPssrPipeService tPssrPipeService;
  92. @Autowired
  93. private ISysUserService userService;
  94. @Autowired
  95. private ITPssrHygieneService tPssrHygieneService;
  96. @Autowired
  97. private ITPssrCleaningService tPssrCleaningService;
  98. @Autowired
  99. private ITPssrAirtightService tPssrAirtightService;
  100. @Autowired
  101. private ITPssrLaboratoryService tPssrLaboratoryService;
  102. @Autowired
  103. private ITPssrMocService tPssrMocService;
  104. @Autowired
  105. private ITPssrCircuitService tPssrCircuitService;
  106. @Autowired
  107. private ITPssrPublicService tPssrPublicService;
  108. @Autowired
  109. private ITPssrSafetyBleedService tPssrSafetyBleedService;
  110. @Autowired
  111. private ITPssrSafetyBreathService tPssrSafetyBreathService;
  112. @Autowired
  113. private ITPssrSafetyBrustService tPssrSafetyBrustService;
  114. @Autowired
  115. private ITPssrSafetyFlamearresterService tPssrSafetyFlamearresterService;
  116. @Autowired
  117. private ITPssrSafetyValveService tPssrSafetyValveService;
  118. @Autowired
  119. private ITPssrFrameService tPssrFrameService;
  120. @Autowired
  121. private ITPssrMotorService tPssrMotorService;
  122. @Autowired
  123. private ITPssrInstrumentCalibrationService tPssrInstrumentCalibrationService;
  124. @Autowired
  125. private ITPssrNitrogenService tPssrNitrogenService;
  126. @Autowired
  127. private ITPssrFranklinismService tPssrFranklinismService;
  128. @Autowired
  129. private ITPssrGasdetectorService tPssrGasdetectorService;
  130. @Autowired
  131. private ITPssrAnalyzerService tPssrAnalyzerService;
  132. @Autowired
  133. private ITPssrMeasureService tPssrMeasureService;
  134. @Autowired
  135. private ITPssrProtectionService tPssrProtectionService;
  136. @Autowired
  137. private ITPssrTorchvocService tPssrTorchvocService;
  138. @Autowired
  139. private ITPssrLightingService tPssrLightingService;
  140. @Autowired
  141. private ITPssrMaterialService tPssrMaterialService;
  142. @Autowired
  143. private ITPssrMaterialRawService tPssrMaterialRawService;
  144. @Autowired
  145. private ITPssrPumpFillService tPssrPumpFillService;
  146. @Autowired
  147. private ITPssrPumpCleaningService tPssrPumpCleaningService;
  148. @Autowired
  149. private ITPssrPumpOverhaulService tPssrPumpOverhaulService;
  150. @Autowired
  151. private ITPssrInstrumentTestService tPssrInstrumentTestService;
  152. @Autowired
  153. private ITPssrAlarmService tPssrAlarmService;
  154. @Autowired
  155. private ITPssrVesselService tPssrVesselService;
  156. @Autowired
  157. private ITPssrProgrammeService tPssrProgrammeService;
  158. @Autowired
  159. private ITPssrPowerService tPssrPowerService;
  160. @Autowired
  161. private TPssrBlindController blindController;
  162. @Autowired
  163. private TPssrAirtightController airtightController;
  164. @Autowired
  165. private TPssrAnalyzerController analyzerController;
  166. @Autowired
  167. private TPssrFrameController frameController;
  168. @Autowired
  169. private TPssrPipeController pipeController;
  170. @Autowired
  171. private TPssrVesselController vesselController;
  172. @Autowired
  173. private TPssrCircuitController circuitController;
  174. @Autowired
  175. private TPssrCleaningController cleaningController;
  176. @Autowired
  177. private TPssrFranklinismController franklinismController;
  178. @Autowired
  179. private TPssrGasdetectorController gasdetectorController;
  180. @Autowired
  181. private TPssrHygieneController hygieneController;
  182. @Autowired
  183. private TPssrInstrumentCalibrationController instrumentCalibrationController;
  184. @Autowired
  185. private TPssrLaboratoryController laboratoryController;
  186. @Autowired
  187. private TPssrLockController lockController;
  188. @Autowired
  189. private TPssrMaterialController materialController;
  190. @Autowired
  191. private TPssrMaterialRawController materialRawController;
  192. @Autowired
  193. private TPssrPumpCleaningController pumpCleaningController;
  194. @Autowired
  195. private TPssrPumpFillController pumpFillController;
  196. @Autowired
  197. private TPssrPumpOverhaulController pumpOverhaulController;
  198. @Autowired
  199. private TPssrMocController mocController;
  200. @Autowired
  201. private TPssrMotorController motorController;
  202. @Autowired
  203. private TPssrLightingController lightingController;
  204. @Autowired
  205. private TPssrNitrogenController nitrogenController;
  206. @Autowired
  207. private TPssrSafetyController safetyController;
  208. @Autowired
  209. private TPssrPatrolController patrolController;
  210. @Autowired
  211. private TPssrPowerController powerController;
  212. @Autowired
  213. private TPssrProgrammeController programmeController;
  214. @Autowired
  215. private TPssrPublicController publicController;
  216. @Autowired
  217. private TCommonuseTesterController testerController;
  218. @Autowired
  219. private TEmergencyPagaController pagaController;
  220. @Autowired
  221. private TEmergencyCctvController cctvController;
  222. @Autowired
  223. private TPssrOverhaulExchangerController exchangerController;
  224. @Autowired
  225. private TPssrOverhaulFilterController filterController;
  226. @Autowired
  227. private TPssrOverhaulTowerController towerController;
  228. @Autowired
  229. private TPssrOverhaulValveController valveController;
  230. @Autowired
  231. private TPssrProtectionController protectionController;
  232. @Autowired
  233. private TPssrMeasureController measureController;
  234. @Autowired
  235. private TPssrSafetyBleedController bleedController;
  236. @Autowired
  237. private TFireAidkitController aidkitController;
  238. @Autowired
  239. private TFireAlarmController alarmController;
  240. @Autowired
  241. private TFireAnnihilatorController annihilatorController;
  242. @Autowired
  243. private TFireDoorController doorController;
  244. @Autowired
  245. private TFireGasShieldController gasShieldController;
  246. @Autowired
  247. private TEmergencyEyewashController eyewashController;
  248. @Autowired
  249. private TFireHoseBoxController hoseBoxController;
  250. @Autowired
  251. private TFirePostFireController postFireController;
  252. @Autowired
  253. private TFireSandboxController sandboxController;
  254. @Autowired
  255. private TFireSprinklerController sprinklerController;
  256. @Autowired
  257. private TEmergencyCabinetController cabinetController;
  258. @Autowired
  259. private TFireStandpipeController standpipeController;
  260. @Autowired
  261. private TFireSteamCurtainController steamCurtainController;
  262. @Autowired
  263. private TFireWaterCannonController waterCannonController;
  264. @Autowired
  265. private TFireWeathervaneController weathervaneController;
  266. @Autowired
  267. private TPssrSafetyBreathController breathController;
  268. @Autowired
  269. private TPssrSafetyBrustController brustController;
  270. @Autowired
  271. private TPssrSafetyFlamearresterController flamearresterController;
  272. @Autowired
  273. private TPssrSafetyValveController safetyValveController;
  274. @Autowired
  275. private TPssrTorchvocController torchvocController;
  276. @PutMapping("/handleConfirm")
  277. public AjaxResult handleConfirm(@RequestBody TPssrApproveDto dto) {
  278. TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(dto.getSubId());
  279. switch (tPssrSubcontent.getForShort()) {
  280. case "jxxm"://检修项目
  281. switch (dto.getSubName()) {
  282. case "exchanger":
  283. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
  284. exchanger.setSubId(dto.getSubId());
  285. exchanger.setIds(dto.getIds());
  286. return exchangerController.confirmExchanger(exchanger);
  287. case "filter":
  288. TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
  289. filter.setSubId(dto.getSubId());
  290. filter.setIds(dto.getIds());
  291. return filterController.confirmFilter(filter);
  292. case "tower":
  293. TPssrOverhaulTower tower = new TPssrOverhaulTower();
  294. tower.setSubId(dto.getSubId());
  295. tower.setIds(dto.getIds());
  296. return towerController.confirmTower(tower);
  297. case "valve":
  298. TPssrOverhaulValve valve = new TPssrOverhaulValve();
  299. valve.setSubId(dto.getSubId());
  300. valve.setIds(dto.getIds());
  301. return valveController.confirmValve(valve);
  302. }
  303. return AjaxResult.error("确认失败!");
  304. case "kgfa"://开工方案
  305. TPssrProgramme programme = new TPssrProgramme();
  306. programme.setSubId(dto.getSubId());
  307. programme.setIds(dto.getIds());
  308. programme.setTaskType(dto.getTaskType());
  309. return programmeController.confirmProgramme(programme);
  310. case "sjbg"://设计变更
  311. TPssrMoc moc = new TPssrMoc();
  312. moc.setSubId(dto.getSubId());
  313. moc.setIds(dto.getIds());
  314. moc.setTaskType(dto.getTaskType());
  315. return mocController.confirmMoc(moc);
  316. case "mb"://盲板
  317. TPssrBlind blind = new TPssrBlind();
  318. blind.setSubId(dto.getSubId());
  319. blind.setIds(dto.getIds());
  320. blind.setTaskType(dto.getTaskType());
  321. return blindController.confirmBlind(blind);
  322. case "xcws"://现场卫生
  323. TPssrHygiene hygiene = new TPssrHygiene();
  324. hygiene.setSubId(dto.getSubId());
  325. hygiene.setIds(dto.getIds());
  326. hygiene.setTaskType(dto.getTaskType());
  327. return hygieneController.confirmHygiene(hygiene);
  328. case "rsfh"://人身防护
  329. switch (dto.getSubName()) {
  330. case "protection":
  331. TPssrProtection protection = new TPssrProtection();
  332. protection.setSubId(dto.getSubId());
  333. protection.setIds(dto.getIds());
  334. protection.setTaskType(dto.getTaskType());
  335. return protectionController.confirmProtection(protection);
  336. case "measure":
  337. TPssrMeasure measure = new TPssrMeasure();
  338. measure.setSubId(dto.getSubId());
  339. measure.setIds(dto.getIds());
  340. measure.setTaskType(dto.getTaskType());
  341. return measureController.confirmMeasure(measure);
  342. }
  343. return AjaxResult.error("确认失败!");
  344. case "sbqjd"://设备清洁度
  345. TPssrCleaning cleaning = new TPssrCleaning();
  346. cleaning.setSubId(dto.getSubId());
  347. cleaning.setIds(dto.getIds());
  348. cleaning.setTaskType(dto.getTaskType());
  349. return cleaningController.confirmCleaning(cleaning);
  350. case "qm"://气密
  351. TPssrAirtight airtight = new TPssrAirtight();
  352. airtight.setSubId(dto.getSubId());
  353. airtight.setIds(dto.getIds());
  354. airtight.setTaskType(dto.getTaskType());
  355. return airtightController.confirmAirtight(airtight);
  356. case "sksgfmzt"://锁开锁关阀门状态
  357. TPssrLock lock = new TPssrLock();
  358. lock.setSubId(dto.getSubId());
  359. lock.setIds(dto.getIds());
  360. lock.setTaskType(dto.getTaskType());
  361. return lockController.confirmLock(lock);
  362. case "sys"://实验室
  363. TPssrLaboratory laboratory = new TPssrLaboratory();
  364. laboratory.setSubId(dto.getSubId());
  365. laboratory.setIds(dto.getIds());
  366. laboratory.setTaskType(dto.getTaskType());
  367. return laboratoryController.confirmLaboratory(laboratory);
  368. case "dj"://短接
  369. TPssrCircuit circuit = new TPssrCircuit();
  370. circuit.setSubId(dto.getSubId());
  371. circuit.setIds(dto.getIds());
  372. circuit.setTaskType(dto.getTaskType());
  373. return circuitController.confirmCircuit(circuit);
  374. case "dqzh"://氮气置换
  375. TPssrNitrogen nitrogen = new TPssrNitrogen();
  376. nitrogen.setSubId(dto.getSubId());
  377. nitrogen.setIds(dto.getIds());
  378. nitrogen.setTaskType(dto.getTaskType());
  379. return nitrogenController.confirmNitrogen(nitrogen);
  380. case "xqf"://消气防设施
  381. return AjaxResult.success();
  382. case "aqss"://安全设施
  383. switch (dto.getSubName()) {
  384. case "bleed":
  385. TPssrSafetyBleed bleed = new TPssrSafetyBleed();
  386. bleed.setSubId(dto.getSubId());
  387. bleed.setIds(dto.getIds());
  388. bleed.setTaskType(dto.getTaskType());
  389. return safetyController.confirmBleed(bleed);
  390. case "breath":
  391. TPssrSafetyBreath breath = new TPssrSafetyBreath();
  392. breath.setSubId(dto.getSubId());
  393. breath.setIds(dto.getIds());
  394. breath.setTaskType(dto.getTaskType());
  395. return safetyController.confirmBreath(breath);
  396. case "brust":
  397. TPssrSafetyBrust brust = new TPssrSafetyBrust();
  398. brust.setSubId(dto.getSubId());
  399. brust.setIds(dto.getIds());
  400. brust.setTaskType(dto.getTaskType());
  401. return safetyController.confirmBrust(brust);
  402. case "flamearrester":
  403. TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
  404. flamearrester.setSubId(dto.getSubId());
  405. flamearrester.setIds(dto.getIds());
  406. flamearrester.setTaskType(dto.getTaskType());
  407. return safetyController.confirmFlamearrester(flamearrester);
  408. case "valve":
  409. TPssrSafetyValve safetyValve = new TPssrSafetyValve();
  410. safetyValve.setSubId(dto.getSubId());
  411. safetyValve.setIds(dto.getIds());
  412. safetyValve.setTaskType(dto.getTaskType());
  413. return safetyController.confirmValve(safetyValve);
  414. }
  415. case "txjk"://通讯监控
  416. return AjaxResult.success();
  417. case "bxsjcy"://便携式检测仪
  418. return AjaxResult.success();
  419. case "gygc"://公用工程
  420. TPssrPublic pssrPublic = new TPssrPublic();
  421. pssrPublic.setSubId(dto.getSubId());
  422. pssrPublic.setIds(dto.getIds());
  423. pssrPublic.setTaskType(dto.getTaskType());
  424. return publicController.confirmPublic(pssrPublic);
  425. case "hbss"://环保设施
  426. TPssrTorchvoc torchvoc = new TPssrTorchvoc();
  427. torchvoc.setSubId(dto.getSubId());
  428. torchvoc.setIds(dto.getIds());
  429. torchvoc.setTaskType(dto.getTaskType());
  430. torchvoc.setTorchvocType(dto.getTorchvocType());
  431. return torchvocController.confirmTorchvoc(torchvoc);
  432. case "yfl"://原辅料
  433. switch (dto.getSubName()) {
  434. case "material":
  435. TPssrMaterial material = new TPssrMaterial();
  436. material.setSubId(dto.getSubId());
  437. material.setIds(dto.getIds());
  438. material.setTaskType(dto.getTaskType());
  439. return materialController.confirmMaterial(material);
  440. case "raw":
  441. TPssrMaterialRaw raw = new TPssrMaterialRaw();
  442. raw.setSubId(dto.getSubId());
  443. raw.setIds(dto.getIds());
  444. raw.setTaskType(dto.getTaskType());
  445. return materialRawController.confirmMaterialRaw(raw);
  446. }
  447. case "jb"://机泵
  448. switch (dto.getSubName()) {
  449. case "cleaning":
  450. TPssrPumpCleaning pumpCleaning = new TPssrPumpCleaning();
  451. pumpCleaning.setSubId(dto.getSubId());
  452. pumpCleaning.setIds(dto.getIds());
  453. pumpCleaning.setTaskType(dto.getTaskType());
  454. return pumpCleaningController.confirmPumpCleaning(pumpCleaning);
  455. case "fill":
  456. TPssrPumpFill pumpFill = new TPssrPumpFill();
  457. pumpFill.setSubId(dto.getSubId());
  458. pumpFill.setIds(dto.getIds());
  459. pumpFill.setTaskType(dto.getTaskType());
  460. return pumpFillController.confirmPumpFill(pumpFill);
  461. case "overhaul":
  462. TPssrPumpOverhaul pumpOverhaul = new TPssrPumpOverhaul();
  463. pumpOverhaul.setSubId(dto.getSubId());
  464. pumpOverhaul.setIds(dto.getIds());
  465. pumpOverhaul.setTaskType(dto.getTaskType());
  466. return pumpOverhaulController.confirmPumpOverhaul(pumpOverhaul);
  467. }
  468. return AjaxResult.error("确认失败!");
  469. case "zdj"://支吊架
  470. TPssrFrame frame = new TPssrFrame();
  471. frame.setSubId(dto.getSubId());
  472. frame.setIds(dto.getIds());
  473. frame.setTaskType(dto.getTaskType());
  474. return frameController.confirmFrame(frame);
  475. case "tzsb"://特种设备
  476. switch (dto.getSubName()) {
  477. case "pipe":
  478. TPssrPipe pipe = new TPssrPipe();
  479. pipe.setSubId(dto.getSubId());
  480. pipe.setIds(dto.getIds());
  481. pipe.setTaskType(dto.getTaskType());
  482. return pipeController.confirmPipe(pipe);
  483. case "vessel":
  484. TPssrVessel vessel = new TPssrVessel();
  485. vessel.setSubId(dto.getSubId());
  486. vessel.setIds(dto.getIds());
  487. vessel.setTaskType(dto.getTaskType());
  488. return vesselController.confirmVessel(vessel);
  489. }
  490. case "ybjy"://仪表校验
  491. TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
  492. calibration.setSubId(dto.getSubId());
  493. calibration.setIds(dto.getIds());
  494. calibration.setTaskType(dto.getTaskType());
  495. return instrumentCalibrationController.confirmInstrumentCalibration(calibration);
  496. case "yblscs"://仪表联锁测试
  497. return AjaxResult.success();
  498. case "bjlszqr"://报警联锁值确认
  499. return AjaxResult.success();
  500. case "lsdy"://临时电源
  501. TPssrPower power = new TPssrPower();
  502. power.setSubId(dto.getSubId());
  503. power.setIds(dto.getIds());
  504. power.setTaskType(dto.getTaskType());
  505. return powerController.confirmPower(power);
  506. case "djsb"://电机设备
  507. TPssrMotor motor = new TPssrMotor();
  508. motor.setSubId(dto.getSubId());
  509. motor.setIds(dto.getIds());
  510. motor.setTaskType(dto.getTaskType());
  511. return motorController.confirmMotor(motor);
  512. case "zmdbr"://照明、电伴热
  513. TPssrLighting lighting = new TPssrLighting();
  514. lighting.setSubId(dto.getSubId());
  515. lighting.setIds(dto.getIds());
  516. lighting.setTaskType(dto.getTaskType());
  517. lighting.setLightingType(dto.getLightingType());
  518. return lightingController.Lighting(lighting);
  519. case "jdjdkj"://静电接地、跨接
  520. TPssrFranklinism franklinism = new TPssrFranklinism();
  521. franklinism.setSubId(dto.getSubId());
  522. franklinism.setIds(dto.getIds());
  523. franklinism.setTaskType(dto.getTaskType());
  524. return franklinismController.Franklinism(franklinism);
  525. case "qtjcy"://气体检测仪
  526. TPssrGasdetector gasdetector = new TPssrGasdetector();
  527. gasdetector.setSubId(dto.getSubId());
  528. gasdetector.setIds(dto.getIds());
  529. gasdetector.setTaskType(dto.getTaskType());
  530. return gasdetectorController.Gasdetector(gasdetector);
  531. case "zxfxy"://在线分析仪
  532. TPssrAnalyzer analyzer = new TPssrAnalyzer();
  533. analyzer.setSubId(dto.getSubId());
  534. analyzer.setIds(dto.getIds());
  535. analyzer.setTaskType(dto.getTaskType());
  536. return analyzerController.Analyzer(analyzer);
  537. default:
  538. return AjaxResult.error("确认失败!");
  539. }
  540. }
  541. @PutMapping("/handleTurndown")
  542. public AjaxResult handleTurndown(@RequestBody TPssrApproveDto dto) {
  543. TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(dto.getSubId());
  544. switch (tPssrSubcontent.getForShort()) {
  545. case "jxxm"://检修项目
  546. switch (dto.getSubName()) {
  547. case "exchanger":
  548. List<TPssrOverhaulExchanger> exchangers = new ArrayList<>();
  549. for (TPssrApproveDto item : dto.getDataList()) {
  550. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
  551. exchanger.setSubId(dto.getSubId());
  552. exchanger.setId(item.getId());
  553. exchanger.setReason(item.getReason());
  554. exchangers.add(exchanger);
  555. }
  556. return exchangerController.turnDownExchanger(exchangers);
  557. case "filter":
  558. List<TPssrOverhaulFilter> filters = new ArrayList<>();
  559. for (TPssrApproveDto item : dto.getDataList()) {
  560. TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
  561. filter.setSubId(dto.getSubId());
  562. filter.setId(item.getId());
  563. filter.setReason(item.getReason());
  564. filters.add(filter);
  565. }
  566. return filterController.turnDownFilter(filters);
  567. case "":
  568. List<TPssrOverhaulTower> towers = new ArrayList<>();
  569. for (TPssrApproveDto item : dto.getDataList()) {
  570. TPssrOverhaulTower tower = new TPssrOverhaulTower();
  571. tower.setSubId(dto.getSubId());
  572. tower.setId(item.getId());
  573. tower.setReason(item.getReason());
  574. towers.add(tower);
  575. }
  576. return towerController.turnDownTower(towers);
  577. case "valve":
  578. List<TPssrOverhaulValve> valves = new ArrayList<>();
  579. for (TPssrApproveDto item : dto.getDataList()) {
  580. TPssrOverhaulValve valve = new TPssrOverhaulValve();
  581. valve.setSubId(dto.getSubId());
  582. valve.setId(item.getId());
  583. valve.setReason(item.getReason());
  584. valves.add(valve);
  585. }
  586. return valveController.turnDownValve(valves);
  587. }
  588. return AjaxResult.error("驳回失败!");
  589. case "kgfa"://开工方案
  590. List<TPssrProgramme> programmes = new ArrayList<>();
  591. for (TPssrApproveDto item : dto.getDataList()) {
  592. TPssrProgramme programme = new TPssrProgramme();
  593. programme.setSubId(dto.getSubId());
  594. programme.setId(item.getId());
  595. programme.setReason(item.getReason());
  596. programmes.add(programme);
  597. }
  598. return programmeController.turnDownProgramme(programmes);
  599. case "sjbg"://设计变更
  600. List<TPssrMoc> mocs = new ArrayList<>();
  601. for (TPssrApproveDto item : dto.getDataList()) {
  602. TPssrMoc moc = new TPssrMoc();
  603. moc.setSubId(dto.getSubId());
  604. moc.setId(item.getId());
  605. moc.setReason(item.getReason());
  606. mocs.add(moc);
  607. }
  608. return mocController.turnDownMoc(mocs);
  609. case "mb"://盲板
  610. List<TPssrBlind> blinds = new ArrayList<>();
  611. for (TPssrApproveDto item : dto.getDataList()) {
  612. TPssrBlind blind = new TPssrBlind();
  613. blind.setSubId(dto.getSubId());
  614. blind.setId(item.getId());
  615. blind.setReason(item.getReason());
  616. blinds.add(blind);
  617. }
  618. return blindController.turnDownBlind(blinds);
  619. case "xcws"://现场卫生
  620. List<TPssrHygiene> hygeins = new ArrayList<>();
  621. for (TPssrApproveDto item : dto.getDataList()) {
  622. TPssrHygiene hygien = new TPssrHygiene();
  623. hygien.setSubId(dto.getSubId());
  624. hygien.setId(item.getId());
  625. hygien.setReason(item.getReason());
  626. hygeins.add(hygien);
  627. }
  628. return hygieneController.turnDownHygiene(hygeins);
  629. case "rsfh"://人身防护
  630. switch (dto.getSubName()) {
  631. case "protection":
  632. List<TPssrProtection> protections = new ArrayList<>();
  633. for (TPssrApproveDto item : dto.getDataList()) {
  634. TPssrProtection protection = new TPssrProtection();
  635. protection.setSubId(dto.getSubId());
  636. protection.setId(item.getId());
  637. protection.setReason(item.getReason());
  638. protections.add(protection);
  639. }
  640. return protectionController.turnDownProtection(protections);
  641. case "measure":
  642. List<TPssrMeasure> measures = new ArrayList<>();
  643. for (TPssrApproveDto item : dto.getDataList()) {
  644. TPssrMeasure measure = new TPssrMeasure();
  645. measure.setSubId(dto.getSubId());
  646. measure.setId(item.getId());
  647. measure.setReason(item.getReason());
  648. measures.add(measure);
  649. }
  650. return measureController.turnDownMeasure(measures);
  651. }
  652. return AjaxResult.error("驳回失败!");
  653. case "sbqjd"://设备清洁度
  654. List<TPssrCleaning> cleans = new ArrayList<>();
  655. for (TPssrApproveDto item : dto.getDataList()) {
  656. TPssrCleaning clean = new TPssrCleaning();
  657. clean.setSubId(dto.getSubId());
  658. clean.setId(item.getId());
  659. clean.setReason(item.getReason());
  660. cleans.add(clean);
  661. }
  662. return cleaningController.turnDownCleaning(cleans);
  663. case "qm"://气密
  664. List<TPssrAirtight> airtights = new ArrayList<>();
  665. for (TPssrApproveDto item : dto.getDataList()) {
  666. TPssrAirtight airtight = new TPssrAirtight();
  667. airtight.setSubId(dto.getSubId());
  668. airtight.setId(item.getId());
  669. airtight.setReason(item.getReason());
  670. airtights.add(airtight);
  671. }
  672. return airtightController.turnDownAirtight(airtights);
  673. case "sksgfmzt"://锁开锁关阀门状态
  674. List<TPssrLock> locks = new ArrayList<>();
  675. for (TPssrApproveDto item : dto.getDataList()) {
  676. TPssrLock lock = new TPssrLock();
  677. lock.setSubId(dto.getSubId());
  678. lock.setId(item.getId());
  679. lock.setReason(item.getReason());
  680. locks.add(lock);
  681. }
  682. return lockController.turnDownLock(locks);
  683. case "sys"://实验室
  684. List<TPssrLaboratory> laboratories = new ArrayList<>();
  685. for (TPssrApproveDto item : dto.getDataList()) {
  686. TPssrLaboratory laboratory = new TPssrLaboratory();
  687. laboratory.setSubId(dto.getSubId());
  688. laboratory.setId(item.getId());
  689. laboratory.setReason(item.getReason());
  690. laboratories.add(laboratory);
  691. }
  692. return laboratoryController.turnDownLaboratory(laboratories);
  693. case "dj"://短接
  694. List<TPssrCircuit> circuits = new ArrayList<>();
  695. for (TPssrApproveDto item : dto.getDataList()) {
  696. TPssrCircuit circuit = new TPssrCircuit();
  697. circuit.setSubId(dto.getSubId());
  698. circuit.setId(item.getId());
  699. circuit.setReason(item.getReason());
  700. circuits.add(circuit);
  701. }
  702. return circuitController.turnDownCircuit(circuits);
  703. case "dqzh"://氮气置换
  704. List<TPssrNitrogen> nitrogens = new ArrayList<>();
  705. for (TPssrApproveDto item : dto.getDataList()) {
  706. TPssrNitrogen nitrogen = new TPssrNitrogen();
  707. nitrogen.setSubId(dto.getSubId());
  708. nitrogen.setId(item.getId());
  709. nitrogen.setReason(item.getReason());
  710. nitrogens.add(nitrogen);
  711. }
  712. return nitrogenController.turnDownNitrogen(nitrogens);
  713. case "xqf"://消气防设施
  714. return AjaxResult.success();
  715. case "aqss"://安全设施
  716. switch (dto.getSubName()) {
  717. case "bleed":
  718. List<TPssrSafetyBleed> bleeds = new ArrayList<>();
  719. for (TPssrApproveDto item : dto.getDataList()) {
  720. TPssrSafetyBleed bleed = new TPssrSafetyBleed();
  721. bleed.setSubId(dto.getSubId());
  722. bleed.setId(item.getId());
  723. bleed.setReason(item.getReason());
  724. bleeds.add(bleed);
  725. }
  726. return safetyController.turnDownBleed(bleeds);
  727. case "breath":
  728. List<TPssrSafetyBreath> breaths = new ArrayList<>();
  729. for (TPssrApproveDto item : dto.getDataList()) {
  730. TPssrSafetyBreath breath = new TPssrSafetyBreath();
  731. breath.setSubId(dto.getSubId());
  732. breath.setId(item.getId());
  733. breath.setReason(item.getReason());
  734. breaths.add(breath);
  735. }
  736. return safetyController.turnDownBreath(breaths);
  737. case "brust":
  738. List<TPssrSafetyBrust> brusts = new ArrayList<>();
  739. for (TPssrApproveDto item : dto.getDataList()) {
  740. TPssrSafetyBrust brust = new TPssrSafetyBrust();
  741. brust.setSubId(dto.getSubId());
  742. brust.setId(item.getId());
  743. brust.setReason(item.getReason());
  744. brusts.add(brust);
  745. }
  746. return safetyController.turnDownBrust(brusts);
  747. case "flamearrester":
  748. List<TPssrSafetyFlamearrester> flamearresters = new ArrayList<>();
  749. for (TPssrApproveDto item : dto.getDataList()) {
  750. TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
  751. flamearrester.setSubId(dto.getSubId());
  752. flamearrester.setId(item.getId());
  753. flamearrester.setReason(item.getReason());
  754. flamearresters.add(flamearrester);
  755. }
  756. return safetyController.turnDownFlamearrester(flamearresters);
  757. case "valve":
  758. List<TPssrSafetyValve> valves = new ArrayList<>();
  759. for (TPssrApproveDto item : dto.getDataList()) {
  760. TPssrSafetyValve valve = new TPssrSafetyValve();
  761. valve.setSubId(dto.getSubId());
  762. valve.setId(item.getId());
  763. valve.setReason(item.getReason());
  764. valves.add(valve);
  765. }
  766. return safetyController.turnDownValve(valves);
  767. }
  768. return AjaxResult.error("驳回失败!");
  769. case "txjk"://通讯监控
  770. return AjaxResult.success();
  771. case "bxsjcy"://便携式检测仪
  772. return AjaxResult.success();
  773. case "gygc"://公用工程
  774. List<TPssrPublic> publics = new ArrayList<>();
  775. for (TPssrApproveDto item : dto.getDataList()) {
  776. TPssrPublic pssrPublic = new TPssrPublic();
  777. pssrPublic.setSubId(dto.getSubId());
  778. pssrPublic.setId(item.getId());
  779. pssrPublic.setReason(item.getReason());
  780. publics.add(pssrPublic);
  781. }
  782. return publicController.turnDownPublic(publics);
  783. case "hbss"://环保设施
  784. List<TPssrTorchvoc> torchvocs = new ArrayList<>();
  785. for (TPssrApproveDto item : dto.getDataList()) {
  786. TPssrTorchvoc torchvoc = new TPssrTorchvoc();
  787. torchvoc.setSubId(dto.getSubId());
  788. torchvoc.setId(item.getId());
  789. torchvoc.setReason(item.getReason());
  790. torchvocs.add(torchvoc);
  791. }
  792. return torchvocController.turnDownTorchvoc(torchvocs);
  793. case "yfl"://原辅料
  794. switch (dto.getSubName()) {
  795. case "material":
  796. List<TPssrMaterial> materials = new ArrayList<>();
  797. for (TPssrApproveDto item : dto.getDataList()) {
  798. TPssrMaterial material = new TPssrMaterial();
  799. material.setSubId(dto.getSubId());
  800. material.setId(item.getId());
  801. material.setReason(item.getReason());
  802. materials.add(material);
  803. }
  804. return materialController.turnDownMaterial(materials);
  805. case "raw":
  806. List<TPssrMaterialRaw> raws = new ArrayList<>();
  807. for (TPssrApproveDto item : dto.getDataList()) {
  808. TPssrMaterialRaw raw = new TPssrMaterialRaw();
  809. raw.setSubId(dto.getSubId());
  810. raw.setId(item.getId());
  811. raw.setReason(item.getReason());
  812. raws.add(raw);
  813. }
  814. return materialRawController.turnDownMaterialRaw(raws);
  815. }
  816. return AjaxResult.error("驳回失败!");
  817. case "jb"://机泵
  818. switch (dto.getSubName()) {
  819. case "cleaning":
  820. List<TPssrPumpCleaning> cleanings = new ArrayList<>();
  821. for (TPssrApproveDto item : dto.getDataList()) {
  822. TPssrPumpCleaning cleaning = new TPssrPumpCleaning();
  823. cleaning.setSubId(dto.getSubId());
  824. cleaning.setId(item.getId());
  825. cleaning.setReason(item.getReason());
  826. cleanings.add(cleaning);
  827. }
  828. return pumpCleaningController.turnDownPumpCleaning(cleanings);
  829. case "overhaul":
  830. List<TPssrPumpOverhaul> overhauls = new ArrayList<>();
  831. for (TPssrApproveDto item : dto.getDataList()) {
  832. TPssrPumpOverhaul overhaul = new TPssrPumpOverhaul();
  833. overhaul.setSubId(dto.getSubId());
  834. overhaul.setId(item.getId());
  835. overhaul.setReason(item.getReason());
  836. overhauls.add(overhaul);
  837. }
  838. return pumpOverhaulController.turnDownPumpOverhaul(overhauls);
  839. case "fill":
  840. List<TPssrPumpFill> fills = new ArrayList<>();
  841. for (TPssrApproveDto item : dto.getDataList()) {
  842. TPssrPumpFill fill = new TPssrPumpFill();
  843. fill.setSubId(dto.getSubId());
  844. fill.setId(item.getId());
  845. fill.setReason(item.getReason());
  846. fills.add(fill);
  847. }
  848. return pumpFillController.turnDownPumpFill(fills);
  849. }
  850. return AjaxResult.error("驳回失败!");
  851. case "zdj"://支吊架
  852. List<TPssrFrame> frames = new ArrayList<>();
  853. for (TPssrApproveDto item : dto.getDataList()) {
  854. TPssrFrame frame = new TPssrFrame();
  855. frame.setSubId(dto.getSubId());
  856. frame.setId(item.getId());
  857. frame.setReason(item.getReason());
  858. frames.add(frame);
  859. }
  860. return frameController.turnDownFrame(frames);
  861. case "tzsb"://特种设备
  862. switch (dto.getSubName()) {
  863. case "pipe":
  864. List<TPssrPipe> pipes = new ArrayList<>();
  865. for (TPssrApproveDto item : dto.getDataList()) {
  866. TPssrPipe pipe = new TPssrPipe();
  867. pipe.setSubId(dto.getSubId());
  868. pipe.setId(item.getId());
  869. pipe.setReason(item.getReason());
  870. pipes.add(pipe);
  871. }
  872. return pipeController.turnDownPipe(pipes);
  873. case "vessel":
  874. List<TPssrVessel> vessels = new ArrayList<>();
  875. for (TPssrApproveDto item : dto.getDataList()) {
  876. TPssrVessel vessel = new TPssrVessel();
  877. vessel.setSubId(dto.getSubId());
  878. vessel.setId(item.getId());
  879. vessel.setReason(item.getReason());
  880. vessels.add(vessel);
  881. }
  882. return vesselController.turnDownVessel(vessels);
  883. }
  884. return AjaxResult.error("驳回失败!");
  885. case "ybjy"://仪表校验
  886. List<TPssrInstrumentCalibration> calibrations = new ArrayList<>();
  887. for (TPssrApproveDto item : dto.getDataList()) {
  888. TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
  889. calibration.setSubId(dto.getSubId());
  890. calibration.setId(item.getId());
  891. calibration.setReason(item.getReason());
  892. calibrations.add(calibration);
  893. }
  894. return instrumentCalibrationController.turnDownInstrumentCalibration(calibrations);
  895. case "yblscs"://仪表联锁测试
  896. return AjaxResult.success();
  897. case "bjlszqr"://报警联锁值确认
  898. return AjaxResult.success();
  899. case "lsdy"://临时电源
  900. List<TPssrPower> powers = new ArrayList<>();
  901. for (TPssrApproveDto item : dto.getDataList()) {
  902. TPssrPower power = new TPssrPower();
  903. power.setSubId(dto.getSubId());
  904. power.setId(item.getId());
  905. power.setReason(item.getReason());
  906. powers.add(power);
  907. }
  908. return powerController.turnDownPower(powers);
  909. case "djsb"://电机设备
  910. List<TPssrMotor> motors = new ArrayList<>();
  911. for (TPssrApproveDto item : dto.getDataList()) {
  912. TPssrMotor motor = new TPssrMotor();
  913. motor.setSubId(dto.getSubId());
  914. motor.setId(item.getId());
  915. motor.setReason(item.getReason());
  916. motors.add(motor);
  917. }
  918. return motorController.turnDownMotor(motors);
  919. case "zmdbr"://照明、电伴热
  920. List<TPssrLighting> lightings = new ArrayList<>();
  921. for (TPssrApproveDto item : dto.getDataList()) {
  922. TPssrLighting lighting = new TPssrLighting();
  923. lighting.setSubId(dto.getSubId());
  924. lighting.setId(item.getId());
  925. lighting.setReason(item.getReason());
  926. lightings.add(lighting);
  927. }
  928. return lightingController.turnDownLighting(lightings);
  929. case "jdjdkj"://静电接地、跨接
  930. List<TPssrFranklinism> franklinisms = new ArrayList<>();
  931. for (TPssrApproveDto item : dto.getDataList()) {
  932. TPssrFranklinism franklinism = new TPssrFranklinism();
  933. franklinism.setSubId(dto.getSubId());
  934. franklinism.setId(item.getId());
  935. franklinism.setReason(item.getReason());
  936. franklinisms.add(franklinism);
  937. }
  938. return franklinismController.turnDownFranklinism(franklinisms);
  939. case "qtjcy"://气体检测仪
  940. List<TPssrGasdetector> gasdetectors = new ArrayList<>();
  941. for (TPssrApproveDto item : dto.getDataList()) {
  942. TPssrGasdetector gasdetector = new TPssrGasdetector();
  943. gasdetector.setSubId(dto.getSubId());
  944. gasdetector.setId(item.getId());
  945. gasdetector.setReason(item.getReason());
  946. gasdetectors.add(gasdetector);
  947. }
  948. return gasdetectorController.turnDownGasdetector(gasdetectors);
  949. case "zxfxy"://在线分析仪
  950. List<TPssrAnalyzer> analyzers = new ArrayList<>();
  951. for (TPssrApproveDto item : dto.getDataList()) {
  952. TPssrAnalyzer analyzer = new TPssrAnalyzer();
  953. analyzer.setSubId(dto.getSubId());
  954. analyzer.setId(item.getId());
  955. analyzer.setReason(item.getReason());
  956. analyzers.add(analyzer);
  957. }
  958. return analyzerController.turnDownAnalyzer(analyzers);
  959. default:
  960. return AjaxResult.error("驳回失败!");
  961. }
  962. }
  963. /**
  964. * 子项内容确认
  965. */
  966. public static void handleConfirmApprove(TPssrApprove approve, String userId) {
  967. String processInstancesId = approve.getProcessId();
  968. ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  969. TaskService taskService = processEngine.getTaskService();
  970. Task task = processEngine.getTaskService()//获取任务service
  971. .createTaskQuery()//创建查询对象
  972. .taskAssignee(userId)
  973. .processInstanceId(processInstancesId).singleResult();
  974. String taskId = task.getId();
  975. //处理流程节点
  976. Map<String, Object> param = new HashMap<>();
  977. param.put("condition", "0");
  978. //认领任务
  979. processEngine.getTaskService().claim(taskId, userId);
  980. taskService.addComment(taskId, processInstancesId, "通过");
  981. taskService.complete(taskId, param);
  982. }
  983. /**
  984. * 查询pssr审批管理列表
  985. */
  986. @PreAuthorize("@ss.hasPermi('pssr:approve:list')")
  987. @GetMapping("/list")
  988. public TableDataInfo list(TPssrApprove tPssrApprove) {
  989. startPage();
  990. List<TPssrApprove> list = tPssrApproveService.selectTPssrApproveList(tPssrApprove);
  991. return getDataTable(list);
  992. }
  993. /**
  994. * 导出pssr审批管理列表
  995. */
  996. @PreAuthorize("@ss.hasPermi('pssr:approve:export')")
  997. @Log(title = "pssr审批管理", businessType = BusinessType.EXPORT)
  998. @GetMapping("/export")
  999. public AjaxResult export(TPssrApprove tPssrApprove) {
  1000. List<TPssrApprove> list = tPssrApproveService.selectTPssrApproveList(tPssrApprove);
  1001. ExcelUtil<TPssrApprove> util = new ExcelUtil<TPssrApprove>(TPssrApprove.class);
  1002. return util.exportExcel(list, "approve");
  1003. }
  1004. /**
  1005. * 获取pssr审批管理详细信息
  1006. */
  1007. @PreAuthorize("@ss.hasPermi('pssr:approve:query')")
  1008. @GetMapping(value = "/{approveId}")
  1009. public AjaxResult getInfo(@PathVariable("approveId") Long approveId) {
  1010. return AjaxResult.success(tPssrApproveService.selectTPssrApproveById(approveId));
  1011. }
  1012. /**
  1013. * 新增pssr审批管理
  1014. */
  1015. @PreAuthorize("@ss.hasPermi('pssr:approve:add')")
  1016. @Log(title = "pssr审批管理", businessType = BusinessType.INSERT)
  1017. @PostMapping
  1018. public AjaxResult add(@RequestBody TPssrApprove tPssrApprove) {
  1019. return toAjax(tPssrApproveService.insertTPssrApprove(tPssrApprove));
  1020. }
  1021. /**
  1022. * 修改pssr审批管理
  1023. */
  1024. @PreAuthorize("@ss.hasPermi('pssr:approve:edit')")
  1025. @Log(title = "pssr审批管理", businessType = BusinessType.UPDATE)
  1026. @PutMapping
  1027. public AjaxResult edit(@RequestBody TPssrApprove tPssrApprove) {
  1028. return toAjax(tPssrApproveService.updateTPssrApprove(tPssrApprove));
  1029. }
  1030. /**
  1031. * 删除pssr审批管理
  1032. */
  1033. @PreAuthorize("@ss.hasPermi('pssr:approve:remove')")
  1034. @Log(title = "pssr审批管理", businessType = BusinessType.DELETE)
  1035. @DeleteMapping("/{approveIds}")
  1036. public AjaxResult remove(@PathVariable Long[] approveIds) {
  1037. return toAjax(tPssrApproveService.deleteTPssrApproveByIds(approveIds));
  1038. }
  1039. @Log(title = "pssr发起审批", businessType = BusinessType.INSERT)
  1040. @PostMapping("/doPssrApprove/{subId}")
  1041. public AjaxResult doApprove(@PathVariable Long subId) {
  1042. TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(subId);
  1043. if (judgmentOrder(tPssrSubcontent)) {
  1044. return AjaxResult.error("请先完成前置审批流程");
  1045. }
  1046. switch (tPssrSubcontent.getForShort()) {
  1047. case "jxxm"://检修项目
  1048. if (tPssrOverhaulExchangerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1049. return AjaxResult.error("请确认所有确认人都已选择!");
  1050. }
  1051. doJxxmApprove(tPssrSubcontent);
  1052. break;
  1053. case "kgfa"://开工方案
  1054. if (tPssrProgrammeService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1055. return AjaxResult.error("请确认所有确认人都已选择!");
  1056. }
  1057. doKgfaApprove(tPssrSubcontent);
  1058. break;
  1059. case "sjbg"://设计变更
  1060. if (tPssrMocService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1061. return AjaxResult.error("请确认所有确认人都已选择!");
  1062. }
  1063. doMocApprove(tPssrSubcontent);
  1064. break;
  1065. case "mb"://盲板
  1066. if (tPssrBlindService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1067. return AjaxResult.error("请确认所有确认人都已选择!");
  1068. }
  1069. doMbApprove(tPssrSubcontent);
  1070. break;
  1071. case "xcws"://现场卫生
  1072. if (tPssrHygieneService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1073. return AjaxResult.error("请确认所有确认人都已选择!");
  1074. }
  1075. doXcwsApprove(tPssrSubcontent);
  1076. break;
  1077. case "rsfh"://人身防护
  1078. if (tPssrProtectionService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
  1079. || tPssrMeasureService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1080. return AjaxResult.error("请确认所有确认人都已选择!");
  1081. }
  1082. doRsfhApprove(tPssrSubcontent);
  1083. break;
  1084. case "sbqjd"://设备清洁度
  1085. if (tPssrCleaningService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1086. return AjaxResult.error("请确认所有确认人都已选择!");
  1087. }
  1088. doSbqjdApprove(tPssrSubcontent);
  1089. break;
  1090. case "qm"://气密
  1091. if (tPssrAirtightService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1092. return AjaxResult.error("请确认所有确认人都已选择!");
  1093. }
  1094. doQmApprove(tPssrSubcontent);
  1095. break;
  1096. case "sksgfmzt"://锁开锁关阀门状态
  1097. if (tPssrLockService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1098. return AjaxResult.error("请确认所有确认人都已选择!");
  1099. }
  1100. doSksgApprove(tPssrSubcontent);
  1101. break;
  1102. case "sys"://实验室
  1103. if (tPssrLaboratoryService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1104. return AjaxResult.error("请确认所有确认人都已选择!");
  1105. }
  1106. doSysApprove(tPssrSubcontent);
  1107. break;
  1108. case "dj"://短接
  1109. if (tPssrCircuitService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1110. return AjaxResult.error("请确认所有确认人都已选择!");
  1111. }
  1112. doDjApprove(tPssrSubcontent);
  1113. break;
  1114. case "dqzh"://氮气置换
  1115. if (tPssrNitrogenService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1116. return AjaxResult.error("请确认所有确认人都已选择!");
  1117. }
  1118. doDqzhApprove(tPssrSubcontent);
  1119. break;
  1120. case "xqf"://消气防设施
  1121. if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1122. return AjaxResult.error("请确认所有确认人都已选择!");
  1123. }
  1124. doPatrolApprove(tPssrSubcontent);
  1125. break;
  1126. case "aqss"://安全设施
  1127. if (tPssrSafetyBleedService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1128. return AjaxResult.error("请确认所有确认人都已选择!");
  1129. }
  1130. doAqssApprove(tPssrSubcontent);
  1131. break;
  1132. case "txjk"://通讯监控
  1133. if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1134. return AjaxResult.error("请确认所有确认人都已选择!");
  1135. }
  1136. doPatrolApprove(tPssrSubcontent);
  1137. break;
  1138. case "bxsjcy"://便携式检测仪
  1139. if (tPssrPatrolService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1140. return AjaxResult.error("请确认所有确认人都已选择!");
  1141. }
  1142. doPatrolApprove(tPssrSubcontent);
  1143. break;
  1144. case "gygc"://公用工程
  1145. if (tPssrPublicService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1146. return AjaxResult.error("请确认所有确认人都已选择!");
  1147. }
  1148. doGygcApprove(tPssrSubcontent);
  1149. break;
  1150. case "hbss"://环保设施
  1151. if (tPssrTorchvocService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1152. return AjaxResult.error("请确认所有确认人都已选择!");
  1153. }
  1154. doHbssApprove(tPssrSubcontent);
  1155. break;
  1156. case "yfl"://原辅料
  1157. if (tPssrMaterialService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
  1158. || tPssrMaterialRawService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1159. return AjaxResult.error("请确认所有确认人都已选择!");
  1160. }
  1161. doYflApprove(tPssrSubcontent);
  1162. break;
  1163. case "jb"://机泵
  1164. if (tPssrPumpCleaningService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1165. return AjaxResult.error("请确认所有确认人都已选择!");
  1166. }
  1167. doJbApprove(tPssrSubcontent);
  1168. break;
  1169. case "zdj"://支吊架
  1170. if (tPssrFrameService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1171. return AjaxResult.error("请确认所有确认人都已选择!");
  1172. }
  1173. doZdjApprove(tPssrSubcontent);
  1174. break;
  1175. case "tzsb"://特种设备
  1176. if (tPssrPipeService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0
  1177. || tPssrVesselService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1178. return AjaxResult.error("请确认所有确认人都已选择!");
  1179. }
  1180. doTzsbApprove(tPssrSubcontent);
  1181. break;
  1182. case "ybjy"://仪表校验
  1183. if (tPssrInstrumentCalibrationService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1184. return AjaxResult.error("请确认所有确认人都已选择!");
  1185. }
  1186. doYbjyApprove(tPssrSubcontent);
  1187. break;
  1188. case "yblscs"://仪表联锁测试
  1189. doYblscsApprove(tPssrSubcontent);
  1190. break;
  1191. case "bjlszqr"://报警联锁值确认
  1192. doBjlszqrApprove(tPssrSubcontent);
  1193. break;
  1194. case "lsdy"://临时电源
  1195. if (tPssrPowerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1196. return AjaxResult.error("请确认所有确认人都已选择!");
  1197. }
  1198. doLsdyApprove(tPssrSubcontent);
  1199. break;
  1200. case "djsb"://电机设备
  1201. if (tPssrMotorService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1202. return AjaxResult.error("请确认所有确认人都已选择!");
  1203. }
  1204. doDjsbApprove(tPssrSubcontent);
  1205. break;
  1206. case "zmdbr"://照明、电伴热
  1207. if (tPssrLightingService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1208. return AjaxResult.error("请确认所有确认人都已选择!");
  1209. }
  1210. doZmdbrApprove(tPssrSubcontent);
  1211. break;
  1212. case "jdjdkj"://静电接地、跨接
  1213. if (tPssrFranklinismService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1214. return AjaxResult.error("请确认所有确认人都已选择!");
  1215. }
  1216. doJdjdkjApprove(tPssrSubcontent);
  1217. break;
  1218. case "qtjcy"://气体检测仪
  1219. if (tPssrGasdetectorService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1220. return AjaxResult.error("请确认所有确认人都已选择!");
  1221. }
  1222. doQtjcyApprove(tPssrSubcontent);
  1223. break;
  1224. case "zxfxy"://在线分析仪
  1225. if (tPssrAnalyzerService.selectNoConfirmCount(tPssrSubcontent.getId()) > 0) {
  1226. return AjaxResult.error("请确认所有确认人都已选择!");
  1227. }
  1228. doZxfxyApprove(tPssrSubcontent);
  1229. break;
  1230. default:
  1231. return AjaxResult.error("申请发起失败!");
  1232. }
  1233. tPssrSubcontent.setApproveStatus(1L);
  1234. tPssrSubcontentService.updateTPssrSubcontent(tPssrSubcontent);
  1235. return AjaxResult.success();
  1236. }
  1237. /**
  1238. * 判断当前发起的审批是否满足前置条件
  1239. */
  1240. private boolean judgmentOrder(TPssrSubcontent sub) {
  1241. TPssrSubcontent subcontent = new TPssrSubcontent();
  1242. subcontent.setAboveallId(sub.getAboveallId());
  1243. List<String> forShorts = new ArrayList<>();
  1244. if ("jb,ybjy".contains(sub.getForShort())) {
  1245. } else if ("sbqjd".contains(sub.getForShort())) {
  1246. forShorts.add("jb");
  1247. forShorts.add("ybjy");
  1248. } else if ("jxxm,kgfa,sjbg".contains(sub.getForShort())) {
  1249. forShorts.add("sbqjd");
  1250. } else if ("mb".contains(sub.getForShort())) {
  1251. forShorts.add("jxxm");
  1252. forShorts.add("kgfa");
  1253. forShorts.add("sjbg");
  1254. } else if ("dj,aqss,sksgfmzt".contains(sub.getForShort())) {
  1255. forShorts.add("mb");
  1256. } else if ("xcws,rsfh,xqf,txjk,bxsjcy,hbss".contains(sub.getForShort())) {
  1257. forShorts.add("dj");
  1258. forShorts.add("aqss");
  1259. forShorts.add("sksgfmzt");
  1260. } else if ("ssy,gygc,yfl".contains(sub.getForShort())) {
  1261. forShorts.add("xcws");
  1262. forShorts.add("rsfh");
  1263. forShorts.add("xqf");
  1264. forShorts.add("txjk");
  1265. forShorts.add("bxsjcy");
  1266. forShorts.add("hbss");
  1267. } else if ("qm,dqzh".contains(sub.getForShort())) {
  1268. forShorts.add("ssy");
  1269. forShorts.add("gygc");
  1270. forShorts.add("yfl");
  1271. }
  1272. if (CollectionUtils.isNotEmpty(forShorts)) {
  1273. subcontent.setForShorts(forShorts);
  1274. for (TPssrSubcontent tPssrSubcontent : tPssrSubcontentService.selectTPssrSubcontentListByForShort(subcontent)) {
  1275. if (tPssrSubcontent.getApproveStatus() != 2) {
  1276. return true;
  1277. }
  1278. }
  1279. }
  1280. return false;
  1281. }
  1282. @Log(title = "pssr负责人审批", businessType = BusinessType.UPDATE)
  1283. @PutMapping("/handlePssrApprove")
  1284. public AjaxResult handlePssrApprove(@RequestBody DevTask devTask) {
  1285. TPssrApprove approve = devTask.gettPssrApprove();
  1286. //使用任务服务完成任务(提交任务)
  1287. String taskId = devTask.getTaskId();
  1288. // 使用任务id,获取任务对象,获取流程实例id
  1289. Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
  1290. //利用任务对象,获取流程实例id
  1291. String taskName = task.getName();//实例名
  1292. String processInstancesId = task.getProcessInstanceId();
  1293. String userId = getUserId().toString();
  1294. String condition = devTask.getCondition();
  1295. boolean allDone = false;
  1296. TPssrSubcontent tPssrSubcontent = tPssrSubcontentService.selectTPssrSubcontentById(approve.getSubId());
  1297. String remark = "";
  1298. if (condition.equals("0")) {
  1299. approve.setApproveStatus(2L);
  1300. tPssrSubcontent.setApproveStatus(2L);
  1301. tPssrSubcontent.setConfirmationDate(new Date());
  1302. tPssrSubcontentService.updateTPssrSubcontent(tPssrSubcontent);
  1303. tPssrApproveService.updateTPssrApprove(approve);
  1304. TPssrSubcontent subcontent = new TPssrSubcontent();
  1305. subcontent.setAboveallId(tPssrSubcontent.getAboveallId());
  1306. for (TPssrSubcontent pssrSubcontent : tPssrSubcontentService.selectTPssrSubcontentList(subcontent)) {
  1307. if (pssrSubcontent.getApproveStatus() != 2) {
  1308. allDone = false;
  1309. break;
  1310. }
  1311. allDone = true;
  1312. }
  1313. }
  1314. //处理流程节点
  1315. Map<String, Object> param = new HashMap<>();
  1316. param.put("condition", condition);
  1317. ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  1318. TaskService taskService = processEngine.getTaskService();
  1319. //认领任务
  1320. processEngine.getTaskService().claim(taskId, userId);
  1321. taskService.addComment(taskId, processInstancesId, remark);
  1322. taskService.complete(taskId, param);
  1323. // 所有流程都结束时,发起经理审批
  1324. if (allDone)
  1325. doMgrApprove(tPssrSubcontent.getAboveallId());
  1326. return AjaxResult.success();
  1327. }
  1328. // pssr发起经理审批
  1329. public void doMgrApprove(Long aboveallId) {
  1330. String userId = getUserId().toString();
  1331. TPssrAboveall aboveall = tPssrAboveallService.selectTPssrAboveallById(aboveallId);
  1332. TStaffmgr tStaffmgr = new TStaffmgr();
  1333. tStaffmgr.setActualposts("24");//装置经理
  1334. tStaffmgr.setDeptId(103L);
  1335. for (SysUser user : userService.selectUserPost(tStaffmgr)) {
  1336. aboveall.setPlantMgr(user.getUserId());
  1337. aboveall.setConfirm(user.getUserId().toString());
  1338. }
  1339. tStaffmgr.setActualposts("40");//ctm经理
  1340. for (SysUser user : userService.selectUserPost(tStaffmgr)) {
  1341. aboveall.setCtmMgr(user.getUserId());
  1342. }
  1343. tStaffmgr.setActualposts("42");//cta经理
  1344. for (SysUser user : userService.selectUserPost(tStaffmgr)) {
  1345. aboveall.setCtaMgr(user.getUserId());
  1346. }
  1347. List<String> executor = new ArrayList<>();
  1348. executor.add(aboveall.getPlantMgr().toString());
  1349. executor.add(aboveall.getCtmMgr().toString());
  1350. executor.add(aboveall.getCtaMgr().toString());
  1351. //设置当前申请人
  1352. Map<String, Object> variables = new HashMap<>();
  1353. variables.put("applyUser", userId);
  1354. variables.put("allJlUsers", executor);
  1355. variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
  1356. variables.put("jlUser", aboveall.getPlantMgr());
  1357. TPssrApprove exist = tPssrApproveService.selectTPssrApproveByAboveallId(aboveallId);
  1358. if (exist == null) {
  1359. TPssrApprove approve = new TPssrApprove();
  1360. approve.setAboveallId(aboveallId);
  1361. approve.setApproveStatus(1L);
  1362. approve.setApNo(DateUtils.dateTimeNow() + userId);
  1363. approve.setApproveStatus(1L);
  1364. approve.setCreaterCode(userId);
  1365. approve.setCreatedate(new Date());
  1366. tPssrApproveService.insertTPssrApprove(approve);
  1367. // 开始申请流程
  1368. long businessKey = approve.getApproveId();
  1369. //开始工作流、监听
  1370. Authentication.setAuthenticatedUserId(userId);
  1371. //采用key来启动流程定义并设置流程变量,返回流程实例
  1372. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssrMgrConfirm", String.valueOf(businessKey), variables);
  1373. approve.setProcessId(pi.getProcessInstanceId());
  1374. tPssrApproveService.updateTPssrApprove(approve);
  1375. } else {
  1376. delProcess(exist.getProcessId(), "pssrMgrConfirm");
  1377. // 开始申请流程
  1378. long businessKey = exist.getApproveId();
  1379. //开始工作流、监听
  1380. Authentication.setAuthenticatedUserId(userId);
  1381. //采用key来启动流程定义并设置流程变量,返回流程实例
  1382. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssrMgrConfirm", String.valueOf(businessKey), variables);
  1383. exist.setProcessId(pi.getProcessInstanceId());
  1384. tPssrApproveService.updateTPssrApprove(exist);
  1385. }
  1386. aboveall.setApproveStatus(1L);
  1387. tPssrAboveallService.updateTPssrAboveall(aboveall);
  1388. }
  1389. @PutMapping("/handleMgrApprove")
  1390. public AjaxResult handleMgrApprove(@RequestBody DevTask devTask) throws Exception {
  1391. TPssrApprove approve = devTask.gettPssrApprove();
  1392. //使用任务服务完成任务(提交任务)
  1393. String taskId = devTask.getTaskId();
  1394. // 使用任务id,获取任务对象,获取流程实例id
  1395. Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
  1396. //利用任务对象,获取流程实例id
  1397. String taskName = task.getName();//实例名
  1398. String processInstancesId = task.getProcessInstanceId();
  1399. String userId = getUserId().toString();
  1400. String condition = devTask.getCondition();
  1401. TPssrAboveall aboveall = tPssrAboveallService.selectTPssrAboveallById(approve.getAboveallId());
  1402. if (taskName.equals("部门经理")) {
  1403. if (condition.equals("0")) {
  1404. if (userId.equals(aboveall.getPlantMgr().toString())) {
  1405. aboveall.setPlantConfirmdate(new Date());
  1406. } else if (userId.equals(aboveall.getCtmMgr().toString())) {
  1407. aboveall.setCtmConfirmdate(new Date());
  1408. } else if (userId.equals(aboveall.getCtaMgr().toString())) {
  1409. aboveall.setCtaConfirmdate(new Date());
  1410. }
  1411. }
  1412. }
  1413. if (taskName.equals("装置经理")) {
  1414. if (condition.equals("0")) {
  1415. aboveall.setApproveStatus(2L);
  1416. aboveall.setConfirmationDate(new Date());
  1417. new Thread(new Runnable() {
  1418. @Override
  1419. public void run() {
  1420. TPssrApproveController controller = new TPssrApproveController();
  1421. try {
  1422. controller.genZip(aboveall);//生成子项文件压缩包
  1423. } catch (Exception e) {
  1424. e.printStackTrace();
  1425. }
  1426. }
  1427. }).start();
  1428. }
  1429. }
  1430. tPssrAboveallService.updateTPssrAboveall(aboveall);
  1431. //处理流程节点
  1432. Map<String, Object> param = new HashMap<>();
  1433. param.put("condition", condition);
  1434. ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  1435. TaskService taskService = processEngine.getTaskService();
  1436. //认领任务
  1437. processEngine.getTaskService().claim(taskId, userId);
  1438. taskService.complete(taskId, param);
  1439. return AjaxResult.success();
  1440. }
  1441. /**
  1442. * 生成子项文件压缩包
  1443. */
  1444. @GetMapping("/genZip")
  1445. public void genZip(TPssrAboveall aboveall) throws Exception {
  1446. Long id = aboveall.getId();//主表id
  1447. AjaxResult result = null;
  1448. String msg = "";//导出方法文件名
  1449. String downloadPath = getProfile() + "/download/";//导出方法默认目录
  1450. String path = "";//导出方法默认文件路径=msg+downloadPath
  1451. String rootPath = getProfile() + "/download/pssr_" + id + "_" + UUID.randomUUID().toString() + "/";//即将被打包的根目录
  1452. String subTitle = "";//子表目录字符串
  1453. List<File> files = new ArrayList<>();//文件路径集合
  1454. TPssrSubcontent queryParams = new TPssrSubcontent();
  1455. queryParams.setAboveallId(id);
  1456. List<TPssrSubcontent> tPssrSubcontents = tPssrSubcontentService.selectTPssrSubcontentList(queryParams);//子表集合
  1457. this.createSubitemDirectory(rootPath);//创建子表目录
  1458. for (TPssrSubcontent tPssrSubcontent : tPssrSubcontents) {
  1459. TPssrPatrol patrol = new TPssrPatrol();
  1460. patrol.setSubId(tPssrSubcontent.getId());
  1461. List<TPssrPatrol> tPssrPatrols = tPssrPatrolService.selectTPssrPatrolList(patrol);//巡检集合
  1462. switch (tPssrSubcontent.getForShort()) {
  1463. case "jxxm"://检修项目
  1464. subTitle = "01检修项目/";
  1465. TPssrOverhaulFilter filter = new TPssrOverhaulFilter();//过滤器
  1466. filter.setSubId(tPssrSubcontent.getId());//子表id
  1467. result = filterController.export(filter);
  1468. msg = (String) result.get("msg");
  1469. path = downloadPath + msg;
  1470. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1471. files.add(new File(rootPath + subTitle + msg));
  1472. TPssrOverhaulTower tower = new TPssrOverhaulTower();//塔罐
  1473. tower.setSubId(tPssrSubcontent.getId());//子表id
  1474. result = towerController.export(tower);
  1475. msg = (String) result.get("msg");
  1476. path = downloadPath + msg;
  1477. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1478. files.add(new File(rootPath + subTitle + msg));
  1479. TPssrOverhaulValve valve = new TPssrOverhaulValve();//阀门
  1480. valve.setSubId(tPssrSubcontent.getId());//子表id
  1481. result = valveController.export(valve);
  1482. msg = (String) result.get("msg");
  1483. path = downloadPath + msg;
  1484. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1485. files.add(new File(rootPath + subTitle + msg));
  1486. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();//换热器
  1487. exchanger.setSubId(tPssrSubcontent.getId());//子表id
  1488. exchanger.setDevType(1L);
  1489. result = exchangerController.export(exchanger);
  1490. msg = (String) result.get("msg");
  1491. path = downloadPath + msg;
  1492. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1493. files.add(new File(rootPath + subTitle + msg));
  1494. exchanger.setDevType(2L);
  1495. result = exchangerController.export(exchanger);
  1496. msg = (String) result.get("msg");
  1497. path = downloadPath + msg;
  1498. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1499. files.add(new File(rootPath + subTitle + msg));
  1500. exchanger.setDevType(3L);
  1501. result = exchangerController.export(exchanger);
  1502. msg = (String) result.get("msg");
  1503. path = downloadPath + msg;
  1504. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1505. files.add(new File(rootPath + subTitle + msg));
  1506. exchanger.setDevType(4L);
  1507. result = exchangerController.export(exchanger);
  1508. msg = (String) result.get("msg");
  1509. path = downloadPath + msg;
  1510. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1511. files.add(new File(rootPath + subTitle + msg));
  1512. exchanger.setDevType(5L);
  1513. result = exchangerController.export(exchanger);
  1514. msg = (String) result.get("msg");
  1515. path = downloadPath + msg;
  1516. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1517. files.add(new File(rootPath + subTitle + msg));
  1518. break;
  1519. case "kgfa"://开工方案
  1520. subTitle = "02开工方案/";
  1521. TPssrProgramme programme = new TPssrProgramme();
  1522. programme.setSubId(tPssrSubcontent.getId());//子表id
  1523. result = programmeController.export(programme);
  1524. msg = (String) result.get("msg");
  1525. path = downloadPath + msg;
  1526. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1527. files.add(new File(rootPath + subTitle + msg));
  1528. //附件
  1529. List<TPssrProgramme> tPssrProgrammes = tPssrProgrammeService.selectTPssrProgrammeList(programme);
  1530. for (TPssrProgramme tPssrProgramme : tPssrProgrammes) {
  1531. String fileUrl = tPssrProgramme.getFileUrl();
  1532. String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
  1533. Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1534. }
  1535. break;
  1536. case "sjbg"://设计变更
  1537. subTitle = "03设计变更/";
  1538. TPssrMoc moc = new TPssrMoc();
  1539. moc.setSubId(tPssrSubcontent.getId());//子表id
  1540. result = mocController.export(moc);
  1541. msg = (String) result.get("msg");
  1542. path = downloadPath + msg;
  1543. files.add(new File(path));
  1544. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1545. files.add(new File(rootPath + subTitle + msg));
  1546. break;
  1547. case "mb"://盲板
  1548. subTitle = "04盲板/";
  1549. TPssrBlind blind = new TPssrBlind();
  1550. blind.setSubId(tPssrSubcontent.getId());//子表id
  1551. result = blindController.export(blind);
  1552. msg = (String) result.get("msg");
  1553. path = downloadPath + msg;
  1554. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1555. files.add(new File(rootPath + subTitle + msg));
  1556. break;
  1557. case "xcws"://现场卫生
  1558. subTitle = "05现场卫生/";
  1559. TPssrHygiene hygiene = new TPssrHygiene();
  1560. hygiene.setSubId(tPssrSubcontent.getId());//子表id
  1561. result = hygieneController.export(hygiene);
  1562. msg = (String) result.get("msg");
  1563. path = downloadPath + msg;
  1564. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1565. files.add(new File(rootPath + subTitle + msg));
  1566. break;
  1567. case "rsfh"://人身防护
  1568. subTitle = "06人身防护/";
  1569. TPssrProtection protection = new TPssrProtection();
  1570. protection.setSubId(tPssrSubcontent.getId());//子表id
  1571. result = protectionController.export(protection);
  1572. msg = (String) result.get("msg");
  1573. path = downloadPath + msg;
  1574. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1575. files.add(new File(rootPath + subTitle + msg));
  1576. TPssrMeasure measure = new TPssrMeasure();
  1577. measure.setSubId(tPssrSubcontent.getId());//子表id
  1578. result = measureController.export(measure);
  1579. msg = (String) result.get("msg");
  1580. path = downloadPath + msg;
  1581. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1582. files.add(new File(rootPath + subTitle + msg));
  1583. break;
  1584. case "sbqjd"://设备清洁度
  1585. subTitle = "07设备清洁度/";
  1586. TPssrCleaning cleaning = new TPssrCleaning();
  1587. cleaning.setSubId(tPssrSubcontent.getId());//子表id
  1588. result = cleaningController.export(cleaning);
  1589. msg = (String) result.get("msg");
  1590. path = downloadPath + msg;
  1591. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1592. files.add(new File(rootPath + subTitle + msg));
  1593. break;
  1594. case "qm"://气密
  1595. subTitle = "08气密/";
  1596. TPssrAirtight airtight = new TPssrAirtight();
  1597. airtight.setSubId(tPssrSubcontent.getId());//子表id
  1598. result = airtightController.export(airtight);
  1599. msg = (String) result.get("msg");
  1600. path = downloadPath + msg;
  1601. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1602. files.add(new File(rootPath + subTitle + msg));
  1603. // break;
  1604. case "sksgfmzt"://锁开锁关阀门状态
  1605. subTitle = "09锁开锁关阀门状态/";
  1606. TPssrLock lock = new TPssrLock();
  1607. lock.setSubId(tPssrSubcontent.getId());//子表id
  1608. result = lockController.export(lock);
  1609. msg = (String) result.get("msg");
  1610. path = downloadPath + msg;
  1611. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1612. files.add(new File(rootPath + subTitle + msg));
  1613. break;
  1614. case "sys"://实验室
  1615. subTitle = "10实验室/";
  1616. TPssrLaboratory laboratory = new TPssrLaboratory();
  1617. laboratory.setSubId(tPssrSubcontent.getId());//子表id
  1618. result = laboratoryController.export(laboratory);
  1619. msg = (String) result.get("msg");
  1620. path = downloadPath + msg;
  1621. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1622. files.add(new File(rootPath + subTitle + msg));
  1623. break;
  1624. case "dj"://短接
  1625. subTitle = "11短接/";
  1626. TPssrCircuit circuit = new TPssrCircuit();
  1627. circuit.setSubId(tPssrSubcontent.getId());//子表id
  1628. result = circuitController.export(circuit);
  1629. msg = (String) result.get("msg");
  1630. path = downloadPath + msg;
  1631. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1632. files.add(new File(rootPath + subTitle + msg));
  1633. break;
  1634. case "dqzh"://氮气置换
  1635. subTitle = "12氮气置换/";
  1636. TPssrNitrogen nitrogen = new TPssrNitrogen();
  1637. nitrogen.setSubId(tPssrSubcontent.getId());//子表id
  1638. result = nitrogenController.export(nitrogen);
  1639. msg = (String) result.get("msg");
  1640. path = downloadPath + msg;
  1641. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1642. files.add(new File(rootPath + subTitle + msg));
  1643. break;
  1644. case "xqf"://消气防设施(巡检)
  1645. subTitle = "13消气防设施/";
  1646. for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
  1647. String planType = tPssrPatrol.getPlanType().toString();
  1648. Long planId = tPssrPatrol.getPlanId();
  1649. switch (planType) {
  1650. case "1"://手提式/小推车式灭火器/灭火器材箱检查记录
  1651. TFireAnnihilator annihilator = new TFireAnnihilator();
  1652. annihilator.setPlanId(planId);
  1653. result = annihilatorController.export(annihilator);
  1654. msg = (String) result.get("msg");
  1655. path = downloadPath + msg;
  1656. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1657. files.add(new File(rootPath + subTitle + msg));
  1658. break;
  1659. case "2"://消防水炮检查记录
  1660. TFireWaterCannon waterCannon = new TFireWaterCannon();
  1661. waterCannon.setPlanId(planId);
  1662. result = waterCannonController.export(waterCannon);
  1663. msg = (String) result.get("msg");
  1664. path = downloadPath + msg;
  1665. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1666. files.add(new File(rootPath + subTitle + msg));
  1667. break;
  1668. case "3"://地上消火栓检查记录
  1669. TFirePostFire postFire = new TFirePostFire();
  1670. postFire.setPlanId(planId);
  1671. result = postFireController.export(postFire);
  1672. msg = (String) result.get("msg");
  1673. path = downloadPath + msg;
  1674. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1675. files.add(new File(rootPath + subTitle + msg));
  1676. break;
  1677. case "4"://消防水带箱检查记录
  1678. TFireHoseBox hoseBox = new TFireHoseBox();
  1679. hoseBox.setPlanId(planId);
  1680. result = hoseBoxController.export(hoseBox);
  1681. msg = (String) result.get("msg");
  1682. path = downloadPath + msg;
  1683. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1684. files.add(new File(rootPath + subTitle + msg));
  1685. break;
  1686. case "5"://消防竖管检查记录
  1687. TFireStandpipePatrol standpipe = new TFireStandpipePatrol();
  1688. standpipe.setPlanId(planId);
  1689. result = standpipeController.export(standpipe);
  1690. msg = (String) result.get("msg");
  1691. path = downloadPath + msg;
  1692. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1693. files.add(new File(rootPath + subTitle + msg));
  1694. break;
  1695. case "6"://自动喷淋灭火系统检查记录
  1696. TFireSprinkler sprinkler = new TFireSprinkler();
  1697. sprinkler.setPlanId(planId);
  1698. result = sprinklerController.export(sprinkler);
  1699. msg = (String) result.get("msg");
  1700. path = downloadPath + msg;
  1701. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1702. files.add(new File(rootPath + subTitle + msg));
  1703. break;
  1704. case "7"://应急事故柜检查记录
  1705. TEmergencyCabinet cabinet = new TEmergencyCabinet();
  1706. cabinet.setPlanId(planId);
  1707. result = cabinetController.export(cabinet);
  1708. msg = (String) result.get("msg");
  1709. path = downloadPath + msg;
  1710. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1711. files.add(new File(rootPath + subTitle + msg));
  1712. break;
  1713. case "8"://现场可燃气体检测器/火灾报警系统检查记录
  1714. TFireAlarm alarm = new TFireAlarm();
  1715. alarm.setPlanId(planId);
  1716. result = alarmController.export(alarm);
  1717. msg = (String) result.get("msg");
  1718. path = downloadPath + msg;
  1719. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1720. files.add(new File(rootPath + subTitle + msg));
  1721. break;
  1722. case "9"://CO2气体保护系统检查记录
  1723. TFireGasShield gasShield = new TFireGasShield();
  1724. gasShield.setPlanId(planId);
  1725. result = gasShieldController.export(gasShield);
  1726. msg = (String) result.get("msg");
  1727. path = downloadPath + msg;
  1728. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1729. files.add(new File(rootPath + subTitle + msg));
  1730. break;
  1731. case "12"://淋浴洗眼器检查记录
  1732. TEmergencyEyewash eyewash = new TEmergencyEyewash();
  1733. eyewash.setPlanId(planId);
  1734. result = eyewashController.export(eyewash);
  1735. msg = (String) result.get("msg");
  1736. path = downloadPath + msg;
  1737. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1738. files.add(new File(rootPath + subTitle + msg));
  1739. break;
  1740. case "13"://应急沙箱检查记录
  1741. TFireSandbox sandbox = new TFireSandbox();
  1742. sandbox.setPlanId(planId);
  1743. result = sandboxController.export(sandbox);
  1744. msg = (String) result.get("msg");
  1745. path = downloadPath + msg;
  1746. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1747. files.add(new File(rootPath + subTitle + msg));
  1748. break;
  1749. case "14"://常闭式防爆门/防火门检查记录
  1750. TFireDoor door = new TFireDoor();
  1751. door.setPlanId(planId);
  1752. result = doorController.export(door);
  1753. msg = (String) result.get("msg");
  1754. path = downloadPath + msg;
  1755. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1756. files.add(new File(rootPath + subTitle + msg));
  1757. break;
  1758. case "15"://风向标/风向袋/新风系统正压计检查记录
  1759. TFireWeathervane weathervane = new TFireWeathervane();
  1760. weathervane.setPlanId(planId);
  1761. result = weathervaneController.export(weathervane);
  1762. msg = (String) result.get("msg");
  1763. path = downloadPath + msg;
  1764. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1765. files.add(new File(rootPath + subTitle + msg));
  1766. break;
  1767. case "16"://蒸汽幕检查记录
  1768. TFireSteamCurtain steamCurtain = new TFireSteamCurtain();
  1769. steamCurtain.setPlanId(planId);
  1770. result = steamCurtainController.export(steamCurtain);
  1771. msg = (String) result.get("msg");
  1772. path = downloadPath + msg;
  1773. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1774. files.add(new File(rootPath + subTitle + msg));
  1775. break;
  1776. case "27"://急救箱检查记录
  1777. TFireAidkit aidkit = new TFireAidkit();
  1778. aidkit.setPlanId(planId);
  1779. result = aidkitController.export(aidkit);
  1780. msg = (String) result.get("msg");
  1781. path = downloadPath + msg;
  1782. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1783. files.add(new File(rootPath + subTitle + msg));
  1784. break;
  1785. }
  1786. }
  1787. break;
  1788. case "aqss"://安全设施
  1789. subTitle = "14安全设施/";
  1790. TPssrSafetyBleed bleed = new TPssrSafetyBleed();
  1791. bleed.setSubId(tPssrSubcontent.getId());//子表id
  1792. result = bleedController.export(bleed);
  1793. msg = (String) result.get("msg");
  1794. path = downloadPath + msg;
  1795. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1796. files.add(new File(rootPath + subTitle + msg));
  1797. TPssrSafetyBreath breath = new TPssrSafetyBreath();
  1798. breath.setSubId(tPssrSubcontent.getId());//子表id
  1799. result = breathController.export(breath);
  1800. msg = (String) result.get("msg");
  1801. path = downloadPath + msg;
  1802. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1803. files.add(new File(rootPath + subTitle + msg));
  1804. TPssrSafetyBrust brust = new TPssrSafetyBrust();
  1805. brust.setSubId(tPssrSubcontent.getId());//子表id
  1806. result = brustController.export(brust);
  1807. msg = (String) result.get("msg");
  1808. path = downloadPath + msg;
  1809. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1810. files.add(new File(rootPath + subTitle + msg));
  1811. TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
  1812. flamearrester.setSubId(tPssrSubcontent.getId());//子表id
  1813. result = flamearresterController.export(flamearrester);
  1814. msg = (String) result.get("msg");
  1815. path = downloadPath + msg;
  1816. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1817. files.add(new File(rootPath + subTitle + msg));
  1818. TPssrSafetyValve safetyValve = new TPssrSafetyValve();
  1819. safetyValve.setSubId(tPssrSubcontent.getId());//子表id
  1820. result = safetyValveController.export(safetyValve);
  1821. msg = (String) result.get("msg");
  1822. path = downloadPath + msg;
  1823. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1824. files.add(new File(rootPath + subTitle + msg));
  1825. break;
  1826. case "txjk"://通讯监控(巡检)
  1827. subTitle = "15通讯监控/";
  1828. for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
  1829. String planType = tPssrPatrol.getPlanType().toString();
  1830. Long planId = tPssrPatrol.getPlanId();
  1831. switch (planType) {
  1832. case "10"://PAGA系统检查记录
  1833. TEmergencyPaga paga = new TEmergencyPaga();
  1834. paga.setPlanId(planId);
  1835. result = pagaController.export(paga);
  1836. msg = (String) result.get("msg");
  1837. path = downloadPath + msg;
  1838. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1839. files.add(new File(rootPath + subTitle + msg));
  1840. break;
  1841. case "11"://CCTV系统检查记录
  1842. TEmergencyCctv cctv = new TEmergencyCctv();
  1843. cctv.setPlanId(planId);
  1844. result = cctvController.export(cctv);
  1845. msg = (String) result.get("msg");
  1846. path = downloadPath + msg;
  1847. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1848. files.add(new File(rootPath + subTitle + msg));
  1849. break;
  1850. }
  1851. }
  1852. break;
  1853. case "bxsjcy"://便携式检测仪(巡检)
  1854. subTitle = "16便携式检测仪/";
  1855. for (TPssrPatrol tPssrPatrol : tPssrPatrols) {
  1856. String planType = tPssrPatrol.getPlanType().toString();
  1857. Long planId = tPssrPatrol.getPlanId();
  1858. switch (planType) {
  1859. case "18"://四合一/苯系物/硫化氢/二氧化碳/射线一氧化碳检测仪检查记录
  1860. TCommonuseTester tester = new TCommonuseTester();
  1861. tester.setPlanId(planId);
  1862. result = testerController.export(tester);
  1863. msg = (String) result.get("msg");
  1864. path = downloadPath + msg;
  1865. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1866. files.add(new File(rootPath + subTitle + msg));
  1867. break;
  1868. }
  1869. }
  1870. break;
  1871. case "gygc"://公用工程
  1872. subTitle = "17公用工程/";
  1873. TPssrPublic tPssrPublic = new TPssrPublic();
  1874. tPssrPublic.setSubId(tPssrSubcontent.getId());//子表id
  1875. result = publicController.export(tPssrPublic);
  1876. msg = (String) result.get("msg");
  1877. path = downloadPath + msg;
  1878. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1879. files.add(new File(rootPath + subTitle + msg));
  1880. break;
  1881. case "hbss"://环保设施
  1882. subTitle = "18环保设施/";
  1883. TPssrTorchvoc torchvoc = new TPssrTorchvoc();
  1884. torchvoc.setSubId(tPssrSubcontent.getId());//子表id
  1885. torchvoc.setTorchvocType("1");
  1886. result = torchvocController.export(torchvoc);
  1887. msg = (String) result.get("msg");
  1888. path = downloadPath + msg;
  1889. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1890. files.add(new File(rootPath + subTitle + msg));
  1891. torchvoc.setTorchvocType("2");
  1892. result = torchvocController.export(torchvoc);
  1893. msg = (String) result.get("msg");
  1894. path = downloadPath + msg;
  1895. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1896. files.add(new File(rootPath + subTitle + msg));
  1897. break;
  1898. case "yfl"://原辅料
  1899. subTitle = "19原辅料/";
  1900. TPssrMaterial material = new TPssrMaterial();
  1901. material.setSubId(tPssrSubcontent.getId());//子表id
  1902. result = materialController.export(material);
  1903. msg = (String) result.get("msg");
  1904. path = downloadPath + msg;
  1905. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1906. files.add(new File(rootPath + subTitle + msg));
  1907. TPssrMaterialRaw materialRaw = new TPssrMaterialRaw();
  1908. materialRaw.setSubId(tPssrSubcontent.getId());//子表id
  1909. result = materialRawController.export(materialRaw);
  1910. msg = (String) result.get("msg");
  1911. path = downloadPath + msg;
  1912. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1913. files.add(new File(rootPath + subTitle + msg));
  1914. break;
  1915. case "jb"://机泵
  1916. subTitle = "20机泵/";
  1917. TPssrPumpCleaning pumpCleaning = new TPssrPumpCleaning();
  1918. pumpCleaning.setSubId(tPssrSubcontent.getId());//子表id
  1919. result = pumpCleaningController.export(pumpCleaning);
  1920. msg = (String) result.get("msg");
  1921. path = downloadPath + msg;
  1922. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1923. files.add(new File(rootPath + subTitle + msg));
  1924. TPssrPumpFill pumpFill = new TPssrPumpFill();
  1925. pumpFill.setSubId(tPssrSubcontent.getId());//子表id
  1926. result = pumpFillController.export(pumpFill);
  1927. msg = (String) result.get("msg");
  1928. path = downloadPath + msg;
  1929. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1930. files.add(new File(rootPath + subTitle + msg));
  1931. TPssrPumpOverhaul pumpOverhaul = new TPssrPumpOverhaul();
  1932. pumpOverhaul.setSubId(tPssrSubcontent.getId());//子表id
  1933. result = pumpOverhaulController.export(pumpOverhaul);
  1934. msg = (String) result.get("msg");
  1935. path = downloadPath + msg;
  1936. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1937. files.add(new File(rootPath + subTitle + msg));
  1938. break;
  1939. case "zdj"://支(吊)架
  1940. subTitle = "21支(吊)架/";
  1941. TPssrFrame frame = new TPssrFrame();
  1942. frame.setSubId(tPssrSubcontent.getId());//子表id
  1943. result = frameController.export(frame);
  1944. msg = (String) result.get("msg");
  1945. path = downloadPath + msg;
  1946. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1947. files.add(new File(rootPath + subTitle + msg));
  1948. break;
  1949. case "tzsb"://压力管道/压力容器
  1950. subTitle = "22压力管道、压力容器/";
  1951. TPssrPipe pipe = new TPssrPipe();
  1952. pipe.setSubId(tPssrSubcontent.getId());//子表id
  1953. result = pipeController.export(pipe);
  1954. msg = (String) result.get("msg");
  1955. path = downloadPath + msg;
  1956. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1957. files.add(new File(rootPath + subTitle + msg));
  1958. TPssrVessel vessel = new TPssrVessel();
  1959. vessel.setSubId(tPssrSubcontent.getId());//子表id
  1960. result = vesselController.export(vessel);
  1961. msg = (String) result.get("msg");
  1962. path = downloadPath + msg;
  1963. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1964. files.add(new File(rootPath + subTitle + msg));
  1965. break;
  1966. case "ybjy"://仪表校验
  1967. subTitle = "23仪表校验/";
  1968. TPssrInstrumentCalibration calibration = new TPssrInstrumentCalibration();
  1969. calibration.setSubId(tPssrSubcontent.getId());//子表id
  1970. result = instrumentCalibrationController.export(calibration);
  1971. msg = (String) result.get("msg");
  1972. path = downloadPath + msg;
  1973. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1974. files.add(new File(rootPath + subTitle + msg));
  1975. break;
  1976. case "yblscs"://仪表联锁测试
  1977. subTitle = "24仪表联锁测试/";
  1978. TPssrInstrumentTest instrumentTest = new TPssrInstrumentTest();
  1979. instrumentTest.setSubId(tPssrSubcontent.getId());//子表id
  1980. //附件
  1981. List<TPssrInstrumentTest> instrumentTests = tPssrInstrumentTestService.selectTPssrInstrumentTestList(instrumentTest);
  1982. for (TPssrInstrumentTest test : instrumentTests) {
  1983. String fileUrl = test.getFileUrl();
  1984. String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
  1985. Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1986. }
  1987. break;
  1988. case "bjlszqr"://报警/联锁值确认
  1989. subTitle = "25报警、联锁值确认/";
  1990. TPssrAlarm pssrAlarm = new TPssrAlarm();
  1991. pssrAlarm.setSubId(tPssrSubcontent.getId());//子表id
  1992. //附件
  1993. List<TPssrAlarm> alarms = tPssrAlarmService.selectTPssrAlarmList(pssrAlarm);
  1994. for (TPssrAlarm a : alarms) {
  1995. String fileUrl = a.getFileUrl();
  1996. String newFileUrl = getProfile() + fileUrl.replace("/profile", "");
  1997. Files.copy(Paths.get(newFileUrl), Paths.get(rootPath + subTitle + fileUrl.substring(fileUrl.lastIndexOf("/"))), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  1998. }
  1999. break;
  2000. case "lsdy"://临时电源
  2001. subTitle = "26临时电源/";
  2002. TPssrPower power = new TPssrPower();
  2003. power.setSubId(tPssrSubcontent.getId());//子表id
  2004. result = powerController.export(power);
  2005. msg = (String) result.get("msg");
  2006. path = downloadPath + msg;
  2007. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2008. files.add(new File(rootPath + subTitle + msg));
  2009. break;
  2010. case "djsb"://电机设备
  2011. subTitle = "27电机设备/";
  2012. TPssrMotor motor = new TPssrMotor();
  2013. motor.setSubId(tPssrSubcontent.getId());//子表id
  2014. result = motorController.export(motor);
  2015. msg = (String) result.get("msg");
  2016. path = downloadPath + msg;
  2017. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2018. files.add(new File(rootPath + subTitle + msg));
  2019. break;
  2020. case "zmdbr"://照明、电伴热
  2021. subTitle = "28照明、电伴热/";
  2022. TPssrLighting lighting = new TPssrLighting();
  2023. lighting.setSubId(tPssrSubcontent.getId());//子表id
  2024. lighting.setLightingType("1");
  2025. result = lightingController.export(lighting);
  2026. msg = (String) result.get("msg");
  2027. path = downloadPath + msg;
  2028. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2029. files.add(new File(rootPath + subTitle + msg));
  2030. lighting.setLightingType("2");
  2031. result = lightingController.export(lighting);
  2032. msg = (String) result.get("msg");
  2033. path = downloadPath + msg;
  2034. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2035. files.add(new File(rootPath + subTitle + msg));
  2036. break;
  2037. case "jdjdkj"://静电接地/跨接
  2038. subTitle = "29静电接地、跨接/";
  2039. TPssrFranklinism franklinism = new TPssrFranklinism();
  2040. franklinism.setSubId(tPssrSubcontent.getId());//子表id
  2041. result = franklinismController.export(franklinism);
  2042. msg = (String) result.get("msg");
  2043. path = downloadPath + msg;
  2044. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2045. files.add(new File(rootPath + subTitle + msg));
  2046. break;
  2047. case "qtjcy"://气体检测仪
  2048. subTitle = "30气体检测仪/";
  2049. TPssrGasdetector gasdetector = new TPssrGasdetector();
  2050. gasdetector.setSubId(tPssrSubcontent.getId());//子表id
  2051. result = gasdetectorController.export(gasdetector);
  2052. msg = (String) result.get("msg");
  2053. path = downloadPath + msg;
  2054. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2055. files.add(new File(rootPath + subTitle + msg));
  2056. break;
  2057. case "zxfxy"://在线分析仪
  2058. subTitle = "31在线分析仪/";
  2059. TPssrAnalyzer analyzer = new TPssrAnalyzer();
  2060. analyzer.setSubId(tPssrSubcontent.getId());//子表id
  2061. result = analyzerController.export(analyzer);
  2062. msg = (String) result.get("msg");
  2063. path = downloadPath + msg;
  2064. Files.copy(Paths.get(path), Paths.get(rootPath + subTitle + msg), StandardCopyOption.REPLACE_EXISTING);//拷贝导出的文件
  2065. files.add(new File(rootPath + subTitle + msg));
  2066. break;
  2067. }
  2068. }
  2069. try {
  2070. String zipName = "pssr_" + id + ".zip";
  2071. ZipUtil.toZipWithDirectory(rootPath, downloadPath + zipName);//打包
  2072. aboveall.setZipUrl(zipName);
  2073. tPssrAboveallService.updateTPssrAboveall(aboveall);
  2074. } catch (IOException e) {
  2075. e.printStackTrace();
  2076. }
  2077. }
  2078. private void createSubitemDirectory(String rootPath) {
  2079. boolean mkdir1 = new File(rootPath + "01检修项目").mkdirs();//子项文件目录
  2080. boolean mkdir2 = new File(rootPath + "02开工方案").mkdirs();
  2081. boolean mkdir3 = new File(rootPath + "03设计变更").mkdirs();
  2082. boolean mkdir4 = new File(rootPath + "04盲板").mkdirs();
  2083. boolean mkdir5 = new File(rootPath + "05现场卫生").mkdirs();
  2084. boolean mkdir6 = new File(rootPath + "06人身防护").mkdirs();
  2085. boolean mkdir7 = new File(rootPath + "07设备清洁度").mkdirs();
  2086. boolean mkdir8 = new File(rootPath + "08气密").mkdirs();
  2087. boolean mkdir9 = new File(rootPath + "09锁开锁关阀门状态").mkdirs();
  2088. boolean mkdir10 = new File(rootPath + "10实验室").mkdirs();
  2089. boolean mkdir11 = new File(rootPath + "11短接").mkdirs();
  2090. boolean mkdir12 = new File(rootPath + "12氮气置换").mkdirs();
  2091. boolean mkdir13 = new File(rootPath + "13消气防设施").mkdirs();
  2092. boolean mkdir14 = new File(rootPath + "14安全设施").mkdirs();
  2093. boolean mkdir15 = new File(rootPath + "15通讯监控").mkdirs();
  2094. boolean mkdir16 = new File(rootPath + "16便携式检测仪").mkdirs();
  2095. boolean mkdir17 = new File(rootPath + "17公用工程").mkdirs();
  2096. boolean mkdir18 = new File(rootPath + "18环保设施").mkdirs();
  2097. boolean mkdir19 = new File(rootPath + "19原辅料").mkdirs();
  2098. boolean mkdir20 = new File(rootPath + "20机泵").mkdirs();
  2099. boolean mkdir21 = new File(rootPath + "21支(吊)架").mkdirs();
  2100. boolean mkdir22 = new File(rootPath + "22压力管道、压力容器").mkdirs();
  2101. boolean mkdir23 = new File(rootPath + "23仪表校验").mkdirs();
  2102. boolean mkdir24 = new File(rootPath + "24仪表联锁测试").mkdirs();
  2103. boolean mkdir25 = new File(rootPath + "25报警、联锁值确认").mkdirs();
  2104. boolean mkdir26 = new File(rootPath + "26临时电源").mkdirs();
  2105. boolean mkdir27 = new File(rootPath + "27电机设备").mkdirs();
  2106. boolean mkdir28 = new File(rootPath + "28照明、电伴热").mkdirs();
  2107. boolean mkdir29 = new File(rootPath + "29静电接地、跨接").mkdirs();
  2108. boolean mkdir30 = new File(rootPath + "30气体检测仪").mkdirs();
  2109. boolean mkdir31 = new File(rootPath + "31在线分析仪").mkdirs();
  2110. }
  2111. /**
  2112. * 氮气置换审批流程发起申请
  2113. *
  2114. * @param sub
  2115. */
  2116. private void doDqzhApprove(TPssrSubcontent sub) {
  2117. String userId = getUserId().toString();
  2118. //修改状态
  2119. TPssrNitrogen tPssrNitrogen = new TPssrNitrogen();
  2120. tPssrNitrogen.setApproveStatus(0L);
  2121. tPssrNitrogen.setSubId(sub.getId());
  2122. Set<String> confirm1 = new HashSet<>();
  2123. Set<String> confirm2 = new HashSet<>();
  2124. for (TPssrNitrogen item : tPssrNitrogenService.selectTPssrNitrogenList(tPssrNitrogen)) {
  2125. item.setApproveStatus(1L);
  2126. item.setUpdatedate(new Date());
  2127. item.setUpdaterCode(userId);
  2128. tPssrNitrogenService.updateTPssrNitrogen(item);
  2129. // 确认人1
  2130. confirm1.add(item.getConfirm1());
  2131. //确认人2
  2132. confirm2.add(item.getConfirm2());
  2133. }
  2134. TPssrApprove exist = new TPssrApprove();
  2135. exist.setSubId(sub.getId());
  2136. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2137. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2138. //新增审批数据
  2139. TPssrApprove approve = new TPssrApprove();
  2140. approve.setSubId(sub.getId());
  2141. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2142. approve.setApproveStatus(1L);
  2143. approve.setSubCharge(sub.getConfirm());
  2144. approve.setCreaterCode(userId);
  2145. approve.setCreatedate(new Date());
  2146. tPssrApproveService.insertTPssrApprove(approve);
  2147. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  2148. } else {
  2149. // 已存在流程时,删除旧流程,重新发起
  2150. TPssrApprove approve = tPssrApproves.get(0);
  2151. delProcess(approve.getProcessId(), "pssr2confirm");
  2152. tPssrNitrogen = new TPssrNitrogen();
  2153. tPssrNitrogen.setApproveStatus(1L);
  2154. tPssrNitrogen.setSubId(sub.getId());
  2155. for (TPssrNitrogen item : tPssrNitrogenService.selectTPssrNitrogenList(tPssrNitrogen)) {
  2156. // 确认人1
  2157. confirm1.add(item.getConfirm1());
  2158. //确认人2
  2159. confirm2.add(item.getConfirm2());
  2160. }
  2161. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  2162. }
  2163. }
  2164. // 检修项目审批流程发起申请
  2165. public void doJxxmApprove(TPssrSubcontent sub) {
  2166. String userId = getUserId().toString();
  2167. //修改所有表的审批状态
  2168. TPssrOverhaulExchanger exchanger = new TPssrOverhaulExchanger();
  2169. exchanger.setSubId(sub.getId());
  2170. exchanger.setApproveStatus(1L);
  2171. exchanger.setUpdaterCode(userId);
  2172. exchanger.setUpdatedate(new Date());
  2173. tPssrOverhaulExchangerService.updateAllBySubId(exchanger);
  2174. TPssrOverhaulFilter filter = new TPssrOverhaulFilter();
  2175. filter.setSubId(sub.getId());
  2176. filter.setApproveStatus(1L);
  2177. filter.setUpdaterCode(userId);
  2178. filter.setUpdatedate(new Date());
  2179. tPssrOverhaulFilterService.updateAllBySubId(filter);
  2180. TPssrOverhaulPipe pipe = new TPssrOverhaulPipe();
  2181. pipe.setSubId(sub.getId());
  2182. pipe.setApproveStatus(1L);
  2183. pipe.setUpdaterCode(userId);
  2184. pipe.setUpdatedate(new Date());
  2185. tPssrOverhaulPipeService.updateAllBySubId(pipe);
  2186. TPssrOverhaulPump pump = new TPssrOverhaulPump();
  2187. pump.setSubId(sub.getId());
  2188. pump.setApproveStatus(1L);
  2189. pump.setUpdaterCode(userId);
  2190. pump.setUpdatedate(new Date());
  2191. tPssrOverhaulPumpService.updateAllBySubId(pump);
  2192. TPssrOverhaulTower tower = new TPssrOverhaulTower();
  2193. tower.setSubId(sub.getId());
  2194. tower.setApproveStatus(1L);
  2195. tower.setUpdaterCode(userId);
  2196. tower.setUpdatedate(new Date());
  2197. tPssrOverhaulTowerService.updateAllBySubId(tower);
  2198. TPssrOverhaulValve valve = new TPssrOverhaulValve();
  2199. valve.setSubId(sub.getId());
  2200. valve.setApproveStatus(1L);
  2201. valve.setUpdaterCode(userId);
  2202. valve.setUpdatedate(new Date());
  2203. tPssrOverhaulValveService.updateAllBySubId(valve);
  2204. //查询所有确认人
  2205. exchanger = new TPssrOverhaulExchanger();
  2206. exchanger.setSubId(sub.getId());
  2207. exchanger.setApproveStatus(1L);
  2208. TPssrOverhaulExchanger tPssrOverhaulExchanger = tPssrOverhaulExchangerService.selectAllConfirmedPersonBySubId(exchanger);
  2209. String confirmers = null;
  2210. if (tPssrOverhaulExchanger != null) {
  2211. confirmers = tPssrOverhaulExchanger.getConfirmedPerson();
  2212. }
  2213. logger.info("=======================confirmers:{}", confirmers);
  2214. List<String> confirmersList = new ArrayList<>();
  2215. if (StringUtils.isNotEmpty(confirmers)) {
  2216. confirmersList.addAll(Arrays.asList(confirmers.split(",")));
  2217. }
  2218. TPssrApprove exist = new TPssrApprove();
  2219. exist.setSubId(sub.getId());
  2220. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2221. //如果当前子项没有审批数据
  2222. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2223. //新增审批数据
  2224. TPssrApprove approve = new TPssrApprove();
  2225. approve.setSubId(sub.getId());
  2226. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2227. approve.setApproveStatus(1L);
  2228. approve.setSubCharge(sub.getConfirm());
  2229. approve.setCreaterCode(userId);
  2230. approve.setCreatedate(new Date());
  2231. tPssrApproveService.insertTPssrApprove(approve);
  2232. pssr1confirm(approve, confirmersList, sub.getConfirm());
  2233. } else {
  2234. // 已存在流程时,删除旧流程,重新发起
  2235. TPssrApprove approve = tPssrApproves.get(0);
  2236. delProcess(approve.getProcessId(), "pssr1confirm");
  2237. pssr1confirm(approve, confirmersList, sub.getConfirm());
  2238. }
  2239. }
  2240. // 盲板审批流程发起申请
  2241. public void doMbApprove(TPssrSubcontent sub) {
  2242. String userId = getUserId().toString();
  2243. //修改状态
  2244. TPssrBlind tPssrBlind = new TPssrBlind();
  2245. tPssrBlind.setApproveStatus(0L);
  2246. tPssrBlind.setSubId(sub.getId());
  2247. Set<String> installer = new HashSet<>();
  2248. Set<String> remover = new HashSet<>();
  2249. for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(tPssrBlind)) {
  2250. item.setApproveStatus(1L);
  2251. item.setUpdatedate(new Date());
  2252. item.setUpdaterCode(userId);
  2253. tPssrBlindService.updateTPssrBlind(item);
  2254. // 拆装人员
  2255. installer.add(item.getInConfirm1());
  2256. //确认人
  2257. remover.add(item.getInConfirm2());
  2258. }
  2259. TPssrApprove exist = new TPssrApprove();
  2260. exist.setSubId(sub.getId());
  2261. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2262. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2263. //新增审批数据
  2264. TPssrApprove approve = new TPssrApprove();
  2265. approve.setSubId(sub.getId());
  2266. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2267. approve.setApproveStatus(1L);
  2268. approve.setSubCharge(sub.getConfirm());
  2269. approve.setCreaterCode(userId);
  2270. approve.setCreatedate(new Date());
  2271. tPssrApproveService.insertTPssrApprove(approve);
  2272. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2273. } else {
  2274. // 已存在流程时,删除旧流程,重新发起
  2275. TPssrApprove approve = tPssrApproves.get(0);
  2276. delProcess(approve.getProcessId(), "pssr2confirm");
  2277. tPssrBlind = new TPssrBlind();
  2278. tPssrBlind.setApproveStatus(1L);
  2279. tPssrBlind.setSubId(sub.getId());
  2280. for (TPssrBlind item : tPssrBlindService.selectTPssrBlindList(tPssrBlind)) {
  2281. // 拆装人员
  2282. installer.add(item.getInConfirm1());
  2283. //确认人
  2284. remover.add(item.getInConfirm2());
  2285. }
  2286. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2287. }
  2288. }
  2289. // 锁开锁关审批流程发起申请
  2290. public void doSksgApprove(TPssrSubcontent sub) {
  2291. String userId = getUserId().toString();
  2292. //修改状态
  2293. TPssrLock tPssrLock = new TPssrLock();
  2294. tPssrLock.setApproveStatus(0L);
  2295. tPssrLock.setSubId(sub.getId());
  2296. Set<String> lockeders = new HashSet<>();
  2297. Set<String> confirmers = new HashSet<>();
  2298. for (TPssrLock item : tPssrLockService.selectTPssrLockList(tPssrLock)) {
  2299. item.setApproveStatus(1L);
  2300. item.setUpdatedate(new Date());
  2301. item.setUpdaterCode(userId);
  2302. tPssrLockService.updateTPssrLock(item);
  2303. // 确认人1
  2304. lockeders.add(item.getLockeder());
  2305. // 确认人2
  2306. confirmers.add(item.getConfirm());
  2307. }
  2308. TPssrApprove exist = new TPssrApprove();
  2309. exist.setSubId(sub.getId());
  2310. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2311. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2312. //新增审批数据
  2313. TPssrApprove approve = new TPssrApprove();
  2314. approve.setSubId(sub.getId());
  2315. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2316. approve.setApproveStatus(1L);
  2317. approve.setSubCharge(sub.getConfirm());
  2318. approve.setCreaterCode(userId);
  2319. approve.setCreatedate(new Date());
  2320. tPssrApproveService.insertTPssrApprove(approve);
  2321. pssr2confirm(approve, new ArrayList<>(lockeders), new ArrayList<>(confirmers), sub.getConfirm());
  2322. } else {
  2323. // 已存在流程时,删除旧流程,重新发起
  2324. TPssrApprove approve = tPssrApproves.get(0);
  2325. delProcess(approve.getProcessId(), "pssr2confirm");
  2326. tPssrLock = new TPssrLock();
  2327. tPssrLock.setApproveStatus(1L);
  2328. tPssrLock.setSubId(sub.getId());
  2329. for (TPssrLock item : tPssrLockService.selectTPssrLockList(tPssrLock)) {
  2330. // 确认人1
  2331. lockeders.add(item.getLockeder());
  2332. // 确认人2
  2333. confirmers.add(item.getConfirm());
  2334. }
  2335. pssr2confirm(approve, new ArrayList<>(lockeders), new ArrayList<>(confirmers), sub.getConfirm());
  2336. }
  2337. }
  2338. // 管道审批流程发起申请
  2339. public void doTzsbApprove(TPssrSubcontent sub) {
  2340. String userId = getUserId().toString();
  2341. TPssrPipe pipe = new TPssrPipe();
  2342. pipe.setSubId(sub.getId());
  2343. pipe.setApproveStatus(1L);
  2344. pipe.setUpdatedate(new Date());
  2345. pipe.setUpdaterCode(userId);
  2346. tPssrPipeService.updateAllBySubId(pipe);
  2347. TPssrVessel vessel = new TPssrVessel();
  2348. vessel.setSubId(sub.getId());
  2349. vessel.setApproveStatus(1L);
  2350. vessel.setUpdatedate(new Date());
  2351. vessel.setUpdaterCode(userId);
  2352. tPssrVesselService.updateAllBySubId(vessel);
  2353. //查询确认人
  2354. TPssrPipe entity = new TPssrPipe();
  2355. entity.setSubId(sub.getId());
  2356. entity.setApproveStatus(1L);
  2357. TPssrPipe tPssrPipe = tPssrPipeService.selectAllConfirmedPersonBySubId(entity);
  2358. String confirmer1s = null;
  2359. String confirmer2s = null;
  2360. if (tPssrPipe != null) {
  2361. confirmer1s = tPssrPipe.getConfirmer1();
  2362. confirmer2s = tPssrPipe.getConfirmer2();
  2363. }
  2364. logger.info("=======================confirmer1s:{}", confirmer1s);
  2365. logger.info("=======================confirmer2s:{}", confirmer2s);
  2366. Set<String> confirmerUsers1 = new HashSet<>();
  2367. Set<String> confirmerUsers2 = new HashSet<>();
  2368. if (StringUtils.isNotEmpty(confirmer1s)) {
  2369. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  2370. }
  2371. if (StringUtils.isNotEmpty(confirmer2s)) {
  2372. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  2373. }
  2374. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  2375. if (tPssrApprove == null) {
  2376. //新增审批数据
  2377. TPssrApprove approve = new TPssrApprove();
  2378. approve.setSubId(sub.getId());
  2379. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2380. approve.setApproveStatus(1L);
  2381. approve.setSubCharge(sub.getConfirm());
  2382. approve.setCreaterCode(userId);
  2383. approve.setCreatedate(new Date());
  2384. tPssrApproveService.insertTPssrApprove(approve);
  2385. pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  2386. } else {
  2387. // 已存在流程时,删除旧流程,重新发起
  2388. delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
  2389. entity.setApproveStatus(3L);
  2390. tPssrPipe = tPssrPipeService.selectAllConfirmedPersonBySubId(entity);
  2391. if (tPssrPipe != null) {
  2392. confirmer1s = tPssrPipe.getConfirmer1();
  2393. confirmer2s = tPssrPipe.getConfirmer2();
  2394. }
  2395. if (StringUtils.isNotEmpty(confirmer1s)) {
  2396. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  2397. }
  2398. if (StringUtils.isNotEmpty(confirmer2s)) {
  2399. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  2400. }
  2401. pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  2402. }
  2403. }
  2404. //巡检审批流程发起申请
  2405. public void doPatrolApprove(TPssrSubcontent sub) {
  2406. String userId = getUserId().toString();
  2407. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  2408. if (tPssrApprove == null) {
  2409. TPssrApprove approve = new TPssrApprove();//新增审批数据
  2410. approve.setSubId(sub.getId());
  2411. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2412. approve.setApproveStatus(1L);
  2413. approve.setSubCharge(sub.getConfirm());
  2414. approve.setCreaterCode(userId);
  2415. approve.setCreatedate(new Date());
  2416. tPssrApproveService.insertTPssrApprove(approve);
  2417. pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
  2418. } else {
  2419. delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
  2420. pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
  2421. }
  2422. }
  2423. /**
  2424. * 安全设施审批流程发起申请
  2425. */
  2426. private void doAqssApprove(TPssrSubcontent sub) {
  2427. String userId = getUserId().toString();
  2428. //修改各表状态
  2429. TPssrSafetyBleed bleed = new TPssrSafetyBleed();
  2430. bleed.setSubId(sub.getId());
  2431. bleed.setApproveStatus(1L);
  2432. bleed.setUpdatedate(new Date());
  2433. bleed.setUpdaterCode(userId);
  2434. tPssrSafetyBleedService.updateAllBySubId(bleed);
  2435. TPssrSafetyBreath breath = new TPssrSafetyBreath();
  2436. breath.setSubId(sub.getId());
  2437. breath.setApproveStatus(1L);
  2438. breath.setUpdatedate(new Date());
  2439. breath.setUpdaterCode(userId);
  2440. tPssrSafetyBreathService.updateAllBySubId(breath);
  2441. TPssrSafetyBrust brust = new TPssrSafetyBrust();
  2442. brust.setSubId(sub.getId());
  2443. brust.setApproveStatus(1L);
  2444. brust.setUpdatedate(new Date());
  2445. brust.setUpdaterCode(userId);
  2446. tPssrSafetyBrustService.updateAllBySubId(brust);
  2447. TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
  2448. flamearrester.setSubId(sub.getId());
  2449. flamearrester.setApproveStatus(1L);
  2450. flamearrester.setUpdatedate(new Date());
  2451. flamearrester.setUpdaterCode(userId);
  2452. tPssrSafetyFlamearresterService.updateAllBySubId(flamearrester);
  2453. TPssrSafetyValve valve = new TPssrSafetyValve();
  2454. valve.setSubId(sub.getId());
  2455. valve.setApproveStatus(1L);
  2456. valve.setUpdatedate(new Date());
  2457. valve.setUpdaterCode(userId);
  2458. tPssrSafetyValveService.updateAllBySubId(valve);
  2459. // 查询确认人
  2460. TPssrSafetyBleed entity = new TPssrSafetyBleed();
  2461. entity.setSubId(sub.getId());
  2462. entity.setApproveStatus(1L);
  2463. TPssrSafetyBleed tPssrSafetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
  2464. String confirmer1s = null;
  2465. String confirmer2s = null;
  2466. if (tPssrSafetyBleed != null) {
  2467. confirmer1s = tPssrSafetyBleed.getConfirmer1();
  2468. confirmer2s = tPssrSafetyBleed.getConfirmer2();
  2469. }
  2470. logger.info("=======================confirmer1s:{}", confirmer1s);
  2471. logger.info("=======================confirmer2s:{}", confirmer2s);
  2472. Set<String> confirmerUsers1 = new HashSet<>();
  2473. Set<String> confirmerUsers2 = new HashSet<>();
  2474. if (StringUtils.isNotEmpty(confirmer1s)) {
  2475. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  2476. }
  2477. if (StringUtils.isNotEmpty(confirmer2s)) {
  2478. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  2479. }
  2480. //查询是否已存在审批流程
  2481. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  2482. if (tPssrApprove == null) {
  2483. TPssrApprove approve = new TPssrApprove();
  2484. approve.setSubId(sub.getId());
  2485. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2486. approve.setApproveStatus(1L);
  2487. approve.setSubCharge(sub.getConfirm());
  2488. approve.setCreaterCode(userId);
  2489. approve.setCreatedate(new Date());
  2490. tPssrApproveService.insertTPssrApprove(approve);
  2491. pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  2492. } else {
  2493. delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
  2494. entity.setSubId(sub.getId());
  2495. entity.setApproveStatus(3L);
  2496. tPssrSafetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
  2497. if (tPssrSafetyBleed != null) {
  2498. confirmer1s = tPssrSafetyBleed.getConfirmer1();
  2499. confirmer2s = tPssrSafetyBleed.getConfirmer2();
  2500. }
  2501. if (StringUtils.isNotEmpty(confirmer1s)) {
  2502. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  2503. }
  2504. if (StringUtils.isNotEmpty(confirmer2s)) {
  2505. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  2506. }
  2507. pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  2508. }
  2509. }
  2510. // 现场卫生流程发起申请
  2511. public void doXcwsApprove(TPssrSubcontent sub) {
  2512. String userId = getUserId().toString();
  2513. //修改状态
  2514. TPssrHygiene tPssrHygiene = new TPssrHygiene();
  2515. tPssrHygiene.setApproveStatus(0L);
  2516. tPssrHygiene.setSubId(sub.getId());
  2517. Set<String> installer = new HashSet<>();
  2518. Set<String> remover = new HashSet<>();
  2519. for (TPssrHygiene item : tPssrHygieneService.selectTPssrHygieneList(tPssrHygiene)) {
  2520. item.setApproveStatus(1L);
  2521. item.setUpdatedate(new Date());
  2522. item.setUpdaterCode(userId);
  2523. tPssrHygieneService.updateTPssrHygiene(item);
  2524. // 安装人员
  2525. installer.add(item.getConfirm1());
  2526. //拆除人员
  2527. remover.add(item.getConfirm2());
  2528. }
  2529. TPssrApprove exist = new TPssrApprove();
  2530. exist.setSubId(sub.getId());
  2531. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2532. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2533. //新增审批数据
  2534. TPssrApprove approve = new TPssrApprove();
  2535. approve.setSubId(sub.getId());
  2536. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2537. approve.setApproveStatus(1L);
  2538. approve.setSubCharge(sub.getConfirm());
  2539. approve.setCreaterCode(userId);
  2540. approve.setCreatedate(new Date());
  2541. tPssrApproveService.insertTPssrApprove(approve);
  2542. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2543. } else {
  2544. // 已存在流程时,删除旧流程,重新发起
  2545. TPssrApprove approve = tPssrApproves.get(0);
  2546. delProcess(approve.getProcessId(), "pssr2confirm");
  2547. tPssrHygiene = new TPssrHygiene();
  2548. tPssrHygiene.setApproveStatus(1L);
  2549. tPssrHygiene.setSubId(sub.getId());
  2550. for (TPssrHygiene item : tPssrHygieneService.selectTPssrHygieneList(tPssrHygiene)) {
  2551. // 安装人员
  2552. installer.add(item.getConfirm1());
  2553. //拆除人员
  2554. remover.add(item.getConfirm2());
  2555. }
  2556. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2557. }
  2558. }
  2559. // 设备清洁度流程发起申请
  2560. public void doSbqjdApprove(TPssrSubcontent sub) {
  2561. String userId = getUserId().toString();
  2562. //修改状态
  2563. TPssrCleaning tPssrCleaning = new TPssrCleaning();
  2564. tPssrCleaning.setApproveStatus(0L);
  2565. tPssrCleaning.setSubId(sub.getId());
  2566. Set<String> installer = new HashSet<>();
  2567. Set<String> remover = new HashSet<>();
  2568. for (TPssrCleaning item : tPssrCleaningService.selectTPssrCleaningList(tPssrCleaning)) {
  2569. item.setApproveStatus(1L);
  2570. item.setUpdatedate(new Date());
  2571. item.setUpdaterCode(userId);
  2572. tPssrCleaningService.updateTPssrCleaning(item);
  2573. // 安装人员
  2574. installer.add(item.getConfirm1());
  2575. //拆除人员
  2576. remover.add(item.getConfirm2());
  2577. }
  2578. TPssrApprove exist = new TPssrApprove();
  2579. exist.setSubId(sub.getId());
  2580. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2581. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2582. //新增审批数据
  2583. TPssrApprove approve = new TPssrApprove();
  2584. approve.setSubId(sub.getId());
  2585. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2586. approve.setApproveStatus(1L);
  2587. approve.setSubCharge(sub.getConfirm());
  2588. approve.setCreaterCode(userId);
  2589. approve.setCreatedate(new Date());
  2590. tPssrApproveService.insertTPssrApprove(approve);
  2591. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2592. } else {
  2593. // 已存在流程时,删除旧流程,重新发起
  2594. TPssrApprove approve = tPssrApproves.get(0);
  2595. delProcess(approve.getProcessId(), "pssr2confirm");
  2596. tPssrCleaning = new TPssrCleaning();
  2597. tPssrCleaning.setApproveStatus(1L);
  2598. tPssrCleaning.setSubId(sub.getId());
  2599. for (TPssrCleaning item : tPssrCleaningService.selectTPssrCleaningList(tPssrCleaning)) {
  2600. // 安装人员
  2601. installer.add(item.getConfirm1());
  2602. //拆除人员
  2603. remover.add(item.getConfirm2());
  2604. }
  2605. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2606. }
  2607. }
  2608. // 气密流程发起申请
  2609. public void doQmApprove(TPssrSubcontent sub) {
  2610. String userId = getUserId().toString();
  2611. //修改状态
  2612. TPssrAirtight tPssrAirtight = new TPssrAirtight();
  2613. tPssrAirtight.setApproveStatus(0L);
  2614. tPssrAirtight.setSubId(sub.getId());
  2615. Set<String> installer = new HashSet<>();
  2616. Set<String> remover = new HashSet<>();
  2617. for (TPssrAirtight item : tPssrAirtightService.selectTPssrAirtightList(tPssrAirtight)) {
  2618. item.setApproveStatus(1L);
  2619. item.setUpdatedate(new Date());
  2620. item.setUpdaterCode(userId);
  2621. tPssrAirtightService.updateTPssrAirtight(item);
  2622. // 安装人员
  2623. installer.add(item.getConfirm1());
  2624. //拆除人员
  2625. remover.add(item.getConfirm2());
  2626. }
  2627. TPssrApprove exist = new TPssrApprove();
  2628. exist.setSubId(sub.getId());
  2629. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2630. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2631. //新增审批数据
  2632. TPssrApprove approve = new TPssrApprove();
  2633. approve.setSubId(sub.getId());
  2634. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2635. approve.setApproveStatus(1L);
  2636. approve.setSubCharge(sub.getConfirm());
  2637. approve.setCreaterCode(userId);
  2638. approve.setCreatedate(new Date());
  2639. tPssrApproveService.insertTPssrApprove(approve);
  2640. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2641. } else {
  2642. // 已存在流程时,删除旧流程,重新发起
  2643. TPssrApprove approve = tPssrApproves.get(0);
  2644. delProcess(approve.getProcessId(), "pssr2confirm");
  2645. tPssrAirtight = new TPssrAirtight();
  2646. tPssrAirtight.setApproveStatus(1L);
  2647. tPssrAirtight.setSubId(sub.getId());
  2648. for (TPssrAirtight item : tPssrAirtightService.selectTPssrAirtightList(tPssrAirtight)) {
  2649. // 安装人员
  2650. installer.add(item.getConfirm1());
  2651. //拆除人员
  2652. remover.add(item.getConfirm2());
  2653. }
  2654. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2655. }
  2656. }
  2657. // 实验室流程发起申请
  2658. public void doSysApprove(TPssrSubcontent sub) {
  2659. String userId = getUserId().toString();
  2660. //修改状态
  2661. TPssrLaboratory tPssrLaboratory = new TPssrLaboratory();
  2662. tPssrLaboratory.setApproveStatus(0L);
  2663. tPssrLaboratory.setSubId(sub.getId());
  2664. Set<String> installer = new HashSet<>();
  2665. Set<String> remover = new HashSet<>();
  2666. for (TPssrLaboratory item : tPssrLaboratoryService.selectTPssrLaboratoryList(tPssrLaboratory)) {
  2667. item.setApproveStatus(1L);
  2668. item.setUpdatedate(new Date());
  2669. item.setUpdaterCode(userId);
  2670. tPssrLaboratoryService.updateTPssrLaboratory(item);
  2671. // 安装人员
  2672. installer.add(item.getConfirm1());
  2673. //拆除人员
  2674. remover.add(item.getConfirm2());
  2675. }
  2676. TPssrApprove exist = new TPssrApprove();
  2677. exist.setSubId(sub.getId());
  2678. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2679. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2680. //新增审批数据
  2681. TPssrApprove approve = new TPssrApprove();
  2682. approve.setSubId(sub.getId());
  2683. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2684. approve.setApproveStatus(1L);
  2685. approve.setSubCharge(sub.getConfirm());
  2686. approve.setCreaterCode(userId);
  2687. approve.setCreatedate(new Date());
  2688. tPssrApproveService.insertTPssrApprove(approve);
  2689. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2690. } else {
  2691. // 已存在流程时,删除旧流程,重新发起
  2692. TPssrApprove approve = tPssrApproves.get(0);
  2693. delProcess(approve.getProcessId(), "pssr2confirm");
  2694. tPssrLaboratory = new TPssrLaboratory();
  2695. tPssrLaboratory.setApproveStatus(1L);
  2696. tPssrLaboratory.setSubId(sub.getId());
  2697. for (TPssrLaboratory item : tPssrLaboratoryService.selectTPssrLaboratoryList(tPssrLaboratory)) {
  2698. // 安装人员
  2699. installer.add(item.getConfirm1());
  2700. //拆除人员
  2701. remover.add(item.getConfirm2());
  2702. }
  2703. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2704. }
  2705. }
  2706. // 短接流程发起申请
  2707. public void doDjApprove(TPssrSubcontent sub) {
  2708. String userId = getUserId().toString();
  2709. //修改状态
  2710. TPssrCircuit tPssrCircuit = new TPssrCircuit();
  2711. tPssrCircuit.setApproveStatus(0L);
  2712. tPssrCircuit.setSubId(sub.getId());
  2713. Set<String> installer = new HashSet<>();
  2714. Set<String> remover = new HashSet<>();
  2715. for (TPssrCircuit item : tPssrCircuitService.selectTPssrCircuitList(tPssrCircuit)) {
  2716. item.setApproveStatus(1L);
  2717. item.setUpdatedate(new Date());
  2718. item.setUpdaterCode(userId);
  2719. tPssrCircuitService.updateTPssrCircuit(item);
  2720. // 安装人员
  2721. installer.add(item.getConfirm1());
  2722. //拆除人员
  2723. remover.add(item.getConfirm2());
  2724. }
  2725. TPssrApprove exist = new TPssrApprove();
  2726. exist.setSubId(sub.getId());
  2727. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2728. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2729. //新增审批数据
  2730. TPssrApprove approve = new TPssrApprove();
  2731. approve.setSubId(sub.getId());
  2732. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2733. approve.setApproveStatus(1L);
  2734. approve.setSubCharge(sub.getConfirm());
  2735. approve.setCreaterCode(userId);
  2736. approve.setCreatedate(new Date());
  2737. tPssrApproveService.insertTPssrApprove(approve);
  2738. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2739. } else {
  2740. // 已存在流程时,删除旧流程,重新发起
  2741. TPssrApprove approve = tPssrApproves.get(0);
  2742. delProcess(approve.getProcessId(), "pssr2confirm");
  2743. tPssrCircuit = new TPssrCircuit();
  2744. tPssrCircuit.setApproveStatus(1L);
  2745. tPssrCircuit.setSubId(sub.getId());
  2746. for (TPssrCircuit item : tPssrCircuitService.selectTPssrCircuitList(tPssrCircuit)) {
  2747. // 安装人员
  2748. installer.add(item.getConfirm1());
  2749. //拆除人员
  2750. remover.add(item.getConfirm2());
  2751. }
  2752. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2753. }
  2754. }
  2755. // 公用工程流程发起申请
  2756. public void doGygcApprove(TPssrSubcontent sub) {
  2757. String userId = getUserId().toString();
  2758. //修改状态
  2759. TPssrPublic tPssrPublic = new TPssrPublic();
  2760. tPssrPublic.setApproveStatus(0L);
  2761. tPssrPublic.setSubId(sub.getId());
  2762. Set<String> installer = new HashSet<>();
  2763. Set<String> remover = new HashSet<>();
  2764. for (TPssrPublic item : tPssrPublicService.selectTPssrPublicList(tPssrPublic)) {
  2765. item.setApproveStatus(1L);
  2766. item.setUpdatedate(new Date());
  2767. item.setUpdaterCode(userId);
  2768. tPssrPublicService.updateTPssrPublic(item);
  2769. // 安装人员
  2770. installer.add(item.getConfirm1());
  2771. //拆除人员
  2772. remover.add(item.getConfirm2());
  2773. }
  2774. TPssrApprove exist = new TPssrApprove();
  2775. exist.setSubId(sub.getId());
  2776. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2777. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2778. //新增审批数据
  2779. TPssrApprove approve = new TPssrApprove();
  2780. approve.setSubId(sub.getId());
  2781. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2782. approve.setApproveStatus(1L);
  2783. approve.setSubCharge(sub.getConfirm());
  2784. approve.setCreaterCode(userId);
  2785. approve.setCreatedate(new Date());
  2786. tPssrApproveService.insertTPssrApprove(approve);
  2787. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2788. } else {
  2789. // 已存在流程时,删除旧流程,重新发起
  2790. TPssrApprove approve = tPssrApproves.get(0);
  2791. delProcess(approve.getProcessId(), "pssr2confirm");
  2792. tPssrPublic = new TPssrPublic();
  2793. tPssrPublic.setApproveStatus(1L);
  2794. tPssrPublic.setSubId(sub.getId());
  2795. for (TPssrPublic item : tPssrPublicService.selectTPssrPublicList(tPssrPublic)) {
  2796. // 安装人员
  2797. installer.add(item.getConfirm1());
  2798. //拆除人员
  2799. remover.add(item.getConfirm2());
  2800. }
  2801. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2802. }
  2803. }
  2804. // 环保设施流程发起申请
  2805. public void doHbssApprove(TPssrSubcontent sub) {
  2806. String userId = getUserId().toString();
  2807. //修改状态
  2808. TPssrTorchvoc tPssrTorchvoc = new TPssrTorchvoc();
  2809. tPssrTorchvoc.setApproveStatus(0L);
  2810. tPssrTorchvoc.setSubId(sub.getId());
  2811. Set<String> installer = new HashSet<>();
  2812. Set<String> remover = new HashSet<>();
  2813. for (TPssrTorchvoc item : tPssrTorchvocService.selectTPssrTorchvocList(tPssrTorchvoc)) {
  2814. item.setApproveStatus(1L);
  2815. item.setUpdatedate(new Date());
  2816. item.setUpdaterCode(userId);
  2817. tPssrTorchvocService.updateTPssrTorchvoc(item);
  2818. // 安装人员
  2819. installer.add(item.getConfirm1());
  2820. //拆除人员
  2821. remover.add(item.getConfirm2());
  2822. }
  2823. TPssrApprove exist = new TPssrApprove();
  2824. exist.setSubId(sub.getId());
  2825. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2826. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2827. //新增审批数据
  2828. TPssrApprove approve = new TPssrApprove();
  2829. approve.setSubId(sub.getId());
  2830. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2831. approve.setApproveStatus(1L);
  2832. approve.setSubCharge(sub.getConfirm());
  2833. approve.setCreaterCode(userId);
  2834. approve.setCreatedate(new Date());
  2835. tPssrApproveService.insertTPssrApprove(approve);
  2836. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2837. } else {
  2838. // 已存在流程时,删除旧流程,重新发起
  2839. TPssrApprove approve = tPssrApproves.get(0);
  2840. delProcess(approve.getProcessId(), "pssr2confirm");
  2841. tPssrTorchvoc = new TPssrTorchvoc();
  2842. tPssrTorchvoc.setApproveStatus(1L);
  2843. tPssrTorchvoc.setSubId(sub.getId());
  2844. for (TPssrTorchvoc item : tPssrTorchvocService.selectTPssrTorchvocList(tPssrTorchvoc)) {
  2845. // 安装人员
  2846. installer.add(item.getConfirm1());
  2847. //拆除人员
  2848. remover.add(item.getConfirm2());
  2849. }
  2850. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2851. }
  2852. }
  2853. // 照明、电伴热流程发起申请
  2854. public void doZmdbrApprove(TPssrSubcontent sub) {
  2855. String userId = getUserId().toString();
  2856. //修改状态
  2857. TPssrLighting tPssrLighting = new TPssrLighting();
  2858. tPssrLighting.setApproveStatus(0L);
  2859. tPssrLighting.setSubId(sub.getId());
  2860. Set<String> installer = new HashSet<>();
  2861. Set<String> remover = new HashSet<>();
  2862. for (TPssrLighting item : tPssrLightingService.selectTPssrLightingList(tPssrLighting)) {
  2863. item.setApproveStatus(1L);
  2864. item.setUpdatedate(new Date());
  2865. item.setUpdaterCode(userId);
  2866. tPssrLightingService.updateTPssrLighting(item);
  2867. // 安装人员
  2868. installer.add(item.getConfirm1());
  2869. //拆除人员
  2870. remover.add(item.getConfirm2());
  2871. }
  2872. TPssrApprove exist = new TPssrApprove();
  2873. exist.setSubId(sub.getId());
  2874. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2875. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2876. //新增审批数据
  2877. TPssrApprove approve = new TPssrApprove();
  2878. approve.setSubId(sub.getId());
  2879. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2880. approve.setApproveStatus(1L);
  2881. approve.setSubCharge(sub.getConfirm());
  2882. approve.setCreaterCode(userId);
  2883. approve.setCreatedate(new Date());
  2884. tPssrApproveService.insertTPssrApprove(approve);
  2885. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2886. } else {
  2887. // 已存在流程时,删除旧流程,重新发起
  2888. TPssrApprove approve = tPssrApproves.get(0);
  2889. delProcess(approve.getProcessId(), "pssr2confirm");
  2890. tPssrLighting = new TPssrLighting();
  2891. tPssrLighting.setApproveStatus(1L);
  2892. tPssrLighting.setSubId(sub.getId());
  2893. for (TPssrLighting item : tPssrLightingService.selectTPssrLightingList(tPssrLighting)) {
  2894. // 安装人员
  2895. installer.add(item.getConfirm1());
  2896. //拆除人员
  2897. remover.add(item.getConfirm2());
  2898. }
  2899. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2900. }
  2901. }
  2902. // 支吊架流程发起申请
  2903. public void doZdjApprove(TPssrSubcontent sub) {
  2904. String userId = getUserId().toString();
  2905. //修改状态
  2906. TPssrFrame tPssrFrame = new TPssrFrame();
  2907. tPssrFrame.setApproveStatus(0L);
  2908. tPssrFrame.setSubId(sub.getId());
  2909. Set<String> installer = new HashSet<>();
  2910. Set<String> remover = new HashSet<>();
  2911. for (TPssrFrame item : tPssrFrameService.selectTPssrFrameList(tPssrFrame)) {
  2912. item.setApproveStatus(1L);
  2913. item.setUpdatedate(new Date());
  2914. item.setUpdaterCode(userId);
  2915. tPssrFrameService.updateTPssrFrame(item);
  2916. // 安装人员
  2917. installer.add(item.getConfirm1());
  2918. //拆除人员
  2919. remover.add(item.getConfirm2());
  2920. }
  2921. TPssrApprove exist = new TPssrApprove();
  2922. exist.setSubId(sub.getId());
  2923. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2924. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2925. //新增审批数据
  2926. TPssrApprove approve = new TPssrApprove();
  2927. approve.setSubId(sub.getId());
  2928. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2929. approve.setApproveStatus(1L);
  2930. approve.setSubCharge(sub.getConfirm());
  2931. approve.setCreaterCode(userId);
  2932. approve.setCreatedate(new Date());
  2933. tPssrApproveService.insertTPssrApprove(approve);
  2934. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2935. } else {
  2936. // 已存在流程时,删除旧流程,重新发起
  2937. TPssrApprove approve = tPssrApproves.get(0);
  2938. delProcess(approve.getProcessId(), "pssr2confirm");
  2939. tPssrFrame = new TPssrFrame();
  2940. tPssrFrame.setApproveStatus(1L);
  2941. tPssrFrame.setSubId(sub.getId());
  2942. for (TPssrFrame item : tPssrFrameService.selectTPssrFrameList(tPssrFrame)) {
  2943. // 安装人员
  2944. installer.add(item.getConfirm1());
  2945. //拆除人员
  2946. remover.add(item.getConfirm2());
  2947. }
  2948. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2949. }
  2950. }
  2951. // 仪表校验流程发起申请
  2952. public void doYbjyApprove(TPssrSubcontent sub) {
  2953. String userId = getUserId().toString();
  2954. //修改状态
  2955. TPssrInstrumentCalibration tPssrInstrumentCalibration = new TPssrInstrumentCalibration();
  2956. tPssrInstrumentCalibration.setApproveStatus(0L);
  2957. tPssrInstrumentCalibration.setSubId(sub.getId());
  2958. Set<String> installer = new HashSet<>();
  2959. Set<String> remover = new HashSet<>();
  2960. for (TPssrInstrumentCalibration item : tPssrInstrumentCalibrationService.selectTPssrInstrumentCalibrationList(tPssrInstrumentCalibration)) {
  2961. item.setApproveStatus(1L);
  2962. item.setUpdatedate(new Date());
  2963. item.setUpdaterCode(userId);
  2964. tPssrInstrumentCalibrationService.updateTPssrInstrumentCalibration(item);
  2965. // 安装人员
  2966. installer.add(item.getConfirm1());
  2967. //拆除人员
  2968. remover.add(item.getConfirm2());
  2969. }
  2970. TPssrApprove exist = new TPssrApprove();
  2971. exist.setSubId(sub.getId());
  2972. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  2973. if (CollectionUtil.isEmpty(tPssrApproves)) {
  2974. //新增审批数据
  2975. TPssrApprove approve = new TPssrApprove();
  2976. approve.setSubId(sub.getId());
  2977. approve.setApNo(DateUtils.dateTimeNow() + userId);
  2978. approve.setApproveStatus(1L);
  2979. approve.setSubCharge(sub.getConfirm());
  2980. approve.setCreaterCode(userId);
  2981. approve.setCreatedate(new Date());
  2982. tPssrApproveService.insertTPssrApprove(approve);
  2983. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2984. } else {
  2985. // 已存在流程时,删除旧流程,重新发起
  2986. TPssrApprove approve = tPssrApproves.get(0);
  2987. delProcess(approve.getProcessId(), "pssr2confirm");
  2988. tPssrInstrumentCalibration = new TPssrInstrumentCalibration();
  2989. tPssrInstrumentCalibration.setApproveStatus(1L);
  2990. tPssrInstrumentCalibration.setSubId(sub.getId());
  2991. for (TPssrInstrumentCalibration item : tPssrInstrumentCalibrationService.selectTPssrInstrumentCalibrationList(tPssrInstrumentCalibration)) {
  2992. // 安装人员
  2993. installer.add(item.getConfirm1());
  2994. //拆除人员
  2995. remover.add(item.getConfirm2());
  2996. }
  2997. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  2998. }
  2999. }
  3000. //临时电源流程发起申请
  3001. public void doLsdyApprove(TPssrSubcontent sub) {
  3002. String userId = getUserId().toString();
  3003. //修改状态
  3004. TPssrPower tPssrPower = new TPssrPower();
  3005. tPssrPower.setApproveStatus(0L);
  3006. tPssrPower.setSubId(sub.getId());
  3007. Set<String> installer = new HashSet<>();
  3008. Set<String> remover = new HashSet<>();
  3009. for (TPssrPower item : tPssrPowerService.selectTPssrPowerList(tPssrPower)) {
  3010. item.setApproveStatus(1L);
  3011. item.setUpdatedate(new Date());
  3012. item.setUpdaterCode(userId);
  3013. tPssrPowerService.updateTPssrPower(item);
  3014. // 安装人员
  3015. installer.add(item.getConfirm1());
  3016. //拆除人员
  3017. remover.add(item.getConfirm2());
  3018. }
  3019. TPssrApprove exist = new TPssrApprove();
  3020. exist.setSubId(sub.getId());
  3021. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3022. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3023. //新增审批数据
  3024. TPssrApprove approve = new TPssrApprove();
  3025. approve.setSubId(sub.getId());
  3026. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3027. approve.setApproveStatus(1L);
  3028. approve.setSubCharge(sub.getConfirm());
  3029. approve.setCreaterCode(userId);
  3030. approve.setCreatedate(new Date());
  3031. tPssrApproveService.insertTPssrApprove(approve);
  3032. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3033. } else {
  3034. // 已存在流程时,删除旧流程,重新发起
  3035. TPssrApprove approve = tPssrApproves.get(0);
  3036. delProcess(approve.getProcessId(), "pssr2confirm");
  3037. tPssrPower = new TPssrPower();
  3038. tPssrPower.setApproveStatus(1L);
  3039. tPssrPower.setSubId(sub.getId());
  3040. for (TPssrPower item : tPssrPowerService.selectTPssrPowerList(tPssrPower)) {
  3041. // 安装人员
  3042. installer.add(item.getConfirm1());
  3043. //拆除人员
  3044. remover.add(item.getConfirm2());
  3045. }
  3046. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3047. }
  3048. }
  3049. //电机设备流程发起申请
  3050. public void doDjsbApprove(TPssrSubcontent sub) {
  3051. String userId = getUserId().toString();
  3052. //修改状态
  3053. TPssrMotor tPssrMotor = new TPssrMotor();
  3054. tPssrMotor.setApproveStatus(0L);
  3055. tPssrMotor.setSubId(sub.getId());
  3056. Set<String> installer = new HashSet<>();
  3057. Set<String> remover = new HashSet<>();
  3058. for (TPssrMotor item : tPssrMotorService.selectTPssrMotorList(tPssrMotor)) {
  3059. item.setApproveStatus(1L);
  3060. item.setUpdatedate(new Date());
  3061. item.setUpdaterCode(userId);
  3062. tPssrMotorService.updateTPssrMotor(item);
  3063. // 安装人员
  3064. installer.add(item.getConfirm1());
  3065. //拆除人员
  3066. remover.add(item.getConfirm2());
  3067. }
  3068. TPssrApprove exist = new TPssrApprove();
  3069. exist.setSubId(sub.getId());
  3070. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3071. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3072. //新增审批数据
  3073. TPssrApprove approve = new TPssrApprove();
  3074. approve.setSubId(sub.getId());
  3075. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3076. approve.setApproveStatus(1L);
  3077. approve.setSubCharge(sub.getConfirm());
  3078. approve.setCreaterCode(userId);
  3079. approve.setCreatedate(new Date());
  3080. tPssrApproveService.insertTPssrApprove(approve);
  3081. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3082. } else {
  3083. // 已存在流程时,删除旧流程,重新发起
  3084. TPssrApprove approve = tPssrApproves.get(0);
  3085. delProcess(approve.getProcessId(), "pssr2confirm");
  3086. tPssrMotor = new TPssrMotor();
  3087. tPssrMotor.setApproveStatus(1L);
  3088. tPssrMotor.setSubId(sub.getId());
  3089. for (TPssrMotor item : tPssrMotorService.selectTPssrMotorList(tPssrMotor)) {
  3090. // 安装人员
  3091. installer.add(item.getConfirm1());
  3092. //拆除人员
  3093. remover.add(item.getConfirm2());
  3094. }
  3095. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3096. }
  3097. }
  3098. //静电接地、跨接流程发起申请
  3099. public void doJdjdkjApprove(TPssrSubcontent sub) {
  3100. String userId = getUserId().toString();
  3101. //修改状态
  3102. TPssrFranklinism tPssrFranklinism = new TPssrFranklinism();
  3103. tPssrFranklinism.setApproveStatus(0L);
  3104. tPssrFranklinism.setSubId(sub.getId());
  3105. Set<String> installer = new HashSet<>();
  3106. Set<String> remover = new HashSet<>();
  3107. for (TPssrFranklinism item : tPssrFranklinismService.selectTPssrFranklinismList(tPssrFranklinism)) {
  3108. item.setApproveStatus(1L);
  3109. item.setUpdatedate(new Date());
  3110. item.setUpdaterCode(userId);
  3111. tPssrFranklinismService.updateTPssrFranklinism(item);
  3112. // 安装人员
  3113. installer.add(item.getConfirm1());
  3114. //拆除人员
  3115. remover.add(item.getConfirm2());
  3116. }
  3117. TPssrApprove exist = new TPssrApprove();
  3118. exist.setSubId(sub.getId());
  3119. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3120. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3121. //新增审批数据
  3122. TPssrApprove approve = new TPssrApprove();
  3123. approve.setSubId(sub.getId());
  3124. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3125. approve.setApproveStatus(1L);
  3126. approve.setSubCharge(sub.getConfirm());
  3127. approve.setCreaterCode(userId);
  3128. approve.setCreatedate(new Date());
  3129. tPssrApproveService.insertTPssrApprove(approve);
  3130. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3131. } else {
  3132. // 已存在流程时,删除旧流程,重新发起
  3133. TPssrApprove approve = tPssrApproves.get(0);
  3134. delProcess(approve.getProcessId(), "pssr2confirm");
  3135. tPssrFranklinism = new TPssrFranklinism();
  3136. tPssrFranklinism.setApproveStatus(1L);
  3137. tPssrFranklinism.setSubId(sub.getId());
  3138. for (TPssrFranklinism item : tPssrFranklinismService.selectTPssrFranklinismList(tPssrFranklinism)) {
  3139. // 安装人员
  3140. installer.add(item.getConfirm1());
  3141. //拆除人员
  3142. remover.add(item.getConfirm2());
  3143. }
  3144. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3145. }
  3146. }
  3147. //气体检测仪流程发起申请
  3148. public void doQtjcyApprove(TPssrSubcontent sub) {
  3149. String userId = getUserId().toString();
  3150. //修改状态
  3151. TPssrGasdetector tPssrGasdetector = new TPssrGasdetector();
  3152. tPssrGasdetector.setApproveStatus(0L);
  3153. tPssrGasdetector.setSubId(sub.getId());
  3154. Set<String> installer = new HashSet<>();
  3155. Set<String> remover = new HashSet<>();
  3156. for (TPssrGasdetector item : tPssrGasdetectorService.selectTPssrGasdetectorList(tPssrGasdetector)) {
  3157. item.setApproveStatus(1L);
  3158. item.setUpdatedate(new Date());
  3159. item.setUpdaterCode(userId);
  3160. tPssrGasdetectorService.updateTPssrGasdetector(item);
  3161. // 安装人员
  3162. installer.add(item.getConfirm1());
  3163. //拆除人员
  3164. remover.add(item.getConfirm2());
  3165. }
  3166. TPssrApprove exist = new TPssrApprove();
  3167. exist.setSubId(sub.getId());
  3168. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3169. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3170. //新增审批数据
  3171. TPssrApprove approve = new TPssrApprove();
  3172. approve.setSubId(sub.getId());
  3173. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3174. approve.setApproveStatus(1L);
  3175. approve.setSubCharge(sub.getConfirm());
  3176. approve.setCreaterCode(userId);
  3177. approve.setCreatedate(new Date());
  3178. tPssrApproveService.insertTPssrApprove(approve);
  3179. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3180. } else {
  3181. // 已存在流程时,删除旧流程,重新发起
  3182. TPssrApprove approve = tPssrApproves.get(0);
  3183. delProcess(approve.getProcessId(), "pssr2confirm");
  3184. tPssrGasdetector = new TPssrGasdetector();
  3185. tPssrGasdetector.setApproveStatus(1L);
  3186. tPssrGasdetector.setSubId(sub.getId());
  3187. for (TPssrGasdetector item : tPssrGasdetectorService.selectTPssrGasdetectorList(tPssrGasdetector)) {
  3188. // 安装人员
  3189. installer.add(item.getConfirm1());
  3190. //拆除人员
  3191. remover.add(item.getConfirm2());
  3192. }
  3193. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3194. }
  3195. }
  3196. //在线分析仪流程发起申请
  3197. public void doZxfxyApprove(TPssrSubcontent sub) {
  3198. String userId = getUserId().toString();
  3199. //修改状态
  3200. TPssrAnalyzer tPssrAnalyzer = new TPssrAnalyzer();
  3201. tPssrAnalyzer.setApproveStatus(0L);
  3202. tPssrAnalyzer.setSubId(sub.getId());
  3203. Set<String> installer = new HashSet<>();
  3204. Set<String> remover = new HashSet<>();
  3205. for (TPssrAnalyzer item : tPssrAnalyzerService.selectTPssrAnalyzerList(tPssrAnalyzer)) {
  3206. item.setApproveStatus(1L);
  3207. item.setUpdatedate(new Date());
  3208. item.setUpdaterCode(userId);
  3209. tPssrAnalyzerService.updateTPssrAnalyzer(item);
  3210. // 安装人员
  3211. installer.add(item.getConfirm1());
  3212. //拆除人员
  3213. remover.add(item.getConfirm2());
  3214. }
  3215. TPssrApprove exist = new TPssrApprove();
  3216. exist.setSubId(sub.getId());
  3217. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3218. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3219. //新增审批数据
  3220. TPssrApprove approve = new TPssrApprove();
  3221. approve.setSubId(sub.getId());
  3222. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3223. approve.setApproveStatus(1L);
  3224. approve.setSubCharge(sub.getConfirm());
  3225. approve.setCreaterCode(userId);
  3226. approve.setCreatedate(new Date());
  3227. tPssrApproveService.insertTPssrApprove(approve);
  3228. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3229. } else {
  3230. // 已存在流程时,删除旧流程,重新发起
  3231. TPssrApprove approve = tPssrApproves.get(0);
  3232. delProcess(approve.getProcessId(), "pssr2confirm");
  3233. tPssrAnalyzer = new TPssrAnalyzer();
  3234. tPssrAnalyzer.setApproveStatus(1L);
  3235. tPssrAnalyzer.setSubId(sub.getId());
  3236. for (TPssrAnalyzer item : tPssrAnalyzerService.selectTPssrAnalyzerList(tPssrAnalyzer)) {
  3237. // 安装人员
  3238. installer.add(item.getConfirm1());
  3239. //拆除人员
  3240. remover.add(item.getConfirm2());
  3241. }
  3242. pssr2confirm(approve, new ArrayList<>(installer), new ArrayList<>(remover), sub.getConfirm());
  3243. }
  3244. }
  3245. // 开工方案流程发起申请
  3246. public void doKgfaApprove(TPssrSubcontent sub) {
  3247. String userId = getUserId().toString();
  3248. //修改状态
  3249. TPssrProgramme tPssrProgramme = new TPssrProgramme();
  3250. tPssrProgramme.setApproveStatus(0L);
  3251. tPssrProgramme.setSubId(sub.getId());
  3252. Set<String> confirm1 = new HashSet<>();
  3253. Set<String> confirm2 = new HashSet<>();
  3254. for (TPssrProgramme item : tPssrProgrammeService.selectTPssrProgrammeList(tPssrProgramme)) {
  3255. item.setApproveStatus(1L);
  3256. item.setUpdatedate(new Date());
  3257. item.setUpdaterCode(userId);
  3258. tPssrProgrammeService.updateTPssrProgramme(item);
  3259. // 安装人员
  3260. confirm1.add(item.getConfirm1());
  3261. //拆除人员
  3262. confirm2.add(item.getConfirm2());
  3263. }
  3264. TPssrApprove exist = new TPssrApprove();
  3265. exist.setSubId(sub.getId());
  3266. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3267. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3268. //新增审批数据
  3269. TPssrApprove approve = new TPssrApprove();
  3270. approve.setSubId(sub.getId());
  3271. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3272. approve.setApproveStatus(1L);
  3273. approve.setSubCharge(sub.getConfirm());
  3274. approve.setCreaterCode(userId);
  3275. approve.setCreatedate(new Date());
  3276. tPssrApproveService.insertTPssrApprove(approve);
  3277. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  3278. } else {
  3279. // 已存在流程时,删除旧流程,重新发起
  3280. TPssrApprove approve = tPssrApproves.get(0);
  3281. delProcess(approve.getProcessId(), "pssr2confirm");
  3282. tPssrProgramme = new TPssrProgramme();
  3283. tPssrProgramme.setApproveStatus(1L);
  3284. tPssrProgramme.setSubId(sub.getId());
  3285. for (TPssrProgramme item : tPssrProgrammeService.selectTPssrProgrammeList(tPssrProgramme)) {
  3286. // 安装人员
  3287. confirm1.add(item.getConfirm1());
  3288. //拆除人员
  3289. confirm2.add(item.getConfirm2());
  3290. }
  3291. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  3292. }
  3293. }
  3294. /**
  3295. * 设计变更发起流程
  3296. */
  3297. private void doMocApprove(TPssrSubcontent sub) {
  3298. String userId = getUserId().toString();
  3299. //修改状态
  3300. TPssrMoc tPssrMoc = new TPssrMoc();
  3301. tPssrMoc.setApproveStatus(0L);
  3302. tPssrMoc.setSubId(sub.getId());
  3303. Set<String> confirm1 = new HashSet<>();
  3304. Set<String> confirm2 = new HashSet<>();
  3305. for (TPssrMoc item : tPssrMocService.selectTPssrMocList(tPssrMoc)) {
  3306. item.setApproveStatus(1L);
  3307. item.setUpdatedate(new Date());
  3308. item.setUpdaterCode(userId);
  3309. tPssrMocService.updateTPssrMoc(item);
  3310. // 安装人员
  3311. confirm1.add(item.getConfirm1());
  3312. //拆除人员
  3313. confirm2.add(item.getConfirm2());
  3314. }
  3315. TPssrApprove exist = new TPssrApprove();
  3316. exist.setSubId(sub.getId());
  3317. List<TPssrApprove> tPssrApproves = tPssrApproveService.selectTPssrApproveList(exist);
  3318. if (CollectionUtil.isEmpty(tPssrApproves)) {
  3319. //新增审批数据
  3320. TPssrApprove approve = new TPssrApprove();
  3321. approve.setSubId(sub.getId());
  3322. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3323. approve.setApproveStatus(1L);
  3324. approve.setSubCharge(sub.getConfirm());
  3325. approve.setCreaterCode(userId);
  3326. approve.setCreatedate(new Date());
  3327. tPssrApproveService.insertTPssrApprove(approve);
  3328. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  3329. } else {
  3330. // 已存在流程时,删除旧流程,重新发起
  3331. TPssrApprove approve = tPssrApproves.get(0);
  3332. delProcess(approve.getProcessId(), "pssr2confirm");
  3333. tPssrMoc = new TPssrMoc();
  3334. tPssrMoc.setApproveStatus(1L);
  3335. tPssrMoc.setSubId(sub.getId());
  3336. for (TPssrMoc item : tPssrMocService.selectTPssrMocList(tPssrMoc)) {
  3337. // 安装人员
  3338. confirm1.add(item.getConfirm1());
  3339. //拆除人员
  3340. confirm2.add(item.getConfirm2());
  3341. }
  3342. pssr2confirm(approve, new ArrayList<>(confirm1), new ArrayList<>(confirm2), sub.getConfirm());
  3343. }
  3344. }
  3345. /**
  3346. * 人身防护审批流程发起申请
  3347. *
  3348. * @param sub 子表对象
  3349. */
  3350. private void doRsfhApprove(TPssrSubcontent sub) {
  3351. String userId = getUserId().toString();
  3352. //修改各表状态
  3353. TPssrMeasure measure = new TPssrMeasure();
  3354. measure.setSubId(sub.getId());
  3355. measure.setApproveStatus(1L);
  3356. measure.setUpdatedate(new Date());
  3357. measure.setUpdaterCode(userId);
  3358. tPssrMeasureService.updateAllBySubId(measure);
  3359. TPssrProtection protection = new TPssrProtection();
  3360. protection.setSubId(sub.getId());
  3361. protection.setApproveStatus(1L);
  3362. protection.setUpdatedate(new Date());
  3363. protection.setUpdaterCode(userId);
  3364. tPssrProtectionService.updateAllBySubId(protection);
  3365. // 查询确认人
  3366. TPssrProtection entity = new TPssrProtection();
  3367. entity.setSubId(sub.getId());
  3368. entity.setApproveStatus(1L);
  3369. TPssrProtection tPssrProtection = tPssrProtectionService.selectAllConfirmedPersonBySubId(entity);
  3370. String confirmer1s = null;
  3371. String confirmer2s = null;
  3372. if (tPssrProtection != null) {
  3373. confirmer1s = tPssrProtection.getConfirm1();
  3374. confirmer2s = tPssrProtection.getConfirm2();
  3375. }
  3376. logger.info("=======================confirmer1s:{}", confirmer1s);
  3377. logger.info("=======================confirmer2s:{}", confirmer2s);
  3378. Set<String> confirmerUsers1 = new HashSet<>();
  3379. Set<String> confirmerUsers2 = new HashSet<>();
  3380. if (StringUtils.isNotEmpty(confirmer1s)) {
  3381. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3382. }
  3383. if (StringUtils.isNotEmpty(confirmer2s)) {
  3384. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  3385. }
  3386. //查询是否已存在审批流程
  3387. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  3388. if (tPssrApprove == null) {
  3389. TPssrApprove approve = new TPssrApprove();
  3390. approve.setSubId(sub.getId());
  3391. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3392. approve.setApproveStatus(1L);
  3393. approve.setSubCharge(sub.getConfirm());
  3394. approve.setCreaterCode(userId);
  3395. approve.setCreatedate(new Date());
  3396. tPssrApproveService.insertTPssrApprove(approve);
  3397. pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  3398. } else {
  3399. delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
  3400. entity.setSubId(sub.getId());
  3401. entity.setApproveStatus(3L);
  3402. tPssrProtection = tPssrProtectionService.selectAllConfirmedPersonBySubId(entity);
  3403. if (tPssrProtection != null) {
  3404. confirmer1s = tPssrProtection.getConfirm1();
  3405. confirmer2s = tPssrProtection.getConfirm2();
  3406. }
  3407. if (StringUtils.isNotEmpty(confirmer1s)) {
  3408. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3409. }
  3410. if (StringUtils.isNotEmpty(confirmer2s)) {
  3411. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  3412. }
  3413. pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  3414. }
  3415. }
  3416. /**
  3417. * 原辅料审批发起申请
  3418. */
  3419. private void doYflApprove(TPssrSubcontent sub) {
  3420. String userId = getUserId().toString();
  3421. //修改各表状态
  3422. TPssrMaterial material = new TPssrMaterial();
  3423. material.setSubId(sub.getId());
  3424. material.setApproveStatus(1L);
  3425. material.setUpdatedate(new Date());
  3426. material.setUpdaterCode(userId);
  3427. tPssrMaterialService.updateAllBySubId(material);
  3428. TPssrMaterialRaw materialRaw = new TPssrMaterialRaw();
  3429. materialRaw.setSubId(sub.getId());
  3430. materialRaw.setApproveStatus(1L);
  3431. materialRaw.setUpdatedate(new Date());
  3432. materialRaw.setUpdaterCode(userId);
  3433. tPssrMaterialRawService.updateAllBySubId(materialRaw);
  3434. // 查询确认人
  3435. TPssrMaterial entity = new TPssrMaterial();
  3436. entity.setSubId(sub.getId());
  3437. entity.setApproveStatus(1L);
  3438. TPssrMaterial tPssrMaterial = tPssrMaterialService.selectAllConfirmedPersonBySubId(entity);
  3439. String confirmer1s = null;
  3440. if (tPssrMaterial != null) {
  3441. confirmer1s = tPssrMaterial.getConfirm1();
  3442. }
  3443. logger.info("=======================confirmer1s:{}", confirmer1s);
  3444. Set<String> confirmerUsers1 = new HashSet<>();
  3445. if (StringUtils.isNotEmpty(confirmer1s)) {
  3446. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3447. }
  3448. //查询是否已存在审批流程
  3449. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  3450. if (tPssrApprove == null) {
  3451. TPssrApprove approve = new TPssrApprove();
  3452. approve.setSubId(sub.getId());
  3453. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3454. approve.setApproveStatus(1L);
  3455. approve.setSubCharge(sub.getConfirm());
  3456. approve.setCreaterCode(userId);
  3457. approve.setCreatedate(new Date());
  3458. tPssrApproveService.insertTPssrApprove(approve);
  3459. pssr1confirm(approve, new ArrayList<>(confirmerUsers1), sub.getConfirm());
  3460. } else {
  3461. delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
  3462. entity.setSubId(sub.getId());
  3463. entity.setApproveStatus(3L);
  3464. tPssrMaterial = tPssrMaterialService.selectAllConfirmedPersonBySubId(entity);
  3465. if (tPssrMaterial != null) {
  3466. confirmer1s = tPssrMaterial.getConfirm1();
  3467. }
  3468. if (StringUtils.isNotEmpty(confirmer1s)) {
  3469. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3470. }
  3471. pssr1confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), sub.getConfirm());
  3472. }
  3473. }
  3474. /**
  3475. * 机泵审批发起申请
  3476. */
  3477. private void doJbApprove(TPssrSubcontent sub) {
  3478. String userId = getUserId().toString();
  3479. //修改各表状态
  3480. TPssrPumpCleaning cleaning = new TPssrPumpCleaning();
  3481. cleaning.setSubId(sub.getId());
  3482. cleaning.setApproveStatus(1L);
  3483. cleaning.setUpdatedate(new Date());
  3484. cleaning.setUpdaterCode(userId);
  3485. tPssrPumpCleaningService.updateAllBySubId(cleaning);
  3486. TPssrPumpFill fill = new TPssrPumpFill();
  3487. fill.setSubId(sub.getId());
  3488. fill.setApproveStatus(1L);
  3489. fill.setUpdatedate(new Date());
  3490. fill.setUpdaterCode(userId);
  3491. tPssrPumpFillService.updateAllBySubId(fill);
  3492. TPssrPumpOverhaul overhaul = new TPssrPumpOverhaul();
  3493. overhaul.setSubId(sub.getId());
  3494. overhaul.setApproveStatus(1L);
  3495. overhaul.setUpdatedate(new Date());
  3496. overhaul.setUpdaterCode(userId);
  3497. tPssrPumpOverhaulService.updateAllBySubId(overhaul);
  3498. // 查询确认人
  3499. TPssrPumpFill entity = new TPssrPumpFill();
  3500. entity.setSubId(sub.getId());
  3501. entity.setApproveStatus(1L);
  3502. TPssrPumpFill queryData = tPssrPumpFillService.selectAllConfirmedPersonBySubId(entity);
  3503. String confirmer1s = null;
  3504. String confirmer2s = null;
  3505. if (queryData != null) {
  3506. confirmer1s = queryData.getConfirmer1();
  3507. confirmer2s = queryData.getConfirmer2();
  3508. }
  3509. logger.info("=======================confirmer1s:{}", confirmer1s);
  3510. logger.info("=======================confirmer2s:{}", confirmer2s);
  3511. Set<String> confirmerUsers1 = new HashSet<>();
  3512. Set<String> confirmerUsers2 = new HashSet<>();
  3513. if (StringUtils.isNotEmpty(confirmer1s)) {
  3514. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3515. }
  3516. if (StringUtils.isNotEmpty(confirmer2s)) {
  3517. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  3518. }
  3519. //查询是否已存在审批流程
  3520. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  3521. if (tPssrApprove == null) {
  3522. TPssrApprove approve = new TPssrApprove();
  3523. approve.setSubId(sub.getId());
  3524. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3525. approve.setApproveStatus(1L);
  3526. approve.setSubCharge(sub.getConfirm());
  3527. approve.setCreaterCode(userId);
  3528. approve.setCreatedate(new Date());
  3529. tPssrApproveService.insertTPssrApprove(approve);
  3530. pssr2confirm(approve, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  3531. } else {
  3532. delProcess(tPssrApprove.getProcessId(), "pssr2confirm");
  3533. entity.setSubId(sub.getId());
  3534. entity.setApproveStatus(3L);
  3535. queryData = tPssrPumpFillService.selectAllConfirmedPersonBySubId(entity);
  3536. if (queryData != null) {
  3537. confirmer1s = queryData.getConfirmer1();
  3538. confirmer2s = queryData.getConfirmer2();
  3539. }
  3540. if (StringUtils.isNotEmpty(confirmer1s)) {
  3541. confirmerUsers1.addAll(Arrays.asList(confirmer1s.split(",")));
  3542. }
  3543. if (StringUtils.isNotEmpty(confirmer2s)) {
  3544. confirmerUsers2.addAll(Arrays.asList(confirmer2s.split(",")));
  3545. }
  3546. pssr2confirm(tPssrApprove, new ArrayList<>(confirmerUsers1), new ArrayList<>(confirmerUsers2), sub.getConfirm());
  3547. }
  3548. }
  3549. /**
  3550. * 仪表联锁测试审批发起申请
  3551. */
  3552. private void doYblscsApprove(TPssrSubcontent sub) {
  3553. String userId = getUserId().toString();
  3554. //修改表状态
  3555. TPssrInstrumentTest instrumentTest = new TPssrInstrumentTest();
  3556. instrumentTest.setSubId(sub.getId());
  3557. for (TPssrInstrumentTest test : tPssrInstrumentTestService.selectTPssrInstrumentTestList(instrumentTest)) {
  3558. test.setApproveStatus(2L);
  3559. test.setUpdatedate(new Date());
  3560. test.setUpdaterCode(userId);
  3561. tPssrInstrumentTestService.updateTPssrInstrumentTest(test);
  3562. }
  3563. //查询是否已存在审批流程
  3564. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  3565. if (tPssrApprove == null) {
  3566. TPssrApprove approve = new TPssrApprove();
  3567. approve.setSubId(sub.getId());
  3568. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3569. approve.setApproveStatus(1L);
  3570. approve.setSubCharge(sub.getConfirm());
  3571. approve.setCreaterCode(userId);
  3572. approve.setCreatedate(new Date());
  3573. tPssrApproveService.insertTPssrApprove(approve);
  3574. pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
  3575. } else {
  3576. delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
  3577. pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
  3578. }
  3579. }
  3580. /**
  3581. * 仪表联锁测试审批发起申请
  3582. */
  3583. private void doBjlszqrApprove(TPssrSubcontent sub) {
  3584. String userId = getUserId().toString();
  3585. //修改表状态
  3586. TPssrAlarm alarm = new TPssrAlarm();
  3587. alarm.setSubId(sub.getId());
  3588. for (TPssrAlarm test : tPssrAlarmService.selectTPssrAlarmList(alarm)) {
  3589. test.setApproveStatus(2L);
  3590. test.setUpdatedate(new Date());
  3591. test.setUpdaterCode(userId);
  3592. tPssrAlarmService.updateTPssrAlarm(test);
  3593. }
  3594. //查询是否已存在审批流程
  3595. TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveBySubId(sub.getId());
  3596. if (tPssrApprove == null) {
  3597. TPssrApprove approve = new TPssrApprove();
  3598. approve.setSubId(sub.getId());
  3599. approve.setApNo(DateUtils.dateTimeNow() + userId);
  3600. approve.setApproveStatus(1L);
  3601. approve.setSubCharge(sub.getConfirm());
  3602. approve.setCreaterCode(userId);
  3603. approve.setCreatedate(new Date());
  3604. tPssrApproveService.insertTPssrApprove(approve);
  3605. pssr1confirm(approve, new ArrayList<>(), sub.getConfirm());
  3606. } else {
  3607. delProcess(tPssrApprove.getProcessId(), "pssr1confirm");
  3608. pssr1confirm(tPssrApprove, new ArrayList<>(), sub.getConfirm());
  3609. }
  3610. }
  3611. /**
  3612. * 单确认人发起流程
  3613. */
  3614. private void pssr1confirm(TPssrApprove approve, List<String> confirmUsers, String confirm) {
  3615. String userId = getUserId().toString();
  3616. // 开始申请流程
  3617. long businessKey = approve.getApproveId();
  3618. //开始工作流、监听
  3619. Authentication.setAuthenticatedUserId(userId);//设置当前申请人
  3620. Map<String, Object> variables = new HashMap<>();
  3621. variables.put("applyUser", userId);
  3622. variables.put("confirmUsers", confirmUsers);
  3623. variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
  3624. variables.put("chargePerson", confirm);
  3625. //采用key来启动流程定义并设置流程变量,返回流程实例
  3626. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr1confirm", String.valueOf(businessKey), variables);
  3627. approve.setProcessId(pi.getProcessInstanceId());
  3628. tPssrApproveService.updateTPssrApprove(approve);
  3629. }
  3630. /**
  3631. * 双确认人发起流程
  3632. */
  3633. private void pssr2confirm(TPssrApprove approve, List<String> confirmUsers1, List<String> confirmUsers2, String confirm) {
  3634. String userId = getUserId().toString();
  3635. // 开始申请流程
  3636. long businessKey = approve.getApproveId();
  3637. //开始工作流、监听
  3638. Authentication.setAuthenticatedUserId(userId);//设置当前申请人
  3639. Map<String, Object> variables = new HashMap<>();
  3640. variables.put("applyUser", userId);
  3641. variables.put("confirmUsers1", confirmUsers1);
  3642. variables.put("confirmUsers2", confirmUsers2);
  3643. variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
  3644. variables.put("chargePerson", confirm);
  3645. //采用key来启动流程定义并设置流程变量,返回流程实例
  3646. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
  3647. approve.setProcessId(pi.getProcessInstanceId());
  3648. tPssrApproveService.updateTPssrApprove(approve);
  3649. }
  3650. /**
  3651. * 三确认人发起流程
  3652. */
  3653. private void pssr3confirm(TPssrApprove approve, List<String> confirmUsers1, List<String> confirmUsers2, List<String> confirmUsers3, String confirm) {
  3654. String userId = getUserId().toString();
  3655. // 开始申请流程
  3656. long businessKey = approve.getApproveId();
  3657. //开始工作流、监听
  3658. Authentication.setAuthenticatedUserId(userId);//设置当前申请人
  3659. Map<String, Object> variables = new HashMap<>();
  3660. variables.put("applyUser", userId);
  3661. variables.put("confirmUsers1", confirmUsers1);
  3662. variables.put("confirmUsers2", confirmUsers2);
  3663. variables.put("confirmUsers3", confirmUsers3);
  3664. variables.put("confirmTaskCreateListener", new ConfirmTaskCreateListener());//发送邮件
  3665. variables.put("chargePerson", confirm);
  3666. //采用key来启动流程定义并设置流程变量,返回流程实例
  3667. ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr3confirm", String.valueOf(businessKey), variables);
  3668. approve.setProcessId(pi.getProcessInstanceId());
  3669. tPssrApproveService.updateTPssrApprove(approve);
  3670. }
  3671. /**
  3672. * 删除已存在流程
  3673. */
  3674. private void delProcess(String processId, String processName) {
  3675. try {
  3676. runtimeService.deleteProcessInstance(processId, processName);
  3677. historyService.deleteHistoricProcessInstance(processId);
  3678. } catch (Exception e) {
  3679. logger.info("无运行时流程");
  3680. }
  3681. }
  3682. }