LAPTOP-KB9HII50\70708 před 2 roky
rodič
revize
0571a8bd1f
16 změnil soubory, kde provedl 224 přidání a 989 odebrání
  1. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/controller/StdRelationController.java
  2. 2 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/BaseDictController.java
  3. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DatasourceController.java
  4. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DictController.java
  5. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/FlowController.java
  6. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/OrgController.java
  7. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ParamController.java
  8. 0 82
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessController.java
  9. 0 133
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessorController.java
  10. 0 111
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/SystemController.java
  11. 0 263
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/UserController.java
  12. 123 123
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DatasourceDao.java
  13. 44 39
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictDao.java
  14. 49 46
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictListDao.java
  15. 0 60
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/UserDao.java
  16. 0 125
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/UserManager.java

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/controller/StdRelationController.java

@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Api(value = "stdRelation", description = "标准关联关系相关")
@Api(value = "stdRelation", tags = "标准关联关系相关")
@RestController("StdRelationController")
public class StdRelationController extends EnvelopRestEndpoint {

+ 2 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/BaseDictController.java

@ -6,16 +6,17 @@ import com.yihu.jw.basic.system.model.SystemDictList;
import com.yihu.jw.basic.system.service.BaseDictManager;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * Created by hzp on 2016/01/11.
 */
@RequestMapping("/basedict")
@RestController
@Api(value = "basedict", tags = "基础字典相关")
public class BaseDictController extends EnvelopRestEndpoint {
    @Autowired

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DatasourceController.java

@ -27,7 +27,7 @@
// * 数据源管理
// */
//@RequestMapping("/datasource")
//@Controller
//@RestController
//public class DatasourceController extends BaseController {
//
//    @Resource(name = Services.Datasource)

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DictController.java

@ -19,7 +19,7 @@
///**
// * Created by chenweida on 2016/1/20.
// */
//@Controller
//@RestController
//@RequestMapping("/dict")
//public class DictController {
//    @Resource(name = DictManager.BEAN_ID)

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/FlowController.java

@ -39,7 +39,7 @@
// * Created at 2016/8/18.
// */
//@RequestMapping("/flow")
//@Controller
//@RestController
//public class FlowController extends BaseController {
//
//    @Resource(name = FlowManager.BEAN_ID)

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/OrgController.java

@ -21,7 +21,7 @@
// * Created by hzp on 2016/1/12.
// */
//@RequestMapping("/org")
//@Controller
//@RestController
//public class OrgController extends BaseController {
//
//    @Resource(name = OrganizationManager.BEAN_ID)

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ParamController.java

@ -23,7 +23,7 @@
// * 系统参数管理
// */
//@RequestMapping("/param")
//@Controller
//@RestController
//public class ParamController extends BaseController {
//    @Resource(name = SystemParamManager.BEAN_ID)
//    private SystemParamManager systemParamManager;

+ 0 - 82
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessController.java

@ -1,82 +0,0 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.service.ProcessManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//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.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//@RequestMapping("/process")
//@Controller
//public class ProcessController  extends BaseController {
//
//    @Autowired
//    private ProcessManager processManager;
//    /**
//     *  流程管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String processInitial(Model model, Integer flowId) {
//        model.addAttribute("flowId", flowId);
//        model.addAttribute("contentPage", "system/process/process");
//        return "partView";
//    }
//
//    @RequestMapping(value = "/getAllEndpoints", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getAllEndpoints(String endpointName) {
//        try {
//            return processManager.getAllEndpoints(endpointName);
//        } catch (Exception e) {
//            return Result.error("查找端点失败");
//        }
//    }
//
//    @RequestMapping(value = "/getAllProcessors", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getAllProcessor(String processorName) {
//        try {
//            return processManager.getAllProcessor(processorName);
//        } catch (Exception e) {
//            return Result.error("查找所有转换器失败");
//        }
//    }
//
//    @RequestMapping(value = "/chart", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getFlowchart(Integer flowId) {
//        try {
//            if (flowId != null) {
//                String flowchart = processManager.getFlowchart(flowId);
//                return Result.success(flowchart);
//            } else {
//                return Result.success("无初始化数据");
//            }
//        } catch (Exception e) {
//            return Result.error("生成业务流程失败");
//        }
//    }
//
//    @RequestMapping(value = "/json", method = RequestMethod.POST)
//    @ResponseBody
//    public Result formatJson(String code, String name, String positionJson, String flowJson) {
//        try {
//            Integer flowId = processManager.generateFlow(code, name, flowJson);
//            if (flowId == null) {
//                return Result.error("生成业务流程失败,请确认流程图是否编辑错误");
//            }
//            processManager.saveProcess(code, name, flowId, positionJson, flowJson);
//
//            return Result.success("生成业务流程成功");
//        } catch (Exception e) {
//            return Result.error("生成业务流程失败");
//        }
//    }
//}

+ 0 - 133
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessorController.java

@ -1,133 +0,0 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemServiceFlowProcessor;
//import com.yihu.hos.system.service.ProcessorManager;
//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.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// *  流程管理
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/12.
// */
//@RequestMapping("/processor")
//@Controller
//public class ProcessorController extends BaseController {
//
//    @Autowired
//    private ProcessorManager processorManager;
//
//    @RequestMapping("/initial")
//    public String processInitial(Model model) {
//        model.addAttribute("contentPage", "system/processor/processor");
//        return "partView";
//    }
//
//    @RequestMapping("/getProcessorList")
//    @ResponseBody
//    public Result getProcessorList(HttpServletRequest request,String name) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            params.put("name", name);
//
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            Result result = processorManager.getProcessorList(params);
//            return result;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//
//    }
//
//    @RequestMapping("/editorProcessor")
//    public String editorAppServicePage(Model model, String id) {
//        try {
//            SystemServiceFlowProcessor serviceFlowProcessor = null;
//            if (id != null && id.length() > 0) {
//                serviceFlowProcessor = processorManager.getProcessorById(id);
//            }  else {
//                serviceFlowProcessor = new SystemServiceFlowProcessor();
//            }
//            model.addAttribute("model", serviceFlowProcessor);
//            model.addAttribute("contentPage", "/system/processor/editorProcessor");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    @RequestMapping("/processorDetail")
//    public String appServiceDetail(Model model, String id) {
//        try {
//            SystemServiceFlowProcessor processor = null;
//            if (id != null && id.length() > 0) {
//                processor = processorManager.getProcessorById(id);
//            }  else {
//                processor = new SystemServiceFlowProcessor();
//            }
//            model.addAttribute("model", processor);
//            model.addAttribute("contentPage", "/system/processor/processorDetail");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    @RequestMapping("addProcessor")
//    @ResponseBody
//    public Result addProcessor(HttpServletRequest request) {
//        try {
//            SystemServiceFlowProcessor obj = new SystemServiceFlowProcessor();
//            BeanUtils.populate(obj, request.getParameterMap());
//            return processorManager.addProcessor(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    @RequestMapping("/deleteProcessor")
//    @ResponseBody
//    public Result deleteProcessor(HttpServletRequest request) {
//
//        try {
//            String id = request.getParameter("id");
//            processorManager.deleteProcessor(id);
//            return Result.success("删除成功!");
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("删除失败!");
//        }
//    }
//
//    @RequestMapping("updateProcessor")
//    @ResponseBody
//    public Result updateProcessor(HttpServletRequest request) {
//        try {
//            SystemServiceFlowProcessor obj = new SystemServiceFlowProcessor();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return processorManager.updateProcessor(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//}

+ 0 - 111
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/SystemController.java

@ -1,111 +0,0 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.service.SystemManager;
//import com.yihu.hos.tenant.model.TenantSession;
//import com.yihu.hos.tenant.service.AuthenticateService;
//import com.yihu.hos.web.framework.constant.ContextAttributes;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.thread.LocalContext;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.util.Map;
//
//
///**
// * 数据采集配置页面
// * Created by hzp on 2015/8/12.
// */
//@RequestMapping("/system")
//@Controller("systemController")
//public class SystemController {
//
//    @Resource(name = SystemManager.BEAN_ID)
//    private SystemManager ehr;
//
//    @Autowired
//    private AuthenticateService authenticateService;
//
//    /**
//     * 判断是否登录
//     *
//     * @return
//     */
//    @RequestMapping("isLogin")
//    @ResponseBody
//    public Result isLogin(HttpServletRequest request, HttpServletResponse response) {
//        try {
//            HttpSession session = request.getSession();
//            Object userInfo = session.getAttribute("userInfo");
//            if (userInfo == null) {
//                //重定向到指定页面
//                response.sendRedirect(request.getContextPath() + "/loginPage");
//                return Result.success("未登录!");
//            }
//            return Result.success("已登录!");
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 登录操作
//     */
//    @RequestMapping(value = "loginAction", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ResponseBody
//    public ActionResult loginAction(HttpServletRequest request, @RequestBody Map<String, Object> params) {
//        try {
//            HttpSession session = request.getSession();
//            String username = params.get("username").toString();
//            String password = params.get("password").toString();
//            return ehr.loginAction(session, username, password);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            ActionResult result = new ActionResult(false, "登录失败!密码错误!");
//            result.setData(ex.getMessage());
//            return result;
//        }
//    }
//
//    /*
//       退出操作
//        */
//    @RequestMapping("logoutAction")
//    @ResponseBody
//    public ActionResult logoutAction(HttpServletRequest request) {
//        try {
//            HttpSession session = request.getSession();
//            String userCode = "";
//            String tenant = "";
//            if (session == null) {
//                tenant = LocalContext.getContext().getAttachment(ContextAttributes.TENANT_NAME);
//            } else {
//                TenantSession tenantSession = (TenantSession) session.getAttribute(ContextAttributes.TENANT_SESSION);
//                if (tenantSession != null) {
//                    userCode = tenantSession.getUserCode();
//                    authenticateService.logout(session);
//                }
//                tenant = tenantSession.getTenant();
//            }
//            session.removeAttribute("userInfo");
//            LocalContext.getContext().removeAttachment(ContextAttributes.TENANT_NAME);
//            ActionResult re = new ActionResult(true, "登出成功!");
//            re.setData(tenant);
//            return re;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return new ActionResult(false, "登出异常!");
//        }
//    }
//
//}

+ 0 - 263
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/UserController.java

@ -1,263 +0,0 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.system.service.UserManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.PKUtil;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpSession;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
///**
// * 用户管理
// * Created by hzp on 2016/01/11.
// */
//@RequestMapping("/user")
//@Controller
//public class UserController extends BaseController {
//    @Resource(name = UserManager.BEAN_ID)
//    private UserManager userManager;
//
//
//    /**
//     * 用户管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String roleInitial(Model model) {
//        model.addAttribute("contentPage", "system/user/user");
//        return "partView";
//    }
//
//    /**
//     * 用户列表
//     *
//     * @param request
//     * @return
//     */
//    @RequestMapping("getUserList")
//    @ResponseBody
//    public Result getUserList(HttpServletRequest request) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            String name = request.getParameter("name");
//            params.put("name", name);
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            return userManager.getUserList(params);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 用户编辑界面
//     */
//    @RequestMapping("editorUser")
//    public String editorUser(Model model, String userId) {
//        try {
//            //是否编辑
//            if (userId != null && userId.length() > 0) {
//                //获取菜单信息
//                SystemUser user = userManager.getUserById(userId);
//                model.addAttribute("model", user);
//                model.addAttribute("userId", userId);
//            }
//            model.addAttribute("contentPage", "system/user/editorUser");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//
//
//    /**
//     * 用户编辑界面
//     */
//    @RequestMapping("roleDistribute")
//    public String roleDistribute(Model model, String userId) {
//        try {
//            //是否编辑
//            if (userId != null && userId.length() > 0) {
//                //获取菜单信息
//                SystemUser user = userManager.getUserById(userId);
//                List<SystemUserRole> userRoles = userManager.getUserRoleByUserId(userId);
//                String roleId = "";
//
//                if(userRoles != null)
//                {
//                    for(SystemUserRole userRole:userRoles)
//                    {
//                        roleId += (StringUtils.isEmpty(roleId)?"":",") + userRole.getRoleId();
//                    }
//                }
//
//                model.addAttribute("roleId", roleId);
//                model.addAttribute("model", user);
//                model.addAttribute("userId", userId);
//            }
//            model.addAttribute("contentPage", "system/user/roleDistribute");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//
//    /**
//     * 新增用户
//     */
//    @RequestMapping("addUser")
//    @ResponseBody
//    public Result addUser(HttpServletRequest request) {
//        try {
//            SystemUser obj = new SystemUser();
//            BeanUtils.populate(obj, request.getParameterMap());
//            String password = request.getParameter("password");
//            String passwordTwo = request.getParameter("passwordTwo");
//            if (!passwordTwo.equals(password)) {
//                throw new Exception("密码不一致");
//            }
//            String saltValu = PKUtil.getUuid();
//            obj.setSaltValue(saltValu);
//            obj.setActivated(SystemUser.ACTIVATED_FORBIDDEN);//未激活
//            obj.setPassword(DigestUtils.md5Hex(password + saltValu));
//            return userManager.addUser(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("新增用户异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改用户
//     */
//    @RequestMapping("updateUser")
//    @ResponseBody
//    public Result updateUser(HttpServletRequest request) {
//        try {
//            SystemUser obj = new SystemUser();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return userManager.updateUser(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改用户异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改菜单状态
//     */
//    @RequestMapping("activityUser")
//    @ResponseBody
//    public Result activityUser(String userid, String flag) {
//        try {
//            return userManager.activityUser(userid, flag);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改菜单状态异常,异常信息:\n"+ex.getMessage());
//
//        }
//    }
//
//    /**
//     * 密码重置
//     */
//    @RequestMapping("resetPassword")
//    @ResponseBody
//    public Result resetPassword(HttpServletRequest request) {
//        try {
//            String userid = request.getParameter("userid");
//            return userManager.resetPassword(userid);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("密码异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//    /**
//     * 修改密码界面
//     */
//    @RequestMapping("renewPassword")
//    public String renewPassword(Model model) {
//        try {
//
//            model.addAttribute("model",null);
//
//            model.addAttribute("contentPage", "system/user/changePassword");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//    /**
//     * 修改密码
//     */
//    @RequestMapping("changePassword")
//    @ResponseBody
//    public Result changePassword(HttpServletRequest request) {
//        try {
//            HttpSession session = request.getSession();
//            String s="username";
//            SystemUser user = (SystemUser) session.getAttribute("userInfo");
//            String oldPassword = request.getParameter("oldPassword");
//
//            userManager.getUserByLoginCode(user.getLoginCode()).getSaltValue();
//            String test= DigestUtils.md5Hex(oldPassword +  userManager.getUserByLoginCode(user.getLoginCode()).getSaltValue());
//            if(!userManager.getUserByLoginCode(user.getLoginCode()).getPassword().equals(test)){
//                return Result.error("旧密码输入错误");
//            }
//            String newPassword = request.getParameter("newPassword");
//           return userManager.changePassword(userManager.getUserByLoginCode(user.getLoginCode()).getId(), newPassword);
//
//
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改密码异常,异常信息:\n"+ex.getMessage());
//
//        }
//    }
//
//    /**
//     * 删除用户
//     */
//    @RequestMapping("deleteUser")
//    @ResponseBody
//    public Result deleteUser(String userid) {
//        try {
//            return userManager.deleteUser(userid);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("用户删除异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//
//    @RequestMapping("/userRoleDistribute")
//    @ResponseBody
//    public Result userRoleDistribute(HttpServletRequest request,String userId,String roleId)
//    {
//        try {
//            return userManager.userRoleDistribute(userId,roleId);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("角色分配异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//}

+ 123 - 123
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DatasourceDao.java

@ -1,123 +1,123 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemDatasource;
//import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
//import com.yihu.jw.basic.standard.model.DataGridResult;
//import org.hibernate.Query;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.util.List;
//import java.util.Map;
//
///**
// * 数据源管理
// * Created by hzp on 2016/1/16.
// */
//@Repository("DatasourceDao")
//public class DatasourceDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "DatasourceDao";
//
//    /**
//     * 测试连接数据源
//     */
//
//    public void testDatasource(String type,String config) throws Exception
//    {
//        String driver = "";
//        switch(type.toLowerCase())
//        {
//            case "mysql"://"MYSQL"
//            {
//                driver = "com.mysql.jdbc.Driver";
//                break;
//            }
//            case "oracle"://ORACLE
//            {
//                driver = "oracle.jdbc.driver.OracleDriver";
//                break;
//            }
//            case "sqlserver"://SQL SERVER
//            {
//                driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
//                break;
//            }
//        }
//
//        Class.forName(driver).newInstance();
//        Connection con = DriverManager.getConnection(config);
//        con.close();
//
//    }
//
//    /**
//     * 获取数据源列表
//     * @return
//     */
//
//    public DataGridResult getDatasource(Map<String, Object> conditionMap, Integer page, Integer pageSize) throws Exception
//    {
//        StringBuilder sb = new StringBuilder();
//        sb.append("from SystemDatasource t where 1=1 ");
//        if (!StringUtils.isEmpty(conditionMap.get("orgId"))) //组织ID
//        {
//            sb.append(" and t.orgId = '" + conditionMap.get("orgId") + "'");
//        }
//        if (!StringUtils.isEmpty(conditionMap.get("type"))) //数据源类型
//        {
//            sb.append(" and t.type = '" + conditionMap.get("type") + "'");
//        }
//        if (!StringUtils.isEmpty(conditionMap.get("name"))) {
//            sb.append(" and t.name like '%" + conditionMap.get("name") + "%'");
//        }
//        return getDataGridResult(sb.toString(),page,pageSize);
//    }
//
//    public List getData() {
//        Query query = getCurrentSession().createQuery("from SystemDatasource t");
//        return query.list();
//    }
//
//    /**
//     * 获取全部数据源列表
//     * @return
//     */
//
//    public DataGridResult getDatasourceByOrg(String orgId) throws Exception
//    {
//        DataGridResult re = new DataGridResult();
//        String sql = "select * from system_datasource";
//        if(orgId!=null&&orgId.length()>0){
//            sql += " where org_id ='"+orgId+"'";
//        }
//
//        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
//        re.setDetailModelList(list);
//
//        return re;
//    }
//
//    /**
//     * 修改数据源状态(暂弃)
//     */
//
//    public void validDatasource(String id,String valid)  throws Exception
//    {
//        String sql = "update system_datasource set activity_Flag='"+valid+"' where Id='"+id+"'";
//        super.execute(sql);
//    }
//
//
//    public List<SystemDatasource> getDatasources(String orgId) throws Exception {
//        String sql = "select * from system_datasource";
//        if(orgId!=null&&orgId.length()>0){
//            sql += " where org_id ='"+orgId+"'";
//        }
//
//        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
//        return list;
//    }
//}
package com.yihu.jw.basic.system.dao;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.DataGridResult;
import com.yihu.jw.basic.system.model.SystemDatasource;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.List;
import java.util.Map;
/**
 * 数据源管理
 * Created by hzp on 2016/1/16.
 */
@Repository("DatasourceDao")
public class DatasourceDao extends SQLGeneralDAO {
    public static final String BEAN_ID = "DatasourceDao";
    /**
     * 测试连接数据源
     */
    public void testDatasource(String type,String config) throws Exception
    {
        String driver = "";
        switch(type.toLowerCase())
        {
            case "mysql"://"MYSQL"
            {
                driver = "com.mysql.jdbc.Driver";
                break;
            }
            case "oracle"://ORACLE
            {
                driver = "oracle.jdbc.driver.OracleDriver";
                break;
            }
            case "sqlserver"://SQL SERVER
            {
                driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
                break;
            }
        }
        Class.forName(driver).newInstance();
        Connection con = DriverManager.getConnection(config);
        con.close();
    }
    /**
     * 获取数据源列表
     * @return
     */
    public DataGridResult getDatasource(Map<String, Object> conditionMap, Integer page, Integer pageSize) throws Exception
    {
        StringBuilder sb = new StringBuilder();
        sb.append("from SystemDatasource t where 1=1 ");
        if (!StringUtils.isEmpty(conditionMap.get("orgId"))) //组织ID
        {
            sb.append(" and t.orgId = '" + conditionMap.get("orgId") + "'");
        }
        if (!StringUtils.isEmpty(conditionMap.get("type"))) //数据源类型
        {
            sb.append(" and t.type = '" + conditionMap.get("type") + "'");
        }
        if (!StringUtils.isEmpty(conditionMap.get("name"))) {
            sb.append(" and t.name like '%" + conditionMap.get("name") + "%'");
        }
        return getDataGridResult(sb.toString(),page,pageSize);
    }
    public List getData() {
        Query query = getCurrentSession().createQuery("from SystemDatasource t");
        return query.list();
    }
    /**
     * 获取全部数据源列表
     * @return
     */
    public DataGridResult getDatasourceByOrg(String orgId) throws Exception
    {
        DataGridResult re = new DataGridResult();
        String sql = "select * from system_datasource";
        if(orgId!=null&&orgId.length()>0){
            sql += " where org_id ='"+orgId+"'";
        }
        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
        re.setDetailModelList(list);
        return re;
    }
    /**
     * 修改数据源状态(暂弃)
     */
    public void validDatasource(String id,String valid)  throws Exception
    {
        String sql = "update system_datasource set activity_Flag='"+valid+"' where Id='"+id+"'";
        super.execute(sql);
    }
    public List<SystemDatasource> getDatasources(String orgId) throws Exception {
        String sql = "select * from system_datasource";
        if(orgId!=null&&orgId.length()>0){
            sql += " where org_id ='"+orgId+"'";
        }
        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
        return list;
    }
}

+ 44 - 39
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.basic.system.dao;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.Result;
import com.yihu.jw.basic.system.model.SystemDict;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
@ -31,22 +32,24 @@ public class DictDao extends SQLGeneralDAO {
    }
   
//    public SystemDict getDictItemByCodeWithOutId(String code, String id) throws Exception  {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.code=? and s.id != ?", code, id);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//    }
//
//
//    public SystemDict getDictItemByCode(String code) throws Exception {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.code=? ", code);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//    }
    public SystemDict getDictItemByCodeWithOutId(String code, String id) throws Exception  {
        String sql = " select  * from system_dict s where s.code='"+code+"' and s.id!='"+id+"'";
        List<SystemDict> sds = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDict.class));
        if (sds != null && sds.size() > 0) {
            return sds.get(0);
        }
        return null;
    }
    public SystemDict getDictItemByCode(String code) throws Exception {
        String sql = " select  * from system_dict s where s.code='"+code+"' ";
        List<SystemDict> sds = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDict.class));
        if (sds != null && sds.size() > 0) {
            return sds.get(0);
        }
        return null;
    }
   
    public void delDictItemByDictName(String dictName) throws Exception
