Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
zyx.net
2022-08-08 18:02:45 +08:00
4 changed files with 179 additions and 37 deletions
@@ -44,6 +44,15 @@ public class SyncDataServiceImpl implements ISyncDataService{
@Value("${people.secret}")
private String secret;
@Value("${people.appIdEU}")
private String appIdEU;
@Value("${people.hostEU}")
private String hostEU;
@Value("${people.secretEU}")
private String secretEU;
@Autowired
private ISysUserService sysUserService;
@Autowired
@@ -163,22 +172,26 @@ public class SyncDataServiceImpl implements ISyncDataService{
List<SysUser> sysUserList = sysUserService.getPPEmployeeList();
// log.info("查询到的用户信息结果集为:"+JSONObject.toJSONString(userEOList));
for(SysUser user:sysUserList){
localUserMap.put(user.getThirdId(),user);
if (StringUtils.isNotBlank(user.getThirdId())) {
localUserMap.put(user.getThirdId().toLowerCase(), user);
}
}
List<PPEmployee> ppEmployeeList = new ArrayList<>();
// 获取people 国内 用户信息
String path = "/people/v1/employee/all-info";
String queryStr = "app_id=" + appId + "&hash_type=sha256&offset=0&limit=100";
String response = getResultDataOfGet(path, queryStr);
JSONObject myJson = JSONObject.parseObject(response);
log.debug(myJson.toJSONString());
if(!myJson.get("result_code").toString().equals("success")){
log.error("请求出现异常:"+myJson.get("message")+" "+myJson);
log.error("【国内】请求国内用户数据出现异常:"+myJson.get("message")+" "+myJson);
}else{
log.debug("打印输出本次同步信息返回结果:"+myJson.get("data").toString());
log.debug("【国内】打印输出本次同步信息返回结果:"+myJson.get("data").toString());
JSONObject resultJson = (JSONObject) myJson.get("data");
//将第一页的账户信息转换为本地dto集合
List<JSONObject> userList = JSONObject.parseArray(resultJson.get("list").toString(), JSONObject.class);
List<PPEmployee> ppEmployeeList = getPPEmployeeList(userList);
ppEmployeeList = getPPEmployeeList(userList, "CN");
//获取总记录数
int total = (int) resultJson.get("amount");
@@ -188,18 +201,57 @@ public class SyncDataServiceImpl implements ISyncDataService{
pageSum += 1;
}
//循环查询统一认证系统所有账户信息(从第二页开始)
for(int page = 1; page < pageSum; page++){
for(int page = 1; page < 2; page++){
path = "/people/v1/employee/all-info";
queryStr = "app_id=" + appId + "&hash_type=sha256&limit=100&offset=" + (page*100);
response = getResultDataOfGet(path, queryStr);
myJson = JSONObject.parseObject(response);
log.debug("打印输出本次同步信息返回结果:"+myJson.get("data").toString());
log.debug("【国内】打印输出本次同步信息返回结果:"+myJson.get("data").toString());
resultJson = (JSONObject) myJson.get("data");
userList = JSONObject.parseArray(resultJson.get("list").toString(), JSONObject.class);
List<PPEmployee> currentPPEmployeeList = getPPEmployeeList(userList);
List<PPEmployee> currentPPEmployeeList = getPPEmployeeList(userList, "CN");
ppEmployeeList.addAll(currentPPEmployeeList);
}
}
// 获取people 欧洲 用户信息
path = "/people/v1/employee/all-info";
String queryStrEU = "app_id=" + appIdEU + "&hash_type=sha256&offset=0&limit=100";
String responseEU = getResultDataOfGetEU(path, queryStrEU);
JSONObject myJsonEU = JSONObject.parseObject(responseEU);
log.debug(myJsonEU.toJSONString());
if(!myJsonEU.get("result_code").toString().equals("success")){
log.error("【欧洲】请求欧洲用户数据出现异常:"+myJsonEU.get("message")+" "+myJsonEU);
}else{
log.debug("【欧洲】打印输出本次同步信息返回结果:"+myJsonEU.get("data").toString());
JSONObject resultJsonEU = (JSONObject) myJsonEU.get("data");
//将第一页的账户信息转换为本地dto集合
List<JSONObject> userListEU = JSONObject.parseArray(resultJsonEU.get("list").toString(), JSONObject.class);
List<PPEmployee> currentPPEmployeeListEU = getPPEmployeeList(userListEU, "EN");
ppEmployeeList.addAll(currentPPEmployeeListEU);
//获取总记录数
int totalEU = (int) resultJsonEU.get("amount");
if(totalEU > 100){
int pageSumEU = totalEU / 100; // 总页数
if((totalEU % 100) > 0){
pageSumEU += 1;
}
//循环查询统一认证系统所有账户信息(从第二页开始)
for(int page = 1; page < pageSumEU; page++){
path = "/people/v1/employee/all-info";
queryStrEU = "app_id=" + appIdEU + "&hash_type=sha256&limit=100&offset=" + (page*100);
responseEU = getResultDataOfGetEU(path, queryStrEU);
myJsonEU = JSONObject.parseObject(responseEU);
log.debug("【欧洲】打印输出本次同步信息返回结果:"+myJsonEU.get("data").toString());
resultJsonEU = (JSONObject) myJsonEU.get("data");
userListEU = JSONObject.parseArray(resultJsonEU.get("list").toString(), JSONObject.class);
currentPPEmployeeListEU = getPPEmployeeList(userListEU, "EN");
ppEmployeeList.addAll(currentPPEmployeeListEU);
}
}
}
// 处理同步过来的数据id不同,username相同的情况 creation_time不能为空
// ppEmployeeList.sort(Comparator.comparing(PPEmployee::getCreation_time).reversed());
ppEmployeeList = ppEmployeeList.stream().distinct().collect(Collectors.toList()); // 去重
@@ -249,10 +301,14 @@ public class SyncDataServiceImpl implements ISyncDataService{
}
private static List<PPEmployee> getPPEmployeeList(List<JSONObject> userList) {
private static List<PPEmployee> getPPEmployeeList(List<JSONObject> userList, String region) {
List<PPEmployee> ppEmployeeList = new ArrayList<>();
for (JSONObject user : userList) {
PPEmployee userMainInfo = JSONObject.parseObject(user.get("people_info").toString(), PPEmployee.class);
if ("EU".equals(region)) {
String newId = "EU" + userMainInfo.getId();
userMainInfo.setId(newId);
}
List<PPEmployee> userJobInfoList = JSONObject.parseArray(user.get("people_job_info").toString(), PPEmployee.class);
if (CollectionUtil.isNotEmpty(userJobInfoList)) {
@@ -315,6 +371,41 @@ public class SyncDataServiceImpl implements ISyncDataService{
// return myJson.get("data").toString();
}
/**
* 发送请求,获取同步数据-欧洲
* @param uri
* @param queryString
* @return
* @throws IOException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
private String getResultDataOfGetEU(String uri, String queryString) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
// 获取签名
String method ="GET";
String path = uri;
String queryStr = queryString;
Map<String, String> header = new HashMap<>();
String timestamp = HmacSignUtil.getSecondTimestamp(new Date());
queryStr += "&timestamp=" + timestamp;
String sign = HmacSignUtil.getSign(secretEU,method,path,queryStr,header);
String url = hostEU;
url += path + "?";
url += queryStr;
url += "&sign=" + sign;
Map<String, String> headerMap = new HashMap<>();
String response = HttpRequestUtil.getResponseOfGET(url, headerMap);
JSONObject myJson = JSONObject.parseObject(response);
return myJson.toJSONString();
// log.debug(myJson.toJSONString());
// if(!myJson.get("result_code").toString().equals("success")) {
// log.error("请求出现异常:" + myJson.get("result_code") + " " + myJson);
// }
// log.debug("打印输出本次同步信息返回结果:"+myJson.get("data").toString());
// return myJson.get("data").toString();
}
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException {
String path = "/people/v1/employee/all-info";
@@ -1,14 +1,18 @@
package com.jero.modules.compare.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
import com.jero.modules.compare.entity.SarFileCompareDetailVO;
import com.jero.modules.compare.entity.SarFileCompareInfo;
import com.jero.modules.compare.service.ISarFileCompareInfoService;
@@ -41,6 +45,8 @@ import java.util.List;
public class SarFileCompareInfoController extends JeroController<SarFileCompareInfo, ISarFileCompareInfoService> {
@Autowired
private ISarFileCompareInfoService sarFileCompareInfoService;
@Autowired
private OnlCgformFieldServiceImpl onlCgformFieldService;
/**
* 分页列表查询
@@ -63,10 +69,25 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
for (SarFileCompareInfo info : pageList.getRecords()) {
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
}
return Result.OK(pageList);
}
private String getFileTypeText(String fileType, String cut) {
OnlCgformField fileTypeField = this.onlCgformFieldService.queryById(fileType);
if (ObjectUtil.isNotEmpty(fileTypeField)) {
if (CutEnum.CN.getValue().equals(cut)) {
return fileTypeField.getDbFieldTxt();
} else {
return fileTypeField.getDbFieldEnName();
}
}
return "";
}
/**
* 列表查询
*
@@ -407,6 +407,11 @@ people:
# appSecret CN PROD版
secret: 7C3F03170E3ea489df04Ce8DEC7Df4f7
cronJobIsOpen: false
# appSecret EU PROD版
appIdEU: 1000233
secretEU: 32172576EB3a6fd4d483de11C6f60828
hostEU: http://napoleon-eu.nioint.com
## Feishu
Feishu:
# 测试
@@ -49,9 +49,9 @@
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<a-form-model-item class="itemModel" prop="approvalOpinion">
<a-form-model-item class="itemModel" prop="commentContent">
<a-textarea :placeholder="$t('pleaseEnter')+$t('comment')"
v-model="formInline.approvalOpinion"
v-model.trim="formInline.commentContent"
:rows="4"/>
</a-form-model-item>
</div>
@@ -59,36 +59,18 @@
</a-row>
</a-form-model>
<div class="content-button">
<a-button class="header-btn submit" @click="release" type="primary">{{$t('release')}}</a-button>
<a-button class="header-btn submit" :loading="loading" @click="release" type="primary">{{$t('release')}}
</a-button>
</div>
<div>
<div v-for="(item,index) in releaseList">
<div class="box-text">
<div class="header-text">
<span style="margin-right: 20px">张三</span>
2022-12-12 10:10:12
<span style="margin-right: 20px">{{item.createBy}}</span>
{{item.createTime}}
</div>
</div>
<div class="content">
sfdsfdsf的防控流感的飞机过来看的结果东法兰克感觉地方给了地方国家的分开两个就地方孤苦伶仃附件给领导反馈
独守空房了就收到付款了的角色发看来都是风景但是考虑附件第三方库老师积分迪斯科浪费绝对是分类的课时费
是反抗拉萨的飞机罗斯福就点十六分就但是发
迪斯科浪费电视机分厘卡的设计分类的水库附近的说服力但是积分的历史房价多少发了多少给京东方管理看豆腐干豆腐干看
a fjsd fklsdjfk s是否考虑技术的反抗类毒素就发的撒开了房间但是发离开打扫房间是开了房间都是老师JFK了的身份圣诞快乐就是的反抗类毒素解放迪斯科浪费是
考虑到房价打开拉萨附近分离技术的领导是否打开拉萨范德萨发了开始就发的考虑是否就但是考虑发及代理商开发就十分大师傅看
</div>
<div class="box-text">
<div class="header-text">
<span style="margin-right: 20px">张三</span>
2022-12-12 10:10:12
</div>
</div>
<div class="content">
sfdsfdsf的防控流感的飞机过来看的结果东法兰克感觉地方给了地方国家的分开两个就地方孤苦伶仃附件给领导反馈
独守空房了就收到付款了的角色发看来都是风景但是考虑附件第三方库老师积分迪斯科浪费绝对是分类的课时费
是反抗拉萨的飞机罗斯福就点十六分就但是发
迪斯科浪费电视机分厘卡的设计分类的水库附近的说服力但是积分的历史房价多少发了多少给京东方管理看豆腐干豆腐干看
a fjsd fklsdjfk s是否考虑技术的反抗类毒素就发的撒开了房间但是发离开打扫房间是开了房间都是老师JFK了的身份圣诞快乐就是的反抗类毒素解放迪斯科浪费是
考虑到房价打开拉萨附近分离技术的领导是否打开拉萨范德萨发了开始就发的考虑是否就但是考虑发及代理商开发就十分大师傅看
{{item.commentContent}}
</div>
</div>
</div>
@@ -135,15 +117,26 @@
],
queryForm: {},
formInline: {},
rules: {},
rules: {
commentContent: [
{
max: 300,
message: this.$t('comment') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
]
},
isPraise: false,
isCollect: false
isCollect: false,
loading: false,
releaseList: []
}
},
mounted() {
document.title = this.$t('applicableInstructionsMarketList')
this.viewAdd()
this.queryById()
this.releaseData()
},
methods: {
...mapGetters(['userInfo']),
@@ -224,8 +217,40 @@
clickButtonToUpload(item) {
this.$refs.viewFileModelRef.clickButtonToUpload(item)
},
releaseData() {
let query = {
problemKnowledgeBaseId: this.$route.query.id
}
getAction('/problemKnowledgeBase/problemKnowledgeBaseCommentEO/list', query).then((res) => {
if (res.success) {
this.releaseList = res.result || []
} else {
this.releaseList = []
}
})
},
release() {
if (!this.formInline.commentContent) {
this.$message.warning(this.$t('pleaseEnter'))
return
}
let query = {
problemKnowledgeBaseId: this.$route.query.id,
commentContent: this.formInline.commentContent,
commentUserId: this.userInfo().id
}
this.loading = true
postAction('/problemKnowledgeBase/problemKnowledgeBaseCommentEO/add', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.releaseData()
this.formInline = {}
this.loading = false
} else {
this.$message.warning(this.$t('operationFailed'))
this.loading = false
}
})
}
}
}