ActTaskController.java 76 KB

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