@ -56,28 +59,30 @@ public class DictDao extends SQLGeneralDAO {
        super.execute(sqlStr);
    }
//    public SystemDict getDictIetmValue(String dictName, String code) {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? and s.code = ?", dictName, code);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//
//    }
    public SystemDict getDictIetmValue(String dictName, String code) {
        String sql = " select  * from system_dict s where s.dict_name='"+dictName+"' and  s.code='"+code+"' ";
        List<SystemDict> sds = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDict.class));
        if (sds != null && sds.size() > 0) {
            return sds.get(0);
        }
        return null;
    }
//    public List<SystemDict> getDictEntries(String dictName, String[] codes) {
//        List<SystemDict> sds = null;
//        if(codes != null && codes.length>0){
//            String codeStr = "";
//            for(String code: codes){
//                codeStr+=","+code;
//            }
//            codeStr = codeStr.substring(1,codeStr.length());
//            sds =  (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? and s.code in ("+ codeStr+")" , dictName);
//        }else{
//            sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? ", dictName);
//        }
//        return sds;
//
//    }
    public List<SystemDict> getDictEntries(String dictName, String[] codes) {
        String sql = null;
        if(codes != null && codes.length>0){
            String codeStr = "";
            for(String code: codes){
                codeStr+=","+code;
            }
            codeStr = codeStr.substring(1,codeStr.length());
            sql = " select  * from system_dict s where s.dict_name='"+dictName+"' and  s.code in '"+codeStr+"' ";
        }else{
            sql = " select  * from system_dict s where s.dict_name='"+dictName+"'  ";
        }
        List<SystemDict> sds = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDict.class));
        return sds;
    }
}

