1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329 |
- /**
- * Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
- */
- package com.jeeplus.modules.act.web;
- import java.io.InputStream;
- import java.io.UnsupportedEncodingException;
- import java.net.URLDecoder;
- import java.util.Date;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import javax.servlet.ServletContext;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import com.jeeplus.common.json.AjaxJson;
- import com.jeeplus.common.utils.SpringContextHolder;
- import com.jeeplus.common.websocket.service.system.SystemInfoSocketHandler;
- import com.jeeplus.modules.act.service.ActModelService;
- import com.jeeplus.modules.oa.entity.OaNotify;
- import com.jeeplus.modules.oa.entity.OaNotifyRecord;
- import com.jeeplus.modules.oa.service.OaNotifyService;
- import com.jeeplus.modules.sg.managementcenter.activiti.entity.*;
- import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
- import com.jeeplus.modules.sg.managementcenter.activiti.service.DiscloseService;
- import com.jeeplus.modules.sg.managementcenter.activiti.service.ProcessPersonnelService;
- import com.jeeplus.modules.sg.managementcenter.activiti.service.UploadImagesService;
- import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
- import com.jeeplus.modules.sg.managementcenter.constructionProject.entity.ConstructionProject;
- import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
- import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
- import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
- import com.jeeplus.modules.sg.managementcenter.project.entity.Assignment;
- import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
- import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
- import com.jeeplus.modules.sg.materialmodule.activiti.entity.MaterialModule;
- import com.jeeplus.modules.sg.materialmodule.activiti.entity.NonPower;
- import com.jeeplus.modules.sg.materialmodule.activiti.service.MaterialModuleService;
- import com.jeeplus.modules.sg.materialmodule.activiti.service.NonPowerService;
- import com.jeeplus.modules.sg.picking.activiti.entity.PickApplication;
- import com.jeeplus.modules.sg.picking.activiti.entity.ShowList;
- import com.jeeplus.modules.sg.picking.activiti.service.PickIngService;
- import com.jeeplus.modules.sg.settActivi.entity.SettActivi;
- import com.jeeplus.modules.sg.settActivi.entity.SettList;
- import com.jeeplus.modules.sg.settActivi.service.SettActiviService;
- import com.jeeplus.modules.sys.service.SystemService;
- import org.activiti.engine.HistoryService;
- import org.activiti.engine.RepositoryService;
- import org.activiti.engine.RuntimeService;
- import org.activiti.engine.TaskService;
- import org.activiti.engine.history.HistoricTaskInstance;
- import org.activiti.engine.impl.RepositoryServiceImpl;
- import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
- import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
- import org.activiti.engine.impl.pvm.PvmActivity;
- import org.activiti.engine.impl.pvm.PvmTransition;
- import org.activiti.engine.impl.pvm.process.ActivityImpl;
- import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
- import org.activiti.engine.impl.pvm.process.TransitionImpl;
- import org.activiti.engine.impl.task.TaskDefinition;
- import org.activiti.engine.runtime.ProcessInstance;
- import org.activiti.engine.task.Task;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.ibatis.annotations.Param;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import com.jeeplus.core.persistence.Page;
- import com.jeeplus.core.web.BaseController;
- import com.jeeplus.modules.act.entity.Act;
- import com.jeeplus.modules.act.service.ActTaskService;
- import com.jeeplus.modules.act.utils.ActUtils;
- import com.jeeplus.modules.sys.utils.UserUtils;
- /**
- * 流程个人任务相关Controller
- *
- * @author jeeplus
- * @version 2016-11-03
- */
- @Controller
- @RequestMapping(value = "${adminPath}/act/task")
- public class ActTaskController extends BaseController {
- @Autowired
- private ActTaskService actTaskService;
- @Autowired
- private HistoryService historyService;
- @Autowired
- private RuntimeService runtimeService;
- @Autowired
- private RepositoryService repositoryService;
- @Autowired
- private TaskService taskService;
- @Autowired
- private ConstructionService constructionService;
- @Autowired
- private DiscloseService discloseService;
- @Autowired
- private UploadImagesService uploadImagesService;
- @Autowired
- private OaNotifyService oaNotifyService;
- @Autowired
- private NonPowerService nonPowerService;
- @Autowired
- private ProjectService projectService;
- @Autowired
- private ActModelService actModelService;
- @Autowired
- private PickIngService pickIngService;
- @Autowired
- private SystemService systemService;
- @Autowired
- private MaterialModuleService materialModuleService;
- @Autowired
- private SettActiviService settActiviService;
- @Autowired
- private MaterialProjectService materialProjectService;
- /**
- * 获取待办列表
- *
- * @return
- */
- @RequestMapping(value = {"todo", ""})
- public String todoList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
- return "modules/bpm/task/todo/taskTodoList";
- }
- @ResponseBody
- @RequestMapping(value = "todo/data")
- public Map<String, Object> todoListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model, String reserveProjectName,String projectId,String projectName) throws Exception {
- /* Page<HashMap<String, String>> page = actTaskService.todoList(new Page<HashMap<String, String>>(request, response), act);
- return getBootstrapData(page);*/
- Page<HashMap<String, String>> page = actTaskService.newTodoList(new Page<HashMap<String, String>>(request, response), act, reserveProjectName, projectId, projectName);
- Map<String, Object> map = new HashMap<String, Object>();
- return getBootstrapData(page);
- }
- /**
- * 获取已办任务
- *
- * @return
- */
- @RequestMapping(value = "historic")
- public String historicList(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
- return "modules/bpm/task/history/taskHistoricList";
- }
- @ResponseBody
- @RequestMapping(value = "historic/data")
- public Map<String, Object> historicListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
- Page<HashMap<String, String>> page = actTaskService.historicList(new Page<HashMap<String, String>>(request, response), act);
- return getBootstrapData(page);
- }
- /**
- * 获取我的申请列表
- *
- * @return
- */
- @RequestMapping(value = "myApplyed")
- public String myApplyedList(Act act, HttpServletResponse response, Model model) throws Exception {
- return "modules/bpm/task/apply/taskMyAppledList";
- }
- @ResponseBody
- @RequestMapping(value = "myApplyed/data")
- public Map<String, Object> myApplyedListData(Act act, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
- Page<HashMap> page = actTaskService.getMyStartedProcIns(UserUtils.getUser(), new Page<HashMap>(request, response));
- return getBootstrapData(page);
- }
- /**
- * 获取流转历史列表
- *
- * @param startAct 开始活动节点名称
- * @param endAct 结束活动节点名称
- */
- @RequestMapping(value = "histoicFlow")
- public String histoicFlow(Act act, String startAct, String endAct, Model model) {
- if (StringUtils.isNotBlank(act.getProcInsId())) {
- List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
- model.addAttribute("histoicFlowList", histoicFlowList);
- }
- return "modules/bpm/task/history/taskHistoricFlow";
- }
- /**
- * 获取流程流向图
- *
- * @param startAct 开始活动节点名称
- * @param endAct 结束活动节点名称
- */
- @RequestMapping(value = "flowChart")
- public String flowChart(Act act, String startAct, String endAct, Model model) {
- if (StringUtils.isNotBlank(act.getProcInsId())) {
- List<Act> histoicFlowList = actTaskService.histoicFlowList(act.getProcInsId(), startAct, endAct);
- model.addAttribute("histoicFlowList", histoicFlowList);
- }
- return "modules/bpm/task/chart/taskFlowChart";
- }
- /**
- * 获取流程列表
- *
- * @param category 流程分类
- */
- @RequestMapping(value = "process")
- public String processList(String category, HttpServletRequest request, HttpServletResponse response, Model model) {
- Page<Object[]> page = new Page<Object[]>(request, response);
- model.addAttribute("category", category);
- return "modules/bpm/task/process/taskProcessList";
- }
- /**
- * 获取流程表单
- */
- @RequestMapping(value = "form")
- public String form(Act act, HttpServletRequest request, Model model) {
- // 获取流程XML上的表单KEY
- String formKey = actTaskService.getFormKey(act.getProcDefId(), act.getTaskDefKey());
- // 获取流程实例对象
- if (act.getProcInsId() != null) {
- if (actTaskService.getProcIns(act.getProcInsId()) != null) {
- try {
- act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
- }
- if (actTaskService.isNextGatewaty(act.getProcInsId())) {
- act.setIsNextGatewaty(true);
- } else {
- act.setIsNextGatewaty(false);
- }
- }
- return "redirect:" + ActUtils.getFormUrl(formKey, act);
- }
- /**
- * 根据流程实例ID,获取当前节点的流程表单详情
- */
- @RequestMapping(value = "formDetail")
- public String formDetail(Act act, HttpServletRequest request, Model model) {
- // 获取流程XML上的表单KEY
- String taskDefKey = nextTaskDefinition(act.getProcInsId());
- String formKey = actTaskService.getFormKey(act.getProcDefId(), taskDefKey);
- // 获取流程实例对象
- if (act.getProcInsId() != null) {
- if (actTaskService.getProcIns(act.getProcInsId()) != null) {
- act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
- } else {
- act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
- }
- if (actTaskService.isNextGatewaty(act.getProcInsId())) {
- act.setIsNextGatewaty(true);
- } else {
- act.setIsNextGatewaty(false);
- }
- }
- return "redirect:" + ActUtils.getFormUrl(formKey, act);
- }
- /**
- * 启动流程
- */
- @RequestMapping(value = "start")
- @ResponseBody
- public String start(Act act, String table, String id, Model model) throws Exception {
- actTaskService.startProcess(act.getProcDefKey(), act.getBusinessId(), act.getBusinessTable(), act.getTitle());
- return "true";//adminPath + "/act/task";
- }
- /**
- * 签收任务
- */
- @RequestMapping(value = "claim")
- @ResponseBody
- public String claim(Act act) {
- String userId = UserUtils.getUser().getLoginName();//ObjectUtils.toString(UserUtils.getUser().getId());
- actTaskService.claim(act.getTaskId(), userId);
- return "true";//adminPath + "/act/task";
- }
- /**
- * 完成任务
- * vars.keys=flag,pass
- * vars.values=1,true
- * vars.types=S,B @see com.jeeplus.jeeplus.modules.act.utils.PropertyType
- */
- @RequestMapping(value = "complete")
- @ResponseBody
- public String complete(Act act) {
- actTaskService.complete(act.getTaskId(), act.getProcInsId(), act.getComment(), act.getVars().getVariableMap());
- return "true";//adminPath + "/act/task";
- }
- /**
- * 读取带跟踪的图片
- */
- @RequestMapping(value = "trace/photo/{procDefId}/{execId}")
- public void tracePhoto(@PathVariable("procDefId") String procDefId, @PathVariable("execId") String execId, HttpServletResponse response) throws Exception {
- InputStream imageStream = actTaskService.tracePhoto(procDefId, execId);
- // 输出资源内容到相应对象
- byte[] b = new byte[1024];
- int len;
- while ((len = imageStream.read(b, 0, 1024)) != -1) {
- response.getOutputStream().write(b, 0, len);
- }
- }
- /**
- * 输出跟踪流程信息
- *
- * @return
- * @throws Exception
- */
- @ResponseBody
- @RequestMapping(value = "trace/info/{proInsId}")
- public List<Map<String, Object>> traceInfo(@PathVariable("proInsId") String proInsId) throws Exception {
- List<Map<String, Object>> activityInfos = actTaskService.traceProcess(proInsId);
- return activityInfos;
- }
- /**
- * 显示流程图
- @RequestMapping(value = "processPic")
- public void processPic(String procDefId, HttpServletResponse response) throws Exception {
- ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
- String diagramResourceName = procDef.getDiagramResourceName();
- InputStream imageStream = repositoryService.getResourceAsStream(procDef.getDeploymentId(), diagramResourceName);
- byte[] b = new byte[1024];
- int len = -1;
- while ((len = imageStream.read(b, 0, 1024)) != -1) {
- response.getOutputStream().write(b, 0, len);
- }
- }*/
- /**
- * 获取跟踪信息
- @RequestMapping(value = "processMap")
- public String processMap(String procDefId, String proInstId, Model model)
- throws Exception {
- List<ActivityImpl> actImpls = new ArrayList<ActivityImpl>();
- ProcessDefinition processDefinition = repositoryService
- .createProcessDefinitionQuery().processDefinitionId(procDefId)
- .singleResult();
- ProcessDefinitionImpl pdImpl = (ProcessDefinitionImpl) processDefinition;
- String processDefinitionId = pdImpl.getId();// 流程标识
- ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
- .getDeployedProcessDefinition(processDefinitionId);
- List<ActivityImpl> activitiList = def.getActivities();// 获得当前任务的所有节点
- List<String> activeActivityIds = runtimeService.getActiveActivityIds(proInstId);
- for (String activeId : activeActivityIds) {
- for (ActivityImpl activityImpl : activitiList) {
- String id = activityImpl.getId();
- if (activityImpl.isScope()) {
- if (activityImpl.getActivities().size() > 1) {
- List<ActivityImpl> subAcList = activityImpl
- .getActivities();
- for (ActivityImpl subActImpl : subAcList) {
- String subid = subActImpl.getId();
- System.out.println("subImpl:" + subid);
- if (activeId.equals(subid)) {// 获得执行到那个节点
- actImpls.add(subActImpl);
- break;
- }
- }
- }
- }
- if (activeId.equals(id)) {// 获得执行到那个节点
- actImpls.add(activityImpl);
- System.out.println(id);
- }
- }
- }
- model.addAttribute("procDefId", procDefId);
- model.addAttribute("proInstId", proInstId);
- model.addAttribute("actImpls", actImpls);
- return "modules/act/actTaskMap";
- }*/
- /**
- * 删除任务
- *
- * @param taskId 流程实例ID
- * @param reason 删除原因
- */
- @ResponseBody
- @RequiresPermissions("act:process:edit")
- @RequestMapping(value = "deleteTask")
- public AjaxJson deleteTask(String taskId, String reason) {
- AjaxJson j = new AjaxJson();
- if (StringUtils.isBlank(reason)) {
- j.setSuccess(false);
- j.setMsg("请填写删除原因");
- } else {
- actTaskService.deleteTask(taskId, reason);
- j.setSuccess(true);
- j.setMsg("删除任务成功,任务ID=" + taskId);
- }
- return j;
- }
- /**
- * 审批
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "audit")
- public AjaxJson auditTask(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.auditSave(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 经研所审批
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "economics")
- public AjaxJson economics(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && !"".equals(pic)) {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("上传新图纸");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- // uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.economics(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 人工选择问题类型审批
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "artificialTask")
- public AjaxJson artificialTask(Act act, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- constructionService.updateOIPI(construction);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.artificialTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 交底:运行人员审核
- */
- @ResponseBody
- @RequestMapping(value = "humanReview")
- public AjaxJson humanReview(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.humanReview(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 导入材料表和拆旧物资表
- */
- @ResponseBody
- @RequestMapping(value = "importTable")
- public AjaxJson importTable(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.importTable(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 导入工程量
- */
- @ResponseBody
- @RequestMapping(value = "engineering")
- public AjaxJson engineeringengineering(Act act, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String flag = act.getFlag();
- Construction construction1 = constructionService.get(construction);
- if ("yes".equals(flag)) {
- if (construction1.getQuantity() == null) {
- j.setSuccess(false);
- j.setMsg("请先导入工程量");
- return j;
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- String processingType = construction1.getQuantity().getProcessingType();
- if (processingType == null || "".equals(processingType)) {
- } else {
- //有政策处理问题,暂定为1
- constructionService.updatePolicyStatus(construction1.getReserveProjectName(),"1");
- }
- }
- actTaskService.engineering(act,construction1);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 政处是否自己进行
- */
- @ResponseBody
- @RequestMapping(value = "ruralOffice")
- public AjaxJson ruralOffice(Act act, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- constructionService.updateIfSelf(construction);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.ruralOffice(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 农村专职判断
- */
- @ResponseBody
- @RequestMapping(value = "ruralJudge")
- public AjaxJson ruralJudge(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.ruralJudge(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 农村上传文件
- */
- @ResponseBody
- @RequestMapping(value = "ruralFiles")
- public AjaxJson ruralFiles(Act act,String path,String path1, String reserveProjectName,Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- constructionService.updateIfBorrow(construction);
- if (path != null && !"".equals(path)) {
- UploadImages uploadImages = new UploadImages();
- uploadImages.setPath(path);
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setImgName("22");
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(uploadImages);
- }
- if (path1 != null && !"".equals(path1)) {
- UploadImages uploadImages = new UploadImages();
- uploadImages.setPath(path1);
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setImgName("23");
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.ruralFiles(act,construction);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 设计单位人员调整文件
- */
- @ResponseBody
- @RequestMapping(value = "operatorAfter")
- public AjaxJson operatorAfter(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
- actTaskService.operatorAfter(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 交底:是否借款
- */
- @ResponseBody
- @RequestMapping(value = "divideForm")
- public AjaxJson divideForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
- actTaskService.divideForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 交底:是否借款
- */
- @ResponseBody
- @RequestMapping(value = "ruralLoan")
- public AjaxJson ruralLoan(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
- actTaskService.ruralLoan(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 交底:是否支付
- */
- @ResponseBody
- @RequestMapping(value = "ruralPays")
- public AjaxJson ruralPays(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- act.setComment(URLDecoder.decode(act.getComment(), "UTF-8"));
- actTaskService.ruralPays(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 是否可以政策处理(农场/民事)
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "policiesChange")
- public AjaxJson policiesChange(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.policiesChange(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 上传借款单据
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "loanUploadList")
- public AjaxJson loanUploadList(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("上传借款单据");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.loanUploadList(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目经理重新审核是否可以政策处理(农场/民事)
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "managerPolicesChange")
- public AjaxJson managerPolicesChange(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.managerPolicesChange(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 上传未签字版政策处理清单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "notSignUpload")
- public AjaxJson notSignUpload(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("2");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.notSignUpload(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 上传签字版政策处理清单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "signUploadList")
- public AjaxJson signUploadList(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("3");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.signUploadList(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 上传签字版合同
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "contractUploadList")
- public AjaxJson contractUploadList(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("4");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.contractUploadList(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 运行单位经理判定设计变更
- */
- @ResponseBody
- @RequestMapping(value = "operator")
- public AjaxJson operator(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.operator(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目经理判断是否需要设计变更
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "managerDesign")
- public AjaxJson managerDesign(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.managerDesign(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 运行单位经理审核方案
- */
- @ResponseBody
- @RequestMapping(value = "designUpload")
- public AjaxJson designUpload(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.designUpload(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 设计单位人员重新设计
- */
- @ResponseBody
- @RequestMapping(value = "operatorUpload")
- public AjaxJson operatorUpload(Act act, String path, String budget,String civil,String reserveProjectName) {
- AjaxJson j = new AjaxJson();
- try {
- if (path != null && !"".equals(path)) {
- UploadImages uploadImages = new UploadImages();
- uploadImages.setPath(path);
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setImgName("1");
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(uploadImages);
- }
- if (budget != null && !"".equals(budget)) {
- UploadImages budgetImages = new UploadImages();
- budgetImages.setPath(budget);
- budgetImages.setUid(UserUtils.getUser().getName());
- budgetImages.setImgName("1");
- budgetImages.setProcInsId(act.getProcInsId());
- budgetImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(budgetImages);
- }
- if (civil != null && !"".equals(civil)) {
- UploadImages civilImages = new UploadImages();
- civilImages.setPath(civil);
- civilImages.setUid(UserUtils.getUser().getName());
- civilImages.setImgName("1");
- civilImages.setProcInsId(act.getProcInsId());
- civilImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(civilImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.operatorUpload(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 运行经理审核设计变更后
- */
- @ResponseBody
- @RequestMapping(value = "managerUpload")
- public AjaxJson managerUpload(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.managerUpload(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网经理审核设计变更后
- */
- @ResponseBody
- @RequestMapping(value = "afterDistribution")
- public AjaxJson afterDistribution(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.afterDistribution(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位判断变更后材料
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "conAfterChange")
- public AjaxJson conAfterChange(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.conAfterChange(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工审批
- */
- @ResponseBody
- @RequestMapping(value = "audit2")
- public AjaxJson auditTask2(Act act, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- if ("no".equals(act.getFlag())) {
- int byProcInsId = discloseService.findByProcInsId(act.getProcInsId());
- if (byProcInsId <= 0) {
- construction.preInsert();
- discloseService.insertDiscloseRole(construction);
- } else {
- discloseService.updateDiscloseByProcInsId(construction);
- }
- }
- actTaskService.auditSave2(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目经理组织交底
- *
- * @param
- */
- @ResponseBody
- @RequestMapping(value = "audit3")
- public AjaxJson auditTask3(Act act) {
- AjaxJson j = new AjaxJson();
- String s = "";
- // MyNeedList 项目经理组织交底 = MyActiviUtils.findActivity("项目经理组织交底");
- boolean flag = false;
- Disclose dc = new Disclose();
- /* dc.setProcInsId(act.getProcInsId());
- Disclose disclose = discloseService.get(dc);
- if (null == disclose) {
- j.setSuccess(false);
- j.setMsg("请导入数据");
- return j;
- }
- Boolean flagDesign = actTaskService.isJudgeDesign(disclose);//设计变更
- Boolean flagItemCLose = actTaskService.isJudgeItemClose(disclose);//项目关闭
- String flagDeal = actTaskService.newJudgeDeal(disclose);
- if (null == disclose.getPrecondition() || "".equals(disclose.getPrecondition())) {
- if (flagItemCLose) {
- if (null == disclose.getExplanationOfNecessity() || disclose.getExplanationOfNecessity().equals("")) {
- s = "必要性问题说明不能为空!";
- flag = true;
- }
- }
- if (flagDesign) {
- if (null == disclose.getInconsistentDescription() || disclose.getInconsistentDescription().equals("")) {
- s += "图纸现场不一致说明不能为空!";
- flag = true;
- }
- }
- if ("民事农村".equals(flagDeal) || "行政".equals(flagDeal)) {
- String policyHandlingInstructions = disclose.getPolicyHandlingInstructions();
- if (policyHandlingInstructions == null || "".equals(policyHandlingInstructions)) {
- s += "政策处理说明不能为空";
- flag = true;
- }
- }
- if (null == disclose.getPolicyHandlingInstructions() || disclose.getPolicyHandlingInstructions().equals("")) {
- s += " 政策处理说明不能为空!";
- flag = true;
- }
- if (flag) {
- j.setSuccess(false);
- j.setMsg(s);
- return j;
- }
- }
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.auditSave3(act, disclose, flagDesign, flagItemCLose, flagDeal);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }*/
- j.setMsg("审批成功");
- return j;
- }
- /*
- 交底:判断项目是否需要关闭
- */
- @ResponseBody
- @RequestMapping(value = "speciallyTask")
- public AjaxJson speciallyTask(Act act, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.specially(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /*
- 项目关闭:项目经理
- */
- @ResponseBody
- @RequestMapping(value = "managerFormTask")
- public AjaxJson managerFormTask(Act act, String fullName, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.managerFormTask(act, fullName);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /*
- 项目关闭:运行人员
- */
- @ResponseBody
- @RequestMapping(value = "memberTask")
- public AjaxJson memberTask(Act act, String fullTime, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.addMember(act, fullTime);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /*
- 项目关闭:系统专职
- */
- @ResponseBody
- @RequestMapping(value = "departmentTask")
- public AjaxJson departmentTask(Act act, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.addDepartment(act);
- // projectService.updateStatusBy("0", act.getProcInsId());
- // projectService.updateStatusByClose("1", act.getProcInsId());
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- // Project user = MyActiviUtils.findUser(act.getProcInsId());
- // User user1 = UserUtils.getByUserName(user.getProjectManageRole());
- OaNotify oaNotify = new OaNotify();
- oaNotify.setType("4");
- oaNotify.setTitle("施工交底结束(项目关闭)");
- oaNotify.setContent("项目为:[" + construction.getProjectName() + "]的项目已经施工交底完成");
- oaNotify.setStatus("1");
- // oaNotify.setOaNotifyRecordIds(user1.getId());
- oaNotifyService.save(oaNotify);
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
- for (OaNotifyRecord o : list) {
- //发送通知到客户端
- ServletContext context = SpringContextHolder
- .getBean(ServletContext.class);
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
- }
- // j.setMsg("审批成功;已经通知" + user.getProjectManageRole());
- return j;
- }
- @ResponseBody
- @RequestMapping(value = "policiesDealTask")
- public AjaxJson policiesDealTask(Act act, String fullName, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.policiesDeal(act, fullName);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /***
- * 项目经理判定是否关闭
- * */
- @ResponseBody
- @RequestMapping(value = "coveredForm")
- public AjaxJson coveredForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.coveredForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网工程专职判定是否关闭
- */
- @ResponseBody
- @RequestMapping(value = "sealForm")
- public AjaxJson sealForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.sealForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- @ResponseBody
- @RequestMapping(value = "phaseManagerTask")
- public AjaxJson phaseManagerTask(Act act, String fullName) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.phaseManager(act, fullName);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /*
- 政策处理:配网政策处理专职 : 上传收据
- */
- @ResponseBody
- @RequestMapping(value = "receiptForm")
- public AjaxJson receiptForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.receiptForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- if ("yes".equals(act.getFlag())) {
- j.setMsg("审批成功");
- } else {
- j.setMsg("驳回成功");
- }
- return j;
- }
- /**
- * 配网工程专职判定变更或关闭
- * */
- @ResponseBody
- @RequestMapping(value = "singleForm")
- public AjaxJson singleForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.singleForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理判定变更或关闭
- * */
- @ResponseBody
- @RequestMapping(value = "documentsForm")
- public AjaxJson documentsForm(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.documentsForm(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网系统专职确认系统关闭
- * */
- @ResponseBody
- @RequestMapping(value = "confirmClose")
- public AjaxJson confirmClose(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.confirmClose(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工交底审批
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "newAudit")
- public AjaxJson newAuditTask(Act act, String tuser, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.newAuditSave(act, tuser, construction);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 取回流程
- *
- * @param taskId
- */
- @ResponseBody
- @RequestMapping(value = "callback")
- public AjaxJson callback(@Param("taskId") String taskId) {
- AjaxJson j = new AjaxJson();
- try {
- Map<String, Object> variables;
- // 取得当前任务
- HistoricTaskInstance currTask = historyService
- .createHistoricTaskInstanceQuery().taskId(taskId)
- .singleResult();
- // 取得流程实例
- ProcessInstance instance = runtimeService
- .createProcessInstanceQuery()
- .processInstanceId(currTask.getProcessInstanceId())
- .singleResult();
- if (instance == null) {
- j.setSuccess(false);
- j.setMsg("流程已经结束");
- return j;
- }
- variables = instance.getProcessVariables();
- // 取得流程定义
- ProcessDefinitionEntity definition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
- .getDeployedProcessDefinition(currTask
- .getProcessDefinitionId());
- if (definition == null) {
- j.setSuccess(false);
- j.setMsg("流程定义未找到");
- return j;
- }
- // 取得下一步活动
- ActivityImpl currActivity = ((ProcessDefinitionImpl) definition)
- .findActivity(currTask.getTaskDefinitionKey());
- List<PvmTransition> nextTransitionList = currActivity
- .getOutgoingTransitions();
- for (PvmTransition nextTransition : nextTransitionList) {
- PvmActivity nextActivity = nextTransition.getDestination();
- List<HistoricTaskInstance> completeTasks = historyService
- .createHistoricTaskInstanceQuery()
- .processInstanceId(instance.getId())
- .taskDefinitionKey(nextActivity.getId()).finished()
- .list();
- int finished = completeTasks.size();
- if (finished > 0) {
- j.setSuccess(false);
- j.setMsg("存在已经完成的下一步,流程不能取回");
- return j;
- }
- List<Task> nextTasks = taskService.createTaskQuery().processInstanceId(instance.getId())
- .taskDefinitionKey(nextActivity.getId()).list();
- for (Task nextTask : nextTasks) {
- //取活动,清除活动方向
- List<PvmTransition> oriPvmTransitionList = new ArrayList<PvmTransition>();
- List<PvmTransition> pvmTransitionList = nextActivity
- .getOutgoingTransitions();
- for (PvmTransition pvmTransition : pvmTransitionList) {
- oriPvmTransitionList.add(pvmTransition);
- }
- pvmTransitionList.clear();
- //建立新方向
- ActivityImpl nextActivityImpl = ((ProcessDefinitionImpl) definition)
- .findActivity(nextTask.getTaskDefinitionKey());
- TransitionImpl newTransition = nextActivityImpl
- .createOutgoingTransition();
- newTransition.setDestination(currActivity);
- //完成任务
- taskService.complete(nextTask.getId(), variables);
- historyService.deleteHistoricTaskInstance(nextTask.getId());
- //恢复方向
- currActivity.getIncomingTransitions().remove(newTransition);
- List<PvmTransition> pvmTList = nextActivity
- .getOutgoingTransitions();
- pvmTList.clear();
- for (PvmTransition pvmTransition : oriPvmTransitionList) {
- pvmTransitionList.add(pvmTransition);
- }
- }
- }
- historyService.deleteHistoricTaskInstance(currTask.getId());
- j.setSuccess(true);
- j.setMsg("取回成功");
- return j;
- } catch (Exception e) {
- j.setSuccess(false);
- j.setMsg("流程取回失败,未知错误.");
- return j;
- }
- }
- /**
- * 根据实例编号查找下一个任务节点
- *
- * @param procInstId :实例编号
- * @return
- */
- public String nextTaskDefinition(String procInstId) {
- //流程标示
- String processDefinitionId = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInstId).singleResult().getProcessDefinitionId();
- ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
- //执行实例
- ExecutionEntity execution = (ExecutionEntity) runtimeService.createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
- //当前实例的执行到哪个节点
- if (execution == null) {
- TaskDefinition[] taskDefinitions = {};
- taskDefinitions = def.getTaskDefinitions().values().toArray(taskDefinitions);
- return taskDefinitions[taskDefinitions.length - 1].getKey();
- } else {
- return execution.getActivityId();
- }
- }
- @ResponseBody
- @RequestMapping(value = "pickIng")
- public AjaxJson pickIng(Act act, String selectNumber) {
- AjaxJson j = new AjaxJson();
- try {
- pickIngService.updateSelectNumber(selectNumber, act.getProcInsId());
- List<ShowList> showLists = MyActiviUtils.finaList(selectNumber);
- for (ShowList a : showLists) {
- a.preInsert();
- a.setProcInsId(act.getProcInsId());
- }
- pickIngService.delAllTem();
- pickIngService.processTemList(showLists);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.pickIng(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- //开具设计清单
- @ResponseBody
- @RequestMapping(value = "materialReport")
- public AjaxJson materialReport(Act act, String selectNumber,String reserveName) {
- AjaxJson j = new AjaxJson();
- try {
- if (null!=reserveName&&reserveName!=""){
- MaterialProject materialProject = new MaterialProject();
- materialProject.setReserveProjectName(reserveName);
- List<MaterialProject> list = materialProjectService.findJugdeReserve(materialProject);
- if (list.size() > 0){
- j.setMsg("项目名称已存在");
- j.setSuccess(false);
- return j;
- }
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.materialReport(act,selectNumber,reserveName);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- //审核材料清单
- @ResponseBody
- @RequestMapping(value = "materialReportBillOff")
- public AjaxJson materialReportBillOff(Act act, String selectNumber,String reserveName) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- Boolean aBoolean = actTaskService.materialReportBillOff(act);
- if (aBoolean){
- j.setSuccess(false);
- j.setMsg("项目名称已存在,请联系流程发起人");
- return j;
- }
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位领导审核-物资领料
- */
- @ResponseBody
- @RequestMapping(value = "constructionLeader")
- public AjaxJson constructionLeader(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.constructionLeader(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位物资专职审核
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "fullExamine")
- public AjaxJson fullExamine(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.fullExamine(act);
- j.setMsg("审批成功");
- return j;
- }
- @ResponseBody
- @RequestMapping(value = "managerExam")
- public AjaxJson managerExam(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.managerExam(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目中心领导审核领料单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "leaderExamine")
- public AjaxJson leaderExamine(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.leaderExamine(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目中心领导审核领料单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "leaderExamine1")
- public AjaxJson leaderExamine1(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.leaderExamine(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理审核领料单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "managerAudit")
- public AjaxJson managerAudit(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.managerAudit(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网物资专职审核领料单
- *
- * @param act
- */
- @ResponseBody
- @RequestMapping(value = "netExamine")
- public AjaxJson netExamine(Act act) {
- AjaxJson j = new AjaxJson();
- actTaskService.netExamine(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 结算填写现场使用量
- */
- @ResponseBody
- @RequestMapping(value = "useQuantityTask")
- public AjaxJson useQuantityTask(Act act) {
- AjaxJson j = new AjaxJson();
- SettList settList = new SettList();
- settList.setAct(act);
- List<SettList> useQuantityData = settActiviService.findUseQuantityData(settList);
- if (null == useQuantityData || useQuantityData.size() <= 0) {
- j.setMsg("请先导入明细账");
- return j;
- }
- actTaskService.useQuantity(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 复合数量修改
- */
- @ResponseBody
- @RequestMapping(value = "reviewQuantityTask")
- public AjaxJson reviewQuantityTask(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("21");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.findJSUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- actTaskService.reviewQuantity(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 结束流程,完成结算
- */
- @ResponseBody
- @RequestMapping(value = "returnDocTask")
- public AjaxJson returnDocTask(Act act) {
- AjaxJson j = new AjaxJson();
- settActiviService.finSetStatus(act.getProcInsId());
- actTaskService.returnDoc(act);
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 经研所判定是否设计变更
- */
- @ResponseBody
- @RequestMapping(value = "auditDrawings")
- public AjaxJson auditDrawings(Act act, String path, String reserveProjectName) {
- AjaxJson j = new AjaxJson();
- try {
- if (path != null && !"".equals(path)) {
- UploadImages uploadImages = new UploadImages();
- uploadImages.setPath(path);
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setImgName("1");
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setReserveProjectName(reserveProjectName);
- constructionService.uploadSave(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.auditDrawings(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目经理审核流程提前领料是否通过
- */
- @ResponseBody
- @RequestMapping(value = "applicationAudit")
- public AjaxJson applicationAudit(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.applicationAudit(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 项目经理审核流程提前施工
- */
- @ResponseBody
- @RequestMapping(value = "contructionManager")
- public AjaxJson contructionManager(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.contructionManager(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理土建开工报告填写
- */
- @ResponseBody
- @RequestMapping(value = "nonPowerStartTask")
- public AjaxJson nonPowerStartTask(Act act, NonPower nonPower) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- //修改土建开工报告信息
- act = nonPower.getAct();
- act.setComment(comment);
- nonPowerService.updateStart(nonPower);
- actTaskService.nonPowerStartTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理电气开工流程提交文件
- */
- @ResponseBody
- @RequestMapping(value = "electricalStartTask")
- public AjaxJson electricalStartTask(Act act, String pic, UploadImages uploadImages, MaterialModule materialModule) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("14");
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setReserveProjectName(materialModule.getReserveProjectName());
- uploadImages.setProcInsId(materialModule.getAct().getProcInsId());
- uploadImages.setId("");
- uploadImagesService.save(uploadImages);
- }
- materialModuleService.updateElectricalStart(materialModule);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act = materialModule.getAct();
- act.setComment(comment);
- actTaskService.electricalStartTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理土建施工中流程提交文件
- */
- @ResponseBody
- @RequestMapping(value = "nonPowerMiddleTask")
- public AjaxJson nonPowerMiddleTask(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("12");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.nonPowerMiddleTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理电气施工中流程提交文件
- */
- @ResponseBody
- @RequestMapping(value = "electricalMiddleTask")
- public AjaxJson electricalMiddleTask(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // Project project1 = MyActiviUtils.sgFindUser(act.getProcInsId());
- // project1.getId();
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("15");
- // uploadImages.setuId(UserUtils.getUser().getName());
- // Project user = MyActiviUtils.sgFindUser(act.getProcInsId());
- // uploadImages.setProjectId(user.getId());
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.electricalMiddleTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 审核土建施工流程
- */
- @ResponseBody
- @RequestMapping(value = "nonRePowerMiddleTask")
- public AjaxJson nonRePowerMiddleTask(Act act) {
- AjaxJson j = new AjaxJson();
- String comment = null;
- try {
- comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.nonRePowerMiddleTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 审核土建竣工流程
- */
- @ResponseBody
- @RequestMapping(value = "nonRePowerEndTask")
- public AjaxJson nonRePowerEndTask(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.nonRePowerEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 审核涉电竣工
- */
- @ResponseBody
- @RequestMapping(value = "rePowerEnd")
- public AjaxJson rePowerEnd(Act act) {
- AjaxJson j = new AjaxJson();
- String comment = null;
- try {
- comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.rePowerEnd(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 电气竣工流程
- */
- @ResponseBody
- @RequestMapping(value = "electricalEndTask")
- public AjaxJson electricalEndTask(Act act, String pic, UploadImages uploadImages,String id) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("16");
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setReserveProjectName(uploadImages.getReserveProjectName());
- uploadImages.setId("");
- uploadImagesService.save(uploadImages);
- }
- //判断是否需要发送通知
- Integer num = 0;
- List<MaterialInfo> allInfo = projectService.findSgInfo(id);
- if (null != allInfo && allInfo.size() > 0) {
- for (MaterialInfo mi :
- allInfo) {
- String materialName = mi.getMaterialName();
- if (materialName.contains("环网柜") || materialName.contains("开关站") || materialName.contains("管塔通道")) {
- num += 1;
- if (num >= 5) {
- Project sgUser = MyActiviUtils.findSGUser(act.getProcInsId());
- //发送通知
- OaNotify oaNotify = new OaNotify();
- oaNotify.setType("4");
- oaNotify.setTitle(uploadImages.getReserveProjectName()+":电气(涉电)需要验收");
- oaNotify.setStatus("1");
- oaNotify.setContent(uploadImages.getReserveProjectName() + ":电气(涉电)需要验收");
- oaNotify.setOaNotifyRecordIds(UserUtils.getByUserName(sgUser.getAssignment().getRepUnit()).getId());
- oaNotifyService.save(oaNotify);
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
- for (OaNotifyRecord o : list) {
- //发送通知到客户端
- ServletContext context = SpringContextHolder.getBean(ServletContext.class);
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
- }
- break;
- }
- }
- }
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.electricalEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 审核电气施工中流程
- */
- @ResponseBody
- @RequestMapping(value = "reElectricalMiddleTask")
- public AjaxJson reElectricalMiddleTask(Act act) {
- AjaxJson j = new AjaxJson();
- String comment = null;
- try {
- comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.reElectricalMiddleTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 审核电气竣工流程
- */
- @ResponseBody
- @RequestMapping(value = "reElectricalEndTask")
- public AjaxJson reElectricalEndTask(Act act, String id) {
- AjaxJson j = new AjaxJson();
- String comment = null;
- try {
- comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- if ("yes".equals(act.getFlag())) {
- Construction blockAss = projectService.findSgBlockAss(id);
- if (null == blockAss.getQuantity()) {
- act.setFlag("noContain");
- } else {
- String blackoutLine = blockAss.getQuantity().getBlackoutLine();
- if (null == blackoutLine || "".equals(blackoutLine) || "不涉电".equals(blackoutLine)) {
- act.setFlag("noContain");
- }
- }
- }
- actTaskService.reElectricalEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 上传涉电开工资料
- */
- @ResponseBody
- @RequestMapping(value = "powerFileTask")
- public AjaxJson powerFileTask(Act act, String pic, UploadImages uploadImages,String id) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("17");
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setReserveProjectName(uploadImages.getReserveProjectName());
- uploadImages.setId("");
- uploadImagesService.save(uploadImages);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.powerFileTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 土建竣工流程
- */
- @ResponseBody
- @RequestMapping(value = "nonPowerEndTask")
- public AjaxJson nonPowerEndTask(Act act, NonPower nonPower) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- String engineering = "";
- if ("yes".equals(act.getFlag())) {
- nonPowerService.updateEnd(nonPower);
- NonPower nonPower1 = nonPowerService.get(nonPower.getId());
- if (nonPower1.getEngineeringAcceptance() == null || "".equals(nonPower1.getEngineeringAcceptance())) {
- j.setSuccess(false);
- j.setMsg("请先填写工程量信息");
- return j;
- }
- engineering = nonPower1.getEngineeringAcceptance();
- if ("是".equals(engineering)) {
- Project user = MyActiviUtils.findTJUser(act.getProcInsId());
- OaNotify oaNotify = new OaNotify();
- oaNotify.setType("4");
- oaNotify.setTitle(nonPower1.getReserveProjectName()+":土建需要验收");
- oaNotify.setStatus("1");
- oaNotify.setContent(nonPower1.getReserveProjectName() + ":土建需要验收");
- oaNotify.setOaNotifyRecordIds(UserUtils.getByUserName(user.getAssignment().getRepUnit()).getId());
- oaNotifyService.save(oaNotify);
- List<OaNotifyRecord> list = oaNotify.getOaNotifyRecordList();
- for (OaNotifyRecord o : list) {
- //发送通知到客户端
- ServletContext context = SpringContextHolder.getBean(ServletContext.class);
- new SystemInfoSocketHandler().sendMessageToUser(UserUtils.get(o.getUser().getId()).getLoginName(), "收到一条新通知,请到我的通知查看!");
- }
- }
- }
- actTaskService.nonPowerEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 土建在线审核流程
- * */
- @ResponseBody
- @RequestMapping(value = "acceptanceTask")
- public AjaxJson acceptanceTask(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.acceptanceTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理判断是否完成土建
- */
- @ResponseBody
- @RequestMapping(value = "reviewNonPower")
- public AjaxJson reviewNonPower(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- //设置土建完成
- // materialModuleService.updateNonPower(act.getProcInsId());
- actTaskService.reviewNonPower(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理判断是否完成电气
- */
- @ResponseBody
- @RequestMapping(value = "reviewElectrical")
- public AjaxJson reviewElectrical(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- //设置土建完成
- // materialModuleService.updateElectrical(act.getProcInsId());
- actTaskService.reviewElectrical(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理判断是否包含涉电工作
- */
- @ResponseBody
- @RequestMapping(value = "managerWhetherTask")
- public AjaxJson managerWhetherTask(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.managerWhetherTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理上传涉电项目开工流程工作
- */
- @ResponseBody
- @RequestMapping(value = "PowerStartTask")
- public AjaxJson PowerStartTask(Act act, String pic, UploadImages uploadImages, MaterialModule materialModule) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("17");
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setReserveProjectName(materialModule.getReserveProjectName());
- uploadImages.setProcInsId(materialModule.getAct().getProcInsId());
- uploadImages.setId("");
- uploadImagesService.save(uploadImages);
- }
- materialModuleService.updateElectricalStart(materialModule);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act = materialModule.getAct();
- act.setComment(comment);
- actTaskService.PowerStartTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 涉电竣工报告
- */
- @ResponseBody
- @RequestMapping(value = "PowerEndTask")
- public AjaxJson PowerEndTask(Act act, String pic, UploadImages uploadImages, MaterialModule materialModule) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("18");
- uploadImages.setUid(UserUtils.getUser().getName());
- uploadImages.setReserveProjectName(materialModule.getReserveProjectName());
- uploadImages.setProcInsId(materialModule.getAct().getProcInsId());
- uploadImages.setId("");
- uploadImagesService.save(uploadImages);
- }
- materialModuleService.updateElectricalEnd(materialModule);
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act = materialModule.getAct();
- act.setComment(comment);
- actTaskService.PowerEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理判断涉电工作
- */
- @ResponseBody
- @RequestMapping(value = "PowerWhetherTask")
- public AjaxJson PowerWhetherTask(Act act,String severalTimes) {
- AjaxJson j = new AjaxJson();
- try {
- //对项目选择二次涉电的时候
- String flag = act.getFlag();
- if ("second".equals(flag)) {
- //获取项目定义号,查询项目信息
- String procInsId = act.getProcInsId();
- Project sgProject = projectService.findSgProject(procInsId);
- sgProject.setArrageProject("0");
- sgProject.setId("");
- sgProject.setSecondPower("1");
- int i = Integer.parseInt(severalTimes);
- i = i + 1;
- String newReserveProjectName = sgProject.getReserveProjectName() + i + "次涉电";
- sgProject.setReserveProjectName(newReserveProjectName);
- //修改
- projectService.insertSgProject(sgProject);
- //跟新项目现有的状态
- materialModuleService.updateSeveralTimes(act.getProcInsId(),i);
- Project project = new Project();
- //查询所有人员信息
- Assignment sgAss = projectService.findSgAss(procInsId);
- sgAss.setReserveProjectName(newReserveProjectName);
- project.setAssignment(sgAss);
- List<Project> insertAsslist = new ArrayList<>();
- insertAsslist.add(project);
- projectService.insertAssList(insertAsslist);
- //查询停电开关信息
- Quantity sgQuantity = projectService.findSgQuantity(procInsId);
- sgQuantity.setReserveProjectName(newReserveProjectName);
- sgQuantity.setId("");
- projectService.insertSgQuantity(sgQuantity);
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.PowerWhetherTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- }
|