Commit 6e5db5c65401bb8da7d32f32fe538a7c57fb3ac3

Authored by 谭毅彬
1 parent 6567790a

授权激活页面提示修改

Signed-off-by: TanYibin <5491541@qq.com>
ant-design-vue-jeecg/src/views/user/modules/SystemActivationModal.vue
... ... @@ -5,7 +5,7 @@
5 5 <a-tab-pane key="tab1" tab="系统激活授权"/>
6 6 </a-tabs>
7 7 <a-form-model-item>
8   - <a-input size="large" v-model="model.activationCode" autocomplete="false" placeholder="系统授权已过期,请输入系统激活码"/>
  8 + <a-input size="large" v-model="model.activationCode" autocomplete="false" placeholder="系统激活授权期限已到期,请输入系统激活码"/>
9 9 </a-form-model-item>
10 10 <a-form-item style="margin-top:24px">
11 11 <a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn" @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java
... ... @@ -15,6 +15,7 @@ import java.util.Map;
15 15 import javax.servlet.http.HttpServletRequest;
16 16 import javax.servlet.http.HttpServletResponse;
17 17  
  18 +import org.apache.commons.io.FileUtils;
18 19 import org.apache.commons.io.IOUtils;
19 20 import org.apache.shiro.SecurityUtils;
20 21 import org.jeecg.common.api.vo.Result;
... ... @@ -114,7 +115,7 @@ public class LoginController {
114 115  
115 116 @Autowired
116 117 private BaseCommonService baseCommonService;
117   -
  118 +
118 119 @Autowired
119 120 private HuahengRedisUtil huahengRedisUtil;
120 121  
... ... @@ -205,6 +206,10 @@ public class LoginController {
205 206 FileCopyUtils.copy(systemActivationModel.getActivationCode().getBytes(), outputStream);
206 207 // 验证通过写入Redis
207 208 huahengRedisUtil.setWithNoExpirationTime(HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_KEY, systemActivationModel.getActivationCode());
  209 + } catch (TokenExpiredException e) {
  210 + result.setSuccess(false);
  211 + result.setCode(499);
  212 + result.setMessage("系统激活授权期限已到期");
208 213 } catch (JWTVerificationException e) {
209 214 log.error(e.getMessage());
210 215 result.error500("系统激活码无效");
... ... @@ -217,14 +222,15 @@ public class LoginController {
217 222 result.setMessage("系统激活成功");
218 223 return result;
219 224 }
220   -
  225 +
221 226 private Result<JSONObject> checkSystemActivationCode() throws IOException {
222 227 Result<JSONObject> result = new Result<JSONObject>();
223 228 FileInputStream inputStream = null;
224 229 FileOutputStream outputStream = null;
  230 + File file = null;
225 231 try {
226 232 String activationCode = null;
227   - File file = new File(System.getProperties().getProperty("user.dir") + File.separatorChar + HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_FILE_NAME);
  233 + file = new File(System.getProperties().getProperty("user.dir") + File.separatorChar + HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_FILE_NAME);
228 234 if (file.exists()) {
229 235 inputStream = new FileInputStream(file);
230 236 activationCode = IOUtils.toString(inputStream, "utf-8");
... ... @@ -252,9 +258,20 @@ public class LoginController {
252 258 huahengRedisUtil.setWithNoExpirationTime(HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_KEY, activationCode);
253 259 }
254 260 } catch (TokenExpiredException e) {
  261 + // 激活码过期删除系统中的激活码
  262 + if (file != null && file.exists()) {
  263 + if (inputStream != null) {
  264 + inputStream.close();
  265 + }
  266 + if (outputStream != null) {
  267 + outputStream.close();
  268 + }
  269 + FileUtils.forceDelete(file);
  270 + huahengRedisUtil.delete(HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_KEY);
  271 + }
255 272 result.setSuccess(false);
256 273 result.setCode(499);
257   - result.setMessage("系统激活码使用期限已到期");
  274 + result.setMessage("系统激活授权期限已到期");
258 275 } catch (Exception e) {
259 276 result.setSuccess(false);
260 277 result.setCode(499);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysTenantController.java
... ... @@ -180,7 +180,7 @@ public class SysTenantController {
180 180 LambdaQueryWrapper<SysTenant> query = new LambdaQueryWrapper<>();
181 181 query.eq(SysTenant::getStatus, 1);
182 182 if (oConvertUtils.isNotEmpty(ids)) {
183   - query.in(SysTenant::getId, ids.split(","));
  183 + query.in(SysTenant::getId, Arrays.asList(ids.split(",")));
184 184 }
185 185 // 此处查询忽略时间条件
186 186 List<SysTenant> ls = sysTenantService.list(query);
... ...