+ 49 - 46
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictListDao.java

@ -1,46 +1,49 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemDictList;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/20.
// */
//@Repository("dictListDao")
//public class DictListDao extends SQLGeneralDAO  {
//
//    public static final String BEAN_ID = "dictListDao";
//
//    public Result getDictList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemDictList s where 1=1 ");
//        if (!StringUtils.isEmpty(params.get("name"))) {
//            sb.append(" and  s.chineseName like '%" + params.get("name") + "%' ");
//        }
//        sb.append(" order by dictName desc");
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//
//    public SystemDictList getDitcByName(String dictName) throws Exception {
//        List<SystemDictList> sdl = (List<SystemDictList>) super.hibernateTemplate.find("from SystemDictList s where s.dictName=?", dictName);
//        if (sdl != null && sdl.size() > 0) {
//            return sdl.get(0);
//        }
//        return null;
//    }
//
//
//    public SystemDictList getDitcByNameWithOutId(String dictName, String id) throws Exception {
//        List<SystemDictList> sdl = (List<SystemDictList>) super.hibernateTemplate.find("from SystemDictList s where s.dictName=? and s.id!=?", dictName, id);
//        if (sdl != null && sdl.size() > 0) {
//            return sdl.get(0);
//        }
//        return null;
//    }
//}
package com.yihu.jw.basic.system.dao;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.Result;
import com.yihu.jw.basic.system.model.SystemDictList;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2016/1/20.
 */
