更新审批流程,更新UserInf->DocUser
| | |
| | | @AfterReturning(pointcut = "operationLogPointcut()",returning = "resp") |
| | | public void doAfterReturnOperation(JoinPoint point,Object resp){ |
| | | //用户id |
| | | Long uId = ActionUtil.getUser().getUId(); |
| | | Long uId = ActionUtil.getUser().getId(); |
| | | |
| | | Signature signature = point.getSignature(); |
| | | String methodSignature = signature.toString(); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("audit") |
| | | @ApiOperation(value = "经理审核",notes = "传参:int id,int linkStatus,String dealReason,int mainId;" + |
| | | @ApiOperation(value = "经理审核",notes = "传参:int id,int linkStatus,String dealReason,int mainId,int nextUser;" + |
| | | "linkStatus:1通过,2驳回;dealReason:审核意见") |
| | | public Response audit(@RequestBody WorksheetLink link){ |
| | | service.audit(link); |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.WorksheetMain; |
| | | import com.whyc.service.WorksheetMainService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("worksheetMain") |
| | |
| | | return new Response().setII(1,"工单提交完成"); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @ApiOperation("获取工单流程-用户对应的待处理/已处理/已提交/已驳回") |
| | | public Response getList(){ |
| | | DocUser user = ActionUtil.getUser(); |
| | | Map<String,WorksheetMain> map = service.getList(); |
| | | return new Response().set(1,map); |
| | | } |
| | | |
| | | @GetMapping("linkInfo") |
| | | @ApiOperation("获取工单流程-单个工单信息流") |
| | | public Response getLinkList(@RequestParam int id){ |
| | | WorksheetMain main = service.getLinkList(id); |
| | | return new Response().set(1,main); |
| | | } |
| | | |
| | | } |
| | |
| | | String requestURI = request.getRequestURI(); |
| | | //单项提取-登录超时 |
| | | if(exceptionStr.contains("login") && exceptionStr.contains("imeout")){ |
| | | CommonUtil.record(ActionUtil.getUser().getUId(), UserOperation.TYPE_LOGIN_TIMEOUT.getType(),"登录请求超时","异常信息:"+ exceptionStr); |
| | | CommonUtil.record(ActionUtil.getUser().getId(), UserOperation.TYPE_LOGIN_TIMEOUT.getType(),"登录请求超时","异常信息:"+ exceptionStr); |
| | | }else { |
| | | CommonUtil.record(ActionUtil.getUser().getUId(), UserOperation.TYPE_EXCEPTION.getType(), "接口调用异常:调用接口"+requestURI+"发生错误:"+exceptionStr); |
| | | CommonUtil.record(ActionUtil.getUser().getId(), UserOperation.TYPE_EXCEPTION.getType(), "接口调用异常:调用接口"+requestURI+"发生错误:"+exceptionStr); |
| | | } |
| | | return new Response().setII(0,"接口请求异常,请联系软件人员进行处理.异常信息"+ exceptionStr); |
| | | } |
| | |
| | | |
| | | import com.whyc.constant.UserOperation; |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | |
| | |
| | | |
| | | if(YamlProperties.profileType.equals("prod")) { |
| | | //用户需要登录 |
| | | UserInf user = (UserInf) request.getSession().getAttribute("user"); |
| | | DocUser user = (DocUser) request.getSession().getAttribute("user"); |
| | | //无需登录可以调用接口放行 |
| | | if (!requestURI.contains(".") && !servletPath.equals("/") && |
| | | (! |
| | |
| | | package com.whyc.filter; |
| | | |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.apache.shiro.util.CollectionUtils; |
| | | import org.apache.shiro.web.filter.authz.AuthorizationFilter; |
| | |
| | | Set<String> roles = CollectionUtils.asSet(rolesArray); |
| | | |
| | | //判断为or |
| | | UserInf user = (UserInf) subject.getPrincipals().getPrimaryPrincipal(); |
| | | DocUser user = (DocUser) subject.getPrincipals().getPrimaryPrincipal(); |
| | | for (String role :roles){ |
| | | if (subject.hasRole(role)){ |
| | | return true; |
| | |
| | | import com.whyc.pojo.WorksheetMain; |
| | | |
| | | public interface WorksheetMainMapper extends CustomMapper<WorksheetMain> { |
| | | WorksheetMain getLinkList(int id); |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "人脸信息") |
| | | private DocFace dface; |
| | | |
| | | public DocUser(Long id, String name) { |
| | | this.id = id; |
| | | this.name = name; |
| | | } |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private Integer nextUser; |
| | | |
| | | @TableField(exist = false) |
| | | private DocUser dealUser; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setNextUser(Integer nextUser) { |
| | | this.nextUser = nextUser; |
| | | } |
| | | |
| | | public DocUser getDealUser() { |
| | | return dealUser; |
| | | } |
| | | |
| | | public void setDealUser(DocUser dealUser) { |
| | | this.dealUser = dealUser; |
| | | } |
| | | } |
| | |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | |
| | | @TableName(schema = "db_doc",value = "tb_worksheet_main") |
| | | @Alias("WorksheetMain") |
| | |
| | | @TableField(exist = false) |
| | | private String dealDesc; |
| | | |
| | | @TableField(exist = false) |
| | | private String createUser; |
| | | |
| | | private LinkedList<WorksheetLink> links; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(String createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public LinkedList<WorksheetLink> getLinks() { |
| | | return links; |
| | | } |
| | | |
| | | public void setLinks(LinkedList<WorksheetLink> links) { |
| | | this.links = links; |
| | | } |
| | | } |
| | |
| | | package com.whyc.realm; |
| | | |
| | | import com.whyc.anotation.Realm; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.service.UserBridgeService; |
| | | import com.whyc.util.RSAUtil; |
| | | import org.apache.shiro.authc.*; |
| | |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { |
| | | String userName = (String) authenticationToken.getPrincipal(); |
| | | UserInf user = userBridgeService.findPasswordByUserName(userName); |
| | | if(user.getUId()==0){ |
| | | DocUser user = userBridgeService.findPasswordByUserName(userName); |
| | | if(user.getId()==0){ |
| | | throw new UnknownAccountException("账号不存在"); |
| | | } |
| | | String password = RSAUtil.decrypt(user.getUpassword(),RSAUtil.getPrivateKey()); |
| | | String password = RSAUtil.decrypt(user.getSnId(),RSAUtil.getPrivateKey()); |
| | | return new SimpleAuthenticationInfo(user,password,getName()); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { |
| | | UserInf user = (UserInf) principalCollection.getPrimaryPrincipal(); |
| | | DocUser user = (DocUser) principalCollection.getPrimaryPrincipal(); |
| | | return userBridgeService.getAuthorizationInfo(user); |
| | | } |
| | | |
| | |
| | | import com.whyc.constant.UserOperation; |
| | | import com.whyc.mapper.DocLogMapper; |
| | | import com.whyc.pojo.DocLog; |
| | | import com.whyc.pojo.UserLog; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ExcelUtil; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import org.apache.shiro.authz.AuthorizationInfo; |
| | | import org.apache.shiro.authz.SimpleAuthorizationInfo; |
| | | import org.springframework.cache.CacheManager; |
| | |
| | | public class UserBridgeService { |
| | | |
| | | @Resource |
| | | private UserInfMapper userMapper; |
| | | private DocUserMapper userMapper; |
| | | |
| | | @Resource |
| | | private CacheManager caffeineCacheManager; |
| | | |
| | | public UserInf findPasswordByUserName(String userName) { |
| | | UserInf userInf = null; |
| | | QueryWrapper<UserInf> queryWrapper = Wrappers.query(); |
| | | public DocUser findPasswordByUserName(String userName) { |
| | | DocUser userInf = null; |
| | | QueryWrapper<DocUser> queryWrapper = Wrappers.query(); |
| | | queryWrapper.select("uId","uName","upassword","UKey_ID","uRole","uSex","uMobilephone","uEmail","uAddr","uDepartment","uBirthDay").eq("uName",userName); |
| | | userInf = userMapper.selectOne(queryWrapper); |
| | | |
| | | return userInf==null?new UserInf(0L,"用户不存在"):userInf; |
| | | return userInf==null?new DocUser(0L,"用户不存在"):userInf; |
| | | } |
| | | |
| | | public UserInf findUserByMobilephone(String mobilephone){ |
| | | QueryWrapper<UserInf> queryWrapper = Wrappers.query(); |
| | | public DocUser findUserByMobilephone(String mobilephone){ |
| | | QueryWrapper<DocUser> queryWrapper = Wrappers.query(); |
| | | queryWrapper.select("uId","uName","upassword","UKey_ID","uRole","uMobilephone").eq("uMobilephone",mobilephone); |
| | | List<UserInf> list = userMapper.selectList(queryWrapper); |
| | | return list.size()==0?new UserInf(0L,"用户不存在"):list.get(0); |
| | | List<DocUser> list = userMapper.selectList(queryWrapper); |
| | | return list.size()==0?new DocUser(0L,"用户不存在"):list.get(0); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | //@Cacheable(key = "#root.methodName+#p0.id") |
| | | public AuthorizationInfo getAuthorizationInfo(UserInf user) { |
| | | public AuthorizationInfo getAuthorizationInfo(DocUser user) { |
| | | System.out.println("=========执行了UserBridgeService.getAuthorization方法=========="); |
| | | SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); |
| | | //添加Roles和Permissions |
| | | List<String> roles = findRolesByUserId(user.getUId()); |
| | | List<String> perms = findPermissionsByUserId(user.getUId()); |
| | | List<String> roles = findRolesByUserId(user.getId()); |
| | | List<String> perms = findPermissionsByUserId(user.getId()); |
| | | |
| | | authorizationInfo.addRoles(roles); |
| | | authorizationInfo.addStringPermissions(perms); |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class WorksheetMainService { |
| | |
| | | main.setStatus(status); |
| | | mainMapper.updateById(main); |
| | | } |
| | | |
| | | public Map<String, WorksheetMain> getList() { |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public WorksheetMain getLinkList(int id) { |
| | | return mainMapper.getLinkList(id); |
| | | } |
| | | } |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | * |
| | | * @return 获取当前session 中的用户对象 |
| | | */ |
| | | public static UserInf getUser(){ |
| | | public static DocUser getUser(){ |
| | | HttpSession session =getSession(); |
| | | Object obj=session.getAttribute("user"); |
| | | UserInf userInf = new UserInf(); |
| | | DocUser userInf = new DocUser(); |
| | | if(obj==null){ |
| | | userInf.setUName("未登录的用户账号"); |
| | | userInf.setUId(0L); |
| | | userInf.setURole(0); |
| | | userInf.setName("未登录的用户账号"); |
| | | userInf.setId(0L); |
| | | userInf.setRoleId("0"); |
| | | }else{ |
| | | userInf=(UserInf) session.getAttribute("user"); |
| | | userInf=(DocUser) session.getAttribute("user"); |
| | | } |
| | | return userInf; |
| | | } |
| | |
| | | package com.whyc.util; |
| | | |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.service.DocLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.system.ApplicationHome; |
| | |
| | | } |
| | | |
| | | /**获取当前Session中的属性user*/ |
| | | public static UserInf getUser(HttpServletRequest request) { |
| | | return (UserInf) request.getSession().getAttribute("user"); |
| | | public static DocUser getUser(HttpServletRequest request) { |
| | | return (DocUser) request.getSession().getAttribute("user"); |
| | | } |
| | | |
| | | public static String classesPath(){ |
| | |
| | | |
| | | package com.whyc.util; |
| | | |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.session.Session; |
| | | import org.apache.shiro.subject.Subject; |
| | |
| | | return subject.isAuthenticated(); |
| | | } |
| | | |
| | | public static UserInf getUser() { |
| | | public static DocUser getUser() { |
| | | if (!isNullOrEmpty(ThreadContext.getSubject()) && !isNullOrEmpty(SecurityUtils.getSubject().getPrincipal())) { |
| | | return (UserInf) SecurityUtils.getSubject().getPrincipal(); |
| | | return (DocUser) SecurityUtils.getSubject().getPrincipal(); |
| | | }else { |
| | | return new UserInf(0L,"none"); |
| | | return new DocUser(0L,"none"); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper" > |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.WorksheetMainMapper" > |
| | | |
| | | <resultMap id="Map_WorksheetMain" type="WorksheetMain"> |
| | | <id column="id" property="id"/> |
| | | <result column="title" property="title"/> |
| | | <result column="description" property="description"/> |
| | | <result column="file" property="file"/> |
| | | <result column="createUserName" property="createUser"/> |
| | | <result column="begin_time" property="beginTime"/> |
| | | <result column="end_time" property="endTime"/> |
| | | <result column="level" property="level"/> |
| | | <result column="status" property="status"/> |
| | | <result column="end_reason" property="endReason"/> |
| | | <collection property="links" ofType="com.whyc.pojo.WorksheetLink"> |
| | | <id column="lid" property="id"/> |
| | | <result column="deal_user_id" property="dealUserId"/> |
| | | <result column="deal_type" property="dealType"/> |
| | | <result column="deal_desc" property="dealDesc"/> |
| | | <result column="deal_reason" property="dealReason"/> |
| | | <result column="link_file" property="linkFile"/> |
| | | <result column="link_status" property="linkStatus"/> |
| | | <result column="enable_archive" property="enableArchive"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="deal_time" property="dealTime"/> |
| | | <association property="dealUser" column="deal_user_id" javaType="com.whyc.pojo.DocUser" select="getUser"> |
| | | <result column="name" property="name"/> |
| | | </association> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="getLinkList" resultMap="Map_WorksheetMain"> |
| | | SELECT |
| | | u.NAME as createUserName, |
| | | m.*, |
| | | l.id lid,deal_user_id,deal_type,deal_desc,deal_reason,link_file,link_status,enable_archive,create_time,deal_time |
| | | FROM |
| | | tb_worksheet_main m, |
| | | tb_worksheet_link l, |
| | | tb_doc_user u |
| | | WHERE |
| | | m.create_user_id = u.id |
| | | AND m.id = l.main_id |
| | | AND m.id = #{id} |
| | | </select> |
| | | |
| | | <select id="getUser" resultType="com.whyc.pojo.DocUser"> |
| | | select name from db_doc.tb_doc_user where id =#{deal_user_id} |
| | | </select> |
| | | </mapper> |