|
@@ -1,119 +0,0 @@
|
|
|
-package com.lsw.controller.admin.work.process;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.jfinal.json.FastJson;
|
|
|
-import com.jfinal.kit.JsonKit;
|
|
|
-import com.jfinal.plugin.activerecord.Db;
|
|
|
-import com.jfinal.plugin.activerecord.Page;
|
|
|
-import com.lsw.base.BaseController;
|
|
|
-import com.lsw.model.Apply;
|
|
|
-import com.lsw.model.Process;
|
|
|
-import com.lsw.model.Role;
|
|
|
-import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author 李书文
|
|
|
- * @description 平台常量管理
|
|
|
- */
|
|
|
-public class ProcessController extends BaseController {
|
|
|
-
|
|
|
- /**
|
|
|
- * 管理页面
|
|
|
- */
|
|
|
- @RequiresPermissions("process:list")
|
|
|
- public void list() {
|
|
|
- render("list.html");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取流程json数据
|
|
|
- */
|
|
|
- public void jsonList() {
|
|
|
- Page<Process> pgaeList = Process.dao.jsonList(getPage(), getRows(), getPara("name"), getSidx(), getSord());
|
|
|
- for (Process p : pgaeList.getList()) {
|
|
|
- System.out.println(p.getId());
|
|
|
- List<Process> lists = Process.dao.find("select * from tb_process where pId=? order by id asc", p.getId());
|
|
|
- p.put("lists", lists);
|
|
|
-
|
|
|
- }
|
|
|
- renderJson(getPage(pgaeList));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 视图页面
|
|
|
- */
|
|
|
- public void view() {
|
|
|
- String op = getPara("op");
|
|
|
- setAttr("op", op);
|
|
|
- if (op.equals("add")) {
|
|
|
- render("form.html");
|
|
|
- }
|
|
|
- if (op.equals("edit")) {
|
|
|
- Process process = Process.dao.findById(getPara("id"));
|
|
|
- List<Process> step_list = Process.dao.find("SELECT * FROM tb_process WHERE pId=?", process.getId());
|
|
|
- setAttr("process", JsonKit.toJson(process));
|
|
|
- setAttr("step_list", JsonKit.toJson(step_list));
|
|
|
- render("form.html");
|
|
|
- }
|
|
|
- if (op.equals("choice")) {
|
|
|
- List<Role> role_list = Role.dao.find("select * from sys_role");
|
|
|
- setAttr("role_list", role_list);
|
|
|
- render("choice.html");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加流程
|
|
|
- */
|
|
|
- @RequiresPermissions("process:add")
|
|
|
- public void add() {
|
|
|
- Process process = FastJson.getJson().parse(getPara("process"), Process.class);
|
|
|
- process.save();
|
|
|
- JSONArray step_list = JSON.parseArray(getPara("step_list"));
|
|
|
- for (int i = 0; i < step_list.size(); i++) {
|
|
|
- JSONObject object = step_list.getJSONObject(i);
|
|
|
- Process p = new Process();
|
|
|
- p.setPId(process.getId());
|
|
|
- p.setName(object.getString("name"));
|
|
|
- p.setSteps(i + 1);
|
|
|
- p.setApproval(object.getString("approval"));
|
|
|
- p.save();
|
|
|
- }
|
|
|
- renderSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑流程
|
|
|
- */
|
|
|
- @RequiresPermissions("process:edit")
|
|
|
- public void edit() {
|
|
|
- Process process = FastJson.getJson().parse(getPara("process"), Process.class);
|
|
|
- process.update();
|
|
|
- Db.update("delete from tb_process where pId=?", process.getId());
|
|
|
- JSONArray step_list = JSON.parseArray(getPara("step_list"));
|
|
|
- for (int i = 0; i < step_list.size(); i++) {
|
|
|
- JSONObject object = step_list.getJSONObject(i);
|
|
|
- Process step = new Process();
|
|
|
- step.setPId(process.getId());
|
|
|
- step.setName(object.getString("name"));
|
|
|
- step.setSteps(i + 1);
|
|
|
- step.setApproval(object.getString("approval"));
|
|
|
- step.save();
|
|
|
- }
|
|
|
- renderSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除
|
|
|
- */
|
|
|
- @RequiresPermissions("process:delete")
|
|
|
- public void delete() {
|
|
|
- Db.update("delete from tb_process where id in(" + getPara("ids") + ")");
|
|
|
- renderSuccess();
|
|
|
- }
|
|
|
-}
|