|
@@ -1,12 +1,18 @@
|
|
|
package com.sooka.web.controller.system;
|
|
|
|
|
|
+import com.business.zhsq_qk.ksh.controller.ZhsqKshController;
|
|
|
+import com.business.zhsq_qk.ksh.service.IZhsqKshService;
|
|
|
+import com.business.zhsq_qk.zhcx.service.IZhsqZhcxService;
|
|
|
import com.sooka.common.core.controller.BaseController;
|
|
|
import com.sooka.common.core.domain.AjaxResult;
|
|
|
import com.sooka.common.utils.ServletUtils;
|
|
|
import com.sooka.common.utils.StringUtils;
|
|
|
import com.sooka.framework.util.ShiroUtils;
|
|
|
+import com.sooka.system.domain.SysDept;
|
|
|
import com.sooka.system.domain.SysRole;
|
|
|
import com.sooka.system.domain.SysUser;
|
|
|
+import com.sooka.system.mapper.SysDeptMapper;
|
|
|
+import com.sooka.system.service.ISysConfigService;
|
|
|
import com.sooka.system.service.ISysUserService;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authc.AuthenticationException;
|
|
@@ -14,10 +20,13 @@ import org.apache.shiro.authc.UsernamePasswordToken;
|
|
|
import org.apache.shiro.subject.Subject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
@@ -33,6 +42,9 @@ public class SysLoginController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysUserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZhsqKshController kshController;
|
|
|
+
|
|
|
|
|
|
@GetMapping("/login")
|
|
|
public String login(HttpServletRequest request, HttpServletResponse response)
|
|
@@ -77,9 +89,79 @@ public class SysLoginController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/login/{username}/{password}")
|
|
|
+ public String getLogin(@PathVariable("username") String username, @PathVariable("password")String password,ModelMap modelMap)
|
|
|
+ {
|
|
|
+ UsernamePasswordToken token = new UsernamePasswordToken(username, password, false);
|
|
|
+ Subject subject = SecurityUtils.getSubject();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ subject.login(token);
|
|
|
+ AjaxResult success=AjaxResult.success();
|
|
|
+ SysUser sysuser = ShiroUtils.getSysUser();
|
|
|
+ boolean isAdmin = sysuser.getDept().getParentId() == 0;
|
|
|
+ if(isAdmin||sysuser.getDept().getPostId()==5){
|
|
|
+ success.put("perFlag","zhzx");//人员身份为管理员或指挥中心
|
|
|
+ }else if(sysuser.getDept().getPostId()==7){
|
|
|
+ //街道登录查询所有社区
|
|
|
+ success.put("perFlag","jd");//人员身份为管理员或指挥中心
|
|
|
+ }
|
|
|
+ return ksh(modelMap);
|
|
|
+ }
|
|
|
+ catch (AuthenticationException e)
|
|
|
+ {
|
|
|
+ String msg = "用户或密码错误";
|
|
|
+ if (StringUtils.isNotEmpty(e.getMessage()))
|
|
|
+ {
|
|
|
+ msg = e.getMessage();
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/unauth")
|
|
|
public String unauth()
|
|
|
{
|
|
|
return "error/unauth";
|
|
|
}
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SysDeptMapper deptMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IZhsqZhcxService zhsqZhcxService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;//获取系统参数配置,超图用
|
|
|
+
|
|
|
+ private String prefix = "zhsq_qk/ksh";
|
|
|
+
|
|
|
+ public String ksh(ModelMap mmap){
|
|
|
+ SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
+ getMapMmap(mmap);
|
|
|
+ boolean isAdmin = sysUser.getDept().getParentId() == 0;
|
|
|
+ if(isAdmin||sysUser.getDept().getPostId()==5){
|
|
|
+ mmap.put("perFlag","zhzx");//人员身份为管理员或指挥中心
|
|
|
+ mmap.put("jdId","0");
|
|
|
+ }else if(sysUser.getDept().getPostId()==7){
|
|
|
+ //街道登录查询所有社区
|
|
|
+ mmap.put("perFlag","jd");
|
|
|
+ mmap.put("jdId",sysUser.getDept().getParentId());
|
|
|
+ SysDept sysDept = deptMapper.selectDeptById(ShiroUtils.getSysUser().getDept().getDeptId());
|
|
|
+ mmap.put("layerId", sysDept.getLayerId());//图层ID
|
|
|
+ mmap.put("centerpointLon", sysDept.getCenterpointLon());//图层中心点(经度)
|
|
|
+ mmap.put("centerpointLat", sysDept.getCenterpointLat());//图层中心点(纬度)
|
|
|
+ }
|
|
|
+ mmap.put("loginName", ShiroUtils.getLoginName());//当前登录人
|
|
|
+ zhsqZhcxService.injectCommunity(mmap);
|
|
|
+ return prefix + "/ksh";
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getMapMmap(ModelMap mmap) {
|
|
|
+ mmap.put("iServerMap", configService.selectConfigByKey("superMap.iServer"));//超图服务
|
|
|
+ mmap.put("iServerJilinshengAndQikaiMap", configService.selectConfigByKey("superMap.iServer.JilinshengAndQikai.map"));//省矢量及区影像服务路径
|
|
|
+ mmap.put("iServerJieDaoSheQuMap", configService.selectConfigByKey("superMap.iServer.jiedaoshequ.map"));//街道社区地图
|
|
|
+ mmap.put("iServerqiKaiQuMapCenterPoint", configService.selectConfigByKey("superMap.iServer.qiKaiQu.map.centerPoint"));//汽开区中心点
|
|
|
+ mmap.put("iServerJieDaoSheQuData", configService.selectConfigByKey("superMap.iServer.jiedaoshequ.data"));//街道社区数据源
|
|
|
+ }
|
|
|
}
|