ActTaskController.java 83 KB

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