|
@@ -0,0 +1,180 @@
|
|
|
+package com.jeeplus.modules.sg.materialmodule.activiti.web;
|
|
|
+
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+import com.jeeplus.common.json.AjaxJson;
|
|
|
+import com.jeeplus.common.utils.DateUtils;
|
|
|
+import com.jeeplus.common.utils.StringUtils;
|
|
|
+import com.jeeplus.common.utils.excel.ExportExcel;
|
|
|
+import com.jeeplus.core.persistence.Page;
|
|
|
+import com.jeeplus.core.web.BaseController;
|
|
|
+import com.jeeplus.modules.act.service.ActProcessService;
|
|
|
+import com.jeeplus.modules.act.service.ActTaskService;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialInventory.entity.MaterialInventory;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialProvided.entity.MaterialProvided;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialProvided.service.MaterialProvidedService;
|
|
|
+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.service.MaterialModuleService;
|
|
|
+import com.jeeplus.modules.sg.picking.activiti.entity.*;
|
|
|
+import com.jeeplus.modules.sg.picking.activiti.service.PickIngService;
|
|
|
+import com.jeeplus.modules.sg.picking.activiti.service.ShowListService;
|
|
|
+import com.jeeplus.modules.sys.entity.DictValue;
|
|
|
+import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import org.activiti.engine.repository.ProcessDefinition;
|
|
|
+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.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Controller
|
|
|
+@RequestMapping(value = "${adminPath}/materialmodule/activiti")
|
|
|
+public class MaterialModuleController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private MaterialModuleService materialModuleService;
|
|
|
+ @Autowired
|
|
|
+ private ActProcessService actProcessService;
|
|
|
+ @Autowired
|
|
|
+ private ActTaskService actTaskService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 施工模块发起页面
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "materialModuleForm")
|
|
|
+ public String materialModuleForm(MaterialModule materialModule, Model model) {
|
|
|
+ model.addAttribute("materialModule", materialModule);
|
|
|
+ return "modules/sg/materialmodule/activiti/materialModuleForm";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "data")
|
|
|
+ public Map<String, Object> data(PickIng pickIng, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
+ Page<PickIng> page = pickIngService.findPage(new Page<PickIng>(request, response), pickIng);
|
|
|
+ return getBootstrapData(page);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ */
|
|
|
+/**
|
|
|
+ * 项目经理审核
|
|
|
+ * 政策处理专职发起项目,交与项目经理审核页面
|
|
|
+ *//*
|
|
|
+
|
|
|
+ @RequestMapping(value = "applicationAudit")
|
|
|
+ public String applicationAudit(PickApplication pickApplication, Model model) {
|
|
|
+ String id = pickApplication.getId();
|
|
|
+ String projectId = showListService.selectProjectId(id);
|
|
|
+ Project project = projectService.get(projectId);
|
|
|
+ model.addAttribute("pickApplication", pickApplication);
|
|
|
+ model.addAttribute("project", project);
|
|
|
+ return "modules/sg/picking/activiti/applicationAudit";
|
|
|
+ }
|
|
|
+
|
|
|
+ */
|
|
|
+/**
|
|
|
+ * 库存对比
|
|
|
+ *//*
|
|
|
+
|
|
|
+ @RequestMapping(value = "inventoryComparison")
|
|
|
+ @RequiresPermissions("picking:activiti:inventoryComparison")
|
|
|
+ public String inventoryComparison(ShowList showList, Model model) {
|
|
|
+ model.addAttribute("showList", showList);
|
|
|
+ return "modules/sg/picking/activiti/inventoryComparison";
|
|
|
+ }
|
|
|
+
|
|
|
+ */
|
|
|
+/**
|
|
|
+ * 导出erp领料单
|
|
|
+ *//*
|
|
|
+
|
|
|
+ @RequiresPermissions("picking:activiti:exportErp")
|
|
|
+ @RequestMapping(value = "exportErp")
|
|
|
+ public String exportErp(Acquisition acquisition, Model model) {
|
|
|
+ model.addAttribute("acquisition", acquisition);
|
|
|
+ return "modules/sg/picking/activiti/exportErp";
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "exportData")
|
|
|
+ public Map<String, Object> exportData(Acquisition acquisition, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
+ Page<Acquisition> page = showListService.acquisitionList(new Page<Acquisition>(request, response), acquisition);
|
|
|
+ List<Acquisition> list = page.getList();
|
|
|
+ for (Acquisition a :list) {
|
|
|
+ a.setTheNumber("第"+a.getTheNumber()+"次领料单");
|
|
|
+ }
|
|
|
+ return getBootstrapData(page);
|
|
|
+ }
|
|
|
+*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 施工流程发起
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "containSave")
|
|
|
+ public AjaxJson save(MaterialModule materialModule, Model model) throws Exception {
|
|
|
+ AjaxJson j = new AjaxJson();
|
|
|
+ /**
|
|
|
+ * 后台hibernate-validation插件校验
|
|
|
+ */
|
|
|
+ String errMsg = beanValidator(materialModule);
|
|
|
+ if (StringUtils.isNotBlank(errMsg)) {
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg(errMsg);
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ String projectId = materialModule.getProjectId();
|
|
|
+ if (projectId == null||"".equals(projectId)) {
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("请选择项目");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 流程审批
|
|
|
+ */
|
|
|
+ if (StringUtils.isBlank(materialModule.getId())) {
|
|
|
+ //保存
|
|
|
+ //修改项目的施工模块状态
|
|
|
+ materialModuleService.save(materialModule);
|
|
|
+ // 启动流程
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ vars.put("manager", UserUtils.getUser().getLoginName());
|
|
|
+ String flag = materialModule.getAct().getFlag();
|
|
|
+ if ("contain".equals(flag)) {
|
|
|
+ vars.put("contain", true);
|
|
|
+ vars.put("notContain", false);
|
|
|
+ vars.put("no", false);
|
|
|
+ } else if ("notContain".equals(flag)) {
|
|
|
+ vars.put("contain", false);
|
|
|
+ vars.put("notContain", true);
|
|
|
+ vars.put("no", false);
|
|
|
+ } else {
|
|
|
+ vars.put("contain", false);
|
|
|
+ vars.put("notContain", false);
|
|
|
+ vars.put("no", true);
|
|
|
+ }
|
|
|
+ ProcessDefinition p = actProcessService.getProcessDefinition(materialModule.getAct().getProcDefId());
|
|
|
+ String title = materialModule.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
|
|
|
+ actTaskService.startProcess(p.getKey(), "sg_construction_process", materialModule.getId(), title, vars);
|
|
|
+ j.setMsg("发起施工流程成功!");
|
|
|
+ j.getBody().put("targetUrl", "/act/task/process/");
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|