cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package cn.ksource.web.controller.business.pages.accountmsg;
 
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.activemq.console.command.StartCommand;
import org.apache.http.impl.io.SocketOutputBuffer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.core.license.AESUtil;
import cn.ksource.core.license.LicenseController;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.util.InetAddrUtil;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
import cn.ksource.web.facade.accountmsg.AccountMsgFacade;
import de.schlichtherle.license.LicenseContent;
/**
 * 角色权限--账户信息控制器
 * @note:
 * @version
 * @author sxj
 * @date June 28, 2016 10:35:44 AM
 */
@Controller
@RequestMapping("/business/pages/accountmsg")
public class AccountMsgController {
    
    @Autowired
    private AccountMsgFacade accountMsgFacade;
    
    @RequestMapping("accountMsg.html")
    public ModelAndView accountMsg(HttpServletRequest request) {
        ModelAndView view = new ModelAndView("/business/pages/accountmsg/accountMsg");
        Map map = accountMsgFacade.getPartnerMsgById();
        int mulUser= ConvertUtil.obj2Int(map.get("USER_ACCOUNT_NUM"))-ConvertUtil.obj2Int(map.get("userCount"));
        map.put("mulUser", mulUser);
        
        Map customerMsg = accountMsgFacade.queryMaxCusNum();
        
        int maxNum = ConvertUtil.obj2Int(customerMsg.get("maxNum"));
        int nowNum = ConvertUtil.obj2Int(customerMsg.get("nowNum"));
        
        int lastNum = maxNum - nowNum;
        
        map.put("maxNum", maxNum);
        map.put("nowNum", nowNum);
        map.put("lastNum", lastNum);
        view.addObject("partner", map);
        return view;
    }
    
    @RequestMapping("glzhList.html")
    public ModelAndView glzhList(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/accountmsg/glzhList");
        return modelAndView;
    }
    
    @RequestMapping("glzhData.html")
    public ModelAndView glzhData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/accountmsg/glzhData");
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        PageInfo info = accountMsgFacade.queryGlzhData(params,pageInfo);
        modelAndView.addObject("info", info);
        return modelAndView;
    }
    
    @RequestMapping("glzhCount.html")
    public void glzhCount(HttpServletRequest request,HttpServletResponse response) {
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        int count = accountMsgFacade.queryGlzhCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    
    @RequestMapping("khList.html")
    public ModelAndView khList(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/accountmsg/khList");
        return modelAndView;
    }
    
    
    @RequestMapping("khData.html")
    public ModelAndView khData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/business/pages/accountmsg/khData");
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        PageInfo info = accountMsgFacade.queryKhData(params, pageInfo);
        modelAndView.addObject("info", info);
        return modelAndView;
    }
    
    @RequestMapping("khCount.html")
    public void khCount(HttpServletRequest request,HttpServletResponse response) {
        //定义参数Map
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        int count = accountMsgFacade.queryKhCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    
    @RequestMapping("licenseInfo.html")
    public String licenseInfo(Model model,HttpServletRequest request,PageInfo pageInfo) {
        String path = this.getClass().getClassLoader().getResource("").getPath().replace("WEB-INF/classes/", "");
        LicenseController licenseController = new LicenseController();
        String licenseFileName = "license.lic";
        
        try {
            Map partnerInfo = accountMsgFacade.getPartnerMsgById();
            model.addAttribute("partnerInfo",partnerInfo);
            
            if(DateUtil.getFromTime2TimeByDay(DateUtil.getCurrentDate8(), Long.valueOf(partnerInfo.get("VALID_END_DATE").toString()))<=30){
                model.addAttribute("warn", "1");
            }
            
            InetAddrUtil util = new InetAddrUtil();
            String ip = util.getLocIp();
            InetAddress ia = InetAddress.getLocalHost();
            String mac = util.getLocalMacByIp(ia);
            String code = ip + ";" + mac;
            //加密
            byte[] encryptResult = AESUtil.encrypt(code, Constants.AES_PWD);
            String encryptCode = AESUtil.parseByte2HexStr(encryptResult);
            model.addAttribute("encryptCode", encryptCode);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "/business/pages/accountmsg/licenseInfo";
    }
 
}