actAction.java 5.07 KB
Newer Older
罗绍泽 committed
1 2 3 4 5 6
package com.gaowj.procdefinitionmodels.action;

import java.util.List;
import java.util.Map;

import com.gaowj.business.ProcdefinitionBusiness;
7
import com.gaowj.business.ProcdefinitionmodelsBusiness;
罗绍泽 committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
import com.gaowj.business.StudentBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status;

import net.sf.json.JSONObject;

public class actAction extends BasicAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1559759499504671708L;

	private JSONObject jsonObject = new JSONObject();

	public JSONObject getJsonObject() {
		return jsonObject;
	}

	public void setJsonObject(JSONObject jsonObject) {
		this.jsonObject = jsonObject;
	}

	/**
	 * 插入
	 * 
	 * @param entity
	 * @throws BusinessException
	 */
42 43
	public String insertProcdefinitionmodels() throws BusinessException {
		ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
罗绍泽 committed
44 45 46 47 48 49 50 51
		Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
		
		jsonObject = new JSONObject();
		try {
			entity = QueryParamUtil.StringToDate(entity);
			//去除不要更新的字段
			entity.remove("OPETYPE");
			//新增
52
			Map<String,Object> procdefinitionmodels=business.insert_procde_finition_models(entity);
罗绍泽 committed
53 54 55
			// 操作日志
			//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
			SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
56 57
				sysbusiness.insert_logBusiness("insertProcdefinitionmodels", "" + procdefinitionmodels,
						"增加流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
罗绍泽 committed
58 59 60 61 62 63 64 65 66 67
			//	
			//
			jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
		} catch (Exception e) {
			jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
			e.printStackTrace();
		}
		return "json";
	}
	
68 69
	public String updateProcdefinitionmodels() throws BusinessException {
		ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
罗绍泽 committed
70 71 72 73 74 75 76 77
		Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
		
		jsonObject = new JSONObject();
		try {
			entity = QueryParamUtil.StringToDate(entity);
			//去除不要更新的字段
			entity.remove("OPETYPE");
			//新增
78
			business.update_procde_finition_models(entity);
罗绍泽 committed
79 80 81
			// 操作日志
			//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
			SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
82 83
				sysbusiness.insert_logBusiness("updateProcdefinitionmodels", "" + entity,
						"修改流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
罗绍泽 committed
84 85 86 87 88 89 90 91 92 93
			//	
			//
			jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
		} catch (Exception e) {
			jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
			e.printStackTrace();
		}
		return "json";
	}
	
94 95
	public String deleteProcdefinitionmodels() throws BusinessException {
		ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
罗绍泽 committed
96 97 98 99 100
		Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
		String deletekey = (String) entity.get("CODE");
		List<String> ListKey = QueryParamUtil.StringToList(deletekey);
		
		try {
101
			business.delete_procde_finition_models(ListKey);
罗绍泽 committed
102 103
			// 操作日志
			SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
104 105
			sysbusiness.insert_logBusiness("deleteProcdefinitionmodels", "" + ListKey,
					"删除流程定义模板数据", deletekey, "多个流水号","procdefinitionmodels");
罗绍泽 committed
106 107 108 109 110 111 112 113 114
			//
			
			jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
		} catch (Exception e) {
			jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
			e.printStackTrace();
		}
		return "json";
	}
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
	
	public String deploy() throws BusinessException {
		ProcdefinitionmodelsBusiness business = BusinessManager.getBusiness(ProcdefinitionmodelsBusiness.class);
		Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
		
		try {
			business.deploy(entity);
			// 操作日志
			SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
			sysbusiness.insert_logBusiness("deploy", "" + entity,
					"部署流程定义模板数据", (String) entity.get("UUID"), (String) entity.get("CONTENT"), "procdefinitionmodels");
			//
			
			jsonObject.putAll(Status.getStatusSuccessMessage("部署成功"));
		} catch (Exception e) {
			jsonObject.putAll(Status.getStatusErrorMessage("部署失败"));
			e.printStackTrace();
		}
		return "json";
	}
罗绍泽 committed
135 136

}