ActTaskController.java 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180
  1. /**
  2. * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
  3. */
  4. package com.jeeplus.modules.act.web;
  5. import java.io.InputStream;
  6. import java.io.UnsupportedEncodingException;
  7. import java.net.URLDecoder;
  8. import java.util.Date;
  9. import java.text.SimpleDateFormat;
  10. import java.util.ArrayList;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map;
  14. import javax.servlet.ServletContext;
  15. import javax.servlet.http.HttpServletRequest;
  16. import javax.servlet.http.HttpServletResponse;
  17. import com.jeeplus.common.json.AjaxJson;
  18. import com.jeeplus.common.utils.SpringContextHolder;
  19. import com.jeeplus.common.websocket.service.system.SystemInfoSocketHandler;
  20. import com.jeeplus.modules.act.service.ActModelService;
  21. import com.jeeplus.modules.oa.entity.OaNotify;
  22. import com.jeeplus.modules.oa.entity.OaNotifyRecord;
  23. import com.jeeplus.modules.oa.service.OaNotifyService;
  24. import com.jeeplus.modules.sg.managementcenter.activiti.entity.*;
  25. import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
  26. import com.jeeplus.modules.sg.managementcenter.activiti.service.DiscloseService;
  27. import com.jeeplus.modules.sg.managementcenter.activiti.service.ProcessPersonnelService;
  28. import com.jeeplus.modules.sg.managementcenter.activiti.service.UploadImagesService;
  29. import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
  30. import com.jeeplus.modules.sg.managementcenter.constructionProject.entity.ConstructionProject;
  31. import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
  32. import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
  33. import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
  34. import com.jeeplus.modules.sg.materialmodule.activiti.entity.NonPower;
  35. import com.jeeplus.modules.sg.materialmodule.activiti.service.MaterialModuleService;
  36. import com.jeeplus.modules.sg.materialmodule.activiti.service.NonPowerService;
  37. import com.jeeplus.modules.sg.picking.activiti.entity.PickApplication;
  38. import com.jeeplus.modules.sg.picking.activiti.entity.ShowList;
  39. import com.jeeplus.modules.sg.picking.activiti.service.PickIngService;
  40. import com.jeeplus.modules.sg.settActivi.service.SettActiviService;
  41. import com.jeeplus.modules.sys.service.SystemService;
  42. import org.activiti.engine.HistoryService;
  43. import org.activiti.engine.RepositoryService;
  44. import org.activiti.engine.RuntimeService;
  45. import org.activiti.engine.TaskService;
  46. import org.activiti.engine.history.HistoricTaskInstance;
  47. import org.activiti.engine.impl.RepositoryServiceImpl;
  48. import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
  49. import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
  50. import org.activiti.engine.impl.pvm.PvmActivity;
  51. import org.activiti.engine.impl.pvm.PvmTransition;
  52. import org.activiti.engine.impl.pvm.process.ActivityImpl;
  53. import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
  54. import org.activiti.engine.impl.pvm.process.TransitionImpl;
  55. import org.activiti.engine.impl.task.TaskDefinition;
  56. import org.activiti.engine.runtime.ProcessInstance;
  57. import org.activiti.engine.task.Task;
  58. import org.apache.commons.lang3.StringUtils;
  59. import org.apache.ibatis.annotations.Param;
  60. import org.apache.shiro.authz.annotation.RequiresPermissions;
  61. import org.springframework.beans.factory.annotation.Autowired;
  62. import org.springframework.stereotype.Controller;
  63. import org.springframework.ui.Model;
  64. import org.springframework.web.bind.annotation.PathVariable;
  65. import org.springframework.web.bind.annotation.RequestMapping;
  66. import org.springframework.web.bind.annotation.ResponseBody;
  67. import com.jeeplus.core.persistence.Page;
  68. import com.jeeplus.core.web.BaseController;
  69. import com.jeeplus.modules.act.entity.Act;
  70. import com.jeeplus.modules.act.service.ActTaskService;
  71. import com.jeeplus.modules.act.utils.ActUtils;
  72. import com.jeeplus.modules.sys.utils.UserUtils;
  73. /**
  74. * 流程个人任务相关Controller
  75. *
  76. * @author jeeplus
  77. * @version 2016-11-03
  78. */
  79. @Controller
  80. @RequestMapping(value = "${adminPath}/act/task")
  81. public class ActTaskController extends BaseController {
  82. @Autowired
  83. private ActTaskService actTaskService;
  84. @Autowired
  85. private HistoryService historyService;
  86. @Autowired
  87. private RuntimeService runtimeService;
  88. @Autowired
  89. private RepositoryService repositoryService;
  90. @Autowired
  91. private TaskService taskService;
  92. @Autowired
  93. private ConstructionService constructionService;
  94. @Autowired
  95. private DiscloseService discloseService;
  96. @Autowired
  97. private UploadImagesService uploadImagesService;
  98. @Autowired
  99. private OaNotifyService oaNotifyService;
  100. @Autowired
  101. private NonPowerService nonPowerService;
  102. @Autowired
  103. private ProjectService projectService;
  104. @Autowired
  105. private ActModelService actModelService;
  106. @Autowired
  107. private PickIngService pickIngService;
  108. @Autowired
  109. private SystemService systemService;
  110. @Autowired
  111. private MaterialModuleService materialModuleService;
  112. @Autowired
  113. private SettActiviService settActiviService;
  114. @Autowired
  115. private MaterialProjectService materialProjectService;
  116. /**
  117. * 获取待办列表
  118. *
  119. * @return
  120. */
  121. @RequestMapping(value = {"todo", ""})
  122. public String todoList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
  123. return "modules/bpm/task/todo/taskTodoList";
  124. }
  125. @ResponseBody
  126. @RequestMapping(value = "todo/data")
  127. public Map<String, Object> todoListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model, String xmName) throws Exception {
  128. Page<HashMap<String, String>> page = actTaskService.todoList(new Page<HashMap<String, String>>(request, response), act);
  129. return getBootstrapData(page);
  130. /* Page<HashMap<String, String>> page = actTaskService.newTodoList(new Page<HashMap<String, String>>(request, response), act, xmName);
  131. Map<String, Object> map = new HashMap<String, Object>();
  132. return getBootstrapData(page);*/
  133. }
  134. /**
  135. * 获取已办任务
  136. *
  137. * @return
  138. */
  139. @RequestMapping(value = "historic")
  140. public String historicList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
  141. return "modules/bpm/task/history/taskHistoricList";
  142. }
  143. @ResponseBody
  144. @RequestMapping(value = "historic/data")
  145. public Map<String, Object> historicListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
  146. Page<HashMap<String, String>> page = actTaskService.historicList(new Page<HashMap<String, String>>(request, response), act);
  147. return getBootstrapData(page);
  148. }
  149. /**
  150. * 获取我的申请列表
  151. *
  152. * @return
  153. */
  154. @RequestMapping(value = "myApplyed")
  155. public String myApplyedList(Act act, HttpServletResponse response, Model model) throws Exception {
  156. return "modules/bpm/task/apply/taskMyAppledList";
  157. }
  158. @ResponseBody
  159. @RequestMapping(value = "myApplyed/data")
  160. public Map<String, Object> myApplyedListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
  161. Page<HashMap> page = actTaskService.getMyStartedProcIns(UserUtils.getUser(), new Page<HashMap>(request, response));
  162. return getBootstrapData(page);
  163. }
  164. /**
  165. * 获取流转历史列表
  166. *
  167. * @param startAct 开始活动节点名称
  168. * @param endAct 结束活动节点名称
  169. */
  170. @RequestMapping(value = "histoicFlow")
  171. public String histoicFlow(Act act, String startAct, String endAct, Model model) {
  172. if (StringUtils.isNotBlank(act.getProcInsId())) {
  173. List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
  174. model.addAttribute("histoicFlowList", histoicFlowList);
  175. }
  176. return "modules/bpm/task/history/taskHistoricFlow";
  177. }
  178. /**
  179. * 获取流程流向图
  180. *
  181. * @param startAct 开始活动节点名称
  182. * @param endAct 结束活动节点名称
  183. */
  184. @RequestMapping(value = "flowChart")
  185. public String flowChart(Act act, String startAct, String endAct, Model model) {
  186. if (StringUtils.isNotBlank(act.getProcInsId())) {
  187. List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
  188. model.addAttribute("histoicFlowList", histoicFlowList);
  189. }
  190. return "modules/bpm/task/chart/taskFlowChart";
  191. }
  192. /**
  193. * 获取流程列表
  194. *
  195. * @param category 流程分类
  196. */
  197. @RequestMapping(value = "process")
  198. public String processList(String category, HttpServletRequest request, HttpServletResponse response, Model model) {
  199. Page<Object[]> page = new Page<Object[]>(request, response);
  200. model.addAttribute("category", category);
  201. return "modules/bpm/task/process/taskProcessList";
  202. }
  203. /**
  204. * 获取流程表单
  205. */
  206. @RequestMapping(value = "form")
  207. public String form(Act act, HttpServletRequest request, Model model) {
  208. // 获取流程XML上的表单KEY
  209. String formKey = actTaskService.getFormKey(act.getProcDefId(), act.getTaskDefKey());
  210. // 获取流程实例对象
  211. if (act.getProcInsId() != null) {
  212. if (actTaskService.getProcIns(act.getProcInsId()) != null) {
  213. try {
  214. act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
  215. } catch (Exception e) {
  216. e.printStackTrace();
  217. }
  218. } else {
  219. act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
  220. }
  221. if (actTaskService.isNextGatewaty(act.getProcInsId())) {
  222. act.setIsNextGatewaty(true);
  223. } else {
  224. act.setIsNextGatewaty(false);
  225. }
  226. }
  227. return "redirect:" + ActUtils.getFormUrl(formKey, act);
  228. }
  229. /**
  230. * 根据流程实例ID,获取当前节点的流程表单详情
  231. */
  232. @RequestMapping(value = "formDetail")
  233. public String formDetail(Act act, HttpServletRequest request, Model model) {
  234. // 获取流程XML上的表单KEY
  235. String taskDefKey = nextTaskDefinition(act.getProcInsId());
  236. String formKey = actTaskService.getFormKey(act.getProcDefId(), taskDefKey);
  237. // 获取流程实例对象
  238. if (act.getProcInsId() != null) {
  239. if (actTaskService.getProcIns(act.getProcInsId()) != null) {
  240. act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
  241. } else {
  242. act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
  243. }
  244. if (actTaskService.isNextGatewaty(act.getProcInsId())) {
  245. act.setIsNextGatewaty(true);
  246. } else {
  247. act.setIsNextGatewaty(false);
  248. }
  249. }
  250. return "redirect:" + ActUtils.getFormUrl(formKey, act);
  251. }
  252. /**
  253. * 启动流程
  254. */
  255. @RequestMapping(value = "start")
  256. @ResponseBody
  257. public String start(Act act, String table, String id, Model model) throws Exception {
  258. actTaskService.startProcess(act.getProcDefKey(), act.getBusinessId(), act.getBusinessTable(), act.getTitle());
  259. return "true";//adminPath + "/act/task";
  260. }
  261. /**
  262. * 签收任务
  263. */
  264. @RequestMapping(value = "claim")
  265. @ResponseBody
  266. public String claim(Act act) {
  267. String userId = UserUtils.getUser().getLoginName();//ObjectUtils.toString(UserUtils.getUser().getId());
  268. actTaskService.claim(act.getTaskId(), userId);
  269. return "true";//adminPath + "/act/task";
  270. }
  271. /**
  272. * 完成任务
  273. * vars.keys=flag,pass
  274. * vars.values=1,true
  275. * vars.types=S,B @see com.jeeplus.jeeplus.modules.act.utils.PropertyType
  276. */
  277. @RequestMapping(value = "complete")
  278. @ResponseBody
  279. public String complete(Act act) {
  280. actTaskService.complete(act.getTaskId(), act.getProcInsId(), act.getComment(), act.getVars().getVariableMap());
  281. return "true";//adminPath + "/act/task";
  282. }
  283. /**
  284. * 读取带跟踪的图片
  285. */
  286. @RequestMapping(value = "trace/photo/{procDefId}/{execId}")
  287. public void tracePhoto(@PathVariable("procDefId") String procDefId, @PathVariable("execId") String execId, HttpServletResponse response) throws Exception {
  288. InputStream imageStream = actTaskService.tracePhoto(procDefId, execId);
  289. // 输出资源内容到相应对象
  290. byte[] b = new byte[1024];
  291. int len;
  292. while ((len = imageStream.read(b, 0, 1024)) != -1) {
  293. response.getOutputStream().write(b, 0, len);
  294. }
  295. }
  296. /**
  297. * 输出跟踪流程信息
  298. *
  299. * @return
  300. * @throws Exception
  301. */
  302. @ResponseBody
  303. @RequestMapping(value = "trace/info/{proInsId}")
  304. public List<Map<String, Object>> traceInfo(@PathVariable("proInsId") String proInsId) throws Exception {
  305. List<Map<String, Object>> activityInfos = actTaskService.traceProcess(proInsId);
  306. return activityInfos;
  307. }
  308. /**
  309. * 显示流程图
  310. @RequestMapping(value = "processPic")
  311. public void processPic(String procDefId, HttpServletResponse response) throws Exception {
  312. ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
  313. String diagramResourceName = procDef.getDiagramResourceName();
  314. InputStream imageStream = repositoryService.getResourceAsStream(procDef.getDeploymentId(), diagramResourceName);
  315. byte[] b = new byte[1024];
  316. int len = -1;
  317. while ((len = imageStream.read(b, 0, 1024)) != -1) {
  318. response.getOutputStream().write(b, 0, len);
  319. }
  320. }*/
  321. /**
  322. * 获取跟踪信息
  323. @RequestMapping(value = "processMap")
  324. public String processMap(String procDefId, String proInstId, Model model)
  325. throws Exception {
  326. List<ActivityImpl> actImpls = new ArrayList<ActivityImpl>();
  327. ProcessDefinition processDefinition = repositoryService
  328. .createProcessDefinitionQuery().processDefinitionId(procDefId)
  329. .singleResult();
  330. ProcessDefinitionImpl pdImpl = (ProcessDefinitionImpl) processDefinition;
  331. String processDefinitionId = pdImpl.getId();// 流程标识
  332. ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
  333. .getDeployedProcessDefinition(processDefinitionId);
  334. List<ActivityImpl> activitiList = def.getActivities();// 获得当前任务的所有节点
  335. List<String> activeActivityIds = runtimeService.getActiveActivityIds(proInstId);
  336. for (String activeId : activeActivityIds) {
  337. for (ActivityImpl activityImpl : activitiList) {
  338. String id = activityImpl.getId();
  339. if (activityImpl.isScope()) {
  340. if (activityImpl.getActivities().size() > 1) {
  341. List<ActivityImpl> subAcList = activityImpl
  342. .getActivities();
  343. for (ActivityImpl subActImpl : subAcList) {
  344. String subid = subActImpl.getId();
  345. System.out.println("subImpl:" + subid);
  346. if (activeId.equals(subid)) {// 获得执行到那个节点
  347. actImpls.add(subActImpl);
  348. break;
  349. }
  350. }
  351. }
  352. }
  353. if (activeId.equals(id)) {// 获得执行到那个节点
  354. actImpls.add(activityImpl);
  355. System.out.println(id);
  356. }
  357. }
  358. }
  359. model.addAttribute("procDefId", procDefId);
  360. model.addAttribute("proInstId", proInstId);
  361. model.addAttribute("actImpls", actImpls);
  362. return "modules/act/actTaskMap";
  363. }*/
  364. /**
  365. * 删除任务
  366. *
  367. * @param taskId 流程实例ID
  368. * @param reason 删除原因
  369. */
  370. @ResponseBody
  371. @RequiresPermissions("act:process:edit")
  372. @RequestMapping(value = "deleteTask")
  373. public AjaxJson deleteTask(String taskId, String reason) {
  374. AjaxJson j = new AjaxJson();
  375. if (StringUtils.isBlank(reason)) {
  376. j.setSuccess(false);
  377. j.setMsg("请填写删除原因");
  378. } else {
  379. actTaskService.deleteTask(taskId, reason);
  380. j.setSuccess(true);
  381. j.setMsg("删除任务成功,任务ID=" + taskId);
  382. }
  383. return j;
  384. }
  385. /**
  386. * 审批
  387. *
  388. * @param act
  389. */
  390. @ResponseBody
  391. @RequestMapping(value = "audit")
  392. public AjaxJson auditTask(Act act) {
  393. AjaxJson j = new AjaxJson();
  394. actTaskService.auditSave(act);
  395. j.setMsg("审批成功");
  396. return j;
  397. }
  398. /**
  399. * 经研所审批
  400. *
  401. * @param act
  402. */
  403. @ResponseBody
  404. @RequestMapping(value = "economics")
  405. public AjaxJson economics(Act act, String pic, UploadImages uploadImages) {
  406. AjaxJson j = new AjaxJson();
  407. try {
  408. if (pic != null && !"".equals(pic)) {
  409. uploadImages.setPath(pic);
  410. // uploadImages.setProcInsId(act.getProcInsId());
  411. uploadImages.setImgName("上传新图纸");
  412. // uploadImages.setuId(UserUtils.getUser().getName());
  413. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  414. // uploadImages.setProjectId(user.getId());
  415. // uploadImagesService.save(uploadImages);
  416. }
  417. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  418. act.setComment(comment);
  419. actTaskService.economics(act);
  420. } catch (UnsupportedEncodingException e) {
  421. e.printStackTrace();
  422. }
  423. j.setMsg("审批成功");
  424. return j;
  425. }
  426. /**
  427. * 人工选择问题类型审批
  428. *
  429. * @param act
  430. */
  431. @ResponseBody
  432. @RequestMapping(value = "artificialTask")
  433. public AjaxJson artificialTask(Act act, Construction construction) {
  434. AjaxJson j = new AjaxJson();
  435. try {
  436. constructionService.updateOIPI(construction);
  437. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  438. act.setComment(comment);
  439. actTaskService.artificialTask(act);
  440. } catch (UnsupportedEncodingException e) {
  441. e.printStackTrace();
  442. }
  443. j.setMsg("审批成功");
  444. return j;
  445. }
  446. /**
  447. * 交底:运行人员审核
  448. */
  449. @ResponseBody
  450. @RequestMapping(value = "humanReview")
  451. public AjaxJson humanReview(Act act) {
  452. AjaxJson j = new AjaxJson();
  453. try {
  454. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  455. act.setComment(comment);
  456. actTaskService.humanReview(act);
  457. } catch (UnsupportedEncodingException e) {
  458. e.printStackTrace();
  459. }
  460. j.setMsg("审批成功");
  461. return j;
  462. }
  463. /**
  464. * 导入材料表和拆旧物资表
  465. */
  466. @ResponseBody
  467. @RequestMapping(value = "importTable")
  468. public AjaxJson importTable(Act act) {
  469. AjaxJson j = new AjaxJson();
  470. try {
  471. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  472. act.setComment(comment);
  473. actTaskService.importTable(act);
  474. } catch (UnsupportedEncodingException e) {
  475. e.printStackTrace();
  476. }
  477. j.setMsg("审批成功");
  478. return j;
  479. }
  480. /**
  481. * 导入工程量
  482. */
  483. @ResponseBody
  484. @RequestMapping(value = "engineering")
  485. public AjaxJson engineering(Act act, Construction construction) {
  486. AjaxJson j = new AjaxJson();
  487. try {
  488. Construction construction1 = constructionService.get(construction);
  489. if (construction1.getQuantity() == null) {
  490. j.setSuccess(false);
  491. j.setMsg("请先导入工程量");
  492. return j;
  493. }
  494. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  495. act.setComment(comment);
  496. actTaskService.engineering(act,construction1);
  497. } catch (UnsupportedEncodingException e) {
  498. e.printStackTrace();
  499. }
  500. j.setMsg("审批成功");
  501. return j;
  502. }
  503. /**
  504. * 政处是否自己进行
  505. */
  506. @ResponseBody
  507. @RequestMapping(value = "ruralOffice")
  508. public AjaxJson ruralOffice(Act act, Construction construction) {
  509. AjaxJson j = new AjaxJson();
  510. try {
  511. constructionService.updateIfSelf(construction);
  512. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  513. act.setComment(comment);
  514. actTaskService.ruralOffice(act);
  515. } catch (UnsupportedEncodingException e) {
  516. e.printStackTrace();
  517. }
  518. j.setMsg("审批成功");
  519. return j;
  520. }
  521. /**
  522. * 农村专职判断
  523. */
  524. @ResponseBody
  525. @RequestMapping(value = "ruralJudge")
  526. public AjaxJson ruralJudge(Act act) {
  527. AjaxJson j = new AjaxJson();
  528. try {
  529. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  530. act.setComment(comment);
  531. actTaskService.ruralJudge(act);
  532. } catch (UnsupportedEncodingException e) {
  533. e.printStackTrace();
  534. }
  535. j.setMsg("审批成功");
  536. return j;
  537. }
  538. /**
  539. * 农村上传文件
  540. */
  541. @ResponseBody
  542. @RequestMapping(value = "ruralFiles")
  543. public AjaxJson ruralFiles(Act act,String path,String path1, String reserveProjectName,Construction construction) {
  544. AjaxJson j = new AjaxJson();
  545. try {
  546. constructionService.updateIfBorrow(construction);
  547. if (path != null && !"".equals(path)) {
  548. UploadImages uploadImages = new UploadImages();
  549. uploadImages.setPath(path);
  550. uploadImages.setUid(UserUtils.getUser().getName());
  551. uploadImages.setImgName("22");
  552. uploadImages.setProcInsId(act.getProcInsId());
  553. uploadImages.setReserveProjectName(reserveProjectName);
  554. constructionService.uploadSave(uploadImages);
  555. }
  556. if (path1 != null && !"".equals(path1)) {
  557. UploadImages uploadImages = new UploadImages();
  558. uploadImages.setPath(path1);
  559. uploadImages.setUid(UserUtils.getUser().getName());
  560. uploadImages.setImgName("23");
  561. uploadImages.setProcInsId(act.getProcInsId());
  562. uploadImages.setReserveProjectName(reserveProjectName);
  563. constructionService.uploadSave(uploadImages);
  564. }
  565. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  566. act.setComment(comment);
  567. actTaskService.ruralFiles(act,construction);
  568. } catch (UnsupportedEncodingException e) {
  569. e.printStackTrace();
  570. }
  571. j.setMsg("审批成功");
  572. return j;
  573. }
  574. /**
  575. * 交底:是否借款
  576. */
  577. @ResponseBody
  578. @RequestMapping(value = "divideForm")
  579. public AjaxJson divideForm(Act act) {
  580. AjaxJson j = new AjaxJson();
  581. try {
  582. act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
  583. actTaskService.divideForm(act);
  584. } catch (UnsupportedEncodingException e) {
  585. e.printStackTrace();
  586. }
  587. j.setMsg("审批成功");
  588. return j;
  589. }
  590. /**
  591. * 交底:是否借款
  592. */
  593. @ResponseBody
  594. @RequestMapping(value = "ruralLoan")
  595. public AjaxJson ruralLoan(Act act) {
  596. AjaxJson j = new AjaxJson();
  597. try {
  598. act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
  599. actTaskService.ruralLoan(act);
  600. } catch (UnsupportedEncodingException e) {
  601. e.printStackTrace();
  602. }
  603. j.setMsg("审批成功");
  604. return j;
  605. }
  606. /**
  607. * 交底:是否支付
  608. */
  609. @ResponseBody
  610. @RequestMapping(value = "ruralPays")
  611. public AjaxJson ruralPays(Act act) {
  612. AjaxJson j = new AjaxJson();
  613. try {
  614. act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
  615. actTaskService.ruralPays(act);
  616. } catch (UnsupportedEncodingException e) {
  617. e.printStackTrace();
  618. }
  619. j.setMsg("审批成功");
  620. return j;
  621. }
  622. /**
  623. * 是否可以政策处理(农场/民事)
  624. *
  625. * @param act
  626. */
  627. @ResponseBody
  628. @RequestMapping(value = "policiesChange")
  629. public AjaxJson policiesChange(Act act) {
  630. AjaxJson j = new AjaxJson();
  631. try {
  632. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  633. act.setComment(comment);
  634. actTaskService.policiesChange(act);
  635. } catch (UnsupportedEncodingException e) {
  636. e.printStackTrace();
  637. }
  638. j.setMsg("审批成功");
  639. return j;
  640. }
  641. /**
  642. * 上传借款单据
  643. *
  644. * @param act
  645. */
  646. @ResponseBody
  647. @RequestMapping(value = "loanUploadList")
  648. public AjaxJson loanUploadList(Act act, String pic, UploadImages uploadImages) {
  649. AjaxJson j = new AjaxJson();
  650. try {
  651. if (pic != null && pic != "") {
  652. uploadImages.setPath(pic);
  653. // uploadImages.setProcInsId(act.getProcInsId());
  654. uploadImages.setImgName("上传借款单据");
  655. // uploadImages.setuId(UserUtils.getUser().getName());
  656. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  657. // uploadImages.setProjectId(user.getId());
  658. uploadImagesService.save(uploadImages);
  659. }
  660. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  661. act.setComment(comment);
  662. actTaskService.loanUploadList(act);
  663. } catch (UnsupportedEncodingException e) {
  664. e.printStackTrace();
  665. }
  666. j.setMsg("审批成功");
  667. return j;
  668. }
  669. /**
  670. * 项目经理重新审核是否可以政策处理(农场/民事)
  671. *
  672. * @param act
  673. */
  674. @ResponseBody
  675. @RequestMapping(value = "managerPolicesChange")
  676. public AjaxJson managerPolicesChange(Act act) {
  677. AjaxJson j = new AjaxJson();
  678. try {
  679. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  680. act.setComment(comment);
  681. actTaskService.managerPolicesChange(act);
  682. } catch (UnsupportedEncodingException e) {
  683. e.printStackTrace();
  684. }
  685. j.setMsg("审批成功");
  686. return j;
  687. }
  688. /**
  689. * 上传未签字版政策处理清单
  690. *
  691. * @param act
  692. */
  693. @ResponseBody
  694. @RequestMapping(value = "notSignUpload")
  695. public AjaxJson notSignUpload(Act act, String pic, UploadImages uploadImages) {
  696. AjaxJson j = new AjaxJson();
  697. try {
  698. if (pic != null && pic != "") {
  699. uploadImages.setPath(pic);
  700. // uploadImages.setProcInsId(act.getProcInsId());
  701. uploadImages.setImgName("2");
  702. // uploadImages.setuId(UserUtils.getUser().getName());
  703. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  704. // uploadImages.setProjectId(user.getId());
  705. uploadImagesService.save(uploadImages);
  706. }
  707. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  708. act.setComment(comment);
  709. actTaskService.notSignUpload(act);
  710. } catch (UnsupportedEncodingException e) {
  711. e.printStackTrace();
  712. }
  713. j.setMsg("审批成功");
  714. return j;
  715. }
  716. /**
  717. * 上传签字版政策处理清单
  718. *
  719. * @param act
  720. */
  721. @ResponseBody
  722. @RequestMapping(value = "signUploadList")
  723. public AjaxJson signUploadList(Act act, String pic, UploadImages uploadImages) {
  724. AjaxJson j = new AjaxJson();
  725. try {
  726. if (pic != null && pic != "") {
  727. uploadImages.setPath(pic);
  728. // uploadImages.setProcInsId(act.getProcInsId());
  729. uploadImages.setImgName("3");
  730. // uploadImages.setuId(UserUtils.getUser().getName());
  731. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  732. // uploadImages.setProjectId(user.getId());
  733. uploadImagesService.save(uploadImages);
  734. }
  735. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  736. act.setComment(comment);
  737. actTaskService.signUploadList(act);
  738. } catch (UnsupportedEncodingException e) {
  739. e.printStackTrace();
  740. }
  741. j.setMsg("审批成功");
  742. return j;
  743. }
  744. /**
  745. * 上传签字版合同
  746. *
  747. * @param act
  748. */
  749. @ResponseBody
  750. @RequestMapping(value = "contractUploadList")
  751. public AjaxJson contractUploadList(Act act, String pic, UploadImages uploadImages) {
  752. AjaxJson j = new AjaxJson();
  753. try {
  754. if (pic != null && pic != "") {
  755. uploadImages.setPath(pic);
  756. // uploadImages.setProcInsId(act.getProcInsId());
  757. uploadImages.setImgName("4");
  758. // uploadImages.setuId(UserUtils.getUser().getName());
  759. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  760. // uploadImages.setProjectId(user.getId());
  761. uploadImagesService.save(uploadImages);
  762. }
  763. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  764. act.setComment(comment);
  765. actTaskService.contractUploadList(act);
  766. } catch (UnsupportedEncodingException e) {
  767. e.printStackTrace();
  768. }
  769. j.setMsg("审批成功");
  770. return j;
  771. }
  772. /**
  773. * 运行单位经理判定设计变更
  774. */
  775. @ResponseBody
  776. @RequestMapping(value = "operator")
  777. public AjaxJson operator(Act act) {
  778. AjaxJson j = new AjaxJson();
  779. try {
  780. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  781. act.setComment(comment);
  782. actTaskService.operator(act);
  783. } catch (UnsupportedEncodingException e) {
  784. e.printStackTrace();
  785. }
  786. j.setMsg("审批成功");
  787. return j;
  788. }
  789. /**
  790. * 项目经理判断是否需要设计变更
  791. *
  792. * @param act
  793. */
  794. @ResponseBody
  795. @RequestMapping(value = "managerDesign")
  796. public AjaxJson managerDesign(Act act) {
  797. AjaxJson j = new AjaxJson();
  798. try {
  799. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  800. act.setComment(comment);
  801. actTaskService.managerDesign(act);
  802. } catch (UnsupportedEncodingException e) {
  803. e.printStackTrace();
  804. }
  805. j.setMsg("审批成功");
  806. return j;
  807. }
  808. /**
  809. * 运行单位经理审核方案
  810. */
  811. @ResponseBody
  812. @RequestMapping(value = "designUpload")
  813. public AjaxJson designUpload(Act act) {
  814. AjaxJson j = new AjaxJson();
  815. try {
  816. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  817. act.setComment(comment);
  818. actTaskService.designUpload(act);
  819. } catch (UnsupportedEncodingException e) {
  820. e.printStackTrace();
  821. }
  822. j.setMsg("审批成功");
  823. return j;
  824. }
  825. /**
  826. * 设计单位人员重新设计
  827. */
  828. @ResponseBody
  829. @RequestMapping(value = "operatorUpload")
  830. public AjaxJson operatorUpload(Act act, String path, String reserveProjectName) {
  831. AjaxJson j = new AjaxJson();
  832. try {
  833. if (path != null && !"".equals(path)) {
  834. UploadImages uploadImages = new UploadImages();
  835. uploadImages.setPath(path);
  836. uploadImages.setUid(UserUtils.getUser().getName());
  837. uploadImages.setImgName("1");
  838. uploadImages.setProcInsId(act.getProcInsId());
  839. uploadImages.setReserveProjectName(reserveProjectName);
  840. constructionService.uploadSave(uploadImages);
  841. }
  842. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  843. act.setComment(comment);
  844. actTaskService.operatorUpload(act);
  845. } catch (UnsupportedEncodingException e) {
  846. e.printStackTrace();
  847. }
  848. j.setMsg("审批成功");
  849. return j;
  850. }
  851. /**
  852. * 运行经理审核设计变更后
  853. */
  854. @ResponseBody
  855. @RequestMapping(value = "managerUpload")
  856. public AjaxJson managerUpload(Act act) {
  857. AjaxJson j = new AjaxJson();
  858. try {
  859. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  860. act.setComment(comment);
  861. actTaskService.managerUpload(act);
  862. } catch (UnsupportedEncodingException e) {
  863. e.printStackTrace();
  864. }
  865. j.setMsg("审批成功");
  866. return j;
  867. }
  868. /**
  869. * 配网经理审核设计变更后
  870. */
  871. @ResponseBody
  872. @RequestMapping(value = "afterDistribution")
  873. public AjaxJson afterDistribution(Act act) {
  874. AjaxJson j = new AjaxJson();
  875. try {
  876. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  877. act.setComment(comment);
  878. actTaskService.afterDistribution(act);
  879. } catch (UnsupportedEncodingException e) {
  880. e.printStackTrace();
  881. }
  882. j.setMsg("审批成功");
  883. return j;
  884. }
  885. /**
  886. * 施工单位判断变更后材料
  887. *
  888. * @param act
  889. */
  890. @ResponseBody
  891. @RequestMapping(value = "conAfterChange")
  892. public AjaxJson conAfterChange(Act act) {
  893. AjaxJson j = new AjaxJson();
  894. try {
  895. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  896. act.setComment(comment);
  897. actTaskService.conAfterChange(act);
  898. } catch (UnsupportedEncodingException e) {
  899. e.printStackTrace();
  900. }
  901. j.setMsg("审批成功");
  902. return j;
  903. }
  904. /**
  905. * 施工审批
  906. */
  907. @ResponseBody
  908. @RequestMapping(value = "audit2")
  909. public AjaxJson auditTask2(Act act, Construction construction) {
  910. AjaxJson j = new AjaxJson();
  911. try {
  912. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  913. act.setComment(comment);
  914. if ("no".equals(act.getFlag())) {
  915. int byProcInsId = discloseService.findByProcInsId(act.getProcInsId());
  916. if (byProcInsId <= 0) {
  917. construction.preInsert();
  918. discloseService.insertDiscloseRole(construction);
  919. } else {
  920. discloseService.updateDiscloseByProcInsId(construction);
  921. }
  922. }
  923. actTaskService.auditSave2(act);
  924. } catch (UnsupportedEncodingException e) {
  925. e.printStackTrace();
  926. }
  927. j.setMsg("审批成功");
  928. return j;
  929. }
  930. /**
  931. * 项目经理组织交底
  932. *
  933. * @param
  934. */
  935. @ResponseBody
  936. @RequestMapping(value = "audit3")
  937. public AjaxJson auditTask3(Act act) {
  938. AjaxJson j = new AjaxJson();
  939. String s = "";
  940. // MyNeedList 项目经理组织交底 = MyActiviUtils.findActivity("项目经理组织交底");
  941. boolean flag = false;
  942. Disclose dc = new Disclose();
  943. /* dc.setProcInsId(act.getProcInsId());
  944. Disclose disclose = discloseService.get(dc);
  945. if (null == disclose) {
  946. j.setSuccess(false);
  947. j.setMsg("请导入数据");
  948. return j;
  949. }
  950. Boolean flagDesign = actTaskService.isJudgeDesign(disclose);//设计变更
  951. Boolean flagItemCLose = actTaskService.isJudgeItemClose(disclose);//项目关闭
  952. String flagDeal = actTaskService.newJudgeDeal(disclose);
  953. if (null == disclose.getPrecondition() || "".equals(disclose.getPrecondition())) {
  954. if (flagItemCLose) {
  955. if (null == disclose.getExplanationOfNecessity() || disclose.getExplanationOfNecessity().equals("")) {
  956. s = "必要性问题说明不能为空!";
  957. flag = true;
  958. }
  959. }
  960. if (flagDesign) {
  961. if (null == disclose.getInconsistentDescription() || disclose.getInconsistentDescription().equals("")) {
  962. s += "图纸现场不一致说明不能为空!";
  963. flag = true;
  964. }
  965. }
  966. if ("民事农村".equals(flagDeal) || "行政".equals(flagDeal)) {
  967. String policyHandlingInstructions = disclose.getPolicyHandlingInstructions();
  968. if (policyHandlingInstructions == null || "".equals(policyHandlingInstructions)) {
  969. s += "政策处理说明不能为空";
  970. flag = true;
  971. }
  972. }
  973. if (null == disclose.getPolicyHandlingInstructions() || disclose.getPolicyHandlingInstructions().equals("")) {
  974. s += " 政策处理说明不能为空!";
  975. flag = true;
  976. }
  977. if (flag) {
  978. j.setSuccess(false);
  979. j.setMsg(s);
  980. return j;
  981. }
  982. }
  983. try {
  984. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  985. act.setComment(comment);
  986. actTaskService.auditSave3(act, disclose, flagDesign, flagItemCLose, flagDeal);
  987. } catch (UnsupportedEncodingException e) {
  988. e.printStackTrace();
  989. }*/
  990. j.setMsg("审批成功");
  991. return j;
  992. }
  993. /*
  994. 交底:判断项目是否需要关闭
  995. */
  996. @ResponseBody
  997. @RequestMapping(value = "speciallyTask")
  998. public AjaxJson speciallyTask(Act act, String tuser, Construction construction) {
  999. AjaxJson j = new AjaxJson();
  1000. try {
  1001. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1002. act.setComment(comment);
  1003. actTaskService.specially(act);
  1004. } catch (UnsupportedEncodingException e) {
  1005. e.printStackTrace();
  1006. }
  1007. if ("yes".equals(act.getFlag())) {
  1008. j.setMsg("审批成功");
  1009. } else {
  1010. j.setMsg("驳回成功");
  1011. }
  1012. return j;
  1013. }
  1014. /*
  1015. 项目关闭:项目经理
  1016. */
  1017. @ResponseBody
  1018. @RequestMapping(value = "managerFormTask")
  1019. public AjaxJson managerFormTask(Act act, String fullName, String tuser, Construction construction) {
  1020. AjaxJson j = new AjaxJson();
  1021. try {
  1022. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1023. act.setComment(comment);
  1024. actTaskService.managerFormTask(act, fullName);
  1025. } catch (UnsupportedEncodingException e) {
  1026. e.printStackTrace();
  1027. }
  1028. if ("yes".equals(act.getFlag())) {
  1029. j.setMsg("审批成功");
  1030. } else {
  1031. j.setMsg("驳回成功");
  1032. }
  1033. return j;
  1034. }
  1035. /*
  1036. 项目关闭:运行人员
  1037. */
  1038. @ResponseBody
  1039. @RequestMapping(value = "memberTask")
  1040. public AjaxJson memberTask(Act act, String fullTime, String tuser, Construction construction) {
  1041. AjaxJson j = new AjaxJson();
  1042. try {
  1043. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1044. act.setComment(comment);
  1045. actTaskService.addMember(act, fullTime);
  1046. } catch (UnsupportedEncodingException e) {
  1047. e.printStackTrace();
  1048. }
  1049. if ("yes".equals(act.getFlag())) {
  1050. j.setMsg("审批成功");
  1051. } else {
  1052. j.setMsg("驳回成功");
  1053. }
  1054. return j;
  1055. }
  1056. /*
  1057. 项目关闭:系统专职
  1058. */
  1059. @ResponseBody
  1060. @RequestMapping(value = "departmentTask")
  1061. public AjaxJson departmentTask(Act act, String tuser, Construction construction) {
  1062. AjaxJson j = new AjaxJson();
  1063. try {
  1064. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1065. act.setComment(comment);
  1066. actTaskService.addDepartment(act);
  1067. // projectService.updateStatusBy("0", act.getProcInsId());
  1068. // projectService.updateStatusByClose("1", act.getProcInsId());
  1069. } catch (UnsupportedEncodingException e) {
  1070. e.printStackTrace();
  1071. }
  1072. // Project user = MyActiviUtils.findUser(act.getProcInsId());
  1073. // User user1 = UserUtils.getByUserName(user.getProjectManageRole());
  1074. OaNotify oaNotify = new OaNotify();
  1075. oaNotify.setType("4");
  1076. oaNotify.setTitle("施工交底结束(项目关闭)");
  1077. oaNotify.setContent("项目为:[" + construction.getProjectName() + "]的项目已经施工交底完成");
  1078. oaNotify.setStatus("1");
  1079. // oaNotify.setOaNotifyRecordIds(user1.getId());
  1080. oaNotifyService.save(oaNotify);
  1081. List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
  1082. for (OaNotifyRecord o : list) {
  1083. //发送通知到客户端
  1084. ServletContext context = SpringContextHolder
  1085. .getBean(ServletContext.class);
  1086. new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
  1087. }
  1088. // j.setMsg("审批成功;已经通知" + user.getProjectManageRole());
  1089. return j;
  1090. }
  1091. @ResponseBody
  1092. @RequestMapping(value = "policiesDealTask")
  1093. public AjaxJson policiesDealTask(Act act, String fullName, String tuser, Construction construction) {
  1094. AjaxJson j = new AjaxJson();
  1095. try {
  1096. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1097. act.setComment(comment);
  1098. actTaskService.policiesDeal(act, fullName);
  1099. } catch (UnsupportedEncodingException e) {
  1100. e.printStackTrace();
  1101. }
  1102. if ("yes".equals(act.getFlag())) {
  1103. j.setMsg("审批成功");
  1104. } else {
  1105. j.setMsg("驳回成功");
  1106. }
  1107. return j;
  1108. }
  1109. /***
  1110. * 项目经理判定是否关闭
  1111. * */
  1112. @ResponseBody
  1113. @RequestMapping(value = "coveredForm")
  1114. public AjaxJson coveredForm(Act act) {
  1115. AjaxJson j = new AjaxJson();
  1116. try {
  1117. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1118. act.setComment(comment);
  1119. actTaskService.coveredForm(act);
  1120. } catch (UnsupportedEncodingException e) {
  1121. e.printStackTrace();
  1122. }
  1123. j.setMsg("审批成功");
  1124. return j;
  1125. }
  1126. /**
  1127. * 配网工程专职判定是否关闭
  1128. */
  1129. @ResponseBody
  1130. @RequestMapping(value = "sealForm")
  1131. public AjaxJson sealForm(Act act) {
  1132. AjaxJson j = new AjaxJson();
  1133. try {
  1134. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1135. act.setComment(comment);
  1136. actTaskService.sealForm(act);
  1137. } catch (UnsupportedEncodingException e) {
  1138. e.printStackTrace();
  1139. }
  1140. j.setMsg("审批成功");
  1141. return j;
  1142. }
  1143. @ResponseBody
  1144. @RequestMapping(value = "phaseManagerTask")
  1145. public AjaxJson phaseManagerTask(Act act, String fullName) {
  1146. AjaxJson j = new AjaxJson();
  1147. try {
  1148. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1149. act.setComment(comment);
  1150. actTaskService.phaseManager(act, fullName);
  1151. } catch (UnsupportedEncodingException e) {
  1152. e.printStackTrace();
  1153. }
  1154. if ("yes".equals(act.getFlag())) {
  1155. j.setMsg("审批成功");
  1156. } else {
  1157. j.setMsg("驳回成功");
  1158. }
  1159. return j;
  1160. }
  1161. /*
  1162. 政策处理:配网政策处理专职 : 上传收据
  1163. */
  1164. @ResponseBody
  1165. @RequestMapping(value = "receiptForm")
  1166. public AjaxJson receiptForm(Act act) {
  1167. AjaxJson j = new AjaxJson();
  1168. try {
  1169. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1170. act.setComment(comment);
  1171. actTaskService.receiptForm(act);
  1172. } catch (UnsupportedEncodingException e) {
  1173. e.printStackTrace();
  1174. }
  1175. if ("yes".equals(act.getFlag())) {
  1176. j.setMsg("审批成功");
  1177. } else {
  1178. j.setMsg("驳回成功");
  1179. }
  1180. return j;
  1181. }
  1182. /**
  1183. * 配网工程专职判定变更或关闭
  1184. * */
  1185. @ResponseBody
  1186. @RequestMapping(value = "singleForm")
  1187. public AjaxJson singleForm(Act act) {
  1188. AjaxJson j = new AjaxJson();
  1189. try {
  1190. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1191. act.setComment(comment);
  1192. actTaskService.singleForm(act);
  1193. } catch (UnsupportedEncodingException e) {
  1194. e.printStackTrace();
  1195. }
  1196. j.setMsg("审批成功");
  1197. return j;
  1198. }
  1199. /**
  1200. * 配网项目经理判定变更或关闭
  1201. * */
  1202. @ResponseBody
  1203. @RequestMapping(value = "documentsForm")
  1204. public AjaxJson documentsForm(Act act) {
  1205. AjaxJson j = new AjaxJson();
  1206. try {
  1207. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1208. act.setComment(comment);
  1209. actTaskService.documentsForm(act);
  1210. } catch (UnsupportedEncodingException e) {
  1211. e.printStackTrace();
  1212. }
  1213. j.setMsg("审批成功");
  1214. return j;
  1215. }
  1216. /**
  1217. * 配网系统专职确认系统关闭
  1218. * */
  1219. @ResponseBody
  1220. @RequestMapping(value = "confirmClose")
  1221. public AjaxJson confirmClose(Act act) {
  1222. AjaxJson j = new AjaxJson();
  1223. try {
  1224. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1225. act.setComment(comment);
  1226. actTaskService.confirmClose(act);
  1227. } catch (UnsupportedEncodingException e) {
  1228. e.printStackTrace();
  1229. }
  1230. j.setMsg("审批成功");
  1231. return j;
  1232. }
  1233. /**
  1234. * 施工交底审批
  1235. *
  1236. * @param act
  1237. */
  1238. @ResponseBody
  1239. @RequestMapping(value = "newAudit")
  1240. public AjaxJson newAuditTask(Act act, String tuser, Construction construction) {
  1241. AjaxJson j = new AjaxJson();
  1242. try {
  1243. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1244. act.setComment(comment);
  1245. actTaskService.newAuditSave(act, tuser, construction);
  1246. } catch (UnsupportedEncodingException e) {
  1247. e.printStackTrace();
  1248. }
  1249. j.setMsg("审批成功");
  1250. return j;
  1251. }
  1252. /**
  1253. * 取回流程
  1254. *
  1255. * @param taskId
  1256. */
  1257. @ResponseBody
  1258. @RequestMapping(value = "callback")
  1259. public AjaxJson callback(@Param("taskId") String taskId) {
  1260. AjaxJson j = new AjaxJson();
  1261. try {
  1262. Map<String, Object> variables;
  1263. // 取得当前任务
  1264. HistoricTaskInstance currTask = historyService
  1265. .createHistoricTaskInstanceQuery().taskId(taskId)
  1266. .singleResult();
  1267. // 取得流程实例
  1268. ProcessInstance instance = runtimeService
  1269. .createProcessInstanceQuery()
  1270. .processInstanceId(currTask.getProcessInstanceId())
  1271. .singleResult();
  1272. if (instance == null) {
  1273. j.setSuccess(false);
  1274. j.setMsg("流程已经结束");
  1275. return j;
  1276. }
  1277. variables = instance.getProcessVariables();
  1278. // 取得流程定义
  1279. ProcessDefinitionEntity definition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
  1280. .getDeployedProcessDefinition(currTask
  1281. .getProcessDefinitionId());
  1282. if (definition == null) {
  1283. j.setSuccess(false);
  1284. j.setMsg("流程定义未找到");
  1285. return j;
  1286. }
  1287. // 取得下一步活动
  1288. ActivityImpl currActivity = ((ProcessDefinitionImpl) definition)
  1289. .findActivity(currTask.getTaskDefinitionKey());
  1290. List<PvmTransition> nextTransitionList = currActivity
  1291. .getOutgoingTransitions();
  1292. for (PvmTransition nextTransition : nextTransitionList) {
  1293. PvmActivity nextActivity = nextTransition.getDestination();
  1294. List<HistoricTaskInstance> completeTasks = historyService
  1295. .createHistoricTaskInstanceQuery()
  1296. .processInstanceId(instance.getId())
  1297. .taskDefinitionKey(nextActivity.getId()).finished()
  1298. .list();
  1299. int finished = completeTasks.size();
  1300. if (finished > 0) {
  1301. j.setSuccess(false);
  1302. j.setMsg("存在已经完成的下一步,流程不能取回");
  1303. return j;
  1304. }
  1305. List<Task> nextTasks = taskService.createTaskQuery().processInstanceId(instance.getId())
  1306. .taskDefinitionKey(nextActivity.getId()).list();
  1307. for (Task nextTask : nextTasks) {
  1308. //取活动,清除活动方向
  1309. List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
  1310. List<PvmTransition> pvmTransitionList = nextActivity
  1311. .getOutgoingTransitions();
  1312. for (PvmTransition pvmTransition : pvmTransitionList) {
  1313. oriPvmTransitionList.add(pvmTransition);
  1314. }
  1315. pvmTransitionList.clear();
  1316. //建立新方向
  1317. ActivityImpl nextActivityImpl = ((ProcessDefinitionImpl) definition)
  1318. .findActivity(nextTask.getTaskDefinitionKey());
  1319. TransitionImpl newTransition = nextActivityImpl
  1320. .createOutgoingTransition();
  1321. newTransition.setDestination(currActivity);
  1322. //完成任务
  1323. taskService.complete(nextTask.getId(), variables);
  1324. historyService.deleteHistoricTaskInstance(nextTask.getId());
  1325. //恢复方向
  1326. currActivity.getIncomingTransitions().remove(newTransition);
  1327. List<PvmTransition> pvmTList = nextActivity
  1328. .getOutgoingTransitions();
  1329. pvmTList.clear();
  1330. for (PvmTransition pvmTransition : oriPvmTransitionList) {
  1331. pvmTransitionList.add(pvmTransition);
  1332. }
  1333. }
  1334. }
  1335. historyService.deleteHistoricTaskInstance(currTask.getId());
  1336. j.setSuccess(true);
  1337. j.setMsg("取回成功");
  1338. return j;
  1339. } catch (Exception e) {
  1340. j.setSuccess(false);
  1341. j.setMsg("流程取回失败,未知错误.");
  1342. return j;
  1343. }
  1344. }
  1345. /**
  1346. * 根据实例编号查找下一个任务节点
  1347. *
  1348. * @param procInstId :实例编号
  1349. * @return
  1350. */
  1351. public String nextTaskDefinition(String procInstId) {
  1352. //流程标示
  1353. String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInstId).singleResult().getProcessDefinitionId();
  1354. ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
  1355. //执行实例
  1356. ExecutionEntity execution = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
  1357. //当前实例的执行到哪个节点
  1358. if (execution == null) {
  1359. TaskDefinition[] taskDefinitions = {};
  1360. taskDefinitions = def.getTaskDefinitions().values().toArray(taskDefinitions);
  1361. return taskDefinitions[taskDefinitions.length - 1].getKey();
  1362. } else {
  1363. return execution.getActivityId();
  1364. }
  1365. }
  1366. @ResponseBody
  1367. @RequestMapping(value = "pickIng")
  1368. public AjaxJson pickIng(Act act, String selectNumber) {
  1369. AjaxJson j = new AjaxJson();
  1370. try {
  1371. pickIngService.updateSelectNumber(selectNumber, act.getProcInsId());
  1372. List<ShowList> showLists = MyActiviUtils.finaList(selectNumber);
  1373. for (ShowList a : showLists) {
  1374. a.preInsert();
  1375. a.setProcInsId(act.getProcInsId());
  1376. }
  1377. pickIngService.delAllTem();
  1378. pickIngService.processTemList(showLists);
  1379. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1380. act.setComment(comment);
  1381. actTaskService.pickIng(act);
  1382. } catch (UnsupportedEncodingException e) {
  1383. e.printStackTrace();
  1384. }
  1385. j.setMsg("审批成功");
  1386. return j;
  1387. }
  1388. //开具设计清单
  1389. @ResponseBody
  1390. @RequestMapping(value = "materialReport")
  1391. public AjaxJson materialReport(Act act, String selectNumber,String reserveName) {
  1392. AjaxJson j = new AjaxJson();
  1393. try {
  1394. if (null!=reserveName&&reserveName!=""){
  1395. MaterialProject materialProject = new MaterialProject();
  1396. materialProject.setReserveProjectName(reserveName);
  1397. List<MaterialProject> list = materialProjectService.findJugdeReserve(materialProject);
  1398. if (list.size() > 0){
  1399. j.setMsg("项目名称已存在");
  1400. j.setSuccess(false);
  1401. return j;
  1402. }
  1403. }
  1404. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1405. act.setComment(comment);
  1406. actTaskService.materialReport(act,selectNumber,reserveName);
  1407. } catch (UnsupportedEncodingException e) {
  1408. e.printStackTrace();
  1409. }
  1410. j.setMsg("审批成功");
  1411. return j;
  1412. }
  1413. //审核材料清单
  1414. @ResponseBody
  1415. @RequestMapping(value = "materialReportBillOff")
  1416. public AjaxJson materialReportBillOff(Act act, String selectNumber,String reserveName) {
  1417. AjaxJson j = new AjaxJson();
  1418. try {
  1419. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1420. act.setComment(comment);
  1421. Boolean aBoolean = actTaskService.materialReportBillOff(act);
  1422. if (aBoolean){
  1423. j.setSuccess(false);
  1424. j.setMsg("项目名称已存在,请联系流程发起人");
  1425. return j;
  1426. }
  1427. } catch (UnsupportedEncodingException e) {
  1428. e.printStackTrace();
  1429. }
  1430. j.setMsg("审批成功");
  1431. return j;
  1432. }
  1433. /**
  1434. * 审批
  1435. *
  1436. * @param act
  1437. */
  1438. @ResponseBody
  1439. @RequestMapping(value = "constructionLeader")
  1440. public AjaxJson constructionLeader(Act act) {
  1441. AjaxJson j = new AjaxJson();
  1442. actTaskService.constructionLeader(act);
  1443. j.setMsg("审批成功");
  1444. return j;
  1445. }
  1446. /**
  1447. * 施工单位物资专职审核
  1448. *
  1449. * @param act
  1450. */
  1451. @ResponseBody
  1452. @RequestMapping(value = "fullExamine")
  1453. public AjaxJson fullExamine(Act act) {
  1454. AjaxJson j = new AjaxJson();
  1455. actTaskService.fullExamine(act);
  1456. j.setMsg("审批成功");
  1457. return j;
  1458. }
  1459. @ResponseBody
  1460. @RequestMapping(value = "managerExam")
  1461. public AjaxJson managerExam(Act act) {
  1462. AjaxJson j = new AjaxJson();
  1463. actTaskService.managerExam(act);
  1464. j.setMsg("审批成功");
  1465. return j;
  1466. }
  1467. /**
  1468. * 项目中心领导审核领料单
  1469. *
  1470. * @param act
  1471. */
  1472. @ResponseBody
  1473. @RequestMapping(value = "leaderExamine")
  1474. public AjaxJson leaderExamine(Act act) {
  1475. AjaxJson j = new AjaxJson();
  1476. actTaskService.leaderExamine(act);
  1477. j.setMsg("审批成功");
  1478. return j;
  1479. }
  1480. /**
  1481. * 项目中心领导审核领料单
  1482. *
  1483. * @param act
  1484. */
  1485. @ResponseBody
  1486. @RequestMapping(value = "leaderExamine1")
  1487. public AjaxJson leaderExamine1(Act act) {
  1488. AjaxJson j = new AjaxJson();
  1489. actTaskService.leaderExamine(act);
  1490. j.setMsg("审批成功");
  1491. return j;
  1492. }
  1493. /**
  1494. * 配网项目经理审核领料单
  1495. *
  1496. * @param act
  1497. */
  1498. @ResponseBody
  1499. @RequestMapping(value = "managerAudit")
  1500. public AjaxJson managerAudit(Act act) {
  1501. AjaxJson j = new AjaxJson();
  1502. actTaskService.managerAudit(act);
  1503. j.setMsg("审批成功");
  1504. return j;
  1505. }
  1506. /**
  1507. * 配网物资专职审核领料单
  1508. *
  1509. * @param act
  1510. */
  1511. @ResponseBody
  1512. @RequestMapping(value = "netExamine")
  1513. public AjaxJson netExamine(Act act) {
  1514. AjaxJson j = new AjaxJson();
  1515. actTaskService.netExamine(act);
  1516. j.setMsg("审批成功");
  1517. return j;
  1518. }
  1519. /**
  1520. * 结算填写现场使用量
  1521. */
  1522. @ResponseBody
  1523. @RequestMapping(value = "useQuantityTask")
  1524. public AjaxJson useQuantityTask(Act act) {
  1525. AjaxJson j = new AjaxJson();
  1526. actTaskService.useQuantity(act);
  1527. j.setMsg("审批成功");
  1528. return j;
  1529. }
  1530. /**
  1531. * 复合数量修改
  1532. */
  1533. @ResponseBody
  1534. @RequestMapping(value = "reviewQuantityTask")
  1535. public AjaxJson reviewQuantityTask(Act act, String pic, UploadImages uploadImages) {
  1536. AjaxJson j = new AjaxJson();
  1537. if (pic != null && pic != "") {
  1538. uploadImages.setPath(pic);
  1539. // uploadImages.setProcInsId(act.getProcInsId());
  1540. uploadImages.setImgName("21");
  1541. // uploadImages.setuId(UserUtils.getUser().getName());
  1542. // Project user = MyActiviUtils.findJSUser(act.getProcInsId());
  1543. // uploadImages.setProjectId(user.getId());
  1544. uploadImagesService.save(uploadImages);
  1545. }
  1546. actTaskService.reviewQuantity(act);
  1547. j.setMsg("审批成功");
  1548. return j;
  1549. }
  1550. /**
  1551. * 结束流程,完成结算
  1552. */
  1553. @ResponseBody
  1554. @RequestMapping(value = "returnDocTask")
  1555. public AjaxJson returnDocTask(Act act) {
  1556. AjaxJson j = new AjaxJson();
  1557. settActiviService.finSetStatus(act.getProcInsId());
  1558. actTaskService.returnDoc(act);
  1559. j.setMsg("审批成功");
  1560. return j;
  1561. }
  1562. /**
  1563. * 经研所判定是否设计变更
  1564. */
  1565. @ResponseBody
  1566. @RequestMapping(value = "auditDrawings")
  1567. public AjaxJson auditDrawings(Act act, String path, String reserveProjectName) {
  1568. AjaxJson j = new AjaxJson();
  1569. try {
  1570. if (path != null && !"".equals(path)) {
  1571. UploadImages uploadImages = new UploadImages();
  1572. uploadImages.setPath(path);
  1573. uploadImages.setUid(UserUtils.getUser().getName());
  1574. uploadImages.setImgName("1");
  1575. uploadImages.setProcInsId(act.getProcInsId());
  1576. uploadImages.setReserveProjectName(reserveProjectName);
  1577. constructionService.uploadSave(uploadImages);
  1578. }
  1579. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1580. act.setComment(comment);
  1581. actTaskService.auditDrawings(act);
  1582. } catch (UnsupportedEncodingException e) {
  1583. e.printStackTrace();
  1584. }
  1585. j.setMsg("审批成功");
  1586. return j;
  1587. }
  1588. /**
  1589. * 项目经理审核流程提前领料是否通过
  1590. */
  1591. @ResponseBody
  1592. @RequestMapping(value = "applicationAudit")
  1593. public AjaxJson applicationAudit(Act act) {
  1594. AjaxJson j = new AjaxJson();
  1595. try {
  1596. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1597. act.setComment(comment);
  1598. actTaskService.applicationAudit(act);
  1599. } catch (UnsupportedEncodingException e) {
  1600. e.printStackTrace();
  1601. }
  1602. j.setMsg("审批成功");
  1603. return j;
  1604. }
  1605. /**
  1606. * 项目经理审核流程提前施工
  1607. */
  1608. @ResponseBody
  1609. @RequestMapping(value = "contructionManager")
  1610. public AjaxJson contructionManager(Act act) {
  1611. AjaxJson j = new AjaxJson();
  1612. try {
  1613. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1614. act.setComment(comment);
  1615. actTaskService.contructionManager(act);
  1616. } catch (UnsupportedEncodingException e) {
  1617. e.printStackTrace();
  1618. }
  1619. j.setMsg("审批成功");
  1620. return j;
  1621. }
  1622. /**
  1623. * 施工单位项目经理土建开工报告填写
  1624. */
  1625. @ResponseBody
  1626. @RequestMapping(value = "nonPowerStartTask")
  1627. public AjaxJson nonPowerStartTask(Act act, NonPower nonPower) {
  1628. AjaxJson j = new AjaxJson();
  1629. try {
  1630. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1631. act.setComment(comment);
  1632. //修改土建开工报告信息
  1633. act = nonPower.getAct();
  1634. nonPowerService.updateStart(nonPower);
  1635. actTaskService.nonPowerStartTask(act);
  1636. } catch (UnsupportedEncodingException e) {
  1637. e.printStackTrace();
  1638. }
  1639. j.setMsg("审批成功");
  1640. return j;
  1641. }
  1642. /**
  1643. * 施工单位项目经理电气开工流程提交文件
  1644. */
  1645. @ResponseBody
  1646. @RequestMapping(value = "electricalStartTask")
  1647. public AjaxJson electricalStartTask(Act act, String pic, UploadImages uploadImages) {
  1648. AjaxJson j = new AjaxJson();
  1649. try {
  1650. if (pic != null && pic != "") {
  1651. uploadImages.setPath(pic);
  1652. // uploadImages.setProcInsId(act.getProcInsId());
  1653. uploadImages.setImgName("14");
  1654. // uploadImages.setuId(UserUtils.getUser().getName());
  1655. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1656. // uploadImages.setProjectId(user.getId());
  1657. uploadImagesService.save(uploadImages);
  1658. }
  1659. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1660. act.setComment(comment);
  1661. actTaskService.electricalStartTask(act);
  1662. } catch (UnsupportedEncodingException e) {
  1663. e.printStackTrace();
  1664. }
  1665. j.setMsg("审批成功");
  1666. return j;
  1667. }
  1668. /**
  1669. * 施工单位项目经理土建施工中流程提交文件
  1670. */
  1671. @ResponseBody
  1672. @RequestMapping(value = "nonPowerMiddleTask")
  1673. public AjaxJson nonPowerMiddleTask(Act act, String pic, UploadImages uploadImages) {
  1674. AjaxJson j = new AjaxJson();
  1675. try {
  1676. if (pic != null && pic != "") {
  1677. uploadImages.setPath(pic);
  1678. // uploadImages.setProcInsId(act.getProcInsId());
  1679. uploadImages.setImgName("12");
  1680. // uploadImages.setuId(UserUtils.getUser().getName());
  1681. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1682. // uploadImages.setProjectId(user.getId());
  1683. uploadImagesService.save(uploadImages);
  1684. }
  1685. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1686. act.setComment(comment);
  1687. actTaskService.nonPowerMiddleTask(act);
  1688. } catch (UnsupportedEncodingException e) {
  1689. e.printStackTrace();
  1690. }
  1691. j.setMsg("审批成功");
  1692. return j;
  1693. }
  1694. /**
  1695. * 施工单位项目经理电气施工中流程提交文件
  1696. */
  1697. @ResponseBody
  1698. @RequestMapping(value = "electricalMiddleTask")
  1699. public AjaxJson electricalMiddleTask(Act act, String pic, UploadImages uploadImages) {
  1700. AjaxJson j = new AjaxJson();
  1701. try {
  1702. if (pic != null && pic != "") {
  1703. uploadImages.setPath(pic);
  1704. // Project project1 = MyActiviUtils.sgFindUser(act.getProcInsId());
  1705. // project1.getId();
  1706. // uploadImages.setProcInsId(act.getProcInsId());
  1707. uploadImages.setImgName("15");
  1708. // uploadImages.setuId(UserUtils.getUser().getName());
  1709. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1710. // uploadImages.setProjectId(user.getId());
  1711. uploadImagesService.save(uploadImages);
  1712. }
  1713. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1714. act.setComment(comment);
  1715. actTaskService.electricalMiddleTask(act);
  1716. } catch (UnsupportedEncodingException e) {
  1717. e.printStackTrace();
  1718. }
  1719. j.setMsg("审批成功");
  1720. return j;
  1721. }
  1722. /**
  1723. * 审核土建施工流程
  1724. */
  1725. @ResponseBody
  1726. @RequestMapping(value = "nonRePowerMiddleTask")
  1727. public AjaxJson nonRePowerMiddleTask(Act act) {
  1728. AjaxJson j = new AjaxJson();
  1729. String comment = null;
  1730. try {
  1731. comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1732. act.setComment(comment);
  1733. actTaskService.nonRePowerMiddleTask(act);
  1734. } catch (UnsupportedEncodingException e) {
  1735. e.printStackTrace();
  1736. }
  1737. j.setMsg("审批成功");
  1738. return j;
  1739. }
  1740. /**
  1741. * 审核土建竣工流程
  1742. */
  1743. @ResponseBody
  1744. @RequestMapping(value = "nonRePowerEndTask")
  1745. public AjaxJson nonRePowerEndTask(Act act) {
  1746. AjaxJson j = new AjaxJson();
  1747. String comment = null;
  1748. try {
  1749. comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1750. act.setComment(comment);
  1751. actTaskService.nonRePowerEndTask(act);
  1752. } catch (UnsupportedEncodingException e) {
  1753. e.printStackTrace();
  1754. }
  1755. j.setMsg("审批成功");
  1756. return j;
  1757. }
  1758. /**
  1759. * 审核土建竣工流程
  1760. */
  1761. @ResponseBody
  1762. @RequestMapping(value = "rePowerEnd")
  1763. public AjaxJson rePowerEnd(Act act) {
  1764. AjaxJson j = new AjaxJson();
  1765. String comment = null;
  1766. try {
  1767. comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1768. act.setComment(comment);
  1769. actTaskService.rePowerEnd(act);
  1770. } catch (UnsupportedEncodingException e) {
  1771. e.printStackTrace();
  1772. }
  1773. j.setMsg("审批成功");
  1774. return j;
  1775. }
  1776. /**
  1777. * 电气竣工流程
  1778. */
  1779. @ResponseBody
  1780. @RequestMapping(value = "electricalEndTask")
  1781. public AjaxJson electricalEndTask(Act act, String pic, UploadImages uploadImages) {
  1782. AjaxJson j = new AjaxJson();
  1783. try {
  1784. if (pic != null && pic != "") {
  1785. uploadImages.setPath(pic);
  1786. // uploadImages.setProcInsId(act.getProcInsId());
  1787. uploadImages.setImgName("16");
  1788. // uploadImages.setuId(UserUtils.getUser().getName());
  1789. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1790. // uploadImages.setProjectId(user.getId());
  1791. uploadImagesService.save(uploadImages);
  1792. }
  1793. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1794. act.setComment(comment);
  1795. actTaskService.electricalEndTask(act);
  1796. } catch (UnsupportedEncodingException e) {
  1797. e.printStackTrace();
  1798. }
  1799. j.setMsg("审批成功");
  1800. return j;
  1801. }
  1802. /**
  1803. * 审核电气施工中流程
  1804. */
  1805. @ResponseBody
  1806. @RequestMapping(value = "reElectricalMiddleTask")
  1807. public AjaxJson reElectricalMiddleTask(Act act) {
  1808. AjaxJson j = new AjaxJson();
  1809. String comment = null;
  1810. try {
  1811. comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1812. act.setComment(comment);
  1813. actTaskService.reElectricalMiddleTask(act);
  1814. } catch (UnsupportedEncodingException e) {
  1815. e.printStackTrace();
  1816. }
  1817. j.setMsg("审批成功");
  1818. return j;
  1819. }
  1820. /**
  1821. * 审核电气竣工流程
  1822. */
  1823. @ResponseBody
  1824. @RequestMapping(value = "reElectricalEndTask")
  1825. public AjaxJson reElectricalEndTask(Act act) {
  1826. AjaxJson j = new AjaxJson();
  1827. String comment = null;
  1828. try {
  1829. comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1830. act.setComment(comment);
  1831. actTaskService.reElectricalEndTask(act);
  1832. } catch (UnsupportedEncodingException e) {
  1833. e.printStackTrace();
  1834. }
  1835. j.setMsg("审批成功");
  1836. return j;
  1837. }
  1838. /**
  1839. * 土建竣工流程
  1840. */
  1841. @ResponseBody
  1842. @RequestMapping(value = "nonPowerEndTask")
  1843. public AjaxJson nonPowerEndTask(Act act, NonPower nonPower) {
  1844. AjaxJson j = new AjaxJson();
  1845. try {
  1846. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1847. act.setComment(comment);
  1848. nonPowerService.updateEnd(nonPower);
  1849. actTaskService.nonPowerEndTask(act);
  1850. } catch (UnsupportedEncodingException e) {
  1851. e.printStackTrace();
  1852. }
  1853. j.setMsg("审批成功");
  1854. return j;
  1855. }
  1856. /**
  1857. * 配网项目经理判断是否完成土建
  1858. */
  1859. @ResponseBody
  1860. @RequestMapping(value = "reviewNonPower")
  1861. public AjaxJson reviewNonPower(Act act) {
  1862. AjaxJson j = new AjaxJson();
  1863. try {
  1864. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1865. act.setComment(comment);
  1866. //设置土建完成
  1867. materialModuleService.updateNonPower(act.getProcInsId());
  1868. actTaskService.reviewNonPower(act);
  1869. } catch (UnsupportedEncodingException e) {
  1870. e.printStackTrace();
  1871. }
  1872. j.setMsg("审批成功");
  1873. return j;
  1874. }
  1875. /**
  1876. * 配网项目经理判断是否完成电气
  1877. */
  1878. @ResponseBody
  1879. @RequestMapping(value = "reviewElectrical")
  1880. public AjaxJson reviewElectrical(Act act) {
  1881. AjaxJson j = new AjaxJson();
  1882. try {
  1883. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1884. act.setComment(comment);
  1885. //设置土建完成
  1886. materialModuleService.updateElectrical(act.getProcInsId());
  1887. actTaskService.reviewElectrical(act);
  1888. } catch (UnsupportedEncodingException e) {
  1889. e.printStackTrace();
  1890. }
  1891. j.setMsg("审批成功");
  1892. return j;
  1893. }
  1894. /**
  1895. * 施工单位项目经理判断是否包含涉电工作
  1896. */
  1897. @ResponseBody
  1898. @RequestMapping(value = "managerWhetherTask")
  1899. public AjaxJson managerWhetherTask(Act act) {
  1900. AjaxJson j = new AjaxJson();
  1901. try {
  1902. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1903. act.setComment(comment);
  1904. actTaskService.managerWhetherTask(act);
  1905. } catch (UnsupportedEncodingException e) {
  1906. e.printStackTrace();
  1907. }
  1908. j.setMsg("审批成功");
  1909. return j;
  1910. }
  1911. /**
  1912. * 施工单位项目经理上传涉电项目开工流程工作
  1913. */
  1914. @ResponseBody
  1915. @RequestMapping(value = "PowerStartTask")
  1916. public AjaxJson PowerStartTask(Act act, String pic, String imgName, UploadImages uploadImages) {
  1917. AjaxJson j = new AjaxJson();
  1918. try {
  1919. //获取当前的流程实例id
  1920. String procInsId = act.getProcInsId();
  1921. //根据项目信息查询计划开工日期
  1922. String projectName = materialModuleService.findProjectName(procInsId);
  1923. Date specificTime = materialModuleService.findSpecificTime(projectName);
  1924. // Project project1 = MyActiviUtils.sgFindUser(procInsId);
  1925. // String[] needUser = {project1.getConstructionUnitManage()};
  1926. // List<String> listUserId = MyActiviUtils.getListUserId(needUser);
  1927. // List<String> userId = materialModuleService.findUserId(listUserId);
  1928. // String stringJoiningTogether = MyActiviUtils.getStringJoiningTogether(userId);
  1929. OaNotify oaNotify = new OaNotify();
  1930. oaNotify.setType("4");
  1931. oaNotify.setTitle("施工验收流程项目计划信息");
  1932. oaNotify.setStatus("1");
  1933. // oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
  1934. if (specificTime == null) {
  1935. //根据流程实例id查询对应的项目信息(如果没有,发送通知,没有该项目计划信息)
  1936. oaNotify.setContent(projectName + ":项目没有对应的计划信息");
  1937. oaNotifyService.save(oaNotify);
  1938. List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
  1939. for (OaNotifyRecord o : list) {
  1940. //发送通知到客户端
  1941. ServletContext context = SpringContextHolder.getBean(ServletContext.class);
  1942. new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
  1943. }
  1944. } else {
  1945. //将计划赶工日期与当前时间比对(则将不符情况以通知形式发送)
  1946. SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
  1947. boolean timeFlag = fmt.format(specificTime).equals(fmt.format(new Date()));
  1948. if (timeFlag == false) {
  1949. oaNotify.setContent(projectName + ":计划时间与实际时间不符");
  1950. oaNotifyService.save(oaNotify);
  1951. List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
  1952. for (OaNotifyRecord o : list) {
  1953. //发送通知到客户端
  1954. ServletContext context = SpringContextHolder.getBean(ServletContext.class);
  1955. new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
  1956. }
  1957. }
  1958. }
  1959. if (pic != null && pic != "") {
  1960. uploadImages.setPath(pic);
  1961. // uploadImages.setProcInsId(act.getProcInsId());
  1962. uploadImages.setImgName("17");
  1963. // uploadImages.setuId(UserUtils.getUser().getName());
  1964. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1965. // uploadImages.setProjectId(user.getId());
  1966. uploadImagesService.save(uploadImages);
  1967. }
  1968. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1969. act.setComment(comment);
  1970. actTaskService.PowerStartTask(act);
  1971. } catch (UnsupportedEncodingException e) {
  1972. e.printStackTrace();
  1973. }
  1974. j.setMsg("审批成功");
  1975. return j;
  1976. }
  1977. /**
  1978. * 施工单位项目经理上传涉电项目竣工流程工作
  1979. */
  1980. @ResponseBody
  1981. @RequestMapping(value = "PowerEndTask")
  1982. public AjaxJson PowerEndTask(Act act, String pic, UploadImages uploadImages) {
  1983. AjaxJson j = new AjaxJson();
  1984. try {
  1985. if (pic != null && pic != "") {
  1986. uploadImages.setPath(pic);
  1987. // uploadImages.setProcInsId(act.getProcInsId());
  1988. uploadImages.setImgName("18");
  1989. // uploadImages.setuId(UserUtils.getUser().getName());
  1990. // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
  1991. // uploadImages.setProjectId(user.getId());
  1992. uploadImagesService.save(uploadImages);
  1993. }
  1994. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  1995. act.setComment(comment);
  1996. actTaskService.PowerEndTask(act);
  1997. } catch (UnsupportedEncodingException e) {
  1998. e.printStackTrace();
  1999. }
  2000. j.setMsg("审批成功");
  2001. return j;
  2002. }
  2003. /**
  2004. * 配网项目经理判断涉电工作
  2005. */
  2006. @ResponseBody
  2007. @RequestMapping(value = "PowerWhetherTask")
  2008. public AjaxJson PowerWhetherTask(Act act) {
  2009. AjaxJson j = new AjaxJson();
  2010. try {
  2011. //对项目选择二次涉电的时候
  2012. String flag = act.getFlag();
  2013. if ("second".equals(flag)) {
  2014. //获取项目定义号,查询项目信息
  2015. String projectName = materialModuleService.findProjectName(act.getProcInsId());
  2016. ConstructionProject project = materialModuleService.findProject(projectName);
  2017. if (project == null) {
  2018. //没有,不允许发起二次涉电
  2019. j.setSuccess(false);
  2020. j.setMsg("没有该项目的计划信息,无法发起二次涉电");
  2021. return j;
  2022. } else {
  2023. //如果有,记录数据,保存数据在项目名称后加入二次涉电插入项目库
  2024. String projectName1 = project.getProjectName();
  2025. project.setProjectName(projectName1 + "二次涉电");
  2026. project.setProjectStatus("0");
  2027. materialModuleService.conProject(project);
  2028. }
  2029. }
  2030. materialModuleService.updatePower(act.getProcInsId());
  2031. String comment = URLDecoder.decode(act.getComment(), "UTF-8");
  2032. act.setComment(comment);
  2033. actTaskService.PowerWhetherTask(act);
  2034. } catch (UnsupportedEncodingException e) {
  2035. e.printStackTrace();
  2036. }
  2037. j.setMsg("审批成功");
  2038. return j;
  2039. }
  2040. }