Browse Source

提交用户登录

v2
chenrui 2 years ago
parent
commit
d858d573e3
  1. 7
      lib/EmergencyBaseLib/EmergencyCommonmDatascope/src/main/java/com/zdxt/common/datascope/aspect/DataScopeAspect.java
  2. 14
      lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java
  3. 68
      lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppXzjcjbxx025711Controller.java
  4. 1
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/controller/LoginController.java
  5. 9
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/domain/LoginDTO.java
  6. 2
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/UserMapper.xml
  7. 16
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/user.html
  8. 8
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/Xzjcjbxx025711Controller.java
  9. 2
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalServiceImpl.java
  10. 6
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/ZwSmsClient.java
  11. 1
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml
  12. 32
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalMapper.xml

7
lib/EmergencyBaseLib/EmergencyCommonmDatascope/src/main/java/com/zdxt/common/datascope/aspect/DataScopeAspect.java

@ -30,6 +30,7 @@ import java.util.Map;
@Aspect @Aspect
@Component @Component
public class DataScopeAspect { public class DataScopeAspect {
/** /**
* 全部数据权限 * 全部数据权限
*/ */
@ -79,6 +80,8 @@ public class DataScopeAspect {
// Object cacheKeys = redisCache.getCacheObject("shiro:session:"+id); // Object cacheKeys = redisCache.getCacheObject("shiro:session:"+id);
// SimpleSession simpleSession = (SimpleSession) new ObjectSerializer().deserialize(redisManager.get(new StringSerializer().serialize(cacheKey))); // SimpleSession simpleSession = (SimpleSession) new ObjectSerializer().deserialize(redisManager.get(new StringSerializer().serialize(cacheKey)));
// Object obj = simpleSession.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); // Object obj = simpleSession.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
System.out.println("进入注解权限");
String id = ServletUtils.getRequest().getSession().getId(); String id = ServletUtils.getRequest().getSession().getId();
Object cacheKeys = cacheService.getCacheValue("shiro:session:"+id); Object cacheKeys = cacheService.getCacheValue("shiro:session:"+id);
// 获得注解 // 获得注解
@ -93,7 +96,9 @@ public class DataScopeAspect {
controllerDataScope.userAlias()); controllerDataScope.userAlias());
} }
}else{ }else{
String userId = ServletUtils.getRequest().getParameter("dataScopeId");//APP如果要走数据权限必须传入这个值 String userId = ServletUtils.getRequest().getParameter("dataScopeId");//APP如果要走数据权限必须传入这个值
System.out.println("APP权限userId------------:" +userId);
Object redisKeys = redisCache.getCacheObject("shiro:app:"+userId); Object redisKeys = redisCache.getCacheObject("shiro:app:"+userId);
if (null != redisKeys && redisKeys instanceof User){ if (null != redisKeys && redisKeys instanceof User){
User appUser = (User) redisKeys; User appUser = (User) redisKeys;
@ -124,7 +129,7 @@ public class DataScopeAspect {
public static void dataScopeFilter(JoinPoint joinPoint, User user, String deptAlias, String userAlias) { public static void dataScopeFilter(JoinPoint joinPoint, User user, String deptAlias, String userAlias) {
StringBuilder sqlString = new StringBuilder(); StringBuilder sqlString = new StringBuilder();
for (Role role : user.getRoles()) { for (Role role : user.getRoles()) {
String dataScope = role.getDataScope(); String dataScope = role.getDataScope();
if (DATA_SCOPE_ALL.equals(dataScope)) { if (DATA_SCOPE_ALL.equals(dataScope)) {
sqlString = new StringBuilder(); sqlString = new StringBuilder();

14
lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppThirdLoginController.java

@ -11,6 +11,7 @@ import com.zdxt.code.domain.SiqLogin;
import com.zdxt.code.service.ThirdLoginService; import com.zdxt.code.service.ThirdLoginService;
import com.zdxt.code.utils.HttpUtil; import com.zdxt.code.utils.HttpUtil;
import com.zdxt.code.utils.IdCardCryptoUtil; import com.zdxt.code.utils.IdCardCryptoUtil;
import com.zdxt.code.utils.ZwSmsClient;
import com.zdxt.common.ZDResponse; import com.zdxt.common.ZDResponse;
import com.zdxt.common.util.RedisCache; import com.zdxt.common.util.RedisCache;
import com.zdxt.domain.auth.User; import com.zdxt.domain.auth.User;
@ -61,6 +62,9 @@ public class AppThirdLoginController {
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private ZwSmsClient zwSmsClient;
/** /**
* 深圳易平台登录 * 深圳易平台登录
*/ */
@ -89,7 +93,7 @@ public class AppThirdLoginController {
String userId = userOjb.getString("UserId"); String userId = userOjb.getString("UserId");
UserBean userBean = userApi.getUserByUserId(Long.valueOf(userId)); UserBean userBean = userApi.getUserByUserId(Long.valueOf(userId));
redisCache.setCacheObject("shiro:app:1731", userBean); // todo:这里需要将转换出来的User存redis用于做权限 redisCache.setCacheObject("shiro:app:" + userId, userBean); // todo:这里需要将转换出来的User存redis用于做权限
return thirdLoginService.szyLogin(userBean.getLoginName()); return thirdLoginService.szyLogin(userBean.getLoginName());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -245,4 +249,12 @@ public class AppThirdLoginController {
} }
return null; return null;
} }
@PostMapping("/sendMessage")
@ResponseBody
public void sendMessage(String phone,String content) throws Exception {
zwSmsClient.sendMessage(phone,content);
}
} }

68
lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppXzjcjbxx025711Controller.java

@ -0,0 +1,68 @@
package com.zdxt.app.controller;
import com.zdxt.code.domain.Xzcfajjbxx026705;
import com.zdxt.code.domain.Xzjcjbxx025711;
import com.zdxt.code.domain.Xzqzjbxx173774;
import com.zdxt.code.service.IXzjcjbxx025711Service;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 【案件信息】Controller
*
* @author ruoyi
* @date 2024-05-20
*/
@Controller
@RequestMapping("/app/xzjcjbxx")
public class AppXzjcjbxx025711Controller extends BaseController
{
private String prefix = "system/xzjcjbxx025711";
@Autowired
private IXzjcjbxx025711Service xzjcjbxx025711Service;
/**
* 查询【历史检查信息】列表
*/
@GetMapping("/queryList/{enterpriseNumber}")
@ResponseBody
public ZDResponse queryList(@PathVariable("enterpriseNumber") String enterpriseNumber)
{
startPage();
List<Xzjcjbxx025711> list = xzjcjbxx025711Service.queryByEnterpriseNumber(enterpriseNumber);
return ZDResponse.success("查询企业历史检查信息",list);
}
/**
* 查询【历史强制案件】列表
*/
@GetMapping("/queryQZAJList/{enterpriseNumber}")
@ResponseBody
public ZDResponse queryQZAJList( @PathVariable("enterpriseNumber") String enterpriseNumber)
{
startPage();
List<Xzqzjbxx173774> qzajList = xzjcjbxx025711Service.queryQZAJByEnterpriseNumber(enterpriseNumber);
return ZDResponse.success("查询企业历史强制案件信息",qzajList);
}
/**
* 查询【历史处罚案件】列表
*/
@GetMapping("/queryCFAJList/{enterpriseNumber}")
@ResponseBody
public ZDResponse queryCFAJList( @PathVariable("enterpriseNumber") String enterpriseNumber)
{
startPage();
List<Xzcfajjbxx026705> xzcfajjbxx026705s = xzjcjbxx025711Service.queryCFAJByEnterpriseNumber(enterpriseNumber);
return ZDResponse.success("查询企业历史处罚案件信息",xzcfajjbxx026705s);
}
}

1
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/controller/LoginController.java

@ -200,6 +200,7 @@ public class LoginController extends BaseController
User result = getSysUser(); User result = getSysUser();
result.setToken(token1); result.setToken(token1);
redisCache.setCacheObject("shiro:app:"+userDB.getUserId(),userDB);
return success("登录成功",result); return success("登录成功",result);

9
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/user/domain/LoginDTO.java

@ -3,6 +3,7 @@ package com.zdxt.auth.project.system.user.domain;
public class LoginDTO { public class LoginDTO {
String secretName; String secretName;
String secretKey; String secretKey;
String type;
public String getSecretName() { public String getSecretName() {
return secretName; return secretName;
@ -19,4 +20,12 @@ public class LoginDTO {
public void setSecretKey(String secretKey) { public void setSecretKey(String secretKey) {
this.secretKey = secretKey; this.secretKey = secretKey;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
} }

2
lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/UserMapper.xml

@ -79,7 +79,7 @@
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.password,u.law_certificate_num, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.kingdee_org_id,u.kingdee_user_id, u.type, select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.password,u.law_certificate_num, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.kingdee_org_id,u.kingdee_user_id, u.type,u.srzUserid,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.tenant_code, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.tenant_code,
t.tenant_code, t.tenant_name, t.contact_man, t.contact_number, t.address t.tenant_code, t.tenant_name, t.contact_man, t.contact_number, t.address

16
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/user.html

@ -114,14 +114,14 @@
} }
);*/ );*/
// $('body').layout({closable: true, livePaneResizing: true}); // $('body').layout({closable: true, livePaneResizing: true});
$('body').layout({ // $('body').layout({
// closable: false, // // closable: false,
livePaneResizing: true, // livePaneResizing: true,
west__size: 250, // west__size: 250,
onresize_end:function () { // onresize_end:function () {
$('#bootstrap-table').bootstrapTable('refresh', {height:$(window).height()-$(".search-collapse").height()-$("#toolbar").height()}); // $('#bootstrap-table').bootstrapTable('refresh', {height:$(window).height()-$(".search-collapse").height()-$("#toolbar").height()});
} // }
}); // });
queryUserList(); queryUserList();
queryDeptTree(); queryDeptTree();
}); });

8
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/Xzjcjbxx025711Controller.java

@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @date 2024-05-20 * @date 2024-05-20
*/ */
@Controller @Controller
@RequestMapping("/code/xzjcjbxx025711") @RequestMapping("/code/xzjcjbxx")
public class Xzjcjbxx025711Controller extends BaseController public class Xzjcjbxx025711Controller extends BaseController
{ {
private String prefix = "system/xzjcjbxx025711"; private String prefix = "system/xzjcjbxx025711";
@ -55,11 +55,11 @@ public class Xzjcjbxx025711Controller extends BaseController
{ {
startPage(); startPage();
List<Xzqzjbxx173774> qzajList = xzjcjbxx025711Service.queryQZAJByEnterpriseNumber(enterpriseNumber); List<Xzqzjbxx173774> qzajList = xzjcjbxx025711Service.queryQZAJByEnterpriseNumber(enterpriseNumber);
return ZDResponse.success("查询企业历史检查信息",qzajList); return ZDResponse.success("查询企业历史强制案件信息",qzajList);
} }
/** /**
* 查询【历史强制案件】列表 * 查询【历史处罚案件】列表
*/ */
@GetMapping("/queryCFAJList/{enterpriseNumber}") @GetMapping("/queryCFAJList/{enterpriseNumber}")
@ResponseBody @ResponseBody
@ -67,7 +67,7 @@ public class Xzjcjbxx025711Controller extends BaseController
{ {
startPage(); startPage();
List<Xzcfajjbxx026705> xzcfajjbxx026705s = xzjcjbxx025711Service.queryCFAJByEnterpriseNumber(enterpriseNumber); List<Xzcfajjbxx026705> xzcfajjbxx026705s = xzjcjbxx025711Service.queryCFAJByEnterpriseNumber(enterpriseNumber);
return ZDResponse.success("查询企业历史检查信息",xzcfajjbxx026705s); return ZDResponse.success("查询企业历史处罚案件信息",xzcfajjbxx026705s);
} }
} }

2
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/StatisticalServiceImpl.java

@ -5,6 +5,7 @@ import com.zdxt.code.domain.StatisticalVo;
import com.zdxt.code.mapper.LinkageDictMapper; import com.zdxt.code.mapper.LinkageDictMapper;
import com.zdxt.code.mapper.StatisticalMapper; import com.zdxt.code.mapper.StatisticalMapper;
import com.zdxt.code.service.StatisticalService; import com.zdxt.code.service.StatisticalService;
import com.zdxt.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,6 +31,7 @@ public class StatisticalServiceImpl implements StatisticalService
} }
@Override @Override
@DataScope(deptAlias = "er")
public Map<String,Object> statisticalData(StatisticalVo statisticalVo) { public Map<String,Object> statisticalData(StatisticalVo statisticalVo) {
//执法事项统计 //执法事项统计
List<StatisticalVo> statisticalVos = statisticalMapper.statisticalLawEnforcementItem(statisticalVo); List<StatisticalVo> statisticalVos = statisticalMapper.statisticalLawEnforcementItem(statisticalVo);

6
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/ZwSmsClient.java

@ -30,8 +30,8 @@ public class ZwSmsClient {
private static String password; private static String password;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
username = Azdg.encrypt(username); // username = Azdg.encrypt(username);
password = Azdg.encrypt(password); // password = Azdg.encrypt(password);
ConnMas(); ConnMas();
String orgCode = "10"; // 发送用户标记 一般两位数字 String orgCode = "10"; // 发送用户标记 一般两位数字
String mobileNum = "17608416852,18520089969"; //接收号码, 多个逗号分隔 String mobileNum = "17608416852,18520089969"; //接收号码, 多个逗号分隔
@ -88,7 +88,7 @@ public class ZwSmsClient {
call.addParameter("username", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); // 为本次调用的方法增加参数,第一次                                                         //参数为参数类型:字符串类型,第二个参数指参数模式:入参 call.addParameter("username", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); // 为本次调用的方法增加参数,第一次                                                         //参数为参数类型:字符串类型,第二个参数指参数模式:入参
call.addParameter("password", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); // 为本次调用的方法增加参数,第一次                                                         //参数为参数类型:字符串类型,第二个参数指参数模式:入参 call.addParameter("password", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); // 为本次调用的方法增加参数,第一次                                                         //参数为参数类型:字符串类型,第二个参数指参数模式:入参
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//为本次调用方法设置返回类型,这里是字符串类型 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//为本次调用方法设置返回类型,这里是字符串类型
String result = (String) call.invoke(new Object[]{username, password}); String result = (String) call.invoke(new Object[]{Azdg.encrypt(username), Azdg.encrypt(password)});
System.out.println(result);//打印返回的结果 System.out.println(result);//打印返回的结果
return result; return result;
} }

1
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml

@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope} ${params.dataScope}
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectEnforcementInspectionProgramById" parameterType="String" resultMap="EnforcementInspectionProgramResult"> <select id="selectEnforcementInspectionProgramById" parameterType="String" resultMap="EnforcementInspectionProgramResult">

32
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalMapper.xml

@ -58,9 +58,14 @@
law_enforcer_id_two as law_enforcer_id, law_enforcer_id_two as law_enforcer_id,
count(*) AS total count(*) AS total
FROM FROM
enforcement_registration enforcement_registration er
WHERE <where>
DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' ) and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' )
<if test="params.dataScope != null and params.dataScope != ''">
<!-- 数据范围过滤 -->
${params.dataScope}
</if>
</where>
GROUP BY GROUP BY
law_enforcer_id_two) t GROUP BY t.law_enforcer_id order by t.total desc law_enforcer_id_two) t GROUP BY t.law_enforcer_id order by t.total desc
</select> </select>
@ -76,16 +81,27 @@
on er.enterprise_number = ei.enterprise_number on er.enterprise_number = ei.enterprise_number
LEFT JOIN ( select dict_label,dict_value from sys_dict_data where dict_type = 'enterpriseType') sdd LEFT JOIN ( select dict_label,dict_value from sys_dict_data where dict_type = 'enterpriseType') sdd
on ei.enterprise_type = sdd.dict_value on ei.enterprise_type = sdd.dict_value
WHERE <where>
DATE_FORMAT( er.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' ); and DATE_FORMAT( er.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' )
<if test="params.dataScope != null and params.dataScope != ''">
<!-- 数据范围过滤 -->
${params.dataScope}
</if>
</where>
</select> </select>
<select id="statisticalToMouth" parameterType="StatisticalVo" resultMap="StatisticalVoResult"> <select id="statisticalToMouth" parameterType="StatisticalVo" resultMap="StatisticalVoResult">
select select
count(*) as total , count(*) as total ,
COUNT(CASE WHEN is_complaint = 1 THEN 1 END) AS complaint_count COUNT(CASE WHEN is_complaint = 1 THEN 1 END) AS complaint_count
from enforcement_registration from enforcement_registration er
WHERE <where>
DATE_FORMAT(create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' ); AND DATE_FORMAT(create_time, '%Y%m' ) = DATE_FORMAT( CURDATE(), '%Y%m' )
<if test="params.dataScope != null and params.dataScope != ''">
<!-- 数据范围过滤 -->
${params.dataScope}
</if>
</where>
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save