Просмотр исходного кода

设置数据库时间为上海,设置登录显示重置加密密码。

anderx лет назад: 3
Родитель
Сommit
b3012664df

+ 6 - 1
src/main/java/com/kede/core/shiro/token/UserRealm.java

@@ -26,7 +26,7 @@ import com.kede.common.utils.PasswordUtil;
 public class UserRealm extends AuthorizingRealm {
 	@Autowired
 	AdminService			adminService;
-	
+
 	@Autowired
 	UserMapper				userMapper;
 //	@Autowired
@@ -54,6 +54,11 @@ public class UserRealm extends AuthorizingRealm {
 				throw new UnknownAccountException();
 			}
 			token.setId(admin.getId());
+			String pwd=admin.getPassword();
+			admin.setPassword("123456");
+			System.out.println("===========================================================================\n");
+			System.out.println("帐号="+admin.getAccount()+",重置密码="+passwordUtil.getEncryptPwd(admin));
+			admin.setPassword(pwd);
 			return new SimpleAuthenticationInfo(admin, admin.getPassword(), passwordUtil.getManageSalt(admin),
 					getName());
 		}else {

+ 7 - 5
src/main/java/com/kede/news/service/impl/NewsServiceImpl.java

@@ -22,7 +22,7 @@ import com.kede.news.bo.OutNews;
 import com.kede.news.service.NewsService;
 @Service
 public class NewsServiceImpl extends BaseMybatisDao<NewsMapper> implements NewsService {
-	
+
 	@Autowired
 	private NewsMapper	newsMapper;
 
@@ -38,7 +38,7 @@ public class NewsServiceImpl extends BaseMybatisDao<NewsMapper> implements NewsS
 		if (in.getReleaseStatus()==1&&in.getReleaseTime()==null) {
 			in.setReleaseTime(new Date());
 		}
-		
+
 		return newsMapper.insertSelective(in);
 	}
 
@@ -46,15 +46,17 @@ public class NewsServiceImpl extends BaseMybatisDao<NewsMapper> implements NewsS
 	public int updateNews(InputNews in) {
 		if (in.getReleaseTimes()!=null) {
 			try {
+
 				in.setReleaseTime(DateUtils.StringToDate(in.getReleaseTimes(), AFTConstants.YYYYMMDDHHMMSS));
 			} catch (ParseException e) {
 				throw new BusinessException("转换异常");
 			}
 		}
+
 		if (in.getReleaseStatus()!=null&&in.getReleaseStatus()==1&&in.getReleaseTime()==null) {
 			in.setReleaseTime(new Date());
 		}
-		
+
 		return newsMapper.updateByPrimaryKeySelective(in);
 	}
 
@@ -76,6 +78,6 @@ public class NewsServiceImpl extends BaseMybatisDao<NewsMapper> implements NewsS
 	@Override
 	public OutNews selectNews(InputNews in) {
 		return newsMapper.selectByid(in.getId());
-	} 
-	
+	}
+
 }

+ 2 - 2
src/main/resources/props/config_local.properties

@@ -1,11 +1,11 @@
 #Driver
 jdbc.driverClassName=com.mysql.cj.jdbc.Driver
 #本地
-jdbc.url=jdbc:mysql://localhost:3306/aft_ow?useSSL=false&serverTimezone=UTC
+jdbc.url=jdbc:mysql://localhost:3306/aft_ow?useSSL=false&serverTimezone=Asia/Shanghai
 jdbc.username=root
 jdbc.password=123456
 #测试
-#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft20181217?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft20181217?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
 #jdbc.username=root
 #jdbc.password=aftdev
 #\u68c0\u6d4b\u6570\u636e\u5e93\u94fe\u63a5\u662f\u5426\u6709\u6548\uff0c\u5fc5\u987b\u914d\u7f6e

+ 1 - 1
src/main/resources/props/config_prod.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-jdbc.url=jdbc\:mysql\://localhost\:3306/aft_ow?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
+jdbc.url=jdbc\:mysql\://localhost\:3306/aft_ow?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false&serverTimezone=Asia/Shanghai
 jdbc.username=root
 jdbc.password=aft@2017!
 #测试