Преглед изворни кода

施工流程实体类,mapper,service,controller,jsp页面,js文件

yue пре 5 година
родитељ
комит
99ebebc001

+ 14 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/ProjectController.java

@@ -146,6 +146,20 @@ public class ProjectController extends BaseController {
 	}
 
 	/**
+	 * 施工模块项目选择框
+	 * */
+	@ResponseBody
+	@RequestMapping(value = "materialDataPicking")
+	public Map<String, Object> materialDataPicking(Project project, HttpServletRequest request, HttpServletResponse response, Model model) {
+		//完成领料状态
+		project.setAcquisitionStatus("2");
+		//运行提前施工
+		project.setPreConstruction(1);
+		Page<Project> page = projectService.findPage(new Page<Project>(request, response), project);
+		return getBootstrapData(page);
+	}
+
+	/**
 	 * 提前施工项目选择
 	 * */
 	@ResponseBody

+ 61 - 0
src/main/java/com/jeeplus/modules/sg/materialmodule/activiti/entity/MaterialModule.java

@@ -0,0 +1,61 @@
+package com.jeeplus.modules.sg.materialmodule.activiti.entity;
+
+import com.jeeplus.core.persistence.ActEntity;
+
+import java.util.Date;
+
+public class MaterialModule extends ActEntity<MaterialModule> {
+    private static final long serialVersionUID = 1L;
+    // 流程实例编号
+    private String procInsId;
+    // 申请人
+    private String userName;
+    // 项目号
+    private String projectId;
+    // 项目名称
+    private String projectName;
+    // 手动填写的项目类型,包含非涉电项目才会有项目类型
+    private Date projectType;
+
+    @Override
+    public String getProcInsId() {
+        return procInsId;
+    }
+
+    @Override
+    public void setProcInsId(String procInsId) {
+        this.procInsId = procInsId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public Date getProjectType() {
+        return projectType;
+    }
+
+    public void setProjectType(Date projectType) {
+        this.projectType = projectType;
+    }
+}

+ 39 - 0
src/main/java/com/jeeplus/modules/sg/materialmodule/activiti/service/MaterialModuleService.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.materialmodule.activiti.service;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.core.service.CrudService;
+import com.jeeplus.modules.sg.advence.activiti.entity.Advance;
+import com.jeeplus.modules.sg.advence.activiti.mapper.AdvanceMapper;
+import com.jeeplus.modules.sg.materialmodule.activiti.entity.MaterialModule;
+import com.jeeplus.modules.sg.materialmodule.activiti.mapper.MaterialModuleMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 请假表单Service
+ * @author lgf
+ * @version 2018-06-12
+ */
+@Service
+@Transactional(readOnly = true)
+public class MaterialModuleService extends CrudService<MaterialModuleMapper, MaterialModule> {
+    @Autowired
+	private MaterialModuleMapper materialModuleMapper;
+
+	public MaterialModule get(String id) {
+		MaterialModule materialModule = super.get(id);
+		return materialModule;
+	}
+
+	@Override
+	public void save(MaterialModule entity) {
+		String projectId = entity.getProjectId();
+		super.save(entity);
+	}
+}

+ 180 - 0
src/main/java/com/jeeplus/modules/sg/materialmodule/activiti/web/MaterialModuleController.java

@@ -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;
+    }
+}
+
+

+ 53 - 0
src/main/webapp/webpage/modules/sg/materialmodule/activiti/materialModuleForm.js

@@ -14,6 +14,59 @@
 			}
 		});
 
+		//包含非涉电项目,需填写项目类型
+		$("#contain").click(function () {
+			var projectType = $("#projectType").val();
+			if (projectType == "") {
+				alert("请正确填写项目类型");
+			} else {
+				jp.prompt("包含非涉电工作", function (message) {
+					jp.post("${ctx}/act/task/constructionLeader",
+					{
+						"projectType": projectType,
+						"flag":"contain",
+						"comment":window.encodeURI(message)
+					},
+					function (data) {
+						if(data.success){
+							jp.success(data.msg);
+							jp.go("${ctx}/act/task/todo")
+						}
+					})
+				});
+			}
+		})
+
+		$("#notContain").click(function () {
+			jp.post("${ctx}///",
+			{
+				"projectType": projectType,
+				"flag":"notContain",
+				"comment":window.encodeURI(message)
+			},
+			function (data) {
+				if(data.success){
+					jp.success(data.msg);
+					jp.go("${ctx}/act/task/todo")
+				}
+			})
+		})
+
+		$("#no").click(function () {
+			jp.post("${ctx}///",
+			{
+				"projectType": projectType,
+				"flag":"no",
+				"comment":window.encodeURI(message)
+			},
+			function (data) {
+				if(data.success){
+					jp.success(data.msg);
+					jp.go("${ctx}/act/task/todo")
+				}
+			})
+		})
+
 		$('#acceptDate').datetimepicker({
 			format: "YYYY-MM-DD HH:mm:ss"
 		});