@Repository("dictListDao")
public class DictListDao extends SQLGeneralDAO {
    public static final String BEAN_ID = "dictListDao";
    public Result getDictList(Map<String, Object> params) throws Exception {
        StringBuilder sb = new StringBuilder("from SystemDictList s where 1=1 ");
        if (!StringUtils.isEmpty(params.get("name"))) {
            sb.append(" and  s.chineseName like '%" + params.get("name") + "%' ");
        }
        sb.append(" order by dictName desc");
        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
    }
    public SystemDictList getDitcByName(String dictName) throws Exception {
        String sql = " select  * from system_dict_list s where s.dict_name='"+dictName+"'";
        List<SystemDictList> sdl = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDictList.class));
        if (sdl != null && sdl.size() > 0) {
            return sdl.get(0);
        }
        return null;
    }
    public SystemDictList getDitcByNameWithOutId(String dictName, String id) throws Exception {
        String sql = " select  * from system_dict_list s where s.dict_name='"+dictName+"' and s.id!='"+id+"'";
        List<SystemDictList> sdl = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SystemDictList.class));
        if (sdl != null && sdl.size() > 0) {
            return sdl.get(0);
        }
        return null;
    }
}

+ 0 - 60
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/UserDao.java

@ -1,60 +0,0 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Repository("userDao")
//public class UserDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "userDao";
//
//
//    public Result getUserList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemUser t where 1=1  and t.activated != '"+SystemUser.ACTIVATED_DELETE+"'");
//        if (!StringUtils.isEmpty(params.get("name"))) {
//            sb.append(" and t.loginCode like '%" + params.get("name") + "%' ");
//        }
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//
//    public void activityUser(String useid, String flag) throws Exception {
//        String sql = "update System_user set activated='" + flag + "' where Id='" + useid + "'";
//        super.execute(sql);
//    }
//
//
//    public SystemUser getUserByLoginCode(String loginCode) {
//        List<SystemUser> users = (List<SystemUser>) hibernateTemplate.find("from SystemUser s where s.loginCode =? and s.activated!=?", loginCode,SystemUser.ACTIVATED_DELETE);
//        if (users != null && users.size() > 0) {
//            return users.get(0);
//        }
//        return null;
//    }
//
//    public void deleteUserRoleByUserId(String userId) throws Exception
//    {
//        String sql = "delete from system_user_role where user_id ='"+ userId + "'";
//        super.execute(sql);
//    }
//
//    public List<SystemUserRole> getUserRoleByUserId(String userId) throws Exception
//    {
//        List<SystemUserRole> userRolse = (List<SystemUserRole>) hibernateTemplate.find("from SystemUserRole s where s.userId =? ", userId);
//        if (userRolse != null && userRolse.size() > 0) {
//            return userRolse;
//        }
//        return null;
//    }
//
//}

