| | |
| | | import com.whyc.factory.FaceEngineFactory; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.mapper.PageParamUserMapper; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.service.BaoJiGroupBattGroupService; |
| | | import com.whyc.service.InterfaceService; |
| | | import com.whyc.service.ProcessSurveyService; |
| | | import com.whyc.service.UserService; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.HttpUtil; |
| | | import com.whyc.util.RSAUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import javax.servlet.ServletContextEvent; |
| | | import javax.servlet.ServletContextListener; |
| | | import javax.servlet.annotation.WebListener; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | //Thread thread_calculateTimeInUse = new Thread(new CalculateTimeInUse(),"Thread_calculateTimeInUse"); |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private BaoJiGroupBattGroupService baoJiGroupBattGroupService; |
| | | |
| | | @Override |
| | | public void contextInitialized(ServletContextEvent servletContextEvent) { |
| | | ServletContext application = servletContextEvent.getServletContext(); |
| | | //记录系统的运行初始时间 |
| | | application.setAttribute("system_start_time", System.currentTimeMillis()); |
| | | //清除错误的包机组机房关系 |
| | | baoJiGroupBattGroupService.clearErrorRelationship(); |
| | | |
| | | //应用启动时,检查是否存在表,不存在则新建 |
| | | //告警语音设置表 |
| | |
| | | } |
| | | /*//刷新 天气城市的数据--聚合平台,弃用 |
| | | new WeatherCityService().insertBatch();*/ |
| | | //视频token获取存入 |
| | | //视频token获取存入,从萤石云获取 |
| | | String resultJson = HttpUtil.doPost(HttpUtil.VIDEO_URL, HttpUtil.VIDEO_REQUEST_BODY); |
| | | ServiceModel model = ActionUtil.getGson().fromJson(resultJson, ServiceModel.class); |
| | | ServletContext application = servletContextEvent.getServletContext(); |
| | | |
| | | application.setAttribute("videoToken",model); |
| | | |
| | | //版本迭代需要打补丁,PageParamUser追加字段type,扩展表的使用范围,原来表记录的type字段统一追加为1 |
| | |
| | | application.setAttribute("alarmMap",alarmMap); |
| | | //更新平台版本号和启动时间 |
| | | processSurveyService.updateWebStartTimeAndVersion(); |
| | | //密码结构更新到3 0 72 |
| | | UserInf sysAdmin = userService.getById(1); |
| | | String uSnId = sysAdmin.getUSnId(); |
| | | if(RSAUtil.decrypt(uSnId,RSAUtil.getPrivateKey()) == null){ //最新结构解码失败 |
| | | //为旧版密码,采用旧版解码并转为新版 |
| | | List<UserInf> all = userService.getAll(); |
| | | List<UserInf> userListWithNewPwd = new LinkedList<>(); |
| | | for (int i = 1; i < all.size(); i++) { //第一条记录非密码,跳过 |
| | | UserInf userInf = all.get(i); |
| | | String pwdOldEncrypt = userInf.getUSnId(); |
| | | String pwd = RSAUtil.decrypt(pwdOldEncrypt, RSAUtil.getPrivateKeyOld()); |
| | | if(pwd != null) { |
| | | String pwdNewEncrypt = RSAUtil.encrypt(pwd, RSAUtil.getPublicKey()); |
| | | userInf.setUSnId(pwdNewEncrypt); |
| | | userListWithNewPwd.add(userInf); |
| | | } |
| | | } |
| | | if(userListWithNewPwd.size()>0) { |
| | | userService.updatePasswordsTo3072(userListWithNewPwd); |
| | | System.out.println("password system renewed"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |