ActTaskController.java 70 KB

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