Browse Source

流程管理添加文件类型字段

demon 8 years ago
parent
commit
0267f68ea8

+ 6 - 1
src/main/java/com/yihu/hos/system/controller/FlowController.java

@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -90,6 +91,9 @@ public class FlowController extends BaseController {
                flow = new SystemServiceFlow();
                flowClassList = new ArrayList<>();
            }
            if (flowClassList == null){
                flowClassList = new ArrayList<>();
            }
            flow.setFlowClassArray(flowClassList);
            model.addAttribute("model", flow);
            model.addAttribute("flowClass", objectMapper.writeValueAsString(flowClassList));
@ -175,7 +179,8 @@ public class FlowController extends BaseController {
    public Object upload(@RequestParam MultipartFile file,HttpSession session
    ) {
        //TODO 文件地址设置
        String basePath = getServletContext().getRealPath("/") + "upload";
        String basePath = this.getServletContext().getRealPath(File.separator) + File.separator + "upload";
        String path = flowManage.uploadFile(file, basePath);
        if (StringUtils.isEmpty(path)){
            return Result.error("上传失败");

+ 9 - 0
src/main/java/com/yihu/hos/system/model/SystemServiceFlow.java

@ -18,10 +18,19 @@ public class SystemServiceFlow implements java.io.Serializable {
    private String description;
    private Integer valid;
    private Date createDate;
    private String fileType;
    private String flowClassList;
    private List<SystemServiceFlowClass> flowClassArray;
    public String getFileType() {
        return fileType;
    }
    public void setFileType(String fileType) {
        this.fileType = fileType;
    }
    public String getFlowClassList() {
        return flowClassList;
    }

+ 6 - 0
src/main/java/com/yihu/hos/system/service/FlowManager.java

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -53,6 +54,7 @@ public class FlowManager implements IFlowManage {
    @Transactional
    public Result addFlow(SystemServiceFlow obj) throws Exception {
        obj.setCreateDate(new Date());
        flowDao.saveEntity(obj);
        List<SystemServiceFlowClass> flowClassList = obj.getFlowClassArray();
        for (SystemServiceFlowClass flowClass:flowClassList){
@ -73,6 +75,8 @@ public class FlowManager implements IFlowManage {
        flow.setPath(obj.getPath());
        flow.setChart(obj.getChart());
        flow.setValid(obj.getValid());
        flow.setFileType(obj.getFileType());
        List<Integer> classIds = flowClassDao.getFlowClassIds(obj.getId());//原flowclass集合
        List<SystemServiceFlowClass> flowClassList = obj.getFlowClassArray();
        for (SystemServiceFlowClass flowClass:flowClassList){
@ -87,6 +91,8 @@ public class FlowManager implements IFlowManage {
        }
        flowDao.updateEntity(flow);
        //删除判断
        if (classIds !=null && classIds.size()>0){
            for (Integer id:classIds){

+ 5 - 0
src/main/resources/resource/SystemServiceFlow.hbm.xml

@ -44,5 +44,10 @@
                <comment>创建时间</comment>
            </column>
        </property>
        <property name="fileType" type="java.lang.String">
            <column name="file_type" length="50">
                <comment>类型</comment>
            </column>
        </property>
    </class>
</hibernate-mapping>

+ 10 - 8
src/main/webapp/WEB-INF/ehr/jsp/system/flow/editorFlow.jsp

@ -96,14 +96,16 @@
                </div>
            </div>
        </div>
        <%--<div class="m-form-group">--%>
        <%--<label>类别:</label>--%>
        <%--<div class="m-form-control ">--%>
        <%--<div class="l-text">--%>
        <%--<input type="text" id="type"  class="l-text-field required" name="type">--%>
        <%--</div>--%>
        <%--</div>--%>
        <%--</div>--%>
        <div class="m-form-group">
            <label>类别:</label>
            <div class="m-form-control ">
                <div class="l-text">
                    <input type="text" id="fileType"  class="l-text-field required" name="fileType">
                </div>
            </div>
        </div>
        <div class="m-form-group" >
            <label><span class="red"></span></label>
            <div class="m-form-control" id="classDiv">

+ 12 - 11
src/main/webapp/WEB-INF/ehr/jsp/system/flow/editorFlowJs.jsp

@ -24,8 +24,6 @@
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
                debugger
                var icon = $("#iconUrl").attr("data-id");
                if(icon!='' && icon!='undefine'){
                    if(icon!= "${model.chart}"){
@ -40,6 +38,8 @@
                var valid = "${model.valid}";
                liger.get("valid").selectValue(valid);
                var fileType = "${model.fileType}";
                liger.get("fileType").selectValue(fileType);
               data={
                    id: "${model.id}",
                    name: "${model.name}",
@ -47,6 +47,7 @@
                   path: "${model.path}",
                   chart:iconUrl,
                   valid:"${model.valid}",
                   fileType:"${model.fileType}",
                   flowClassList: '${flowClass}',
                   flowClassArray:'${model.flowClassArray}',
                   createDate:'${model.createDate}'
@ -55,7 +56,8 @@
                me.actionUrl = "${contextRoot}/flow/updateFlow";
            }else{
                liger.get("valid").selectValue("1");//默认有效
                liger.get("type").selectValue("route");//默认route
                liger.get("fileType").selectValue("java");//默认java文件类型
//                liger.get("type").selectValue("route");//默认route
            }
            $("#div_info_form").ligerAutoForm({
@ -101,11 +103,9 @@
                }
                var index =newMaxFormIndex();
                if(index==0){index=1;}
                    for (var i = index; i > 0; i--) {
                        me.bindFlowClass(i);
                    }
                for (var i = index; i > 0; i--) {
                    me.bindFlowClass(i);
                }
                var data = $("#div_info_form").ligerAutoForm("getData");
                delete data.file;
@ -143,13 +143,14 @@
                cancelable:false,
                onSuccess:function(data){
                }});
            $("#fileType").ligerComboBox({data : [{"value":"java文件","code":"java"},{"value":"class文件","code":"class"}],
                cancelable:false,
                onSuccess:function(data){
                }});
            /* =====================添加新节点========================= */
            $(".m-form-group").on("click","#btnAddClass",function () {
                var index =newMaxFormIndex();
                if(index>0){
                    index++
                }
                var html = '<div class="flows"  dataIndex="'+index+'" id="paramGroup'+index+'">';
                html += '<div class="m-form-group" dataIndex="'+index+'"  ><label>类别 : </label><div class="m-form-control ">'  +

+ 4 - 3
src/main/webapp/WEB-INF/ehr/jsp/system/flow/flowJs.jsp

@ -32,18 +32,19 @@
                    valid:flowValid
                },
                columns: [
                    {display: '流程名称', id: 'id', name: 'name', width: '40%'},
                    {display: '流程名称', id: 'id', name: 'name', width: '20%'},
                    {display: '文件类型', id: 'fileType', name: 'fileType', width: '20%'},
                    {display: '状态', name: 'valid', width: '20%',align: 'center', render: function (rowdata, rowindex, value) {
                        if(rowdata.valid==1 ){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效  </span></div>';
                        }else if(rowdata.valid==0){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
                            return ' <div style="222;margin-top: 10px;"><span>无效 </span></div>';
                        }
                    }},
                    {
                        display: '操作', name: 'operator', width: '40%', render: function (row) {
                        var html = '<div class="m-inline-buttons" style="width:350px;">';
                        var html = '<div class="m-inline-buttons" style="width:350px;vertical-align:middle;">';
                        html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"flow.showImage('"+row.chart+"')\">查看流程图</a>";
                        html += "<a class=\"m-btn-edit\" onclick=\"flow.editorDialog('"+row.id+"')\"></a>";
                        html += "<a class=\"m-btn-delete\" onclick=\"flow.delete('"+row.id+"')\"></a>";