主数据显示查看数据格式功能
This commit is contained in:
parent
fa2583176e
commit
61b0cdfaee
|
@ -0,0 +1,48 @@
|
||||||
|
package com.hzya.frame.dingtalk.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 通讯录事件类型
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/27 15:58
|
||||||
|
**/
|
||||||
|
public enum OrgEventEnum {
|
||||||
|
USER_ADD_ORG("user_add_org","通讯录用户新增"),
|
||||||
|
USER_MODIFY_ORG("user_modify_org","通讯录用户更改"),
|
||||||
|
USER_LEAVE_ORG("user_leave_org","通讯录用户离职"),
|
||||||
|
USER_ACTIVE_ORG("user_active_org","加入企业后用户激活"),
|
||||||
|
ORG_DEPT_CREATE("org_dept_create","通讯录企业部门创建"),
|
||||||
|
ORG_DEPT_MODIFY("org_dept_modify","通讯录企业部门更改"),
|
||||||
|
ORG_DEPT_REMOVE("org_dept_remove","通讯录企业部门删除"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String explain;
|
||||||
|
|
||||||
|
OrgEventEnum(String code, String explain) {
|
||||||
|
this.code = code;
|
||||||
|
this.explain = explain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExplain() {
|
||||||
|
return explain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取事件类型
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static OrgEventEnum getByCode(String code){
|
||||||
|
for (OrgEventEnum org : OrgEventEnum.values()) {
|
||||||
|
if (org.getCode().equals(code)){
|
||||||
|
return org;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.hzya.frame.dingtalk.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 钉钉集成扩展类
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/28 14:25
|
||||||
|
**/
|
||||||
|
public interface IDingTalkExtService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用这个方法初始化钉钉参数
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysExtensionApiEntity init(SysExtensionApiEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置在应用上的钉钉参数
|
||||||
|
* @param sysApplication
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject getDingTalkConfig(SysApplicationEntity sysApplication);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空配置缓存
|
||||||
|
*/
|
||||||
|
void clearDingTalkConfigCatch();
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.hzya.frame.dingtalk.service;
|
||||||
|
|
||||||
|
import com.dingtalk.api.request.OapiV2UserListRequest;
|
||||||
|
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2UserGetResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2UserListResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 钉钉service
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/27 16:17
|
||||||
|
**/
|
||||||
|
public interface IDingTalkService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据userid获取用户详情
|
||||||
|
* @param userId 钉钉userid
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OapiV2UserGetResponse.UserGetResponse getUserById(String userId, String appKey, String appSecret);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据userid获取用户详情
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OapiV2UserGetResponse.UserGetResponse getUserById(String userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门用户列表
|
||||||
|
* @param req 请求参数
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OapiV2UserListResponse.PageResult getUserListByDeptId(OapiV2UserListRequest req, String appKey, String appSecret);
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门详情
|
||||||
|
* @param deptId 钉钉部门id
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId, String appKey, String appSecret);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门详情
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门列表,此接口只会返回下一级部门信息
|
||||||
|
* @param deptId 部门id,如果不传则查询一级部门
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDeptList(Long deptId, String appKey, String appSecret);
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.hzya.frame.dingtalk.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.dingtalk.service.IDingTalkExtService;
|
||||||
|
import com.hzya.frame.dingtalk.util.DingTalkAccessToken;
|
||||||
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
|
import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
|
||||||
|
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
|
||||||
|
import com.hzya.frame.sysnew.application.apiPara.service.ISysApplicationApiParaService;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 钉钉集成扩展类
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/28 14:25
|
||||||
|
**/
|
||||||
|
@Service(value = "dingTalkExtService")
|
||||||
|
public class DingTalkExtServiceImpl implements IDingTalkExtService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysApplicationApiParaDao sysApplicationApiParaDao;
|
||||||
|
private final ConcurrentHashMap<String, JSONObject> dingTalkMap = new ConcurrentHashMap<>();
|
||||||
|
/**
|
||||||
|
* 调用这个方法初始化钉钉参数
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysExtensionApiEntity init(SysExtensionApiEntity entity) {
|
||||||
|
Map<String, String> headers = entity.getHeaders();
|
||||||
|
if (null == headers){
|
||||||
|
headers = new HashMap<>();
|
||||||
|
}
|
||||||
|
SysApplicationEntity receiveApp = entity.getReceiveApp();
|
||||||
|
//查询应用上配置的参数
|
||||||
|
JSONObject dingTalkConfig = getDingTalkConfig(receiveApp);
|
||||||
|
//给token赋值
|
||||||
|
entity.setQuerys("access_token="+DingTalkAccessToken.getAccessToken(dingTalkConfig.getString("appKey"),dingTalkConfig.getString("appSecret")));
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置在应用上的钉钉参数
|
||||||
|
*
|
||||||
|
* @param sysApplication
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JSONObject getDingTalkConfig(SysApplicationEntity sysApplication) {
|
||||||
|
if (null != sysApplication && StrUtil.isNotEmpty(sysApplication.getId()) && null != sysApplication.getAppId()){
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
String key = sysApplication.getAppId()+"dingTalk";
|
||||||
|
if (null != dingTalkMap.get(key)){
|
||||||
|
return dingTalkMap.get(key);
|
||||||
|
}else {
|
||||||
|
//查询应用上配置的参数
|
||||||
|
SysApplicationApiParaEntity paraEntity = new SysApplicationApiParaEntity();
|
||||||
|
paraEntity.setAppId(sysApplication.getId());
|
||||||
|
List<SysApplicationApiParaEntity> paraList = sysApplicationApiParaDao.query(paraEntity);
|
||||||
|
if (CollectionUtils.isNotEmpty(paraList)) {
|
||||||
|
List<SysApplicationApiParaEntity> appKeyList = paraList.stream().filter(p -> p.getInterfaceKey().equals("appKey")).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(appKeyList)) {
|
||||||
|
jsonObject.put("appKey", appKeyList.get(0).getInterfaceValue());
|
||||||
|
}
|
||||||
|
List<SysApplicationApiParaEntity> appSecretList = paraList.stream().filter(p -> p.getInterfaceKey().equals("appSecret")).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(appSecretList)) {
|
||||||
|
jsonObject.put("appSecret", appSecretList.get(0).getInterfaceValue());
|
||||||
|
}
|
||||||
|
dingTalkMap.put(key,jsonObject);
|
||||||
|
return dingTalkMap.get(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空配置缓存
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearDingTalkConfigCatch() {
|
||||||
|
dingTalkMap.clear();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
package com.hzya.frame.dingtalk.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.dingtalk.api.DefaultDingTalkClient;
|
||||||
|
import com.dingtalk.api.DingTalkClient;
|
||||||
|
import com.dingtalk.api.request.OapiV2DepartmentGetRequest;
|
||||||
|
import com.dingtalk.api.request.OapiV2DepartmentListsubRequest;
|
||||||
|
import com.dingtalk.api.request.OapiV2UserGetRequest;
|
||||||
|
import com.dingtalk.api.request.OapiV2UserListRequest;
|
||||||
|
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2UserGetResponse;
|
||||||
|
import com.dingtalk.api.response.OapiV2UserListResponse;
|
||||||
|
import com.hzya.frame.dingtalk.service.IDingTalkService;
|
||||||
|
import com.hzya.frame.dingtalk.util.DingTalkAccessToken;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 钉钉service
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/27 16:17
|
||||||
|
**/
|
||||||
|
@Service(value = "dingTalkService")
|
||||||
|
public class DingTalkServiceImpl implements IDingTalkService {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
@Value("${dingtalk.appKey:}")
|
||||||
|
private String dAppKey;
|
||||||
|
@Value("${dingtalk.appSecret:}")
|
||||||
|
private String dAppSecret;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据userid获取用户详情
|
||||||
|
*
|
||||||
|
* @param userId 钉钉userid
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OapiV2UserGetResponse.UserGetResponse getUserById(String userId, String appKey, String appSecret) {
|
||||||
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
|
||||||
|
OapiV2UserGetRequest req = new OapiV2UserGetRequest();
|
||||||
|
req.setUserid(userId);
|
||||||
|
req.setLanguage("zh_CN");
|
||||||
|
try {
|
||||||
|
OapiV2UserGetResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||||
|
if (rsp.isSuccess()){
|
||||||
|
OapiV2UserGetResponse.UserGetResponse result = rsp.getResult();
|
||||||
|
String s = JSONObject.toJSONString(result);
|
||||||
|
logger.info("人员详情信息:{}",s);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("根据部门id获取钉钉用户详情出错:{}",e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据userid获取用户详情
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OapiV2UserGetResponse.UserGetResponse getUserById(String userId) {
|
||||||
|
return getUserById(userId,dAppKey,dAppSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门用户列表
|
||||||
|
*
|
||||||
|
* @param req 请求参数
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OapiV2UserListResponse.PageResult getUserListByDeptId(OapiV2UserListRequest req, String appKey, String appSecret) {
|
||||||
|
try {
|
||||||
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/list");
|
||||||
|
req.setSize(100L);//每页最大只能查100条
|
||||||
|
req.setOrderField("modify_desc");
|
||||||
|
req.setContainAccessLimit(false);
|
||||||
|
req.setLanguage("zh_CN");
|
||||||
|
OapiV2UserListResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||||
|
OapiV2UserListResponse.PageResult result = rsp.getResult();
|
||||||
|
return result;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门详情
|
||||||
|
*
|
||||||
|
* @param deptId 钉钉部门id
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId, String appKey, String appSecret) {
|
||||||
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/get");
|
||||||
|
OapiV2DepartmentGetRequest req = new OapiV2DepartmentGetRequest();
|
||||||
|
req.setDeptId(deptId);
|
||||||
|
req.setLanguage("zh_CN");
|
||||||
|
try {
|
||||||
|
OapiV2DepartmentGetResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||||
|
if (rsp.isSuccess()){
|
||||||
|
OapiV2DepartmentGetResponse.DeptGetResponse result = rsp.getResult();
|
||||||
|
String s = JSONObject.toJSONString(result);
|
||||||
|
logger.info("部门详情信息:{}",s);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("根据部门id获取钉钉部门出错:{}",e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门id获取部门详情
|
||||||
|
*
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId) {
|
||||||
|
return getDeptById(deptId,dAppKey,dAppSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门列表,此接口只会返回下一级部门信息
|
||||||
|
* @param deptId 部门id,如果不传则查询一级部门
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDeptList(Long deptId,String appKey,String appSecret) {
|
||||||
|
try {
|
||||||
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
|
||||||
|
OapiV2DepartmentListsubRequest req = new OapiV2DepartmentListsubRequest();
|
||||||
|
req.setDeptId(deptId);
|
||||||
|
req.setLanguage("zh_CN");
|
||||||
|
OapiV2DepartmentListsubResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||||
|
if (rsp.isSuccess()){
|
||||||
|
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> result = rsp.getResult();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("获取部门列表接口出错:{}",e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
103
base-service/src/main/java/com/hzya/frame/dingtalk/util/DingTalkAccessToken.java
Executable file
103
base-service/src/main/java/com/hzya/frame/dingtalk/util/DingTalkAccessToken.java
Executable file
|
@ -0,0 +1,103 @@
|
||||||
|
package com.hzya.frame.dingtalk.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenResponse;
|
||||||
|
import com.aliyun.tea.TeaException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 钉钉获取accessToken
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/8/27 14:05
|
||||||
|
**/
|
||||||
|
public class DingTalkAccessToken {
|
||||||
|
static Logger logger = LoggerFactory.getLogger(DingTalkAccessToken.class);
|
||||||
|
//token
|
||||||
|
private static String accessToken;
|
||||||
|
//过期时间
|
||||||
|
private static Instant expireTime;
|
||||||
|
private static final Long CACHE_EXPIRY_TIME = 7000L; // 缓存有效时间(秒)
|
||||||
|
//应用key
|
||||||
|
private static String appKey;
|
||||||
|
//应用密钥
|
||||||
|
private static String appSecret;
|
||||||
|
@Value("${dingtalk.appKey:}")
|
||||||
|
public static void setAppKey(String appKey) {
|
||||||
|
DingTalkAccessToken.appKey = appKey;
|
||||||
|
}
|
||||||
|
@Value("${dingtalk.appSecret:}")
|
||||||
|
public static void setAppSecret(String appSecret) {
|
||||||
|
DingTalkAccessToken.appSecret = appSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getAccessToken(){
|
||||||
|
return getAccessToken(appKey,appSecret);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取accessToken
|
||||||
|
*
|
||||||
|
* @param appKey
|
||||||
|
* @param appSecret
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getAccessToken(String appKey,String appSecret) {
|
||||||
|
//判断是否过期 如果没过期直接返回
|
||||||
|
if (null != accessToken && expireTime != null && Instant.now().isBefore(expireTime)) {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
//获取新的accessToken
|
||||||
|
accessToken = fetchNewAccessToken(appKey,appSecret);
|
||||||
|
//过期时间设置成当前事件+7000s,预留200s的时间
|
||||||
|
expireTime = Instant.now().plusSeconds(CACHE_EXPIRY_TIME);
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新的accessToken
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String fetchNewAccessToken(String appKey,String appSecret) {
|
||||||
|
try {
|
||||||
|
//查询应用上配置的钉钉信息
|
||||||
|
if (StrUtil.isNotEmpty(appKey) && StrUtil.isNotEmpty(appSecret)) {
|
||||||
|
//查询应用上的信息
|
||||||
|
com.aliyun.dingtalkoauth2_1_0.Client client = DingTalkAccessToken.createClient();
|
||||||
|
com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest getAccessTokenRequest = new com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest()
|
||||||
|
.setAppKey(appKey)
|
||||||
|
.setAppSecret(appSecret);
|
||||||
|
GetAccessTokenResponse accessToken = client.getAccessToken(getAccessTokenRequest);
|
||||||
|
String accessToken1 = accessToken.getBody().getAccessToken();
|
||||||
|
return accessToken1;
|
||||||
|
}
|
||||||
|
} catch (Exception _err) {
|
||||||
|
TeaException err = new TeaException(_err.getMessage(), _err);
|
||||||
|
if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
||||||
|
// err 中含有 code 和 message 属性,可帮助开发定位问题
|
||||||
|
}
|
||||||
|
logger.error("获取钉钉token出错:{}", _err);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用 Token 初始化账号Client
|
||||||
|
*
|
||||||
|
* @return Client
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private static com.aliyun.dingtalkoauth2_1_0.Client createClient() throws Exception {
|
||||||
|
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
|
||||||
|
config.protocol = "https";
|
||||||
|
config.regionId = "central";
|
||||||
|
return new com.aliyun.dingtalkoauth2_1_0.Client(config);
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ public class HomeServiceImpl extends BaseService<HomeEntity, String> implements
|
||||||
for (int a = 0; a < sysApplicationEntities.size(); a++) {
|
for (int a = 0; a < sysApplicationEntities.size(); a++) {
|
||||||
if(homeEntities.get(i).getAppId()!= null && sysApplicationEntities.get(a).getId().equals(homeEntities.get(i).getAppId())){
|
if(homeEntities.get(i).getAppId()!= null && sysApplicationEntities.get(a).getId().equals(homeEntities.get(i).getAppId())){
|
||||||
homeEntities.get(i).setPath(sysApplicationEntities.get(a).getAppLogo());
|
homeEntities.get(i).setPath(sysApplicationEntities.get(a).getAppLogo());
|
||||||
|
homeEntities.get(i).setName(sysApplicationEntities.get(a).getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.hzya.frame.mdm.entity;
|
||||||
|
|
||||||
|
|
||||||
|
public class MdmFiledsRuleDto {
|
||||||
|
/** 主数据模版ID */
|
||||||
|
private String mdmId;
|
||||||
|
/** 模版数据库id */
|
||||||
|
private String dbId;
|
||||||
|
/** 模版数据库字段id */
|
||||||
|
private String filedId;
|
||||||
|
/** 字段类型 1、select 2、treeselect */
|
||||||
|
private String filedType;
|
||||||
|
/** 字段服务 */
|
||||||
|
private String typeFiled;
|
||||||
|
/** 字段服务 */
|
||||||
|
private String id;
|
||||||
|
/** 字段服务 */
|
||||||
|
private String dataId;
|
||||||
|
|
||||||
|
public String getMdmId() {
|
||||||
|
return mdmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMdmId(String mdmId) {
|
||||||
|
this.mdmId = mdmId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDbId() {
|
||||||
|
return dbId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbId(String dbId) {
|
||||||
|
this.dbId = dbId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFiledId() {
|
||||||
|
return filedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFiledId(String filedId) {
|
||||||
|
this.filedId = filedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFiledType() {
|
||||||
|
return filedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFiledType(String filedType) {
|
||||||
|
this.filedType = filedType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeFiled() {
|
||||||
|
return typeFiled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeFiled(String typeFiled) {
|
||||||
|
this.typeFiled = typeFiled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDataId() {
|
||||||
|
return dataId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataId(String dataId) {
|
||||||
|
this.dataId = dataId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.hzya.frame.mdm.mdmModule.dao;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.mdm.entity.MdmDataDto;
|
import com.hzya.frame.mdm.entity.MdmDataDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmDto;
|
import com.hzya.frame.mdm.entity.MdmDto;
|
||||||
|
import com.hzya.frame.mdm.entity.MdmFiledsRuleDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmQuery;
|
import com.hzya.frame.mdm.entity.MdmQuery;
|
||||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
|
@ -68,5 +69,7 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
|
||||||
void updataTreeUpData(Map<String, String> updateMaps);
|
void updataTreeUpData(Map<String, String> updateMaps);
|
||||||
|
|
||||||
void updataTreeUpDataDetail(Map<String, String> updateMaps);
|
void updataTreeUpDataDetail(Map<String, String> updateMaps);
|
||||||
|
|
||||||
|
MdmFiledsRuleDto queryDataId(MdmFiledsRuleDto mdmFiledsRuleDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.mdm.entity.MdmDataDto;
|
import com.hzya.frame.mdm.entity.MdmDataDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmDto;
|
import com.hzya.frame.mdm.entity.MdmDto;
|
||||||
|
import com.hzya.frame.mdm.entity.MdmFiledsRuleDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmQuery;
|
import com.hzya.frame.mdm.entity.MdmQuery;
|
||||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||||
|
@ -181,6 +182,12 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
||||||
super.update(getSqlIdPrifx() + "updataTreeUpDataDetail", maps);
|
super.update(getSqlIdPrifx() + "updataTreeUpDataDetail", maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MdmFiledsRuleDto queryDataId(MdmFiledsRuleDto mdmFiledsRuleDto) {
|
||||||
|
MdmFiledsRuleDto o = (MdmFiledsRuleDto) super.selectOne(getSqlIdPrifx() + "queryDataId", mdmFiledsRuleDto);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> queryMdMFields(Map<String, Object> maps) {
|
public List<String> queryMdMFields(Map<String, Object> maps) {
|
||||||
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
|
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
|
||||||
|
|
|
@ -1086,5 +1086,14 @@ where id = #{id}
|
||||||
AND b.sts = 'Y'
|
AND b.sts = 'Y'
|
||||||
AND b.data_status != 'N'
|
AND b.data_status != 'N'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 分页查询列表 采用like格式 -->
|
||||||
|
<select id="queryDataId" resultType="com.hzya.frame.mdm.entity.MdmFiledsRuleDto"
|
||||||
|
parameterType="com.hzya.frame.mdm.entity.MdmFiledsRuleDto">
|
||||||
|
select
|
||||||
|
data_id as dataId
|
||||||
|
from ${typeFiled} where sts='Y' and id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -2340,7 +2340,20 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
||||||
xf.setCreate();
|
xf.setCreate();
|
||||||
sysButtonConfigDao.save(xf);
|
sysButtonConfigDao.save(xf);
|
||||||
}
|
}
|
||||||
|
if ("viewData".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) {
|
||||||
|
SysButtonConfigEntity xf = new SysButtonConfigEntity();
|
||||||
|
xf.setCode("viewData");
|
||||||
|
xf.setNameCh("查看数据格式");
|
||||||
|
xf.setNameEn("viewData");
|
||||||
|
xf.setMenuId(module.getId());
|
||||||
|
xf.setIconName("");
|
||||||
|
xf.setStyles("");
|
||||||
|
xf.setBtnFunction("viewData");
|
||||||
|
xf.setRemark("查看数据格式");
|
||||||
|
xf.setSorts(i + 1L);
|
||||||
|
xf.setCreate();
|
||||||
|
sysButtonConfigDao.save(xf);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,15 @@ public interface IMdmService {
|
||||||
* @Date 9:40 上午 2023/10/18
|
* @Date 9:40 上午 2023/10/18
|
||||||
**/
|
**/
|
||||||
JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject);
|
JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jsonObject
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 主数据详情数据字典
|
||||||
|
* @Date 9:40 上午 2023/10/18
|
||||||
|
**/
|
||||||
|
JsonResultEntity queryMdmShowDetailsDictionary(JSONObject jsonObject);
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
|
|
|
@ -101,12 +101,6 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
@Resource
|
@Resource
|
||||||
private IMdmServiceCache mdmServiceCache;
|
private IMdmServiceCache mdmServiceCache;
|
||||||
@Resource
|
@Resource
|
||||||
private ISysMenuConfigDao sysMenuConfigDao;
|
|
||||||
@Resource
|
|
||||||
private ISysButtonConfigDao sysButtonConfigDao;
|
|
||||||
@Resource
|
|
||||||
private ISysPopedomOperateDao sysPopedomOperateDao;
|
|
||||||
@Resource
|
|
||||||
private IMdmModuleDbDao mdmModuleDbDao;
|
private IMdmModuleDbDao mdmModuleDbDao;
|
||||||
@Resource
|
@Resource
|
||||||
private ISysUserDao sysUserDao;
|
private ISysUserDao sysUserDao;
|
||||||
|
@ -1381,15 +1375,188 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (tablename != null && !"".equals(tablename)) {
|
|
||||||
// Map<String, Object> queryData = new HashMap<>();
|
|
||||||
// queryData.put("tableName", tablename);//表名
|
|
||||||
// queryData.put("id", entity.getId());//字段
|
|
||||||
// List<HashMap<String, Object>> datas = mdmModuleDbDao.getServiceByDistributeId(queryData);
|
|
||||||
// jsonObject.put(tablename, datas);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param object
|
||||||
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 主数据详情数据字典
|
||||||
|
* @Date 9:40 上午 2023/10/18
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity queryMdmShowDetailsDictionary(JSONObject object) {
|
||||||
|
MdmDto entity = getData("jsonStr", object, MdmDto.class);
|
||||||
|
if (entity == null) {
|
||||||
|
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||||
|
}
|
||||||
|
if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
//查询模版
|
||||||
|
|
||||||
|
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
|
||||||
|
if (mdmModuleEntity == null) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
//查询数据源主表
|
||||||
|
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||||
|
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
|
||||||
|
mdmModuleDbEntity.setSts("Y");
|
||||||
|
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
|
||||||
|
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
|
||||||
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
|
}
|
||||||
|
MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity();
|
||||||
|
queryFild.setMdmId(mdmModuleEntity.getId());
|
||||||
|
queryFild.setSts("Y");
|
||||||
|
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild);
|
||||||
|
|
||||||
|
MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity();
|
||||||
|
mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId());
|
||||||
|
mdmModuleDbFiledsRuleEntity.setSts("Y");
|
||||||
|
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity);
|
||||||
|
|
||||||
|
List<MdmFiledsRuleDto> mdmFiledsRuleDtos = new ArrayList<>();
|
||||||
|
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
|
||||||
|
for (int i = 0; i < mdmModuleDbFiledsRuleEntities.size(); i++) {
|
||||||
|
if("treeselect".equals(mdmModuleDbFiledsRuleEntities.get(i).getRuleValue()) || "select".equals(mdmModuleDbFiledsRuleEntities.get(i).getRuleValue())){
|
||||||
|
MdmFiledsRuleDto mdmFiledsRuleDto = new MdmFiledsRuleDto();
|
||||||
|
mdmFiledsRuleDto.setDbId(mdmModuleDbFiledsRuleEntities.get(i).getDbId());
|
||||||
|
mdmFiledsRuleDto.setFiledId(mdmModuleDbFiledsRuleEntities.get(i).getFiledId());
|
||||||
|
mdmFiledsRuleDto.setMdmId(mdmModuleDbFiledsRuleEntities.get(i).getMdmId());
|
||||||
|
mdmFiledsRuleDto.setFiledType(mdmModuleDbFiledsRuleEntities.get(i).getRuleValue());
|
||||||
|
mdmFiledsRuleDtos.add(mdmFiledsRuleDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mdmFiledsRuleDtos != null && mdmFiledsRuleDtos.size() > 0){
|
||||||
|
for (int i = 0; i < mdmFiledsRuleDtos.size(); i++) {
|
||||||
|
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
|
||||||
|
if(mdmFiledsRuleDtos.get(i).getFiledId().equals(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId())
|
||||||
|
&& "service".equals(mdmModuleDbFiledsRuleEntities.get(i1).getRuleCode())){
|
||||||
|
mdmFiledsRuleDtos.get(i).setTypeFiled(mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//String tablename = null;
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("appName","数智中台");
|
||||||
|
jsonObject.put("appCode","800004");
|
||||||
|
jsonObject.put("mdmCode",entity.getMdmCode());
|
||||||
|
jsonObject.put("optionName","admin");
|
||||||
|
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
|
||||||
|
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
|
||||||
|
//查询数据
|
||||||
|
Map<String, Object> queryData = new HashMap<>();
|
||||||
|
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
|
||||||
|
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
|
||||||
|
queryData.put("detailFlag", false);//是否明细
|
||||||
|
queryData.put("id", entity.getId());//字段
|
||||||
|
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
|
||||||
|
convertKeysToLowerCase(datas);
|
||||||
|
JSONObject zbdata = new JSONObject();
|
||||||
|
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
||||||
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
|
if(mdmModuleDbFiledsEntities.get(i2).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){
|
||||||
|
if("1".equals(mdmModuleDbFiledsEntities.get(i2).getViewType())){
|
||||||
|
//判断是否是下拉类型
|
||||||
|
Object data = datas.get(mdmModuleDbFiledsEntities.get(i2).getEnName());
|
||||||
|
if(mdmFiledsRuleDtos != null && mdmFiledsRuleDtos.size() > 0){
|
||||||
|
for (int i1 = 0; i1 < mdmFiledsRuleDtos.size(); i1++) {
|
||||||
|
if(mdmModuleDbFiledsEntities.get(i2).getId().equals(mdmFiledsRuleDtos.get(i1).getFiledId())){
|
||||||
|
//查询对应的data_id
|
||||||
|
String strData = String.valueOf(data);
|
||||||
|
int index = strData.lastIndexOf(',');
|
||||||
|
if (index!= -1) {
|
||||||
|
strData = strData.substring(index + 1);
|
||||||
|
}
|
||||||
|
mdmFiledsRuleDtos.get(i1).setId(strData);
|
||||||
|
MdmFiledsRuleDto mdmFiledsRuleDto = mdmModuleDao.queryDataId(mdmFiledsRuleDtos.get(i1));
|
||||||
|
if(mdmFiledsRuleDto != null && mdmFiledsRuleDto.getDataId() != null && !"".equals(mdmFiledsRuleDto.getDataId())){
|
||||||
|
data = mdmFiledsRuleDto.getDataId();
|
||||||
|
}else {
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zbdata.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), zbdata);
|
||||||
|
} else {
|
||||||
|
queryData.put("detailFlag", true);//是否明细
|
||||||
|
queryData.put("id", entity.getId());//字段
|
||||||
|
List<HashMap<String, Object>> datas = mdmModuleDbDao.getServiceByFormmainId(queryData);
|
||||||
|
convertKeysToLowerCase(datas);
|
||||||
|
List<JSONObject> mxDataList = new ArrayList<>();
|
||||||
|
if(datas != null && datas.size() > 0){
|
||||||
|
for (int i1 = 0; i1 < datas.size(); i1++) {
|
||||||
|
JSONObject mxData = new JSONObject();
|
||||||
|
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
||||||
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
|
if(mdmModuleDbFiledsEntities.get(i2).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){
|
||||||
|
if("1".equals(mdmModuleDbFiledsEntities.get(i2).getViewType())){
|
||||||
|
|
||||||
|
//判断是否是下拉类型
|
||||||
|
Object data = datas.get(i1).get(mdmModuleDbFiledsEntities.get(i2).getEnName());
|
||||||
|
if(mdmFiledsRuleDtos != null && mdmFiledsRuleDtos.size() > 0){
|
||||||
|
for (int b = 0; b < mdmFiledsRuleDtos.size(); b++) {
|
||||||
|
if(mdmModuleDbFiledsEntities.get(i2).getId().equals(mdmFiledsRuleDtos.get(b).getFiledId())){
|
||||||
|
//查询对应的data_id
|
||||||
|
String strData = String.valueOf(data);
|
||||||
|
int index = strData.lastIndexOf(',');
|
||||||
|
if (index!= -1) {
|
||||||
|
strData = strData.substring(index + 1);
|
||||||
|
}
|
||||||
|
mdmFiledsRuleDtos.get(b).setId(strData);
|
||||||
|
MdmFiledsRuleDto mdmFiledsRuleDto = mdmModuleDao.queryDataId(mdmFiledsRuleDtos.get(b));
|
||||||
|
if(mdmFiledsRuleDto != null && mdmFiledsRuleDto.getDataId() != null && !"".equals(mdmFiledsRuleDto.getDataId())){
|
||||||
|
data = mdmFiledsRuleDto.getDataId();
|
||||||
|
}else {
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mxData.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mxDataList.add(mxData);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
JSONObject mxData = new JSONObject();
|
||||||
|
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
||||||
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
|
if(mdmModuleDbFiledsEntities.get(i2).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){
|
||||||
|
if("1".equals(mdmModuleDbFiledsEntities.get(i2).getViewType())){
|
||||||
|
mxData.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mxDataList.add(mxData);
|
||||||
|
}
|
||||||
|
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), mxDataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject);
|
return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.hzya.frame.sysnew.application.service;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
import com.hzya.frame.basedao.service.IBaseService;
|
import com.hzya.frame.basedao.service.IBaseService;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
|
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
|
@ -432,4 +433,8 @@ public interface ISysApplicationService extends IBaseService<SysApplicationEntit
|
||||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
**/
|
**/
|
||||||
JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse);
|
JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse);
|
||||||
|
|
||||||
|
SysExtensionApiEntity setDDtoken(SysExtensionApiEntity sysExtensionApiEntity);
|
||||||
|
SysExtensionApiEntity setDDUserId(SysExtensionApiEntity sysExtensionApiEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1986,6 +1986,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
|
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
response = closeableHttpClient.execute(get);
|
response = closeableHttpClient.execute(get);
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
@ -3478,4 +3479,39 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysExtensionApiEntity setDDtoken(SysExtensionApiEntity sysExtensionApiEntity) {
|
||||||
|
SysApplicationApiEntity sysApplicationApiEntity = sysExtensionApiEntity.getReceiveApi();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
if (sysApplicationApiEntity.getQueryIn() != null && !"".equals(sysApplicationApiEntity.getQueryIn())) {
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(sysApplicationApiEntity.getQueryIn());
|
||||||
|
if (jsonArray != null && jsonArray.size() > 0) {
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
JSONObject object1 = jsonArray.getJSONObject(i);
|
||||||
|
if(i > 0){
|
||||||
|
stringBuilder.append("&");
|
||||||
|
}
|
||||||
|
stringBuilder.append(object1.getString("parameterName")).append("=").append(object1.getString("example"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sysExtensionApiEntity.setQuerys(stringBuilder.toString());
|
||||||
|
return sysExtensionApiEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysExtensionApiEntity setDDUserId(SysExtensionApiEntity sysExtensionApiEntity) {
|
||||||
|
String bodys = sysExtensionApiEntity.getBodys();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(bodys);
|
||||||
|
stringBuilder.append("userid=").append(jsonObject.getString("userid"));
|
||||||
|
stringBuilder.append("&");
|
||||||
|
stringBuilder.append("access_token=").append(jsonObject.getString("access_token"));
|
||||||
|
sysExtensionApiEntity.setQuerys(stringBuilder.toString());
|
||||||
|
return sysExtensionApiEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
String requestType = entity.getString("UserAgent");// pc端还是移动端
|
String requestType = entity.getString("UserAgent");// pc端还是移动端
|
||||||
JSONObject bodyParams = new JSONObject();
|
JSONObject bodyParams = new JSONObject();
|
||||||
bodyParams.put("code",code);
|
bodyParams.put("code",code);
|
||||||
String result = HttpRequest.post("url").
|
String result = HttpRequest.post(url).
|
||||||
header("appId",appId).
|
header("appId",appId).
|
||||||
header("apiCode",userApiCode).
|
header("apiCode",userApiCode).
|
||||||
header("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj").
|
header("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj").
|
||||||
|
@ -192,26 +192,24 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
JSONObject resultJson = JSONObject.parseObject(result);
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
boolean flag = resultJson.getBoolean("flag");
|
boolean flag = resultJson.getBoolean("flag");
|
||||||
if(!flag){
|
if(!flag){
|
||||||
throw new BaseSystemException("请求错误:"+resultJson.getString("msg"));
|
return BaseResult.getFailureMessageEntity("请求错误:"+resultJson.getString("msg"));
|
||||||
}
|
}
|
||||||
String userid = resultJson.getString("userid");
|
String userid = resultJson.getJSONObject("attribute").getJSONObject("result").getString("userid");
|
||||||
if(StrUtil.isEmpty(userid)){
|
if(StrUtil.isEmpty(userid)){
|
||||||
return BaseResult.getFailureMessageEntity("认证失败!当前用户未绑定钉钉","1005");
|
return BaseResult.getFailureMessageEntity("认证失败!获取钉钉userid错误","1006");
|
||||||
}
|
}
|
||||||
userEntity.setDdUserId( userid);
|
userEntity.setDdUserId( userid);
|
||||||
userEntity = sysUserDao.queryOne(userEntity);
|
userEntity = sysUserDao.queryOne(userEntity);
|
||||||
if(null == userEntity ){
|
if(null == userEntity ){
|
||||||
if(StrUtil.isEmpty(userid)){
|
JSONObject object = new JSONObject();
|
||||||
JSONObject object = new JSONObject();
|
object.put("userid",userid);
|
||||||
object.put("userid",userid);
|
return BaseResult.getFailureMessageEntity("认证失败!当前用户未绑定钉钉","1005",object);
|
||||||
return BaseResult.getFailureMessageEntity("认证失败!当前用户未绑定钉钉","1005",object);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "weChat":
|
case "weChat":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new BaseSystemException("错误的App类型:"+appType+" 支持的app类型有:DD,weChat");
|
return BaseResult.getFailureMessageEntity("错误的App类型:"+appType+" 支持的app类型有:DD,weChat");
|
||||||
|
|
||||||
}
|
}
|
||||||
//登录
|
//登录
|
||||||
|
@ -266,6 +264,18 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JSONObject getAccess_token(String appId,String apiCode) {
|
||||||
|
String result = HttpRequest.post(url).
|
||||||
|
header("appId",appId).
|
||||||
|
header("apiCode",apiCode).
|
||||||
|
header("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj").
|
||||||
|
header("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||||
|
execute().
|
||||||
|
body();
|
||||||
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected <T> T getData(String key, JSONObject jsonObject, Class<T> clz) {
|
protected <T> T getData(String key, JSONObject jsonObject, Class<T> clz) {
|
||||||
if (checkStr(jsonObject.getString(key))) {
|
if (checkStr(jsonObject.getString(key))) {
|
||||||
|
|
|
@ -21,7 +21,9 @@ public class SysMessageManageLogEntity extends BaseEntity {
|
||||||
private String messageCode;
|
private String messageCode;
|
||||||
/** 发送者应用 */
|
/** 发送者应用 */
|
||||||
private String sendApp;
|
private String sendApp;
|
||||||
/** 发送者 */
|
private String sendAppName;
|
||||||
|
|
||||||
|
/** 发送者 */
|
||||||
private String sendApi;
|
private String sendApi;
|
||||||
/** 接收者编码 */
|
/** 接收者编码 */
|
||||||
private String receiveCode;
|
private String receiveCode;
|
||||||
|
@ -196,5 +198,13 @@ public class SysMessageManageLogEntity extends BaseEntity {
|
||||||
public void setCreateTimeEnd(Date createTimeEnd) {
|
public void setCreateTimeEnd(Date createTimeEnd) {
|
||||||
this.createTimeEnd = createTimeEnd;
|
this.createTimeEnd = createTimeEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSendAppName() {
|
||||||
|
return sendAppName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSendAppName(String sendAppName) {
|
||||||
|
this.sendAppName = sendAppName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
|
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||||
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
import com.hzya.frame.sysnew.messageManageLogBack.detail.server.ISysMessageManageLogDetailBackService;
|
import com.hzya.frame.sysnew.messageManageLogBack.detail.server.ISysMessageManageLogDetailBackService;
|
||||||
import com.hzya.frame.sysnew.messageManageLogBack.service.ISysMessageManageLogBackService;
|
import com.hzya.frame.sysnew.messageManageLogBack.service.ISysMessageManageLogBackService;
|
||||||
import com.hzya.frame.sysnew.messageManageLogDetail.dao.ISysMessageManageLogDetailDao;
|
import com.hzya.frame.sysnew.messageManageLogDetail.dao.ISysMessageManageLogDetailDao;
|
||||||
|
@ -41,7 +43,8 @@ public class SysMessageManageLogServiceImpl extends BaseService<SysMessageManage
|
||||||
private ISysMessageManageLogDao sysMessageManageLogDao;
|
private ISysMessageManageLogDao sysMessageManageLogDao;
|
||||||
@Resource
|
@Resource
|
||||||
private IEsbService esbService;
|
private IEsbService esbService;
|
||||||
|
@Resource
|
||||||
|
private ISysApplicationDao sysApplicationDao;
|
||||||
@Resource
|
@Resource
|
||||||
private ISysMessageManageLogBackService sysMessageManageLogBackService;
|
private ISysMessageManageLogBackService sysMessageManageLogBackService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -222,6 +225,14 @@ public class SysMessageManageLogServiceImpl extends BaseService<SysMessageManage
|
||||||
}
|
}
|
||||||
entity = sysMessageManageLogDao.queryOne(entity);
|
entity = sysMessageManageLogDao.queryOne(entity);
|
||||||
if (entity != null && entity.getId() != null) {
|
if (entity != null && entity.getId() != null) {
|
||||||
|
if(entity.getSendApp()!= null){
|
||||||
|
SysApplicationEntity sysApplicationEntity = new SysApplicationEntity();
|
||||||
|
sysApplicationEntity.setId(entity.getSendApp());
|
||||||
|
sysApplicationEntity = sysApplicationDao.queryOne(sysApplicationEntity);
|
||||||
|
if(sysApplicationEntity!= null && sysApplicationEntity.getName() != null){
|
||||||
|
entity.setSendAppName(sysApplicationEntity.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("查询数据成功", entity);
|
return BaseResult.getSuccessMessageEntity("查询数据成功", entity);
|
||||||
} else {
|
} else {
|
||||||
return BaseResult.getFailureMessageEntity("未查询到数据");
|
return BaseResult.getFailureMessageEntity("未查询到数据");
|
||||||
|
|
|
@ -104,6 +104,8 @@
|
||||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||||
|
<if test="ddUserId != null and ddUserId != ''">and dd_user_id = #{ddUserId}</if>
|
||||||
|
<if test="wxUserId != null and wxUserId != ''">and wx_user_id = #{wxUserId}</if>
|
||||||
and sts='Y'
|
and sts='Y'
|
||||||
</trim>
|
</trim>
|
||||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||||
|
|
|
@ -52,7 +52,6 @@ public class EntranceController {
|
||||||
protected ISysApplicationService sysApplicationService;
|
protected ISysApplicationService sysApplicationService;
|
||||||
@RequestMapping(value = "/option")
|
@RequestMapping(value = "/option")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@CrossOrigin(origins = "*")
|
|
||||||
public JsonResultEntity option(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
public JsonResultEntity option(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||||
return entranceService.doBusiness(servletRequest, servletResponse);
|
return entranceService.doBusiness(servletRequest, servletResponse);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue