ActTaskController.java 71 KB

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