| | |
| | | import com.fgkj.services.User_logService; |
| | | import com.fgkj.services.Vip_userService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RequestMapping("login") |
| | | @RestController |
| | | @Api |
| | | @Api(tags = "login接口") |
| | | public class LoginController{ |
| | | |
| | | // private User_inf uinf; |
| | | private ServiceModel model; |
| | | ServiceModel model = new ServiceModel(); |
| | | //private String user; |
| | | //private String password; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private User_infService service; |
| | | @Autowired |
| | | @Resource |
| | | private Vip_userService vservice; |
| | | @Autowired |
| | | @Resource |
| | | private User_ChartMapper userChartMapper; |
| | | |
| | | //web版登录 |
| | | @PostMapping("login") |
| | | @ApiOperation(notes = "",value="web版登录") |
| | | public ServiceModel login(@RequestBody User_inf uinf) { |
| | | model=vservice.login(uinf); |
| | | //System.out.println(model); |
| | |
| | | if(model.getCode()==1){ |
| | | Cookie c = null; |
| | | //System.out.println(ActionUtil.DecryptionBase64()); |
| | | if(uinf.getUId() == 1){ |
| | | if(uinf.getuId() == 1){ |
| | | c = new Cookie("user", ActionUtil.EncryptionBase64(ActionUtil.getGson().toJson(uinf)).toString()); |
| | | }else{ |
| | | c = new Cookie("user", ""); |
| | |
| | | |
| | | //手机端登录action |
| | | @PostMapping("mobileLogin") |
| | | @ApiOperation(notes = "",value="手机端登录action") |
| | | public ServiceModel MobileLogin(@RequestBody User_inf uinf){ |
| | | System.out.println(uinf); |
| | | String usnId64=(String) ActionUtil.EncryptionBase64(uinf.getUpassword()); |
| | |
| | | User_log log = new User_log(); |
| | | User_inf uinf2 = (User_inf) ActionUtil.getUser(); |
| | | if(uinf!=null){ |
| | | log.setuId(uinf2.getUId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuId(uinf2.getuId()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登录移动系统"); |
| | | log.setUOprateType(UserUtil.LOGIN); |
| | | log.setuOprateType(UserUtil.LOGIN); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | logservice.add(log); |
| | | } |
| | |
| | | |
| | | //检查超级管理员是否 |
| | | @GetMapping("checkVip") |
| | | @ApiOperation(notes = "",value="检查超级管理员是否") |
| | | public ServiceModel checkVip(){ |
| | | Map<String, UserClient> map = (Map) ActionUtil.getApplication().getAttribute("vips"); |
| | | model=vservice.checkVip(); |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("check") |
| | | @ApiOperation(notes = "",value="判断是否有另一同一账号登陆的用户") |
| | | public ServiceModel check(){ |
| | | //System.out.println("开始检查"); |
| | | model=service.checkUser(); |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/userExit") |
| | | @ApiOperation(notes = "",value="退出登录") |
| | | public ServiceModel exitUser(){ |
| | | //将当前用户从所有的登陆用户中移除 |
| | | Map<String, UserClient> map = (Map) ActionUtil.getApplication().getAttribute("users"); |
| | |
| | | User_inf user = (User_inf) ActionUtil.getSession().getAttribute("user"); |
| | | if(user!=null){ |
| | | //System.out.println(user); |
| | | UserClient client = map.get(user.getUName()); |
| | | UserClient client = map.get(user.getuName()); |
| | | //System.out.println(client); |
| | | if(client!=null){ |
| | | map.remove(user.getUName()); |
| | | map.remove(user.getuName()); |
| | | } |
| | | User_logService logservice= new User_logService(); |
| | | User_log log = new User_log(); |
| | | log.setuId(user.getUId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuId(user.getuId()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登出系统"); |
| | | log.setUOprateType(UserUtil.LOGOUT); |
| | | log.setuOprateType(UserUtil.LOGOUT); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getLocalAddr()); |
| | | logservice.add(log); |
| | | } |
| | |
| | | try { |
| | | User_logService logservice= new User_logService(); |
| | | User_log log = new User_log(); |
| | | log.setuId(u.getUId()); |
| | | log.setUOprateDay(new Date()); |
| | | log.setuId(u.getuId()); |
| | | log.setuOprateDay(new Date()); |
| | | log.setuOprateMsg("登录PC系统"); |
| | | log.setUOprateType(UserUtil.LOGIN); |
| | | log.setuOprateType(UserUtil.LOGIN); |
| | | log.setuTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | logservice.add(log); |
| | | } catch (Exception e) { |