123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205 |
- /**
- * 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.materialproject.entity.MaterialProject;
- import com.jeeplus.modules.sg.managementcenter.materialproject.service.MaterialProjectService;
- import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
- 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.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 xmName) 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, xmName);
- 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 engineering(Act act, Construction construction) {
- AjaxJson j = new AjaxJson();
- try {
- Construction construction1 = constructionService.get(construction);
- if (construction1.getQuantity() == null) {
- j.setSuccess(false);
- j.setMsg("请先导入工程量");
- return j;
- }
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- 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 = "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 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.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();
- 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) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("14");
- // 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.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) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("16");
- // 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.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) {
- AjaxJson j = new AjaxJson();
- String comment = null;
- try {
- comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.reElectricalEndTask(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();
- }
- actTaskService.nonPowerEndTask(act,engineering);
- } 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, String imgName, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- //获取当前的流程实例id
- String procInsId = act.getProcInsId();
- //根据项目信息查询计划开工日期
- String projectName = materialModuleService.findProjectName(procInsId);
- Date specificTime = materialModuleService.findSpecificTime(projectName);
- // Project project1 = MyActiviUtils.sgFindUser(procInsId);
- // String[] needUser = {project1.getConstructionUnitManage()};
- // List<String> listUserId = MyActiviUtils.getListUserId(needUser);
- // List<String> userId = materialModuleService.findUserId(listUserId);
- // String stringJoiningTogether = MyActiviUtils.getStringJoiningTogether(userId);
- OaNotify oaNotify = new OaNotify();
- oaNotify.setType("4");
- oaNotify.setTitle("施工验收流程项目计划信息");
- oaNotify.setStatus("1");
- // oaNotify.setOaNotifyRecordIds(stringJoiningTogether);
- if (specificTime == null) {
- //根据流程实例id查询对应的项目信息(如果没有,发送通知,没有该项目计划信息)
- oaNotify.setContent(projectName + ":项目没有对应的计划信息");
- 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(), "收到一条新通知,请到我的通知查看!");
- }
- } else {
- //将计划赶工日期与当前时间比对(则将不符情况以通知形式发送)
- SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
- boolean timeFlag = fmt.format(specificTime).equals(fmt.format(new Date()));
- if (timeFlag == false) {
- oaNotify.setContent(projectName + ":计划时间与实际时间不符");
- 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(), "收到一条新通知,请到我的通知查看!");
- }
- }
- }
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("17");
- // 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.PowerStartTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 施工单位项目经理上传涉电项目竣工流程工作
- */
- @ResponseBody
- @RequestMapping(value = "PowerEndTask")
- public AjaxJson PowerEndTask(Act act, String pic, UploadImages uploadImages) {
- AjaxJson j = new AjaxJson();
- try {
- if (pic != null && pic != "") {
- uploadImages.setPath(pic);
- // uploadImages.setProcInsId(act.getProcInsId());
- uploadImages.setImgName("18");
- // 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.PowerEndTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- /**
- * 配网项目经理判断涉电工作
- */
- @ResponseBody
- @RequestMapping(value = "PowerWhetherTask")
- public AjaxJson PowerWhetherTask(Act act) {
- AjaxJson j = new AjaxJson();
- try {
- //对项目选择二次涉电的时候
- String flag = act.getFlag();
- if ("second".equals(flag)) {
- //获取项目定义号,查询项目信息
- String projectName = materialModuleService.findProjectName(act.getProcInsId());
- ConstructionProject project = materialModuleService.findProject(projectName);
- if (project == null) {
- //没有,不允许发起二次涉电
- j.setSuccess(false);
- j.setMsg("没有该项目的计划信息,无法发起二次涉电");
- return j;
- } else {
- //如果有,记录数据,保存数据在项目名称后加入二次涉电插入项目库
- String projectName1 = project.getProjectName();
- project.setProjectName(projectName1 + "二次涉电");
- project.setProjectStatus("0");
- materialModuleService.conProject(project);
- }
- }
- materialModuleService.updatePower(act.getProcInsId());
- String comment = URLDecoder.decode(act.getComment(), "UTF-8");
- act.setComment(comment);
- actTaskService.PowerWhetherTask(act);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- j.setMsg("审批成功");
- return j;
- }
- }
|