Ver Fonte

app版本管理

everydatestudy há 3 anos atrás
pai
commit
bf52f49718

+ 1 - 2
java/sp-app/src/main/assembly/bin/restart.sh

@@ -1,5 +1,4 @@
 #!/bin/bash
 cd `dirname $0`
 ./stop.sh
-./start.sh
-
+./start.sh

+ 1 - 1
java/sp-app/src/main/java/com/anji/sp/service/impl/SpAppReqServiceImpl.java

@@ -286,7 +286,7 @@ public class SpAppReqServiceImpl implements SpAppReqService {
 				// 查询是否需要强制更新
 				List<String> list = vo.getNeedUpdateVersionList();
 				long version = spVersionService.selectUpdateVersion(list, vo.getCreateDate(), vo.getAppId());
-				if (paramVersion < version) {
+				if (paramVersion <=version) {
 					respVo.setUpdateStatus("2");
 				}
 			}

+ 1 - 1
java/sp-app/src/main/resources/application.properties

@@ -67,7 +67,7 @@ pagehelper.params=count=countSql
 
 
 #服务器地址
-customer.environment.path=https://openappsp.anji-plus.com
+customer.environment.path=http://127.0.0.1:10022
 #apk 下载路径前缀
 file.apk.url=http://192.168.0.105:8831/sp/download/
 # 上传你文件地址  upload.filename + /apk  查看 sp-version util FileProfileConfig、FileNameEnum、FileUploadUtils

+ 3 - 2
java/sp-app/src/main/resources/mapper/SpUserAppRoleMapper.xml

@@ -27,9 +27,10 @@
             resultType="com.anji.sp.model.vo.SpAppInfoVO">
     select a.*, b.title operation_title, b.oper_name operation_name,b.oper_time operation_time FROM (
 	select 
-	 a.promote_name,a.promote_version,a.promote_desc,a.promote_introduction,
+	 a.promote_name,a.promote_version,a.promote_desc,a.promote_introduction,a.logo_url,
 	  a.app_id, a.app_key, a.`name` from  sp_application a where a.enable_flag = 1 and a.delete_flag = 0) a
-	LEFT JOIN (select g.*  FROM (select s.app_id,MAX(s.oper_id) oper_id,MAX(s.oper_time) oper_time from sp_oper_log s GROUP BY s.app_id) log
+	LEFT JOIN (select g.*  FROM (select s.app_id,MAX(s.oper_id) oper_id,
+	MAX(s.oper_time) oper_time from sp_oper_log s GROUP BY s.app_id) log
 	LEFT JOIN sp_oper_log g on log.oper_id = g.oper_id) b on a.app_id=b.app_id
     </select>
 

+ 31 - 25
java/sp-auth/src/main/java/com/anji/sp/filter/JwtAuthenticationTokenFilter.java

@@ -23,30 +23,36 @@ import java.io.IOException;
 @Component
 public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
 
-    private static final String SLASH =  "/sp/";
-
-    @Autowired
-    private TokenService tokenService;
-
-    @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
-            throws ServletException, IOException {
-        String uri = request.getRequestURI();
-        if (SLASH.equals(uri)) {
-            response.setStatus(302);
-            response.setHeader("location", request.getContextPath() + "/index.html");
-            return;
-        }
-
-        LoginUser loginUser = tokenService.getLoginUser(request);
-        if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
-            tokenService.verifyToken(loginUser);
-            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
-            authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
-            //安全环境是通过调用 SecurityContextHolder.getContext().setAuthentication(…​), 传递到返回的验证对象建立的。
-            SecurityContextHolder.getContext().setAuthentication(authenticationToken);
-        }
-        chain.doFilter(request, response);
-    }
+	private static final String SLASH = "/sp/";
+
+	@Autowired
+	private TokenService tokenService;
+
+	@Override
+	protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
+			throws ServletException, IOException {
+		String uri = request.getRequestURI();
+		if (SLASH.equals(uri)) {
+			response.setStatus(302);
+			response.setHeader("location", request.getContextPath() + "/index.html");
+			return;
+		}
+		String path = request.getRequestURI();
+		if (path.contains("sp/upload/uploadMinio")) {
+			chain.doFilter(request, response);
+			return;
+		}
+		LoginUser loginUser = tokenService.getLoginUser(request);
+		if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
+			tokenService.verifyToken(loginUser);
+			UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser,
+					null, loginUser.getAuthorities());
+			authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+			// 安全环境是通过调用 SecurityContextHolder.getContext().setAuthentication(…​),
+			// 传递到返回的验证对象建立的。
+			SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+		}
+		chain.doFilter(request, response);
+	}
 
 }

+ 1 - 1
java/sp-auth/src/main/java/com/anji/sp/model/vo/SpAppInfoVO.java

@@ -34,7 +34,7 @@ public class SpAppInfoVO implements Serializable {
     @ApiModelProperty("操作日志信息用户名")
     private String operationName;
 
-    @ApiModelProperty("logo Url")
+    @ApiModelProperty("logo_url")
     private String logoUrl;
     @ApiModelProperty("推广版本/环境信息")
     private String promoteVersion;

+ 20 - 1
java/sp-version/src/main/java/com/anji/sp/controller/SpFileDownloadController.java

@@ -27,7 +27,8 @@ public class SpFileDownloadController {
 
     @Autowired
     private SpDownloadService spDownloadService;
-
+    @Autowired 
+    SpUploadService spUploadService;
     /**
      * 文件上传
      * @param spUploadVO
@@ -46,5 +47,23 @@ public class SpFileDownloadController {
     public ResponseEntity<byte[]> uploadFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("sdk") String sdk) {
         return spDownloadService.download(request, response, sdk);
     }
+    /**
+     * 文件上传
+     * @param spUploadVO
+     * @return
+     */
+
+    /**
+     * 文件下载
+     *
+     * @param sdk     appId
+     *                sdktest102-1629448268933-2-b6af895c0d1146d5a10d4367a664721e.apk
+     * @return
+     */
+    @ApiOperation(value = "文件下载", notes = "文件下载")
+    @GetMapping(value = "/file/download/{sdk}")
+    public ResponseEntity<byte[]> download(HttpServletRequest request, HttpServletResponse response, @PathVariable("sdk") String sdk) {
+        return spUploadService.download(request, response, sdk);
+    }
 }
 

+ 6 - 1
java/sp-version/src/main/java/com/anji/sp/controller/SpFileUploadController.java

@@ -91,7 +91,12 @@ public class SpFileUploadController {
 	@RequestMapping("/uploadMinio")
 	public Map<String, Object> uploadCard(@RequestBody String image) {
 		JSONObject json = JSONObject.parseObject(image);
-		FileUploadUtils.saveImage(json.getString("base64"));
+		try {
+			FileUploadUtils.saveImage(json.getString("base64"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
 		// SUCCESS(100,"操作成功!"),
 		Map<String, Object> map = new HashMap<>();
 		map.put("code", 100);

+ 1 - 1
java/sp-version/src/main/java/com/anji/sp/service/impl/SpUploadServiceImpl.java

@@ -128,7 +128,7 @@ public class SpUploadServiceImpl implements SpUploadService {
 			if (StringUtils.isBlank(f.getFilePath())) {
 				ResponseModel.errorMsg("文件路径不存在");
 			}
-			String filename = filePath.substring(filePath.lastIndexOf(File.separator));
+			String filename = filePath.substring(filePath.lastIndexOf("/"));
 			if (StringUtils.isBlank(filename)) {
 				ResponseModel.errorMsg("文件名为空");
 			}