+ 0 - 125
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/UserManager.java

@ -1,125 +0,0 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.dao.UserDao;
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.Result;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Service("UserManager")
//public class UserManager {
//
//    public static final String BEAN_ID = "UserManager";
//
//    @Resource(name = UserDao.BEAN_ID)
//    private UserDao userdao;
//
//
//    public Result getUserList(Map<String, Object> params) throws Exception {
//
//        return userdao.getUserList(params);
//    }
//
//
//    public SystemUser getUserByLoginCode(String loginCode)  {
//        return userdao.getUserByLoginCode(loginCode);
//    }
//
//
//    public SystemUser getUserById(String userid) throws Exception {
//        return userdao.getEntity(SystemUser.class, userid);
//    }
//
//    @Transactional
//    public Result addUser(SystemUser obj) throws Exception {
//        SystemUser user = userdao.getUserByLoginCode(obj.getLoginCode());
//        if (user != null) {
//            throw new Exception("用户名存在");
//        }
//        userdao.saveEntity(obj);
//
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateUser(SystemUser obj) throws Exception {
//        SystemUser systemUser = userdao.getEntity(SystemUser.class, obj.getId());
//        systemUser.setUserBirthday(obj.getUserBirthday());
//        systemUser.setUserName(obj.getUserName());
//        systemUser.setUserWechat(obj.getUserWechat());
//        systemUser.setUserQq(obj.getUserQq());
//        systemUser.setUserEmail(obj.getUserEmail());
//        systemUser.setUserSex(obj.getUserSex());
//        systemUser.setUserMobile(obj.getUserMobile());
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result activityUser(String useid, String flag) throws Exception {
//        try {
//            userdao.activityUser(useid, flag);
//            return new ActionResult(true, "修改成功!");
//        } catch (Exception ex) {
//            return new ActionResult(false, "状态修改失败!");
//        }
//    }
//
//    @Transactional
//    public Result deleteUser(String userid) throws Exception {
//        userdao.activityUser(userid, SystemUser.ACTIVATED_DELETE);
//        return Result.success("删除成功");
//    }
//
//    @Transactional
//    public Result resetPassword(String userid) throws Exception {
//        SystemUser systemUser=userdao.getEntity(SystemUser.class,userid);
//        String saltString=systemUser.getSaltValue();
//        systemUser.setPassword(DigestUtils.md5Hex("111111"+saltString));
//        return Result.success("重置成功");
//    }
//
//    @Transactional
//    public Result changePassword(String userid, String newps) throws Exception {
//        SystemUser systemUser=userdao.getEntity(SystemUser.class,userid);
//        String saltString=systemUser.getSaltValue();
//        systemUser.setPassword(DigestUtils.md5Hex(newps+saltString));
//        return Result.success("密码修改成功");
//    }
//
//    @Transactional
//    public Result userRoleDistribute(String userId,String roleId) throws Exception
//    {
//        userdao.deleteUserRoleByUserId(userId);
//        if(!StringUtils.isEmpty(roleId))
//        {
//            String[] roles = roleId.split(",");
//
//            for(String role:roles)
//            {
//                SystemUserRole userRole = new SystemUserRole();
//                userRole.setUserId(userId);
//                userRole.setRoleId(role);
//
//                userdao.saveEntity(userRole);
//            }
//        }
//
//        return Result.success("角色分配成功");
//    }
//
//    public List<SystemUserRole> getUserRoleByUserId(String userId) throws Exception
//    {
//         return userdao.getUserRoleByUserId(userId);
//    }
//}