commit
d9ca391a6e
@ -0,0 +1,13 @@
|
||||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 2:34 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Path("/bs/hrmorganization/config")
|
||||
public class ConfigController extends com.engine.organization.web.ConfigController {
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.engine.organization.entity.config.params;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 3:38 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class QTXConfigParam {
|
||||
|
||||
public QTXConfigParam() {
|
||||
this.type = "1";
|
||||
this.domainIndex = "0";
|
||||
this.whole = "0";
|
||||
}
|
||||
|
||||
private String loginId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String domainIndex;
|
||||
|
||||
private String whole;
|
||||
|
||||
private String userAgent;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.engine.organization.entity.config.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 3:34 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class QTXConfigPO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String appSecret;
|
||||
|
||||
private String url;
|
||||
|
||||
private String pcAddress;
|
||||
|
||||
private String mobileAddress;
|
||||
|
||||
private String secondUrl;
|
||||
|
||||
private Integer creator;
|
||||
|
||||
private String createDate;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.engine.organization.enums;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 4:29 PM
|
||||
* @Description: 移动端类型
|
||||
* @Version 1.0
|
||||
*/
|
||||
public enum MobileTerminalEnum {
|
||||
Android,
|
||||
iPhone,
|
||||
iPad,
|
||||
Mobile;
|
||||
|
||||
|
||||
/**
|
||||
* 判断字符串是否包含某个枚举值
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static boolean containsEnumValue(String str) {
|
||||
for (MobileTerminalEnum myEnum : MobileTerminalEnum.values()) {
|
||||
if (str.contains(myEnum.toString())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.engine.organization.mapper.config;
|
||||
|
||||
|
||||
import com.engine.organization.entity.config.po.QTXConfigPO;
|
||||
|
||||
/**
|
||||
* 企通学配置Mapper
|
||||
*/
|
||||
public interface ConfigMapper {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 获取配置信息
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/8/18 5:01 PM
|
||||
* @param: []
|
||||
* @return: com.engine.organization.entity.config.po.QTXConfigPO
|
||||
*/
|
||||
QTXConfigPO selectConfigInfo();
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.organization.mapper.config.ConfigMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.config.po.QTXConfigPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="app_secret" property="appSecret"/>
|
||||
<result column="url" property="url"/>
|
||||
<result column="pc_address" property="pcAddress"/>
|
||||
<result column="mobile_address" property="mobileAddress"/>
|
||||
<result column="second_url" property="secondUrl"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="create_date" property="createDate"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.app_secret
|
||||
, t.url
|
||||
, t.pc_address
|
||||
, t.mobile_address
|
||||
, t.second_url
|
||||
, t.creator
|
||||
, t.create_date
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectConfigInfo" parameterType="com.engine.organization.entity.config.po.QTXConfigPO"
|
||||
resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from JCL_ORG_QTXCONFIG t
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.config.params.QTXConfigParam;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 2:35 PM
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface ConfigService {
|
||||
|
||||
/**
|
||||
* @Description: 企通学单点地址
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2023/8/18 4:06 PM
|
||||
* @param: [qtxConfigParam]
|
||||
* @return: java.lang.String
|
||||
*/
|
||||
String ssoLogin(QTXConfigParam qtxConfigParam) throws UnsupportedEncodingException;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.config.params.QTXConfigParam;
|
||||
import com.engine.organization.service.ConfigService;
|
||||
import com.engine.organization.service.impl.ConfigServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2023/8/18 2:29 PM
|
||||
* @Description: 配置入口
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ConfigController {
|
||||
|
||||
|
||||
public ConfigService getConfigService(User user) {
|
||||
return ServiceUtil.getService(ConfigServiceImpl.class,user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/ssoLogin")
|
||||
public void ssoLogin(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("type") String type,@QueryParam("domainIndex") String domainIndex,@QueryParam("whole") String whole) throws IOException {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
QTXConfigParam qtxConfigParam = QTXConfigParam.builder().loginId(user.getLoginid()).type(type).domainIndex(domainIndex).whole(whole)
|
||||
.userAgent(request.getHeader("user-agent")).build();
|
||||
String url = getConfigService(user).ssoLogin(qtxConfigParam);
|
||||
response.sendRedirect(url);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue