Commit cd7037d91310c010bc169dc2a426542e0d9d0c1a
1 parent
ba18504a
update
Showing
12 changed files
with
1055 additions
and
10 deletions
pom.xml
| @@ -74,6 +74,22 @@ | @@ -74,6 +74,22 @@ | ||
| 74 | <artifactId>tomcat-embed-jasper</artifactId> | 74 | <artifactId>tomcat-embed-jasper</artifactId> |
| 75 | <scope>provided</scope> | 75 | <scope>provided</scope> |
| 76 | </dependency> | 76 | </dependency> |
| 77 | + | ||
| 78 | + <dependency> | ||
| 79 | + <groupId>com.alibaba</groupId> | ||
| 80 | + <artifactId>fastjson</artifactId> | ||
| 81 | + <version>1.2.33</version> | ||
| 82 | + </dependency> | ||
| 83 | + <dependency> | ||
| 84 | + <groupId>commons-codec</groupId> | ||
| 85 | + <artifactId>commons-codec</artifactId> | ||
| 86 | + <version>1.11</version> | ||
| 87 | + </dependency> | ||
| 88 | + <dependency> | ||
| 89 | + <groupId>org.slf4j</groupId> | ||
| 90 | + <artifactId>slf4j-api</artifactId> | ||
| 91 | + <version>1.7.25</version> | ||
| 92 | + </dependency> | ||
| 77 | </dependencies> | 93 | </dependencies> |
| 78 | 94 | ||
| 79 | <build> | 95 | <build> |
src/main/java/com/cnlive/shenhe/intercept/LoginIntercept.java renamed to src/main/java/com/cnlive/shenhe/config/LoginIntercept.java
| 1 | -package com.cnlive.shenhe.intercept; | 1 | +package com.cnlive.shenhe.config; |
| 2 | 2 | ||
| 3 | -import org.springframework.stereotype.Component; | ||
| 4 | import org.springframework.web.servlet.HandlerInterceptor; | 3 | import org.springframework.web.servlet.HandlerInterceptor; |
| 5 | 4 | ||
| 6 | import javax.servlet.http.HttpServletRequest; | 5 | import javax.servlet.http.HttpServletRequest; |
src/main/java/com/cnlive/shenhe/intercept/LoginConfiguration.java renamed to src/main/java/com/cnlive/shenhe/config/WebConfiguration.java
| 1 | -package com.cnlive.shenhe.intercept; | 1 | +package com.cnlive.shenhe.config; |
| 2 | 2 | ||
| 3 | +import org.springframework.context.annotation.ComponentScan; | ||
| 3 | import org.springframework.context.annotation.Configuration; | 4 | import org.springframework.context.annotation.Configuration; |
| 5 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| 5 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | 7 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| @@ -11,7 +13,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | @@ -11,7 +13,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
| 11 | * @Description: | 13 | * @Description: |
| 12 | */ | 14 | */ |
| 13 | @Configuration | 15 | @Configuration |
| 14 | -public class LoginConfiguration implements WebMvcConfigurer { | 16 | +@ComponentScan("com.cnlive.shenhe.job") |
| 17 | +@EnableScheduling | ||
| 18 | +public class WebConfiguration implements WebMvcConfigurer { | ||
| 15 | @Override | 19 | @Override |
| 16 | public void addInterceptors(InterceptorRegistry registry) { | 20 | public void addInterceptors(InterceptorRegistry registry) { |
| 17 | registry.addInterceptor(new LoginIntercept()).addPathPatterns("/**"); | 21 | registry.addInterceptor(new LoginIntercept()).addPathPatterns("/**"); |
src/main/java/com/cnlive/shenhe/controller/UsersController.java
| @@ -23,7 +23,7 @@ public class UsersController { | @@ -23,7 +23,7 @@ public class UsersController { | ||
| 23 | @GetMapping(value = "/{id}") | 23 | @GetMapping(value = "/{id}") |
| 24 | @ResponseBody | 24 | @ResponseBody |
| 25 | public Object getTest(@PathVariable Integer id){ | 25 | public Object getTest(@PathVariable Integer id){ |
| 26 | - return usersService.getAll(id); | 26 | + return usersService.get(id); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | @GetMapping(value = "/index") | 29 | @GetMapping(value = "/index") |
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
0 → 100644
| 1 | +package com.cnlive.shenhe.entity; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | +import javax.persistence.*; | ||
| 5 | + | ||
| 6 | +@Table(name = "shy_videos") | ||
| 7 | +public class ShyVideos { | ||
| 8 | + @Id | ||
| 9 | + private Integer id; | ||
| 10 | + | ||
| 11 | + private String video_title; | ||
| 12 | + | ||
| 13 | + private Integer spid; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 点播url | ||
| 17 | + */ | ||
| 18 | + private String video_url; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 点播封面图图片 | ||
| 22 | + */ | ||
| 23 | + private String video_imgs; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 标签 | ||
| 27 | + */ | ||
| 28 | + private String video_tags; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 更新者 | ||
| 32 | + */ | ||
| 33 | + private String updater; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 审核员id | ||
| 37 | + */ | ||
| 38 | + private Integer auditor; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 回调地址 | ||
| 42 | + */ | ||
| 43 | + private String callback; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 优先级 | ||
| 47 | + */ | ||
| 48 | + private String video_priority; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 拒绝理由 | ||
| 52 | + */ | ||
| 53 | + private String msg; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 状态:0.未审核,1:已审核,2.拒绝 | ||
| 57 | + */ | ||
| 58 | + private Boolean state; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 上传时间 | ||
| 62 | + */ | ||
| 63 | + private Date video_upload_time; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 关键字 | ||
| 67 | + */ | ||
| 68 | + private String video_keyword; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 介绍 | ||
| 72 | + */ | ||
| 73 | + private String video_desc; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 点播id | ||
| 77 | + */ | ||
| 78 | + private String video_id; | ||
| 79 | + | ||
| 80 | + private Date created_at; | ||
| 81 | + | ||
| 82 | + private Date updated_at; | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * @return id | ||
| 86 | + */ | ||
| 87 | + public Integer getId() { | ||
| 88 | + return id; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @param id | ||
| 93 | + */ | ||
| 94 | + public void setId(Integer id) { | ||
| 95 | + this.id = id; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * @return video_title | ||
| 100 | + */ | ||
| 101 | + public String getVideo_title() { | ||
| 102 | + return video_title; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * @param video_title | ||
| 107 | + */ | ||
| 108 | + public void setVideo_title(String video_title) { | ||
| 109 | + this.video_title = video_title; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * @return spid | ||
| 114 | + */ | ||
| 115 | + public Integer getSpid() { | ||
| 116 | + return spid; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * @param spid | ||
| 121 | + */ | ||
| 122 | + public void setSpid(Integer spid) { | ||
| 123 | + this.spid = spid; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * 获取点播url | ||
| 128 | + * | ||
| 129 | + * @return video_url - 点播url | ||
| 130 | + */ | ||
| 131 | + public String getVideo_url() { | ||
| 132 | + return video_url; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 设置点播url | ||
| 137 | + * | ||
| 138 | + * @param video_url 点播url | ||
| 139 | + */ | ||
| 140 | + public void setVideo_url(String video_url) { | ||
| 141 | + this.video_url = video_url; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * 获取点播封面图图片 | ||
| 146 | + * | ||
| 147 | + * @return video_imgs - 点播封面图图片 | ||
| 148 | + */ | ||
| 149 | + public String getVideo_imgs() { | ||
| 150 | + return video_imgs; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 设置点播封面图图片 | ||
| 155 | + * | ||
| 156 | + * @param video_imgs 点播封面图图片 | ||
| 157 | + */ | ||
| 158 | + public void setVideo_imgs(String video_imgs) { | ||
| 159 | + this.video_imgs = video_imgs; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * 获取标签 | ||
| 164 | + * | ||
| 165 | + * @return video_tags - 标签 | ||
| 166 | + */ | ||
| 167 | + public String getVideo_tags() { | ||
| 168 | + return video_tags; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * 设置标签 | ||
| 173 | + * | ||
| 174 | + * @param video_tags 标签 | ||
| 175 | + */ | ||
| 176 | + public void setVideo_tags(String video_tags) { | ||
| 177 | + this.video_tags = video_tags; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * 获取更新者 | ||
| 182 | + * | ||
| 183 | + * @return updater - 更新者 | ||
| 184 | + */ | ||
| 185 | + public String getUpdater() { | ||
| 186 | + return updater; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + /** | ||
| 190 | + * 设置更新者 | ||
| 191 | + * | ||
| 192 | + * @param updater 更新者 | ||
| 193 | + */ | ||
| 194 | + public void setUpdater(String updater) { | ||
| 195 | + this.updater = updater; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + /** | ||
| 199 | + * 获取审核员id | ||
| 200 | + * | ||
| 201 | + * @return auditor - 审核员id | ||
| 202 | + */ | ||
| 203 | + public Integer getAuditor() { | ||
| 204 | + return auditor; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * 设置审核员id | ||
| 209 | + * | ||
| 210 | + * @param auditor 审核员id | ||
| 211 | + */ | ||
| 212 | + public void setAuditor(Integer auditor) { | ||
| 213 | + this.auditor = auditor; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + /** | ||
| 217 | + * 获取回调地址 | ||
| 218 | + * | ||
| 219 | + * @return callback - 回调地址 | ||
| 220 | + */ | ||
| 221 | + public String getCallback() { | ||
| 222 | + return callback; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * 设置回调地址 | ||
| 227 | + * | ||
| 228 | + * @param callback 回调地址 | ||
| 229 | + */ | ||
| 230 | + public void setCallback(String callback) { | ||
| 231 | + this.callback = callback; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + /** | ||
| 235 | + * 获取优先级 | ||
| 236 | + * | ||
| 237 | + * @return video_priority - 优先级 | ||
| 238 | + */ | ||
| 239 | + public String getVideo_priority() { | ||
| 240 | + return video_priority; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + /** | ||
| 244 | + * 设置优先级 | ||
| 245 | + * | ||
| 246 | + * @param video_priority 优先级 | ||
| 247 | + */ | ||
| 248 | + public void setVideo_priority(String video_priority) { | ||
| 249 | + this.video_priority = video_priority; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * 获取拒绝理由 | ||
| 254 | + * | ||
| 255 | + * @return msg - 拒绝理由 | ||
| 256 | + */ | ||
| 257 | + public String getMsg() { | ||
| 258 | + return msg; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * 设置拒绝理由 | ||
| 263 | + * | ||
| 264 | + * @param msg 拒绝理由 | ||
| 265 | + */ | ||
| 266 | + public void setMsg(String msg) { | ||
| 267 | + this.msg = msg; | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + /** | ||
| 271 | + * 获取状态:0.未审核,1:已审核,2.拒绝 | ||
| 272 | + * | ||
| 273 | + * @return state - 状态:0.未审核,1:已审核,2.拒绝 | ||
| 274 | + */ | ||
| 275 | + public Boolean getState() { | ||
| 276 | + return state; | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + /** | ||
| 280 | + * 设置状态:0.未审核,1:已审核,2.拒绝 | ||
| 281 | + * | ||
| 282 | + * @param state 状态:0.未审核,1:已审核,2.拒绝 | ||
| 283 | + */ | ||
| 284 | + public void setState(Boolean state) { | ||
| 285 | + this.state = state; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + /** | ||
| 289 | + * 获取上传时间 | ||
| 290 | + * | ||
| 291 | + * @return video_upload_time - 上传时间 | ||
| 292 | + */ | ||
| 293 | + public Date getVideo_upload_time() { | ||
| 294 | + return video_upload_time; | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * 设置上传时间 | ||
| 299 | + * | ||
| 300 | + * @param video_upload_time 上传时间 | ||
| 301 | + */ | ||
| 302 | + public void setVideo_upload_time(Date video_upload_time) { | ||
| 303 | + this.video_upload_time = video_upload_time; | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + /** | ||
| 307 | + * 获取关键字 | ||
| 308 | + * | ||
| 309 | + * @return video_keyword - 关键字 | ||
| 310 | + */ | ||
| 311 | + public String getVideo_keyword() { | ||
| 312 | + return video_keyword; | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + /** | ||
| 316 | + * 设置关键字 | ||
| 317 | + * | ||
| 318 | + * @param video_keyword 关键字 | ||
| 319 | + */ | ||
| 320 | + public void setVideo_keyword(String video_keyword) { | ||
| 321 | + this.video_keyword = video_keyword; | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + /** | ||
| 325 | + * 获取介绍 | ||
| 326 | + * | ||
| 327 | + * @return video_desc - 介绍 | ||
| 328 | + */ | ||
| 329 | + public String getVideo_desc() { | ||
| 330 | + return video_desc; | ||
| 331 | + } | ||
| 332 | + | ||
| 333 | + /** | ||
| 334 | + * 设置介绍 | ||
| 335 | + * | ||
| 336 | + * @param video_desc 介绍 | ||
| 337 | + */ | ||
| 338 | + public void setVideo_desc(String video_desc) { | ||
| 339 | + this.video_desc = video_desc; | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + /** | ||
| 343 | + * 获取点播id | ||
| 344 | + * | ||
| 345 | + * @return video_id - 点播id | ||
| 346 | + */ | ||
| 347 | + public String getVideo_id() { | ||
| 348 | + return video_id; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + /** | ||
| 352 | + * 设置点播id | ||
| 353 | + * | ||
| 354 | + * @param video_id 点播id | ||
| 355 | + */ | ||
| 356 | + public void setVideo_id(String video_id) { | ||
| 357 | + this.video_id = video_id; | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + /** | ||
| 361 | + * @return created_at | ||
| 362 | + */ | ||
| 363 | + public Date getCreated_at() { | ||
| 364 | + return created_at; | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + /** | ||
| 368 | + * @param created_at | ||
| 369 | + */ | ||
| 370 | + public void setCreated_at(Date created_at) { | ||
| 371 | + this.created_at = created_at; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + /** | ||
| 375 | + * @return updated_at | ||
| 376 | + */ | ||
| 377 | + public Date getUpdated_at() { | ||
| 378 | + return updated_at; | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + /** | ||
| 382 | + * @param updated_at | ||
| 383 | + */ | ||
| 384 | + public void setUpdated_at(Date updated_at) { | ||
| 385 | + this.updated_at = updated_at; | ||
| 386 | + } | ||
| 387 | +} | ||
| 0 | \ No newline at end of file | 388 | \ No newline at end of file |
src/main/java/com/cnlive/shenhe/job/UsersJob.java
0 → 100644
| 1 | +package com.cnlive.shenhe.job; | ||
| 2 | + | ||
| 3 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 4 | +import com.cnlive.shenhe.mapper.ShyUsersMapper; | ||
| 5 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | +import tk.mybatis.mapper.entity.Example; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Auther: 周伟鹏 | ||
| 16 | + * @Date: 2018/11/30 11:31 | ||
| 17 | + * @Description: | ||
| 18 | + */ | ||
| 19 | +@Component | ||
| 20 | +public class UsersJob { | ||
| 21 | + private static Logger logger = LoggerFactory.getLogger(UsersJob.class); | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + ShyUsersMapper shyUsersMapper; | ||
| 26 | + | ||
| 27 | + //@Scheduled(fixedRate = 30*60 * 1000) | ||
| 28 | + public void syncUsers() { | ||
| 29 | + long tm = 0L; | ||
| 30 | + Example usersExample = new Example(ShyUsers.class); | ||
| 31 | + usersExample.setOrderByClause("tm desc"); | ||
| 32 | + List<ShyUsers> usersList = shyUsersMapper.selectByExample(usersExample); | ||
| 33 | + if(!usersList.isEmpty()){ | ||
| 34 | + String tmStr = usersList.get(0).getTm(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + } | ||
| 38 | +} |
src/main/java/com/cnlive/shenhe/mapper/ShyVideosMapper.java
0 → 100644
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 3 | import com.cnlive.shenhe.mapper.ShyUsersMapper; | 4 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 4 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
| 7 | +import tk.mybatis.mapper.entity.Example; | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * @Auther: 周伟鹏 | 10 | * @Auther: 周伟鹏 |
| @@ -14,7 +16,8 @@ public class UsersServiceImpl { | @@ -14,7 +16,8 @@ public class UsersServiceImpl { | ||
| 14 | @Autowired | 16 | @Autowired |
| 15 | ShyUsersMapper shyUsersMapper; | 17 | ShyUsersMapper shyUsersMapper; |
| 16 | 18 | ||
| 17 | - public Object getAll(Integer id){ | 19 | + public Object get(Integer id){ |
| 18 | return shyUsersMapper.selectByPrimaryKey(id); | 20 | return shyUsersMapper.selectByPrimaryKey(id); |
| 19 | } | 21 | } |
| 22 | + | ||
| 20 | } | 23 | } |
src/main/java/com/cnlive/shenhe/utils/CommonUtils.java
0 → 100644
| 1 | +package com.cnlive.shenhe.utils; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import org.apache.commons.codec.binary.Base32; | ||
| 6 | + | ||
| 7 | +import javax.servlet.http.HttpServletRequest; | ||
| 8 | +import java.io.ByteArrayOutputStream; | ||
| 9 | +import java.io.PrintStream; | ||
| 10 | +import java.io.UnsupportedEncodingException; | ||
| 11 | +import java.math.BigDecimal; | ||
| 12 | +import java.net.InetAddress; | ||
| 13 | +import java.net.NetworkInterface; | ||
| 14 | +import java.net.SocketException; | ||
| 15 | +import java.net.UnknownHostException; | ||
| 16 | +import java.security.MessageDigest; | ||
| 17 | +import java.security.NoSuchAlgorithmException; | ||
| 18 | +import java.sql.Timestamp; | ||
| 19 | +import java.text.DateFormat; | ||
| 20 | +import java.text.ParseException; | ||
| 21 | +import java.text.SimpleDateFormat; | ||
| 22 | +import java.util.*; | ||
| 23 | + | ||
| 24 | +public class CommonUtils { | ||
| 25 | + private static char md5Chars[] = { | ||
| 26 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | ||
| 27 | + 'a', 'b', 'c', 'd', 'e', 'f' | ||
| 28 | + }; | ||
| 29 | + | ||
| 30 | + public static boolean isNull(Object object) { | ||
| 31 | + if (object == null) | ||
| 32 | + return true; | ||
| 33 | + return false; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static boolean isNotNull(Object object) { | ||
| 37 | + if (object == null) | ||
| 38 | + return false; | ||
| 39 | + return true; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public static Timestamp getCurrentTime() { | ||
| 43 | + return new Timestamp(new Date().getTime()); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public static String getRandowUUID() { | ||
| 47 | + UUID uuid = UUID.randomUUID(); | ||
| 48 | + return uuid.toString().replaceAll("-", ""); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static boolean isEmpty(String str) { | ||
| 52 | + if (str == null || "".equals(str.trim())) | ||
| 53 | + return true; | ||
| 54 | + return false; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public static boolean isNotEmpty(String str) { | ||
| 58 | + if (str != null && !"".equals(str.trim())) | ||
| 59 | + return true; | ||
| 60 | + return false; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public static String formatDate(Date data, String pattern) { | ||
| 64 | + SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); | ||
| 65 | + return dateFormat.format(data); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 解析命令字符串 | ||
| 70 | + * | ||
| 71 | + * @param command | ||
| 72 | + * @return | ||
| 73 | + * @author fan xiao chun | ||
| 74 | + * @date 2016年9月5日 | ||
| 75 | + */ | ||
| 76 | + public static Map<String, String> parseCommand(String command) { | ||
| 77 | + Map<String, String> cmdMap = new HashMap<String, String>(); | ||
| 78 | + String[] items = command.split("&"); | ||
| 79 | + for (String item : items) { | ||
| 80 | + int splitIndex = item.indexOf("="); | ||
| 81 | + String key = item.substring(0, splitIndex); | ||
| 82 | + String value = item.substring(splitIndex + 1); | ||
| 83 | + cmdMap.put(key, value); | ||
| 84 | + } | ||
| 85 | + return cmdMap; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 四舍五入 | ||
| 90 | + * | ||
| 91 | + * @param num | ||
| 92 | + * @param digit | ||
| 93 | + * @return | ||
| 94 | + * @author fan xiao chun | ||
| 95 | + * @date 2016年9月21日 | ||
| 96 | + */ | ||
| 97 | + public static float getRound(float num, int digit) { | ||
| 98 | + BigDecimal b = new BigDecimal(num); | ||
| 99 | + float f1 = b.setScale(digit, BigDecimal.ROUND_HALF_UP).floatValue(); | ||
| 100 | + return f1; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 获取当前时间戳 | ||
| 105 | + * | ||
| 106 | + * @return | ||
| 107 | + */ | ||
| 108 | + public static long getCurrentMillisecond() { | ||
| 109 | + return new Date().getTime(); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * 按指定格式解析日期 | ||
| 114 | + * | ||
| 115 | + * @param date | ||
| 116 | + * @param pattern | ||
| 117 | + * @return | ||
| 118 | + * @throws ParseException | ||
| 119 | + */ | ||
| 120 | + public static Timestamp parseDate(String date, String pattern) throws ParseException { | ||
| 121 | + SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); | ||
| 122 | + return new Timestamp(dateFormat.parse(date).getTime()); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 获取本机ip | ||
| 127 | + * | ||
| 128 | + * @return | ||
| 129 | + * @date 2017年3月12日 | ||
| 130 | + * @author fanxiaochun | ||
| 131 | + */ | ||
| 132 | + public static String getLocalIp() { | ||
| 133 | + try { | ||
| 134 | + if (isWindowsOS()) { | ||
| 135 | + return InetAddress.getLocalHost().getHostAddress(); | ||
| 136 | + } else { | ||
| 137 | + return getLinuxLocalIp(); | ||
| 138 | + } | ||
| 139 | + } catch (Exception e) { | ||
| 140 | + throw new RuntimeException(e); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + public static String decodeBase32(String str) { | ||
| 146 | + Base32 base32 = new Base32(); | ||
| 147 | + try { | ||
| 148 | + return new String(base32.decode(str.getBytes("utf-8")), "utf-8"); | ||
| 149 | + } catch (UnsupportedEncodingException e) { | ||
| 150 | + e.printStackTrace(); | ||
| 151 | + } | ||
| 152 | + return ""; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public static String encodeBase32(String str) { | ||
| 156 | + Base32 base32 = new Base32(); | ||
| 157 | + try { | ||
| 158 | + return base32.encodeAsString(str.getBytes("utf-8")); | ||
| 159 | + } catch (UnsupportedEncodingException e) { | ||
| 160 | + e.printStackTrace(); | ||
| 161 | + } | ||
| 162 | + return ""; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + private static String toHexString(byte[] b) { | ||
| 166 | + char HEX_DIGITS[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; | ||
| 167 | + StringBuilder sb = new StringBuilder(b.length * 2); | ||
| 168 | + for (int i = 0; i < b.length; i++) { | ||
| 169 | + sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]); | ||
| 170 | + sb.append(HEX_DIGITS[b[i] & 0x0f]); | ||
| 171 | + } | ||
| 172 | + return sb.toString(); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public static String Bit32(String SourceString) { | ||
| 176 | + try { | ||
| 177 | + | ||
| 178 | + MessageDigest digest = MessageDigest.getInstance("MD5"); | ||
| 179 | + digest.update(SourceString.getBytes()); | ||
| 180 | + byte messageDigest[] = digest.digest(); | ||
| 181 | + return toHexString(messageDigest); | ||
| 182 | + } catch (Exception e) { | ||
| 183 | + e.printStackTrace(); | ||
| 184 | + } | ||
| 185 | + return ""; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public static String Bit16(String SourceString) { | ||
| 189 | + try { | ||
| 190 | + return Bit32(SourceString).substring(8, 24); | ||
| 191 | + } catch (Exception e) { | ||
| 192 | + e.printStackTrace(); | ||
| 193 | + } | ||
| 194 | + return ""; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public static int getShortSide(String res) { | ||
| 198 | + String[] resArr = res.split("x"); | ||
| 199 | + int width = Integer.parseInt(resArr[0]); | ||
| 200 | + int height = Integer.parseInt(resArr[1]); | ||
| 201 | + | ||
| 202 | + if (width > height) | ||
| 203 | + return height; | ||
| 204 | + | ||
| 205 | + return width; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * 获取短边长度 | ||
| 210 | + * | ||
| 211 | + * @param width | ||
| 212 | + * @param height | ||
| 213 | + * @return | ||
| 214 | + */ | ||
| 215 | + public static int getShortSide(int width, int height) { | ||
| 216 | + if (width > height) | ||
| 217 | + return height; | ||
| 218 | + | ||
| 219 | + return width; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + /** | ||
| 223 | + * md5加密 | ||
| 224 | + * | ||
| 225 | + * @param str | ||
| 226 | + * @return | ||
| 227 | + */ | ||
| 228 | + public static String md5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException { | ||
| 229 | + MessageDigest md5 = MessageDigest.getInstance("MD5"); | ||
| 230 | + md5.update(str.getBytes("UTF-8")); | ||
| 231 | + byte digest[] = md5.digest(); | ||
| 232 | + char chars[] = toHexChars(digest); | ||
| 233 | + return new String(chars); | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + private static char[] toHexChars(byte digest[]) { | ||
| 237 | + char chars[] = new char[digest.length * 2]; | ||
| 238 | + int i = 0; | ||
| 239 | + byte abyte0[] = digest; | ||
| 240 | + int j = abyte0.length; | ||
| 241 | + for (int k = 0; k < j; k++) { | ||
| 242 | + byte b = abyte0[k]; | ||
| 243 | + char c0 = md5Chars[(b & 0xf0) >> 4]; | ||
| 244 | + chars[i++] = c0; | ||
| 245 | + char c1 = md5Chars[b & 0xf]; | ||
| 246 | + chars[i++] = c1; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + return chars; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + /** | ||
| 254 | + * 判断操作系统是否是Windows | ||
| 255 | + * | ||
| 256 | + * @return | ||
| 257 | + */ | ||
| 258 | + public static boolean isWindowsOS() { | ||
| 259 | + boolean isWindowsOS = false; | ||
| 260 | + String osName = System.getProperty("os.name"); | ||
| 261 | + if (osName.toLowerCase().indexOf("windows") > -1) { | ||
| 262 | + isWindowsOS = true; | ||
| 263 | + } | ||
| 264 | + return isWindowsOS; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + /** | ||
| 268 | + * 获取本地Host名称 | ||
| 269 | + */ | ||
| 270 | + public static String getLocalHostName() throws UnknownHostException { | ||
| 271 | + return InetAddress.getLocalHost().getHostName(); | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + /** | ||
| 275 | + * 获取Linux下的IP地址 | ||
| 276 | + * | ||
| 277 | + * @return IP地址 | ||
| 278 | + * @throws SocketException | ||
| 279 | + */ | ||
| 280 | + private static String getLinuxLocalIp() throws SocketException { | ||
| 281 | + String ip = ""; | ||
| 282 | + for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) { | ||
| 283 | + NetworkInterface intf = en.nextElement(); | ||
| 284 | + String name = intf.getName(); | ||
| 285 | + if (!name.contains("docker") && !name.contains("lo")) { | ||
| 286 | + for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) { | ||
| 287 | + InetAddress inetAddress = enumIpAddr.nextElement(); | ||
| 288 | + if (!inetAddress.isLoopbackAddress()) { | ||
| 289 | + String ipaddress = inetAddress.getHostAddress().toString(); | ||
| 290 | + if (!ipaddress.contains("::") && !ipaddress.contains("0:0:") && !ipaddress.contains("fe80")) { | ||
| 291 | + ip = ipaddress; | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + return ip; | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + /** | ||
| 303 | + * 文件大小格式化 | ||
| 304 | + * | ||
| 305 | + * @param bSize b单位 | ||
| 306 | + * @return | ||
| 307 | + */ | ||
| 308 | + public static String sizeFormat(long bSize) { | ||
| 309 | + String size = ""; | ||
| 310 | + float kbSize = bSize / 1024.0f; | ||
| 311 | + if (kbSize >= 1.0f) { | ||
| 312 | + float mbSize = kbSize / 1024.0f; | ||
| 313 | + if (mbSize >= 1.0f) { | ||
| 314 | + float gbSize = mbSize / 1024.0f; | ||
| 315 | + if (gbSize >= 1.0f) { | ||
| 316 | + size = getRound(gbSize, 2) + "G"; | ||
| 317 | + } else { | ||
| 318 | + size = getRound(mbSize, 2) + "M"; | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + size = getRound(kbSize, 2) + "K"; | ||
| 322 | + } | ||
| 323 | + } else { | ||
| 324 | + size = getRound(bSize, 2) + "B"; | ||
| 325 | + } | ||
| 326 | + return size; | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * 相比返回最大值 | ||
| 331 | + * | ||
| 332 | + * @param width | ||
| 333 | + * @param height | ||
| 334 | + * @return | ||
| 335 | + */ | ||
| 336 | + public static int max(int width, int height) { | ||
| 337 | + if (width > height) | ||
| 338 | + return width; | ||
| 339 | + return height; | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + /** | ||
| 343 | + * 将秒转换成固定格式时分秒输出 | ||
| 344 | + * | ||
| 345 | + * @param second | ||
| 346 | + * @param separator | ||
| 347 | + * @return | ||
| 348 | + * @author fan xiao chun | ||
| 349 | + */ | ||
| 350 | + | ||
| 351 | + public static String secondTimeFormat(long second, String separator) { | ||
| 352 | + int secondCardinal = 1; | ||
| 353 | + int minuteCardinal = secondCardinal * 60; | ||
| 354 | + int hourCardinal = minuteCardinal * 60; | ||
| 355 | + | ||
| 356 | + String hourStr = null; | ||
| 357 | + String minuteStr = null; | ||
| 358 | + String secondStr = null; | ||
| 359 | + | ||
| 360 | + long hour = 0; | ||
| 361 | + long minute = 0; | ||
| 362 | + String timeStr = null; | ||
| 363 | + | ||
| 364 | + if ((hour = second / hourCardinal) > 0) | ||
| 365 | + second = second - hourCardinal * hour; | ||
| 366 | + if ((minute = second / minuteCardinal) > 0) | ||
| 367 | + second = second - minuteCardinal * minute; | ||
| 368 | + | ||
| 369 | + hourStr = (String.valueOf(hour).length() == 1) ? "0" + hour : hour + ""; | ||
| 370 | + minuteStr = (String.valueOf(minute).length() == 1) ? "0" + minute : minute + ""; | ||
| 371 | + secondStr = (String.valueOf(second).length() == 1) ? "0" + second : second + ""; | ||
| 372 | + return hourStr + separator + minuteStr + separator + secondStr; | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + /** | ||
| 376 | + * 将固定格式时分秒输出转换成秒 | ||
| 377 | + * | ||
| 378 | + * @param timeStr | ||
| 379 | + * @param separator | ||
| 380 | + * @return | ||
| 381 | + * @author fan xiao chun | ||
| 382 | + */ | ||
| 383 | + public static long timeStrToSecond(String timeStr, String separator) { | ||
| 384 | + int secondCardinal = 1; | ||
| 385 | + int minuteCardinal = secondCardinal * 60; | ||
| 386 | + int hourCardinal = minuteCardinal * 60; | ||
| 387 | + | ||
| 388 | + String[] timeArr = timeStr.split(separator); | ||
| 389 | + long hour = Long.parseLong(timeArr[0]); | ||
| 390 | + long minute = Long.parseLong(timeArr[1]); | ||
| 391 | + long second = Long.parseLong(timeArr[2]); | ||
| 392 | + return hour * hourCardinal + minute * minuteCardinal + second; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + /** | ||
| 396 | + * 获取异常日志 | ||
| 397 | + * | ||
| 398 | + * @param ex | ||
| 399 | + * @return | ||
| 400 | + */ | ||
| 401 | + public static String getExceptioniInformation(Throwable ex) { | ||
| 402 | + ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
| 403 | + PrintStream pout = new PrintStream(out); | ||
| 404 | + ex.printStackTrace(pout); | ||
| 405 | + String ret = new String(out.toByteArray()); | ||
| 406 | + pout.close(); | ||
| 407 | + try { | ||
| 408 | + out.close(); | ||
| 409 | + } catch (Exception e) { | ||
| 410 | + return null; | ||
| 411 | + } | ||
| 412 | + return ret; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + /** | ||
| 416 | + * 将对象转成map形式 | ||
| 417 | + * | ||
| 418 | + * @param o | ||
| 419 | + * @return | ||
| 420 | + */ | ||
| 421 | + public static Map objectToMap(Object o) { | ||
| 422 | + return (Map) JSONObject.toJSON(o); | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + | ||
| 426 | + /** | ||
| 427 | + * 判断当前json数组是否为空 | ||
| 428 | + * | ||
| 429 | + * @param jsonArray | ||
| 430 | + * @return | ||
| 431 | + */ | ||
| 432 | + public static boolean isEmpty(JSONArray jsonArray) { | ||
| 433 | + if (isNotNull(jsonArray) && !jsonArray.isEmpty()) { | ||
| 434 | + return false; | ||
| 435 | + } | ||
| 436 | + return true; | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + /** | ||
| 440 | + * 返回当前时间,格式HH:mm:ss new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); | ||
| 441 | + * | ||
| 442 | + * @return String 当前时间 | ||
| 443 | + */ | ||
| 444 | + public static String getCurrentDate(String formatStr) { | ||
| 445 | + String time = null; | ||
| 446 | + try { | ||
| 447 | + DateFormat myformat = new SimpleDateFormat(formatStr); | ||
| 448 | + time = myformat.format(new Date()); | ||
| 449 | + } catch (Exception e) { | ||
| 450 | + e.printStackTrace(); | ||
| 451 | + } | ||
| 452 | + return time; | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + | ||
| 456 | + public static boolean isAjax(HttpServletRequest request) { | ||
| 457 | + String requestType = request.getHeader("X-Requested-With"); | ||
| 458 | + if ("XMLHttpRequest".equals(requestType)) { | ||
| 459 | + return true; | ||
| 460 | + } | ||
| 461 | + return false; | ||
| 462 | + } | ||
| 463 | + | ||
| 464 | + /** | ||
| 465 | + * 将字符串匹配替换成占位符形式 | ||
| 466 | + * | ||
| 467 | + * @param str | ||
| 468 | + * @param separator | ||
| 469 | + * @return | ||
| 470 | + */ | ||
| 471 | + public static String format(String str, String regex, String separator) { | ||
| 472 | + String temp = ""; | ||
| 473 | + String[] pathArr = null; | ||
| 474 | + if (str.startsWith(separator)) { | ||
| 475 | + temp = separator; | ||
| 476 | + pathArr = str.replaceFirst(separator, "").split(separator); | ||
| 477 | + } else { | ||
| 478 | + pathArr = str.split(separator); | ||
| 479 | + } | ||
| 480 | + int perchIndex = 0; | ||
| 481 | + String path = null; | ||
| 482 | + for (int i = 0; i < pathArr.length; i++) { | ||
| 483 | + path = pathArr[i]; | ||
| 484 | + if (path.matches("\\d+") || path.indexOf("%2C") >= 0 || path.indexOf(",") >= 0) { | ||
| 485 | + //path = path.replaceFirst("(\\d+)", String.format("%s%d%s", "{", perchIndex, "}")); | ||
| 486 | + path = "{" + perchIndex + "}"; | ||
| 487 | + perchIndex++; | ||
| 488 | + } | ||
| 489 | + temp += path; | ||
| 490 | + if (i != pathArr.length - 1) { | ||
| 491 | + temp += separator; | ||
| 492 | + } | ||
| 493 | + } | ||
| 494 | + return temp; | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + public static <T> T toObject(Object o, Class<T> tClass) { | ||
| 498 | + return JSONObject.parseObject(JSONObject.toJSONString(o), tClass); | ||
| 499 | + } | ||
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * 判断json中是否有该key的json对象,如果没有将该key添加到json中,并返回key代表的json對象 | ||
| 503 | + * | ||
| 504 | + * @param jsonObject | ||
| 505 | + * @param key | ||
| 506 | + * @return | ||
| 507 | + */ | ||
| 508 | + public static JSONObject getJSONObject(JSONObject jsonObject, String key) { | ||
| 509 | + JSONObject obj = jsonObject.getJSONObject(key); | ||
| 510 | + if (CommonUtils.isNull(obj)) { | ||
| 511 | + obj = new JSONObject(); | ||
| 512 | + jsonObject.put(key, obj); | ||
| 513 | + } | ||
| 514 | + return obj; | ||
| 515 | + } | ||
| 516 | + | ||
| 517 | + /** | ||
| 518 | + * 判断jsonArr中是否有该key的json对象,如果没有将该key添加到json中,并返回key代表的jsonArr對象 | ||
| 519 | + * | ||
| 520 | + * @param jsonObject | ||
| 521 | + * @param key | ||
| 522 | + * @return | ||
| 523 | + */ | ||
| 524 | + public static JSONArray getJSONArray(JSONObject jsonObject, String key) { | ||
| 525 | + JSONArray obj = jsonObject.getJSONArray(key); | ||
| 526 | + if (CommonUtils.isNull(obj)) { | ||
| 527 | + obj = new JSONArray(); | ||
| 528 | + jsonObject.put(key, obj); | ||
| 529 | + } | ||
| 530 | + return obj; | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + | ||
| 534 | + /** | ||
| 535 | + * 判断是否是网络地址 | ||
| 536 | + * | ||
| 537 | + * @param url | ||
| 538 | + */ | ||
| 539 | + public static boolean isHttpUrl(String url) { | ||
| 540 | + if (isNotEmpty(url)) { | ||
| 541 | + if (url.startsWith("http://") || url.startsWith("https://")) { | ||
| 542 | + return true; | ||
| 543 | + } | ||
| 544 | + } | ||
| 545 | + return false; | ||
| 546 | + } | ||
| 547 | + | ||
| 548 | + public static Timestamp getTimestamp(String timeStr, String fromPattern) { | ||
| 549 | + Timestamp dateTime = null; | ||
| 550 | + try { | ||
| 551 | + SimpleDateFormat formatter = null; | ||
| 552 | + if (isEmpty(fromPattern)) { | ||
| 553 | + formatter = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 554 | + } else { | ||
| 555 | + formatter = new SimpleDateFormat(fromPattern); | ||
| 556 | + } | ||
| 557 | + Date day = formatter.parse(timeStr); | ||
| 558 | + dateTime = new Timestamp(day.getTime()); | ||
| 559 | + } catch (Exception ex) { | ||
| 560 | + ex.printStackTrace(); | ||
| 561 | + } | ||
| 562 | + return dateTime; | ||
| 563 | + } | ||
| 564 | +} |
src/main/resources/application.properties
| 1 | -spring.datasource.url=jdbc:mysql://localhost:3307/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false | 1 | +spring.datasource.url=jdbc:mysql://120.92.102.31:3306/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false |
| 2 | spring.datasource.username=root | 2 | spring.datasource.username=root |
| 3 | -spring.datasource.password=root | 3 | +spring.datasource.password=M345sdfss4! |
| 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver | 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
| 5 | 5 | ||
| 6 | spring.jpa.properties.hibernate.hbm2ddl.auto=update | 6 | spring.jpa.properties.hibernate.hbm2ddl.auto=update |
src/main/resources/generatorConfig.xml
| @@ -23,9 +23,9 @@ | @@ -23,9 +23,9 @@ | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | <jdbcConnection driverClass="com.mysql.jdbc.Driver" | 25 | <jdbcConnection driverClass="com.mysql.jdbc.Driver" |
| 26 | - connectionURL="jdbc:mysql://localhost:3307/new_shy??useUnicode=true&characterEncoding=utf8&characterSetResults=utf8" | 26 | + connectionURL="jdbc:mysql://120.92.102.31:3306/new_shy??useUnicode=true&characterEncoding=utf8&characterSetResults=utf8" |
| 27 | userId="root" | 27 | userId="root" |
| 28 | - password="root"> | 28 | + password="M345sdfss4!"> |
| 29 | </jdbcConnection> | 29 | </jdbcConnection> |
| 30 | 30 | ||
| 31 | <javaModelGenerator targetPackage="com.cnlive.shenhe.entity" targetProject="src/main/java"/> | 31 | <javaModelGenerator targetPackage="com.cnlive.shenhe.entity" targetProject="src/main/java"/> |
src/main/resources/mapper/ShyVideosMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.cnlive.shenhe.mapper.ShyVideosMapper"> | ||
| 4 | + <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyVideos"> | ||
| 5 | + <!-- | ||
| 6 | + WARNING - @mbg.generated | ||
| 7 | + --> | ||
| 8 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
| 9 | + <result column="video_title" jdbcType="VARCHAR" property="video_title" /> | ||
| 10 | + <result column="spid" jdbcType="INTEGER" property="spid" /> | ||
| 11 | + <result column="video_url" jdbcType="VARCHAR" property="video_url" /> | ||
| 12 | + <result column="video_imgs" jdbcType="VARCHAR" property="video_imgs" /> | ||
| 13 | + <result column="video_tags" jdbcType="VARCHAR" property="video_tags" /> | ||
| 14 | + <result column="updater" jdbcType="VARCHAR" property="updater" /> | ||
| 15 | + <result column="auditor" jdbcType="INTEGER" property="auditor" /> | ||
| 16 | + <result column="callback" jdbcType="VARCHAR" property="callback" /> | ||
| 17 | + <result column="video_priority" jdbcType="VARCHAR" property="video_priority" /> | ||
| 18 | + <result column="msg" jdbcType="VARCHAR" property="msg" /> | ||
| 19 | + <result column="state" jdbcType="BIT" property="state" /> | ||
| 20 | + <result column="video_upload_time" jdbcType="TIMESTAMP" property="video_upload_time" /> | ||
| 21 | + <result column="video_keyword" jdbcType="VARCHAR" property="video_keyword" /> | ||
| 22 | + <result column="video_desc" jdbcType="VARCHAR" property="video_desc" /> | ||
| 23 | + <result column="video_id" jdbcType="VARCHAR" property="video_id" /> | ||
| 24 | + <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> | ||
| 25 | + <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> | ||
| 26 | + </resultMap> | ||
| 27 | +</mapper> | ||
| 0 | \ No newline at end of file | 28 | \ No newline at end of file |