add 标协会议修改文件时,推送到会员系统
This commit is contained in:
+14
-2
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.asymmetric.KeyType;
|
||||
import cn.hutool.crypto.asymmetric.RSA;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -23,9 +24,9 @@ public class AuthenticationUtils {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private static String URL;
|
||||
public static String URL;
|
||||
|
||||
private static String APPLICATION_TOKEN;
|
||||
public static String APPLICATION_TOKEN;
|
||||
|
||||
@Value("${standards.url}")
|
||||
public void setURL(String url) {
|
||||
@@ -88,4 +89,15 @@ public class AuthenticationUtils {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验返回值判断是否同步成功
|
||||
* @param response
|
||||
*/
|
||||
public static void checkResult(String response) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
String code = jsonObject.getString("code");
|
||||
if (!"200".equals(code)){
|
||||
throw new JeroBootException("数据同步失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-1
@@ -6,7 +6,10 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
@@ -34,6 +37,7 @@ import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.system.volid.group.UpdateGroup;
|
||||
import com.jero.project.entity.PayWorkingGroup;
|
||||
import com.jero.project.service.IPayWorkingGroupService;
|
||||
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
|
||||
import com.jero.util.QrcodeUtil;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -324,6 +328,26 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
|
||||
wrapper.eq(PayMeeting::getId,id);
|
||||
wrapper.set(PayMeeting::getMeetingData,fileIds);
|
||||
payMeetingService.update(wrapper);
|
||||
List<String> idList = Arrays.asList(fileIds.split(","));
|
||||
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
|
||||
for (OSSFile ossFile : ossFiles) {
|
||||
String url = ossFile.getUrl();
|
||||
String[] fileUrl = url.split("/");
|
||||
int length = fileUrl.length;
|
||||
ossFile.setFileName(fileUrl[length - 1]);
|
||||
}
|
||||
Map<String, String> stringStringMap = AuthenticationUtils.encryptByRsaPriKey();
|
||||
String publicKey = stringStringMap.get("publicKey");
|
||||
String token = stringStringMap.get("token");
|
||||
String jsonString1 = JSONObject.toJSONString(ossFiles);
|
||||
String post = HttpUtil.post(AuthenticationUtils.URL + "/stablecrosstraining/stableCrossTraining/addStandardsFile?publicKey=" + publicKey + "&token=" + token, jsonString1);
|
||||
AuthenticationUtils.checkResult(post);
|
||||
StableCrossTraining stableCrossTraining = new StableCrossTraining();
|
||||
stableCrossTraining.setId(id);
|
||||
stableCrossTraining.setMeetingFiles(fileIds);
|
||||
String jsonString = JSONObject.toJSONString(stableCrossTraining);
|
||||
String post1 = HttpUtil.post(AuthenticationUtils.URL + "/stablecrosstraining/stableCrossTraining/updateStandardsFile?publicKey=" + publicKey + "&token=" + token, jsonString);
|
||||
AuthenticationUtils.checkResult(post1);
|
||||
return Result.OK("上传资料成功!");
|
||||
}
|
||||
|
||||
@@ -368,7 +392,7 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
|
||||
String token = request.getParameter("token");
|
||||
authenticationUtils.check(token,publicKey);
|
||||
for (OSSFile ossFile : ossFileList) {
|
||||
iossFileService.save(ossFile);
|
||||
iossFileService.saveOrUpdate(ossFile);
|
||||
}
|
||||
return Result.OK("新增会议文件成功!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user