| | |
| | | package com.gkhy.safePlatform.emergency.controller; |
| | | |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; |
| | | import org.apache.dubbo.config.annotation.DubboReference; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | public class Test { |
| | | |
| | | @DubboReference(check = false) |
| | | private UserAccountService userAccountService; |
| | | private AccountAuthService accountAuthService; |
| | | |
| | | // @Autowired |
| | | // private DemoService demoService; |
| | |
| | | |
| | | public class EmergencyTeamQuery { |
| | | |
| | | private String team_name ; |
| | | |
| | | private String team_level ; |
| | | |
| | | public String getTeam_name() { |
| | | return team_name; |
| | | } |
| | | |
| | | public void setTeam_name(String team_name) { |
| | | this.team_name = team_name; |
| | | } |
| | | |
| | | public String getTeam_level() { |
| | | return team_level; |
| | | } |
| | | |
| | | public void setTeam_level(String team_level) { |
| | | this.team_level = team_level; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "EmergencyTeamDBQuery{" + |
| | | "team_name='" + team_name + '\'' + |
| | | ", team_level='" + team_level + '\'' + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | |
| | | public class EmergencyTeamDBQuery { |
| | | |
| | | private String team_name ; |
| | | |
| | | private String team_level ; |
| | | |
| | | public String getTeam_name() { |
| | | return team_name; |
| | | } |
| | | |
| | | public void setTeam_name(String team_name) { |
| | | this.team_name = team_name; |
| | | } |
| | | |
| | | public String getTeam_level() { |
| | | return team_level; |
| | | } |
| | | |
| | | public void setTeam_level(String team_level) { |
| | | this.team_level = team_level; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "EmergencyTeamDBQuery{" + |
| | | "team_name='" + team_name + '\'' + |
| | | ", team_level='" + team_level + '\'' + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | |
| | | @Repository |
| | | public interface EmergencyTeamInfoRepository extends BaseMapper<EmergencyTeamInfo> { |
| | | |
| | | List<EmergencyTeamInfoPageDO> selectEmergencyTeamList(Page<EmergencyTeamInfoPageDO> page, @Param("query") EmergencyTeamDBQuery emergencyTeamDBQuery); |
| | | |
| | | } |
对比新文件 |
| | |
| | | <?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.gkhy.safePlatform.emergency.repository.EmergencyTeamInfoRepository"> |
| | | |
| | | <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyTeamInfoPageDO" id="pageResult"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="team_level" property="teamLevel" /> |
| | | <result column="team_name" property="teamName" /> |
| | | <result column="principal_phone" property="principalPhone" /> |
| | | <result column="team_desc" property="teamDesc" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectEmergencyTeamList" resultMap="pageResult"> |
| | | select id,`team_level`,`team_name`,`principal_phone`,`team_desc` from emergency_team where del_flag = 0 |
| | | <if test="query.teamName != null and query.teamName != ''"> and `team_name` like concat('%', #{query.teamName}, '%')</if> |
| | | <if test="query.teamLevel != null and query.teamLevel != ''"> and `team_level` = #{query.teamLevel}</if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.gkhy.safePlatform.accountController; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.MenuRPCRespDTO; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.UserLoginRPCRespDTO; |
| | | import com.gkhy.safePlatform.commons.vo.ResultVO; |
| | |
| | | public class LoginController { |
| | | |
| | | @DubboReference(check = false) |
| | | private UserAccountService userAccountService; |
| | | private AccountAuthService accountAuthService; |
| | | |
| | | @RequestMapping("/login") |
| | | public ResultVO<UserLoginRPCRespDTO> authLogin(@RequestBody JSONObject loginForm){ |
| | | String username = loginForm.getString("username"); |
| | | String password = loginForm.getString("password"); |
| | | return userAccountService.authLogin(username, password); |
| | | return accountAuthService.authLogin(username, password); |
| | | } |
| | | |
| | | @RequestMapping("/menu") |
| | | public ResultVO<List<MenuRPCRespDTO>> getMenu(Principal principal, Long projectId){ |
| | | String userId = principal.getName(); |
| | | return userAccountService.getMenu(Long.valueOf(userId), projectId); |
| | | return accountAuthService.getMenu(Long.valueOf(userId), projectId); |
| | | } |
| | | } |
| | |
| | | package com.gkhy.safePlatform.accountController; |
| | | |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountMenuService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.req.MenuAddRPCReqDTO; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.MenuModRPCReqDTO; |
| | | import com.gkhy.safePlatform.commons.enums.ResultCodes; |
| | |
| | | public class MenuController { |
| | | |
| | | @DubboReference(check = false) |
| | | private UserAccountService userAccountService; |
| | | private AccountMenuService accountMenuService; |
| | | |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/add",method = RequestMethod.POST) |
| | | public ResultVO<String> addMenu(Principal principal, @RequestBody MenuAddRPCReqDTO menuAddDto) { |
| | | String userId = principal.getName(); |
| | | return userAccountService.addMenu(Long.valueOf(userId), menuAddDto); |
| | | return accountMenuService.addMenu(Long.valueOf(userId), menuAddDto); |
| | | } |
| | | |
| | | |
| | |
| | | @RequestMapping(value = "/mod",method = RequestMethod.POST) |
| | | public ResultVO<String> addMenu(Principal principal, @RequestBody MenuModRPCReqDTO menuModDto) { |
| | | String userId = principal.getName(); |
| | | return userAccountService.modMenu(Long.valueOf(userId), menuModDto); |
| | | return accountMenuService.modMenu(Long.valueOf(userId), menuModDto); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.safePlatform.accountController; |
| | | |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountMenuService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountUserService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.model.req.query.AccountRPCQuery; |
| | | import com.gkhy.safePlatform.commons.query.PageQuery; |
| | | import org.apache.dubbo.config.annotation.DubboReference; |
| | | import org.apache.dubbo.config.annotation.DubboService; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.security.Principal; |
| | | |
| | | @RestController |
| | | @RequestMapping("/account") |
| | | public class UserController { |
| | | |
| | | @DubboReference(check = false) |
| | | private AccountUserService accountUserService; |
| | | |
| | | |
| | | @RequestMapping("/page/list") |
| | | public Object getUserPage(Principal principal, PageQuery<AccountRPCQuery> rpcQueryPageQuery) { |
| | | return accountUserService.getAccountPage(Long.valueOf(principal.getName()), rpcQueryPageQuery); |
| | | } |
| | | } |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.security.access.AccessDeniedException; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | |
| | | |
| | | /** |
| | | * @Description: 请求方法 |
| | | */ |
| | | @ResponseBody |
| | | @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class) |
| | | public ResultVO DHandler(HttpRequestMethodNotSupportedException e) { |
| | | ResultVO resultVO = new ResultVO(); |
| | | resultVO.setCode(ResultCodes.CLIENT_METHOD_NOT_MATCH.getCode()); |
| | | resultVO.setMsg(e.getMessage()); |
| | | return resultVO; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 系统错误异常 |
| | | */ |
| | | @ResponseBody |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService; |
| | | import com.gkhy.safePlatform.commons.co.CacheAuthority; |
| | | import com.gkhy.safePlatform.commons.co.CacheUser; |
| | | import com.gkhy.safePlatform.commons.enums.RedisKeyEnum; |
| | |
| | | @Autowired |
| | | private TokenConfig tokenConfig; |
| | | @DubboReference(check = false) |
| | | private UserAccountService userAccountService; |
| | | private AccountAuthService userAccountService; |
| | | |
| | | |
| | | |
| | |
| | | package com.gkhy.safePlatform.config.security; |
| | | |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.UserAccountService; |
| | | import com.gkhy.safePlatform.config.security.customzie.CustomizeAccessDeniedHandler; |
| | | import com.gkhy.safePlatform.config.security.customzie.CustomizeAuthenticationEntryPoint; |
| | | import org.apache.dubbo.config.annotation.DubboReference; |