+ 18 - 13
src/main/webapp/webpage/modules/sg/materialmodule/activiti/materialModuleForm.jsp

@@ -2,7 +2,7 @@
 <%@ include file="/webpage/include/taglib.jsp"%>
 <html>
 <head>
-	<title>施工模块申请</title>
+	<title>施工模块项目发起流程</title>
 	<meta name="decorator" content="ani"/>
 	<!-- SUMMERNOTE -->
 	<%@include file="/webpage/include/summernote.jsp" %>
@@ -21,14 +21,7 @@
 				</div>
 				<div class="panel-body">
 
-					<form:form id="inputForm" modelAttribute="showList" action="${ctx}/picking/activiti/save" method="post" class="form-horizontal">
-						<form:hidden path="id"/>
-						<form:hidden path="act.taskId"/>
-						<form:hidden path="act.taskName"/>
-						<form:hidden path="act.taskDefKey"/>
-						<form:hidden path="act.procInsId"/>
-						<form:hidden path="act.procDefId"/>
-						<form:hidden id="flag" path="act.flag" />
+					<form:form id="inputForm" modelAttribute="materialModule" action="${ctx}/picking/activiti/save" method="post" class="form-horizontal">
 						<div class="form-group text-center">
 							<h3> 领料申请</h3>
 						</div>
@@ -37,16 +30,17 @@
 							<tr>
 								<td class="width-15 active"><label class="pull-right"><font color="red">*</font>项目名称:</label></td>
 								<td class="width-35">
-									<sys:itemselect url="${ctx}/sg/managementcenter/project/dataPicking" id="project" name="projectId" value="${showList.projectName}" labelName="project.requireName" labelValue="${showList.projectName}"
+									<sys:itemselect url="${ctx}/sg/managementcenter/project/materialDataPicking" id="project" name="projectId" value="${showList.projectName}" labelName="project.requireName" labelValue="${showList.projectName}"
 													title="选择项目号" cssClass="form-control " fieldLabels="${fns:urlEncode('项目需求名称|工程编号|项目名称|项目定义号')}" fieldKeys="requireName|projecId|projectName|projectNumber" searchLabels="${fns:urlEncode('项目需求名称')}" searchKeys="requireName"  isMultiSelected="false"></sys:itemselect>
 								</td>
 							</tr>
 							<tr>
+								<td class="width-15 active">填写项目类型</td>
+								<td class="width-35"><input class="form-control" type="text" id="projectType"/></td>
 							</tr>
 							</tbody>
 						</table>
-
-						<div class="form-group">
+						<%--<div class="form-group">
 							<div class="col-lg-3"></div>
 								<div class="col-lg-6">
 									<div class="form-group text-center">
@@ -55,8 +49,19 @@
 										</div>
 									</div>
 								</div>
-						</div>
+						</div>--%>
 					</form:form>
+
+					<div class="row">
+						<div class="col-sm-3"></div>
+						<div class="col-sm-6">
+							<div class="form-group text-center">
+								<input id="contain" class="btn  btn-primary btn-lg btn-parsley" type="submit" value="包含非涉电工作" />&nbsp;
+								<input id="notContain" class="btn  btn-primary btn-lg btn-parsley" type="submit" value="不包含非涉电工作,包含涉电工作" />&nbsp;
+								<input id="no" class="btn  btn-primary btn-lg btn-parsley" type="submit" value="不包含非涉电工作,不包含涉电工作" />
+							</div>
+						</div>
+					</div>
 					<c:if test="${not empty showList.id}">
 						<act:flowChart procInsId="${showList.act.procInsId}"/>
 						<act:histoicFlow procInsId="${showList.act.procInsId}" />