瀏覽代碼

登录新加入版本分支号

wangliang 2 年之前
父節點
當前提交
ad6acae0a0

+ 1 - 25
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -38,7 +38,6 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
@@ -117,9 +116,6 @@ public class SysController {
     @Resource
     ConditionService conditionService;
 
-    @Value(value = "${app.version}")
-    private String version;
-
     /**
      * 登录
      *
@@ -427,9 +423,6 @@ public class SysController {
         return ResultUtil.ok(userLoginCheckResult, "");
     }
 
-//    @Resource
-//    private Environment env;
-
     @ApiOperation(value = "根据机构代码查询机构信息接口")
     @RequestMapping(value = "/school/query_by_school_code", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学校信息", response = EditResult.class)})
@@ -438,25 +431,8 @@ public class SysController {
         if (Objects.nonNull(code) && code.contains("#")) {
             code = code.substring(0, code.indexOf("#"));
         }
-//        String jdbcUrl = env.getProperty("app1.version");
-//        String[] strs = env.getActiveProfiles();
-//        String version1 = this.getClass().getPackage().getImplementationVersion();
-//        String version = Application.class.getPackage().getImplementationVersion();
-//        Enumeration<URL> urls = null;
-//        try {
-//            //假设读取META-INF/MANIFEST.MF文件
-//            urls = SpringContextHolder.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
-//            int i = 1;
-//            while (urls.hasMoreElements()) {
-//                URL url = urls.nextElement();
-//                log.info("===={}, {}", i++, url.getPath());
-//            }
-//        } catch (IOException e) {
-//            log.error(e.getMessage());
-//        }
-        String version2 = SystemConstant.getVersion();
         Map<String, Object> map = new HashMap<>();
-        map.put(SystemConstant.VERSION, version);
+        map.put(SystemConstant.VERSION, SystemConstant.VERSION_VALUE);
         if (!code.equalsIgnoreCase(SystemConstant.ADMIN_CODE)) {
             BasicSchool basicSchool = commonCacheService.schoolCache(code);
             Optional.ofNullable(basicSchool).orElseThrow(() -> ExceptionResultEnum.SCHOOL_NO_DATA.exception());

+ 0 - 1
distributed-print/src/main/resources/application.properties

@@ -8,7 +8,6 @@ server.tomcat.uri-encoding=UTF-8
 
 #\u9879\u76EE\u540D\u79F0
 spring.application.name=distributed-print
-app.version=@project.version@
 
 #\u6570\u636E\u6E90\u914D\u7F6E
 db.host=localhost

+ 18 - 19
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -234,6 +234,7 @@ public class SystemConstant {
     public static final String ID = "id";
     public static final String MODEL = "model";
     public static final String VERSION = "version";
+    public static final String VERSION_VALUE = "3.2.5.1";
     public static final String FLOW_ENTITY_ID = "flowEntityId";
     public static final String CUSTOM_FLOW_ID = "customFlowId";
     public static final String ACT_FLOW_ID = "actFlowId";
@@ -1126,23 +1127,21 @@ public class SystemConstant {
         return file;
     }
 
-    /**
-     * 获取版本号
-     *
-     * @return
-     */
-    public static String getVersion() {
-//        String rootPath = System.getProperty(SystemConstant.USER_DIR);
-        MavenXpp3Reader reader = new MavenXpp3Reader();
-//        String myPom = rootPath + File.separator + "pom.xml";
-        Model model = null;
-        String version = null;
-        try {
-            model = reader.read(new FileReader("pom.xml"));
-            version = model.getVersion();
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-        }
-        return version;
-    }
+//    /**
+//     * 获取版本号
+//     *
+//     * @return
+//     */
+//    public static String getVersion() {
+//        MavenXpp3Reader reader = new MavenXpp3Reader();
+//        Model model = null;
+//        String version = null;
+//        try {
+//            model = reader.read(new FileReader("pom.xml"));
+//            version = model.getVersion();
+//        } catch (Exception e) {
+//            log.error(SystemConstant.LOG_ERROR, e);
+//        }
+//        return version;
+//    }
 }

+ 1 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -785,8 +785,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         redisUtil.setUserSession(sessionId, tbSession, expireTime.getExpireSeconds());
 
 //        LoginResult loginResult = new LoginResult(sysUser, sessionId, test, Objects.nonNull(roleTypes) && roleTypes.size() > 0 ? roleTypes : roleNamesSet, appSource, roleSource);
-        String version = SystemConstant.getVersion();
-        LoginResult loginResult = new LoginResult(sysUser, sessionId, token, Objects.nonNull(roleTypes) && roleTypes.size() > 0 ? roleTypes : roleNamesSet, appSource, roleSource, version);
+        LoginResult loginResult = new LoginResult(sysUser, sessionId, token, Objects.nonNull(roleTypes) && roleTypes.size() > 0 ? roleTypes : roleNamesSet, appSource, roleSource, SystemConstant.VERSION_VALUE);
         loginResult.setSchoolInfo(Objects.nonNull(authBean.getSchool()) ? Lists.newArrayList(loginResult.new SchoolNativeBean(authBean.getSchool())) : null);
         loginResult.setOrgInfo(Objects.nonNull(authBean.getOrg()) ? loginResult.new OrgNativeBean(authBean.getOrg()) : null);
         loginResult.setTime(System.currentTimeMillis());

+ 1 - 2
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysController.java

@@ -225,9 +225,8 @@ public class SysController {
         if (Objects.nonNull(code) && code.contains("#")) {
             code = code.substring(0, code.indexOf("#"));
         }
-        String version = SystemConstant.getVersion();
         Map<String, Object> map = new HashMap<>();
-        map.put(SystemConstant.VERSION, version);
+        map.put(SystemConstant.VERSION, SystemConstant.VERSION_VALUE);
         if (!Objects.equals(code.toUpperCase(), RoleTypeEnum.ADMIN.name())) {
             BasicSchool basicSchool = commonCacheService.schoolCache(code);
             Optional.ofNullable(basicSchool).orElseThrow(() -> ExceptionResultEnum.SCHOOL_NO_DATA.exception());