syh пре 5 година
родитељ
комит
954950111f
18 измењених фајлова са 228 додато и 417 уклоњено
  1. 0 4
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountAuth.java
  2. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  3. 1 3
      module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java
  4. 0 13
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java
  5. 42 40
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  6. 20 91
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  7. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/IpPoolServiceImpl.java
  8. 37 45
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java
  9. 15 21
      module-common/src/main/java/cn/com/ctop/common/module/utils/AesEncryptUtil.java
  10. 14 6
      module-common/src/main/java/cn/com/ctop/common/module/utils/Base64Utils.java
  11. 6 77
      module-common/src/main/java/cn/com/ctop/common/module/utils/BigDecimalUtil.java
  12. 0 4
      module-common/src/main/java/cn/com/ctop/common/module/utils/BytedanceInterfaceConstant.java
  13. 2 8
      module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java
  14. 5 3
      module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java
  15. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/CsvUtils.java
  16. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  17. 78 97
      module-common/src/main/java/cn/com/ctop/common/module/utils/FileUploadTool.java
  18. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpClientUtils.java

+ 0 - 4
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountAuth.java

@@ -68,8 +68,4 @@ public class BindAccountAuth {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
-
-
-    public BindAccountAuth() {
-    }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java

@@ -20,7 +20,7 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
 
     Map<String, Object> getByteDanceAccessToken(String accountId);
 
-    Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken, Integer agentType);
+    void getKuaiShouRefreshToken(Long accountId, String refreshToken, Integer agentType);
 
     List<CtopOauthToken> getTokenListByType(String platformTypeBytedance);
 

+ 1 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java

