123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- package com.yihu.hos.system.controller;
- import com.yihu.hos.core.datatype.StringUtil;
- import com.yihu.hos.system.model.SystemOrganization;
- import com.yihu.hos.system.service.OrganizationManager;
- import com.yihu.hos.web.framework.model.Result;
- import com.yihu.hos.web.framework.util.controller.BaseController;
- import org.apache.commons.beanutils.BeanUtils;
- 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.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * 机构管理
- * Created by hzp on 2016/1/12.
- */
- @RequestMapping("/org")
- @Controller
- public class OrgController extends BaseController {
- @Resource(name = OrganizationManager.BEAN_ID)
- private OrganizationManager organization;
- /**
- * 组织管理界面
- * @param model
- * @return
- */
- @RequestMapping("initial")
- public String organization(Model model) {
- model.addAttribute("contentPage","system/org/organization");
- return "partView";
- }
- /**
- * 组织编辑界面
- */
- @RequestMapping("editorOrganization")
- public String editorOrganization(Model model,String orgId) {
- try {
- //是否编辑
- if (orgId != null && orgId.length() > 0) {
- //获取机构信息
- SystemOrganization org = organization.getOrgById(orgId);
- model.addAttribute("model", org);
- }
- model.addAttribute("contentPage", "system/org/editorOrganization");
- return "pageView";
- } catch (Exception ex) {
- model.addAttribute("contentPage", "organization/editorOrganization");
- return "pageView";
- }
- }
- /**
- * 获取组织列表
- */
- @RequestMapping("getOrgList")
- @ResponseBody
- public Result getOrgList(String pid,String name,String activityFlag,Integer page, Integer rows) {
- try {
- Map<String, Object> map = new HashMap<>();
- map.put("pid", pid);
- map.put("name", name);
- map.put("activityFlag", activityFlag);
- return organization.getOrgList(map, page, rows);
- }
- catch (Exception ex)
- {
- return Result.error(ex.getMessage());
- }
- }
- /**
- * 新增组织
- */
- @RequestMapping("addOrg")
- @ResponseBody
- public Result addOrg(HttpServletRequest request) {
- try {
- SystemOrganization obj = new SystemOrganization();
- BeanUtils.populate(obj, request.getParameterMap());
- obj.setActivityFlag("1");
- return organization.addOrg(obj);
- }
- catch(Exception ex)
- {
- return Result.error(ex.getMessage());
- }
- }
- /**
- * 修改组织
- */
- @RequestMapping("updateOrg")
- @ResponseBody
- public Result updateOrg(HttpServletRequest request) {
- try {
- SystemOrganization obj = new SystemOrganization();
- BeanUtils.populate(obj, request.getParameterMap());
- if(!StringUtil.isEmpty(obj.getSettledWay()))
- {
- obj.setSettled("1");
- }
- else{
- obj.setSettled("0");
- }
- return organization.updateOrg(obj);
- }
- catch (Exception ex)
- {
- return Result.error(ex.getMessage());
- }
- }
- /**
- * 删除组织
- */
- @RequestMapping("deleteOrg")
- @ResponseBody
- public Result deleteOrg(String orgId) {
- try {
- return organization.deleteOrg(orgId);
- }
- catch (Exception ex)
- {
- return Result.error(ex.getMessage());
- }
- }
- /**
- * 修改组织状态
- *//*
- @RequestMapping("activityOrg")
- @ResponseBody
- public Result activityOrg(String orgId,String activityFlag) {
- try {
- return organization.activityOrg(orgId,activityFlag);
- }
- catch (Exception ex)
- {
- return Result.error(ex.getMessage());
- }
- }*/
- }
|