ActTaskController.java 77 KB

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