@@ -16,7 +16,7 @@ import java.util.Map;
  */
 public interface IFileInfoService extends IService<FileInfo> {
 
-    Map<String, Object> uploadVideoToBytedance(String accountId, String videoUrl);
+    void uploadVideoToBytedance(String accountId, String videoUrl);
 
     Map<String, Object> uploadImageToBytedance(String accountId, String imageFileId);
 
@@ -28,7 +28,5 @@ public interface IFileInfoService extends IService<FileInfo> {
 
     JSONObject getCreativeWord(CtopOauthToken token, Long advertiserId);
 
-    Map<String, Object> insertFile(String code, String url);
-
     String downLoadByUrl(String fileUrl);
 }

+ 0 - 13
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CorpWeixinServiceImpl.java

@@ -1,22 +1,12 @@
 package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.service.ICorpWeixinService;
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import lombok.val;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpChatService;
 import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.api.WxCpUserService;
-import me.chanjar.weixin.cp.api.impl.WxCpChatServiceImpl;
 import me.chanjar.weixin.cp.api.impl.WxCpOAuth2ServiceImpl;
 import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
-import me.chanjar.weixin.cp.api.impl.WxCpUserServiceImpl;
-import me.chanjar.weixin.cp.bean.WxCpAppChatMessage;
 import me.chanjar.weixin.cp.bean.WxCpMessage;
-import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
-import me.chanjar.weixin.cp.bean.WxCpUser;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 import org.springframework.stereotype.Service;
 
@@ -35,9 +25,6 @@ public class CorpWeixinServiceImpl implements ICorpWeixinService {
         service.setWxCpConfigStorage(configStorage);
         WxCpOAuth2Service wxCpOAuth2Service = new WxCpOAuth2ServiceImpl(service);
         try {
-//            WxCpOauth2UserInfo userInfo = wxCpOAuth2Service.getUserInfo(1000002,"_Mq0Dx1dynryHsgBkoU1dAk5A3Y7lrfg8V0GDv4ocWQ");
-//            WxCpUserService wxCpUserService = new WxCpUserServiceImpl(service);
-//            WxCpUser user = wxCpUserService.getById("YiErSanSi");
             WxCpMessage message = new WxCpMessage();
             message.setToUser("YiErSanSi");
             message.setAgentId(1000002);

+ 42 - 40
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -35,8 +35,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
         queryWrapper.last("limit 1");
-        CtopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
-        return cTopOauthToken;
+        return cTopOauthTokenMapper.selectOne(queryWrapper);
     }
 
 
@@ -45,8 +44,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
         queryWrapper.last("limit 1");
-        CtopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
-        return cTopOauthToken;
+        return cTopOauthTokenMapper.selectOne(queryWrapper);
     }
 
     /**
@@ -65,7 +63,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
             return resultMap;
         }
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + "/oauth2/refresh_token";
-        Map<String, Object> param = new HashMap<String, Object>();
+        Map<String, Object> param = new HashMap<>();
         param.put("app_id", PropertiesUtils.getValue("bytedance_config", "bytedance_appid"));
         param.put("secret", PropertiesUtils.getValue("bytedance_config", "bytedance_secret"));
         param.put("grant_type", "refresh_token");
@@ -102,11 +100,11 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
      * @return
      */
     @Override
-    public Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken, Integer agentType) {
+    public void getKuaiShouRefreshToken(Long accountId, String refreshToken, Integer agentType) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + "/rest/openapi/oauth2/authorize/refresh_token";
-        Map<String, String> headers = new HashMap<String, String>();
+        Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", " application/json");
-        Map<String, Object> param = new HashMap<String, Object>();
+        Map<String, Object> param = new HashMap<>();
         if (agentType == 1) {
             param.put("app_id", PropertiesUtils.getConfig("kuaishou_appid"));
             param.put("secret", PropertiesUtils.getConfig("kuaishou_secret"));
@@ -117,44 +115,48 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
 
         param.put("refresh_token", refreshToken);
         try {
+            CtopOauthToken oauthToken = cTopOauthTokenMapper.selectByAccountId(accountId);
+            if (null == oauthToken) {
+                log.error("查询token信息返回结果为空,accountId:{}", accountId);
+                return;
+            }
             String result = HttpUtils.httpPostRequest(url, param, headers);
             JSONObject resultJson = JSONObject.parseObject(result);
-            if (!Check.isNull(resultJson)) {
-                Integer code = resultJson.getInteger("code");
-                if (code == 0) {
-                    CtopOauthToken oauthToken = cTopOauthTokenMapper.selectByAccountId(accountId);
-                    if (!Check.isNull(oauthToken)) {
-                        JSONObject dataJson = resultJson.getJSONObject("data");
-                        if (!Check.isNull(dataJson)) {
-                            oauthToken.setAccessToken(dataJson.getString("access_token"));
-                            long accessTokenExpireIn = dataJson.getLong("access_token_expires_in") * 1000L;
-                            long now = System.currentTimeMillis();
-                            Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
-                            oauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
-                            oauthToken.setRefreshToken(dataJson.getString("refresh_token"));
-                            long refreshTokenExpireIn = dataJson.getLong("refresh_token_expires_in") * 1000L;
-                            Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
-                            oauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
-                            oauthToken.setUpdateTime(new Date());
-                            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-                            queryWrapper.eq("account_id", accountId);
-                            queryWrapper.eq("media_id", 2);
-                            int i = cTopOauthTokenMapper.update(oauthToken, queryWrapper);
-                            if (i > 0) {
-                                log.info("快手刷新token成功,accountId:{}", accountId);
-                            }
-                        }
-                    }
-                } else {
-                    log.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
-                }
-            } else {
+            if (Check.isNull(resultJson)) {
                 log.error("快手刷新token返回结果为空,accountId:{}", accountId);
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            if (null == code || code != 0) {
+                log.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
+                return;
+            }
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (null == dataJson) {
+                log.error("快手刷新token失败,accountId:{},result:{}", accountId, resultJson);
+                return;
+            }
+            oauthToken.setAccessToken(dataJson.getString("access_token"));
+            long accessTokenExpireIn = dataJson.getLong("access_token_expires_in") * 1000L;
+            long now = System.currentTimeMillis();
+            Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
+            oauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
+            oauthToken.setRefreshToken(dataJson.getString("refresh_token"));
+            long refreshTokenExpireIn = dataJson.getLong("refresh_token_expires_in") * 1000L;
+            Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
+            oauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+            oauthToken.setUpdateTime(new Date());
+            QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("media_id", 2);
+            int i = cTopOauthTokenMapper.update(oauthToken, queryWrapper);
+            if (i > 0) {
+                log.info("快手刷新token成功,accountId:{}", accountId);
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            log.error("快手刷新token失败,accountId{}", accountId);
         }
-        return null;
     }
 
     @Override

+ 20 - 91
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -5,7 +5,9 @@ import cn.com.ctop.common.module.entity.FileInfo;
 import cn.com.ctop.common.module.mapper.FileInfoMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IFileInfoService;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.utils.BytedanceInterfaceConstant;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,7 +15,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.http.HttpEntity;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -51,19 +52,16 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     private ICtopOauthTokenService tokenService;
 
     @Override
-    public Map<String, Object> uploadVideoToBytedance(String accountId, String videoUrl) {
+    public void uploadVideoToBytedance(String accountId, String videoUrl) {
         try {
             CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
             uploadAdvideo(token, videoUrl, token.getAccountId() + "");
             JSONObject jsonObject = videoUpload(token, videoUrl);
             log.info("头条上传素材返回信息:{},accountId:{}", jsonObject, accountId);
         } catch (Exception e) {
-            log.info("头条上传视频文件失败,accountId:{}", accountId);
-            e.printStackTrace();
+            log.error("头条上传视频文件失败,accountId:{}", accountId);
+            log.error(e.getMessage(), e);
         }
-
-        return new HashMap<>();
-
     }
 
     @Override
@@ -74,8 +72,8 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             JSONObject jsonObject = imageUpload(token, String.valueOf(token.getAccountId()), imageUrl);
             log.info("头条上传图片素材返回信息:{},accountId:{}", jsonObject, accountId);
         } catch (Exception e) {
-            log.info("头条上传图片文件失败,accountId:{}", accountId);
-            e.printStackTrace();
+            log.error("头条上传图片文件失败,accountId:{}", accountId);
+            log.error(e.getMessage(), e);
         }
 
         return resultMap;
@@ -125,77 +123,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return resultObject;
     }
 
-    @Override
-    public Map<String, Object> insertFile(String code, String url) {
-        Map<String, Object> resultMap = new HashMap();
-        FileInfo fileInfo = new FileInfo();
-        fileInfo.setFileName("");
-        fileInfo.setFileUrl(url);
-        fileInfo.setMd5(code);
-        fileInfo.setPath("");
-        fileInfo.setPlatformType("");
-        fileInfo.setAccountId(0L);
-        fileInfo.setFileId("");
-        fileInfo.setType("");
-        this.saveOrUpdate(fileInfo);
-        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
-        return resultMap;
-    }
-
-    public JSONObject searchIndustry(CtopOauthToken token, Integer level) {
-        // 请求地址
-        String url = "https://ad.toutiao.com/open_api/2/tools/industry/get/";
-        if (null != level) {
-            url += "?level=" + level;
-        }
-        return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, new JSONObject());
-    }
-
-    public JSONObject uploadAdImage(CtopOauthToken token, String imageUrl, String advertiserId) {
-        JSONObject result = new JSONObject();
-        //1:下载文件到本地
-        String imagePath = downLoadByUrl(imageUrl);
-        //2: 获取MD5值
-        String md5Hex = null;
-        try {
-            md5Hex = DigestUtils.md5Hex(new FileInputStream(imagePath));
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        //3: 根据MD5值查询是否已经上传过服务器
-      /*  List<FileInfo> getFileInfo = getFileInfoByMd5(md5Hex);
-        //表示已经上传过服务器
-        if (null != getFileInfo && getFileInfo.size() > 0) {
-            result.put("code", 0);
-            result.put("file", getFileInfo.get(0));
-            result.put("message", "图片上传成功");
-            result.put("success", true);
-            return result;
-        }*/
-        QueryWrapper<FileInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("md5", md5Hex);
-        fileInfoMapper.delete(queryWrapper);
-
-        //文件上传
-        JSONObject bytedanceObject = imageUpload(token, advertiserId, imageUrl);
-        if (null == bytedanceObject) {
-            log.info("今日头条图片上传失败");
-            result.put("code", -1);
-            result.put("message", "今日头条文件上传失败");
-            return result;
-        }
-        JSONObject data = bytedanceObject.getJSONObject("data");
-        FileInfo fileInfo = new FileInfo(md5Hex, data, advertiserId, token, "https:" + imageUrl, imagePath, "IMAGE", "1");
-        fileInfoMapper.insert(fileInfo);
-        result.put("code", 0);
-        result.put("file", fileInfo);
-        result.put("message", "图片上传成功");
-        result.put("success", true);
-        return result;
-    }
-
     private JSONObject imageUpload(CtopOauthToken token, String advertiserId, String imageUrl) {
-        JSONObject result = null;
         // 请求地址
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_file_image_ad");
         // 构造请求
@@ -217,7 +145,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             response = client.execute(httpPost);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
                 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuffer buffer = new StringBuffer();
+                StringBuilder buffer = new StringBuilder();
                 String line = "";
                 while ((line = bufferedReader.readLine()) != null) {
                     buffer.append(line);
@@ -225,18 +153,18 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                 bufferedReader.close();
                 return JSONObject.parseObject(buffer.toString());
             }
-        } catch (ClientProtocolException e) {
-            e.printStackTrace();
         } catch (IOException e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         } finally {
             try {
                 if (response != null) {
                     response.close();
                 }
-                client.close();
+                if (null != client) {
+                    client.close();
+                }
             } catch (IOException e) {
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
             }
         }
         return null;
@@ -277,7 +205,6 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     }
 
     public void uploadAdvideo(CtopOauthToken token, String videoUrl, String advertiserId) {
-        JSONObject result = new JSONObject();
         //1:下载文件到本地
 
 
@@ -310,7 +237,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             response = client.execute(httpPost);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
                 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-                StringBuffer result = new StringBuffer();
+                StringBuilder result = new StringBuilder();
                 String line = "";
                 while ((line = bufferedReader.readLine()) != null) {
                     result.append(line);
@@ -319,15 +246,17 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
                 return JSONObject.parseObject(result.toString());
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         } finally {
             try {
                 if (response != null) {
                     response.close();
                 }
-                client.close();
+                if (null != client) {
+                    client.close();
+                }
             } catch (IOException e) {
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
             }
         }
         return null;

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/IpPoolServiceImpl.java

@@ -67,7 +67,7 @@ public class IpPoolServiceImpl extends ServiceImpl<IpPoolMapper, IpPool> impleme
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         }
     }
 }

