1
zj
2025-03-20 697c08d94a3c26aaa970c467775989bb548fb6c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package project.web.admin.security;
 
import java.util.Date;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
 
import kernel.util.DateUtils;
import kernel.util.StringUtils;
import project.Constants;
import project.log.Log;
import project.log.LogService;
import security.web.LoginSuccessAction;
 
@RestController
public class LocalLoginSuccessController extends LoginSuccessAction {
 
    @Autowired
    private LogService logService;
 
    @RequestMapping(value = "normal/LoginSuccessAction!view.action") 
    public ModelAndView loginSuccess() {
        ModelAndView model = new ModelAndView();
 
        String cookie_username = this.getCookie(COOKIE_USERNAME_NAME);
        if (!StringUtils.isNullOrEmpty(cookie_username) && cookie_username.length() >= 4000) {
            cookie_username = cookie_username.substring(0, 3999);
        }
        
        String partyId = this.getLoginPartyId();
        
        Log log = new Log();
        log.setCategory(Constants.LOG_CATEGORY_SECURITY);
        if ("root".equals(this.getUsername_login())) {
            log.setLog("登录系统,时间[" + DateUtils.dateToStr(new Date(), DateUtils.DF_yyyyMMddHHmmss) + "]");
        }else {
            log.setLog("登录系统,ip[" + this.getIp(getRequest()) + "]");
        }
        log.setPartyId(partyId);
        log.setUsername(this.getUsername_login());
        logService.saveAsyn(log);
    
        model.addObject("username_login", this.getUsername_login());
        model.setViewName("auto_monitor_iframe");
        return model;
    }
}