+ 37 - 45
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -3,7 +3,6 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
 import cn.com.ctop.common.module.mapper.MaterialCutFrameMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.MpsUtils;
 import com.alibaba.fastjson.JSON;
@@ -104,59 +103,52 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
             request.setPipelineId(pipelineId);
             // call api
             SubmitSnapshotJobResponse response;
-
             response = client.getAcsResponse(request);
-
-        /*    String requestId = response.getRequestId();
-            String jobId = response.getSnapshotJob().getId();
-*/
             for (int i = 0; i < 100; i++) {
-
-                Thread.sleep(5 * 1000);
+                Thread.sleep(5 * 1000L);
                 QuerySnapshotJobListRequest request1 = new QuerySnapshotJobListRequest();
                 request1.setSnapshotJobIds(response.getSnapshotJob().getId());
                 QuerySnapshotJobListResponse response1 = client.getAcsResponse(request1);
                 String s = JSON.toJSONString(response1);
                 JSONObject jsonObject = JSONObject.parseObject(s);
-                if (!Check.isNull(jsonObject)) {
-                    JSONObject json = (JSONObject) jsonObject.getJSONArray("snapshotJobList").get(0);
-                    String state = json.getString("state");
-                    if ("Success".equals(state)) {
-                        Integer count = json.getInteger("count");
-                        for (int j = 1; j <= count; j++) {
-                            String urlStr = "";
-                            if (j < 10) {
-                                urlStr = String.format(
-                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_0000" + j + ".jpg",
-                                        ossBucket,
-                                        ossLocation);
-                            } else if (j >= 10 && j < 100) {
-                                urlStr = String.format(
-                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_000" + j + ".jpg",
-                                        ossBucket,
-                                        ossLocation);
-                            } else if (j > 100) {
-                                urlStr = String.format(
-                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_00" + j + ".jpg",
-                                        ossBucket,
-                                        ossLocation);
-                            }
-                            String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, "D:\\tets1");
-                            String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
-                            LoadFileUtil.delFile(cutFramePath);
-                            cutFrame = new MaterialCutFrame();
-                            cutFrame.setCode(cutFrameMd5);
-                            cutFrame.setUrl(urlStr);
-                            cutFrame.setMaterialMd5(materialId);
-                            cutFrame.setCutFrameIndex(j);
-                            this.save(cutFrame);
-                        }
-
-                        break;
+                if (jsonObject == null) {
+                    continue;
+                }
+                JSONObject json = (JSONObject) jsonObject.getJSONArray("snapshotJobList").get(0);
+                String state = json.getString("state");
+                if (null == state || !"Success".equals(state)) {
+                    continue;
+                }
+                Integer count = json.getInteger("count");
+                for (int j = 1; j <= count; j++) {
+                    String urlStr = "";
+                    if (j < 10) {
+                        urlStr = String.format(
+                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_0000" + j + ".jpg",
+                                ossBucket,
+                                ossLocation);
+                    } else if (j < 100) {
+                        urlStr = String.format(
+                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_000" + j + ".jpg",
+                                ossBucket,
+                                ossLocation);
+                    } else if (j > 100) {
+                        urlStr = String.format(
+                                "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_00" + j + ".jpg",
+                                ossBucket,
+                                ossLocation);
                     }
+                    String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, "D:\\tets1");
+                    String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+                    LoadFileUtil.delFile(cutFramePath);
+                    cutFrame = new MaterialCutFrame();
+                    cutFrame.setCode(cutFrameMd5);
+                    cutFrame.setUrl(urlStr);
+                    cutFrame.setMaterialMd5(materialId);
+                    cutFrame.setCutFrameIndex(j);
+                    this.save(cutFrame);
                 }
-
-
+                break;
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 15 - 21
module-common/src/main/java/cn/com/ctop/common/module/utils/AesEncryptUtil.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.utils;
 
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.codec.Base64;
 
 import javax.crypto.Cipher;
@@ -9,16 +10,13 @@ import java.io.UnsupportedEncodingException;
 
 /**
  * AES 加密
+ * @author jeecg-boot
  */
+@Slf4j
 public class AesEncryptUtil {
 
-    /**
-     * 使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
-     */
-    private static String KEY = EncryptedString.key;
-
-    private static String IV = EncryptedString.iv;
-
+    private AesEncryptUtil() {
+    }
     /**
      * 加密方法
      *
@@ -26,9 +24,8 @@ public class AesEncryptUtil {
      * @param key  加密key
      * @param iv   加密iv
      * @return 加密的结果
-     * @throws Exception
      */
-    public static String encrypt(String data, String key, String iv) throws Exception {
+    public static String encrypt(String data, String key, String iv) {
         try {
             //"算法/模式/补码方式"NoPadding PkcsPadding
             Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
@@ -52,7 +49,7 @@ public class AesEncryptUtil {
             return Base64.encodeToString(encrypted);
 
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
             return null;
         }
     }
@@ -66,7 +63,7 @@ public class AesEncryptUtil {
      * @return 解密的结果
      * @throws Exception
      */
-    public static String desEncrypt(String data, String key, String iv) throws Exception {
+    public static String desEncrypt(String data, String key, String iv) {
         try {
             byte[] encrypted1 = Base64.decode(data);
 
@@ -77,10 +74,9 @@ public class AesEncryptUtil {
             cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
 
             byte[] original = cipher.doFinal(encrypted1);
-            String originalString = new String(original);
-            return originalString;
+            return new String(original);
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
             return null;
         }
     }
@@ -92,8 +88,8 @@ public class AesEncryptUtil {
      * @return
      * @throws Exception
      */
-    public static String encrypt(String data) throws Exception {
-        return encrypt(data, KEY, IV);
+    public static String encrypt(String data) {
+        return encrypt(data, EncryptedString.key, EncryptedString.iv);
     }
 
     /**
@@ -101,10 +97,9 @@ public class AesEncryptUtil {
      *
      * @param data
      * @return
-     * @throws Exception
      */
-    public static String desEncrypt(String data) throws Exception {
-        return desEncrypt(data, KEY, IV);
+    public static String desEncrypt(String data) {
+        return desEncrypt(data, EncryptedString.key, EncryptedString.iv);
     }
 
 
@@ -116,10 +111,9 @@ public class AesEncryptUtil {
         try {
             result = java.net.URLDecoder.decode(str, "UTF-8");
         } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         }
         return result;
 
-
     }
 }

+ 14 - 6
module-common/src/main/java/cn/com/ctop/common/module/utils/Base64Utils.java

@@ -1,20 +1,28 @@
 package cn.com.ctop.common.module.utils;
 
+import lombok.extern.slf4j.Slf4j;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Base64;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+@Slf4j
 public class Base64Utils {
-    private static Pattern REUNICODE_PATTERN = Pattern.compile("[0-9]+");
+    private static Pattern reunicodePattern = Pattern.compile("[0-9]+");
+
+    private Base64Utils() {
+
+    }
+
     public static String decode1(String s) {
-        Matcher m = REUNICODE_PATTERN.matcher(s);
+        Matcher m = reunicodePattern.matcher(s);
         StringBuffer sb = new StringBuffer(s.length());
         while (m.find()) {
-            m.appendReplacement(sb,
-                    Character.toString((char) Integer.parseInt(m.group(1), 16)));
+            m.appendReplacement(sb, Character.toString((char) Integer.parseInt(m.group(1), 16)));
         }
         m.appendTail(sb);
         return sb.toString();
@@ -32,7 +40,7 @@ public class Base64Utils {
         }
         Base64.Decoder decoder = Base64.getDecoder();
         try {
-            return new String(decoder.decode(text), "utf-8");
+            return new String(decoder.decode(text), StandardCharsets.UTF_8);
         } catch (Exception e) {
             return null;
         }
@@ -47,7 +55,7 @@ public class Base64Utils {
             in.read(data);
             in.close();
         } catch (IOException e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         }
         // 对字节数组Base64编码
         Base64.Encoder encoder = Base64.getEncoder();

+ 6 - 77
module-common/src/main/java/cn/com/ctop/common/module/utils/BigDecimalUtil.java

@@ -3,20 +3,10 @@ package cn.com.ctop.common.module.utils;
 import java.math.BigDecimal;
 
 public class BigDecimalUtil {
+    private BigDecimalUtil() {
 
-    /**
-     * 想加
-     *
-     * @param v1
-     * @param v2
-     * @return
-     */
-    public static BigDecimal addBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal add_result = v1.add(v2);
-        return add_result;
     }
 
-
     /**
      * 相减
      *
@@ -25,8 +15,7 @@ public class BigDecimalUtil {
      * @return
      */
     public static BigDecimal subtractBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal subtract_result = v1.subtract(v2);
-        return subtract_result;
+        return v1.subtract(v2);
     }
 
 
@@ -38,8 +27,7 @@ public class BigDecimalUtil {
      * @return
      */
     public static BigDecimal multiplyBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal multiply_result = v1.multiply(v2);
-        return multiply_result;
+        return v1.multiply(v2);
     }
 
 
@@ -51,47 +39,7 @@ public class BigDecimalUtil {
      * @return
      */
     public static BigDecimal divideBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal divide_result = v1.divide(v2);
-        return divide_result;
-    }
-
-
-    /**
-     * 余数
-     *
-     * @param v1
-     * @param v2
-     * @return
-     */
-    public static BigDecimal remainderDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal remainder_result = v1.remainder(v2);
-        return remainder_result;
-    }
-
-    /**
-     * 最大数
-     *
-     * @param v1
-     * @param v2
-     * @return
-     */
-
-    public static BigDecimal maxBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal max_result = v1.max(v2);
-        return max_result;
-    }
-
-    /**
-     * 最小数
-     *
-     * @param v1
-     * @param v2
-     * @return
-     */
-
-    public static BigDecimal minBigDecimal(BigDecimal v1, BigDecimal v2) {
-        BigDecimal min_result = v1.min(v2);
-        return min_result;
+        return v1.divide(v2);
     }
 
     /**
@@ -101,26 +49,9 @@ public class BigDecimalUtil {
      * @return
      */
     public static BigDecimal absBigDecimal(BigDecimal v) {
-        BigDecimal abs_result = v.abs();
-        return abs_result;
-
-
+        return v.abs();
     }
 
-
-    /**
-     * 相反数
-     *
-     * @param v
-     * @return
-     */
-    public static BigDecimal negateBigDecimal(BigDecimal v) {
-        BigDecimal negate_result = v.negate();
-        return negate_result;
-
-    }
-
-
     /**
      * 比较大小
      *
@@ -130,9 +61,7 @@ public class BigDecimalUtil {
      * -1 小于 0 等于 1 大于
      */
     public static int compareToDecimal(BigDecimal v1, BigDecimal v2) {
-        int i = v1.compareTo(v2);
-        return i;
-
+        return v1.compareTo(v2);
     }
 
 }

+ 0 - 4
module-common/src/main/java/cn/com/ctop/common/module/utils/BytedanceInterfaceConstant.java

@@ -3,10 +3,6 @@ package cn.com.ctop.common.module.utils;
 public class BytedanceInterfaceConstant {
     public static final String AUTH_PATH = "/audit/oauth.html";
     public static final String AUTH_TOKEN = "/oauth2/access_token";
-    public static final String REFRESH_TOKEN = "/oauth2/refresh_token";
-    public static final String ADVERTISER_INFO = "/2/advertiser/info";
-
-    public static final String UPLOAD_TYPE_BY_FILE = "UPLOAD_BY_FILE";
     public static final String UPLOAD_TYPE_BY_URL = "UPLOAD_BY_URL";
 
 }

+ 2 - 8
module-common/src/main/java/cn/com/ctop/common/module/utils/ChaojiyingUtils.java

@@ -11,20 +11,14 @@ public class ChaojiyingUtils {
     private static Integer softId = 901055;
 
     public static String process(String imageBase64,int code) {
-        Map<String, Object> params = new HashMap<String, Object>();
+        Map<String, Object> params = new HashMap<>();
         params.put("user", username);
         params.put("pass", password);
         params.put("softid", softId);
-//        params.put("codetype", 9005);
         params.put("codetype", code);
         params.put("file_base64", imageBase64);
-        Map<String, String> headers = new HashMap<String, String>();
+        Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
         return HttpUtils.httpPostRequest(host + path, params, headers);
     }
-
-    public static String sendError() {
-
-        return null;
-    }
 }

+ 5 - 3
module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.utils;
 
+import lombok.extern.slf4j.Slf4j;
 import lombok.val;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.api.WxCpService;
@@ -9,6 +10,7 @@ import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 
 import java.util.List;
 
+@Slf4j
 public class CorpWexinUtils {
     private static WxCpService wxCpService;
 
@@ -31,7 +33,7 @@ public class CorpWexinUtils {
         if (wxCpService == null) {
             initService();
         }
-        if (wxUserList != null && wxUserList.size() > 0) {
+        if (wxUserList != null && !wxUserList.isEmpty()) {
             for (String userId : wxUserList) {
                 WxCpMessage message = new WxCpMessage();
                 message.setMsgType("text");
@@ -41,7 +43,7 @@ public class CorpWexinUtils {
                 try {
                     wxCpService.messageSend(message);
                 } catch (WxErrorException e) {
-                    e.printStackTrace();
+                    log.error(e.getMessage(), e);
                 }
             }
         }
@@ -62,7 +64,7 @@ public class CorpWexinUtils {
             try {
                 wxCpService.messageSend(message);
             } catch (WxErrorException e) {
-                e.printStackTrace();
+                log.error(e.getMessage(), e);
             }
 
         }

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/CsvUtils.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.utils;
 
 import com.csvreader.CsvReader;
 import com.csvreader.CsvWriter;
+import lombok.extern.slf4j.Slf4j;
 
 import java.io.File;
 import java.io.IOException;
@@ -13,6 +14,7 @@ import java.util.List;
  * @author yumeng
  * 2019年11月12日10:04:00
  */
+@Slf4j
 public class CsvUtils {
     public static void checkandCreateFile(String outPath) {
         File file = new File(outPath);
@@ -21,7 +23,7 @@ public class CsvUtils {
                 file.createNewFile();
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(), e);
         }
     }
 

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -23,7 +23,7 @@ public class ExportExcelUtils {
      */
 
     public void exportExcel(XSSFWorkbook workbook, int sheetNum,
-                            String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
+                            String sheetTitle, String[] headers, List<List<Object>> result) {
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);

+ 78 - 97
module-common/src/main/java/cn/com/ctop/common/module/utils/FileUploadTool.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.utils;
 
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -11,6 +12,7 @@ import java.text.DecimalFormat;
 import java.util.Arrays;
 import java.util.Iterator;
 
+@Slf4j
 public class FileUploadTool {
 
 
@@ -18,117 +20,97 @@ public class FileUploadTool {
     /**
      * 文件最大500M
      */
-    private static long UPLOAD_MAXSIZE = 800 * 1024 * 1024;
+    private static long uploadMaxsize = 800 * 1024 * 1024L;
     /**
      * 文件允许格式
      */
-    private static String[] ALLOWFILES = {".rar", ".doc", ".docx", ".zip",
+    private static String[] allowfiles = {".rar", ".doc", ".docx", ".zip",
             ".pdf", ".txt", ".swf", ".xlsx", ".gif", ".png", ".jpg", ".jpeg",
             ".bmp", ".xls", ".mp4", ".flv", ".ppt", ".avi", ".mpg", ".wmv",
             ".3gp", ".mov", ".asf", ".asx", ".vob", ".wmv9", ".rm", ".rmvb", ".apk"};
     /**
      * 允许转码的视频格式(ffmpeg)
      */
-    private static String[] ALLOWFLV = {".avi", ".mpg", ".wmv", ".3gp",
+    private static String[] allowflv = {".avi", ".mpg", ".wmv", ".3gp",
             ".mov", ".asf", ".asx", ".vob"};
 
     /**
      * 允许的视频转码格式(mencoder)
      */
-    private static String[] ALLOWAVI = {".wmv9", ".rm", ".rmvb"};
+    private static String[] allowavi = {".wmv9", ".rm", ".rmvb"};
 
     public FileEntity createFile(MultipartFile multipartFile, HttpServletRequest request, String savaPath) {
         FileEntity entity = new FileEntity();
-        boolean bflag = false;
-        String fileName = multipartFile.getOriginalFilename().toString();
-        // 判断文件不为空
-        if (multipartFile.getSize() != 0 && !multipartFile.isEmpty()) {
-            bflag = true;
-            // 判断文件大小
-            if (multipartFile.getSize() <= UPLOAD_MAXSIZE) {
-                bflag = true;
-                // 文件类型判断
-                if (this.checkFileType(fileName)) {
-                    bflag = true;
-                } else {
-                    bflag = false;
-                }
-            } else {
-                bflag = false;
-            }
-        } else {
-            bflag = false;
+        String fileName = multipartFile.getOriginalFilename();
+        // 判断文件为空
+        if (multipartFile.isEmpty() || multipartFile.getSize() == 0) {
+            return null;
         }
-        if (bflag) {
-            File logoSaveFile = new File(savaPath);
-            if (!logoSaveFile.exists()) {
-                logoSaveFile.mkdirs();
-            }
-            String name = fileName.substring(0, fileName.lastIndexOf("."));
-            // 新的文件名
-            String newFileName = this.getName(fileName);
-            // 文件扩展名
-            String fileEnd = this.getFileExt(fileName);
-            // 绝对路径
-            String fileNamedirs = savaPath + File.separator + newFileName + fileEnd;
-            File filedirs = new File(fileNamedirs);
-            // 转入文件
-            try {
-                multipartFile.transferTo(filedirs);
-            } catch (IllegalStateException e) {
-                e.printStackTrace();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            // 相对路径
-            entity.setType(fileEnd);
-            String fileDir = savaPath + newFileName + fileEnd;
-            StringBuilder builder = new StringBuilder(fileDir);
-            String finalFileDir = builder.substring(1);
-            // size存储为String
-            String size = this.getSize(filedirs);
-            // 源文件保存路径
-            String aviPath = filedirs.getAbsolutePath();
-            // 转码Avi
-//            boolean flag = false;
-            if (this.checkAviType(fileEnd)) {
-                // 设置转换为AVI格式后文件的保存路径
-                String codcAviPath = savaPath + File.separator + newFileName + ".avi";
-                // 获取配置的转换工具(mencoder.exe)的存放路径
-                String mencoderPath = request.getSession().getServletContext().getRealPath("/tools/mencoder.exe");
-                aviPath = transfMediaTool.processAvi(mencoderPath, filedirs.getAbsolutePath(), codcAviPath);
-                fileEnd = this.getFileExt(codcAviPath);
-            }
-            if (aviPath != null) {
-                // 转码Flv
-                if (this.checkMediaType(fileEnd)) {
-                    try {
-                        // 设置转换为flv格式后文件的保存路径
-                        String codcFilePath = savaPath + File.separator + newFileName + ".flv";
-                        // 获取配置的转换工具(ffmpeg.exe)的存放路径
-                        String ffmpegPath = request.getSession().getServletContext().getRealPath("/tools/ffmpeg.exe");
-                        transfMediaTool.processFlv(ffmpegPath, aviPath, codcFilePath);
-                        fileDir = savaPath + newFileName + ".flv";
-                        builder = new StringBuilder(fileDir);
-                        finalFileDir = builder.substring(1);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-                entity.setSize(size);
-                entity.setPath(fileNamedirs);
-                entity.setTitleOrig(name);
-                entity.setTitleAlter(newFileName);
-                Timestamp timestamp = new Timestamp(System.currentTimeMillis());
-                entity.setUploadTime(timestamp);
-                return entity;
-            } else {
-                return null;
-            }
-        } else {
+
+        // 判断文件大小(大于文件大小限制)
+        if (multipartFile.getSize() > uploadMaxsize) {
+            return null;
+        }
+        // 文件类型判断
+        if (!this.checkFileType(fileName)) {
             return null;
         }
 
+        File logoSaveFile = new File(savaPath);
+        if (!logoSaveFile.exists()) {
+            logoSaveFile.mkdirs();
+        }
+        String name = fileName.substring(0, fileName.lastIndexOf('.'));
+        // 新的文件名
+        String newFileName = this.getName(fileName);
+        // 文件扩展名
+        String fileEnd = this.getFileExt(fileName);
+        // 绝对路径
+        String fileNamedirs = savaPath + File.separator + newFileName + fileEnd;
+        File filedirs = new File(fileNamedirs);
+        // 转入文件
+        try {
+            multipartFile.transferTo(filedirs);
+        } catch (IllegalStateException | IOException e) {
+            log.error(e.getMessage(), e);
+        }
+        // 相对路径
+        entity.setType(fileEnd);
+        // size存储为String
+        String size = this.getSize(filedirs);
+        // 源文件保存路径
+        String aviPath = filedirs.getAbsolutePath();
+        // 转码Avi
+        if (this.checkAviType(fileEnd)) {
+            // 设置转换为AVI格式后文件的保存路径
+            String codcAviPath = savaPath + File.separator + newFileName + ".avi";
+            // 获取配置的转换工具(mencoder.exe)的存放路径
+            String mencoderPath = request.getSession().getServletContext().getRealPath("/tools/mencoder.exe");
+            aviPath = transfMediaTool.processAvi(mencoderPath, filedirs.getAbsolutePath(), codcAviPath);
+            fileEnd = this.getFileExt(codcAviPath);
+        }
+        if (aviPath == null) {
+            return null;
+        }
+        // 转码Flv
+        if (this.checkMediaType(fileEnd)) {
+            try {
+                // 设置转换为flv格式后文件的保存路径
+                String codcFilePath = savaPath + File.separator + newFileName + ".flv";
+                // 获取配置的转换工具(ffmpeg.exe)的存放路径
+                String ffmpegPath = request.getSession().getServletContext().getRealPath("/tools/ffmpeg.exe");
+                transfMediaTool.processFlv(ffmpegPath, aviPath, codcFilePath);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+            }
+        }
+        entity.setSize(size);
+        entity.setPath(fileNamedirs);
+        entity.setTitleOrig(name);
+        entity.setTitleAlter(newFileName);
+        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+        entity.setUploadTime(timestamp);
+        return entity;
     }
 
     /**
@@ -138,7 +120,7 @@ public class FileUploadTool {
      * @return
      */
     private boolean checkFileType(String fileName) {
-        Iterator<String> type = Arrays.asList(ALLOWFILES).iterator();
+        Iterator<String> type = Arrays.asList(allowfiles).iterator();
         while (type.hasNext()) {
             String ext = type.next();
             if (fileName.toLowerCase().endsWith(ext)) {
@@ -155,7 +137,7 @@ public class FileUploadTool {
      * @return
      */
     private boolean checkMediaType(String fileEnd) {
-        Iterator<String> type = Arrays.asList(ALLOWFLV).iterator();
+        Iterator<String> type = Arrays.asList(allowflv).iterator();
         while (type.hasNext()) {
             String ext = type.next();
             if (fileEnd.equals(ext)) {
@@ -172,7 +154,7 @@ public class FileUploadTool {
      * @return
      */
     private boolean checkAviType(String fileEnd) {
-        Iterator<String> type = Arrays.asList(ALLOWAVI).iterator();
+        Iterator<String> type = Arrays.asList(allowavi).iterator();
         while (type.hasNext()) {
             String ext = type.next();
             if (fileEnd.equals(ext)) {
@@ -188,7 +170,7 @@ public class FileUploadTool {
      * @return string
      */
     private String getFileExt(String fileName) {
-        return fileName.substring(fileName.lastIndexOf("."));
+        return fileName.substring(fileName.lastIndexOf('.'));
     }
 
     /**
@@ -197,12 +179,11 @@ public class FileUploadTool {
      * @return
      */
     private String getName(String fileName) {
-        Iterator<String> type = Arrays.asList(ALLOWFILES).iterator();
+        Iterator<String> type = Arrays.asList(allowfiles).iterator();
         while (type.hasNext()) {
             String ext = type.next();
             if (fileName.contains(ext)) {
-                String newFileName = fileName.substring(0, fileName.lastIndexOf(ext));
-                return newFileName;
+                return fileName.substring(0, fileName.lastIndexOf(ext));
             }
         }
         return "";

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpClientUtils.java

@@ -30,6 +30,7 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.*;
@@ -101,7 +102,7 @@ public class HttpClientUtils {
         URL url = new URL(urlStr);
         URLConnection urlConnection = url.openConnection();
         // 获取输入流
-        BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), "utf-8"));
+        BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StandardCharsets.UTF_8));
         String line = null;
         StringBuilder sb = new StringBuilder();
         while ((line = br.readLine()) != null) {