4ac95c0a 张雷

增加单点登录接口、OA待办对接接口、禅道BUG修改

1 个父辈 c937ee54
......@@ -76,11 +76,6 @@ public class AjhMeetingController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<AjhMeeting>> result = new Result<IPage<AjhMeeting>>();
// if(ajhMeeting.getStartTime()!=null&&ajhMeeting.getEndTime()!=null){
// String startTime = ajhMeeting.getStartTime()+" 00:00:00";
// String endTime = ajhMeeting.getEndTime()+" 23:59:59";
// queryWrapper.between("start_time", startTime, endTime);
// }
Page<AjhMeeting> page = new Page<AjhMeeting>(pageNo, pageSize);
IPage<AjhMeeting> pageList = ajhMeetingService.queryPageList(page, ajhMeeting);
result.setSuccess(true);
......
......@@ -89,10 +89,9 @@ public class AjhMeetingSendController {
queryWrapper.like(ConvertUtils.isNotEmpty(ajhMeetingSend.getMeetTitle()),"meet_title",ajhMeetingSend.getMeetTitle());
queryWrapper.between(ConvertUtils.isNotEmpty(ajhMeetingSend.getMeetStartTime()),"meet_start_time",
ajhMeetingSend.getMeetStartTime()+" 00:00:00",ajhMeetingSend.getMeetEndTime()+" 23:59:59");
queryWrapper.orderByDesc("send_status");
Page<AjhMeetingSend> page = new Page<AjhMeetingSend>(pageNo, pageSize);
IPage<AjhMeetingSend> pageList = ajhMeetingSendService.queryPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
......
......@@ -87,7 +87,8 @@ public interface AjhRectificationInfoMapper extends BaseMapper<AjhRectificationI
* @param endDate
* @return
*/
List<RectificationInfoAnalyseVO.XAndCount> areaList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
List<RectificationInfoAnalyseVO.XAndCount> areaList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
@Param("departId") String departId);
/**
* 雷达图:安全隐患伤害类别
......
......@@ -46,7 +46,7 @@
<if test="ajhMeeting.meetCategory !=null and ajhMeeting.meetCategory!=''">
AND m.meet_category = #{ajhMeeting.meetCategory}
</if>
order by m.create_time desc
order by m.create_time desc,m.send_status asc
</select>
<select id="getDataById" resultType="com.skua.modules.ajh.vo.AjhMeetingVO">
......
......@@ -162,6 +162,7 @@
) t
group by ym;
</select>
<select id="areaList" resultType="com.skua.modules.ajh.vo.RectificationInfoAnalyseVO$XAndCount">
<!--要求:要返回所有的字典项-->
select dic.struct_name x, count
......@@ -172,7 +173,15 @@
group by ri.rec_ord_body
) t
right join sys_struct_dict dic on t.rec_ord_body = dic.id
where 1=1
<if test="departId!=null and departId!=''">
and dic.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="classifyList" resultType="java.lang.String">
select GROUP_CONCAT(rec_ord_classify)
from ajh_rectification_info ri
......
......@@ -255,7 +255,7 @@ public class AjhRectificationInfoServiceImpl extends ServiceImpl<AjhRectificatio
vo.setLevelHistogramList(mapper.levelHistogramList(startDate, endDate, departId));
vo.setDutyHistogramList(mapper.dutyHistogramList(startDate, endDate, departId));
vo.setAreaList(mapper.areaList(startDate, endDate));
vo.setAreaList(mapper.areaList(startDate, endDate, departId));
//雷达图:安全隐患伤害类别 (因为一个安全隐患可以选择多个[伤害类别],所以统计会复杂些)-------------------------------------------------------------------------------------------
List<RectificationInfoAnalyseVO.XAndCount> classifyList = new LinkedList<>();
......
package com.skua.modules.flow.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.core.entity.FlowAssemblyEntity;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 流程业务类
*
* @author Jkadmin
*/
public interface FlowForThirdBusinessService {
/**
* 流程待签列表
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectClaimPage(BladeFlow bladeFlow, String userId, String roles);
/**
* 流程待办列表
* @param bladeFlow 流程类
* @return
*/
List<BladeFlow> selectTodoPage(BladeFlow bladeFlow, String userId);
}
package com.skua.modules.flow.service.impl;
import com.skua.core.context.SpringContextUtils;
import com.skua.modules.flow.beans.BladeUser;
import com.skua.modules.flow.business.service.IFlowService;
import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.core.utils.TaskUtil;
import com.skua.modules.flow.custombiz.handle.IFlowBusinessDescService;
import com.skua.modules.flow.engine.constant.FlowEngineConstant;
import com.skua.modules.flow.service.FlowForThirdBusinessService;
import com.skua.modules.flow.utils.Func;
import com.skua.modules.flow.utils.StringPool;
import com.skua.modules.flow.utils.WebUtil;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
/**
* 流程业务实现类
* @author Jkadmin
*/
@Service
public class FlowForThirdBusinessServiceImpl implements FlowForThirdBusinessService {
@Autowired
private TaskService taskService;
@Autowired
private HistoryService historyService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private IFlowService flowService;
@Override
public List<BladeFlow> selectClaimPage(BladeFlow bladeFlow, String userId, String roles) {
String taskUser = TaskUtil.getTaskUser(userId);
String taskGroup = roles;
List<BladeFlow> flowList = new LinkedList<>();
// 个人等待签收的任务
TaskQuery claimUserQuery = taskService.createTaskQuery().taskCandidateUser(taskUser)
.includeProcessVariables().active().orderByTaskCreateTime().desc();
// 通用流程等待签收的任务
TaskQuery claimRoleWithoutTenantIdQuery = taskService.createTaskQuery().taskWithoutTenantId().taskCandidateGroupIn(Func.toStrList(taskGroup))
.includeProcessVariables().active().orderByTaskCreateTime().desc();
// 构建列表数据
buildFlowTaskList(bladeFlow, flowList, claimUserQuery, FlowEngineConstant.STATUS_CLAIM);
buildFlowTaskList(bladeFlow, flowList, claimRoleWithoutTenantIdQuery, FlowEngineConstant.STATUS_CLAIM);
flowList = flowList.stream().sorted(Comparator.comparing(BladeFlow::getCreateTime).reversed()).collect(Collectors.toList());
getFlowBusinessDesc(flowList);
return flowList;
}
@Override
public List<BladeFlow> selectTodoPage(BladeFlow bladeFlow, String userId) {
String taskUser = TaskUtil.getTaskUser(userId);
List<BladeFlow> flowList = new LinkedList<>();
// 已签收的任务
TaskQuery todoQuery = taskService.createTaskQuery().taskAssignee(taskUser).active()
.includeProcessVariables().orderByTaskCreateTime().desc();
if (bladeFlow.getProcessDefinitionName() != null) {
todoQuery.processDefinitionNameLike(bladeFlow.getProcessDefinitionName());
}
// 构建列表数据
buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO);
getFlowBusinessDesc(flowList);
return flowList;
}
/**
* 构建流程
*
* @param bladeFlow 流程通用类
* @param flowList 流程列表
* @param taskQuery 任务查询类
* @param status 状态
*/
private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) {
if (bladeFlow.getCategory() != null) {
taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
}
if (bladeFlow.getBeginDate() != null) {
taskQuery.taskCreatedAfter(bladeFlow.getBeginDate());
}
if (bladeFlow.getEndDate() != null) {
taskQuery.taskCreatedBefore(bladeFlow.getEndDate());
}
if (bladeFlow.getProcessDefinitionName() != null) {
taskQuery.processDefinitionNameLike(bladeFlow.getProcessDefinitionName());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessInstanceId())){
taskQuery.processInstanceId(bladeFlow.getProcessInstanceId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionId())){
taskQuery.processDefinitionId(bladeFlow.getProcessDefinitionId());
}
if (!org.apache.commons.lang3.StringUtils.isBlank(bladeFlow.getProcessDefinitionKey())){
taskQuery.processDefinitionKey(bladeFlow.getProcessDefinitionKey());
}
List<Task> queryList = taskQuery.list();
Set<String> processInstanceIdSet = new TreeSet<>();
Set<String> processDefinitionIdSet = new TreeSet<>();
queryList.forEach(task -> {
processInstanceIdSet.add(task.getProcessInstanceId());
processDefinitionIdSet.add(task.getProcessDefinitionId());
});
List<HistoricProcessInstance> historicProcessInstanceList = getHistoricProcessInstances(processInstanceIdSet);
Map<String, HistoricProcessInstance> historicProcessInstanceMap = new LinkedHashMap<>();
historicProcessInstanceList.forEach(historicProcessInstance -> {
historicProcessInstanceMap.put(historicProcessInstance.getId(), historicProcessInstance);
});
List<ProcessDefinition> processDefinitionList = getProcessDefinitionList(processDefinitionIdSet);
Map<String, ProcessDefinition> processDefinitionMap = new LinkedHashMap<>();
processDefinitionList.forEach(processDefinition -> {
processDefinitionMap.put(processDefinition.getId(), processDefinition);
});
List<BladeFlow> dataList = new ArrayList<>();
queryList.forEach(task -> {
BladeFlow flow = new BladeFlow();
flow.setTaskId(task.getId());
flow.setTaskDefinitionKey(task.getTaskDefinitionKey());
flow.setTaskName(task.getName());
flow.setAssignee(task.getAssignee());
flow.setCreateTime(task.getCreateTime());
flow.setClaimTime(task.getClaimTime());
flow.setExecutionId(task.getExecutionId());
flow.setVariables(task.getProcessVariables());
HistoricProcessInstance historicProcessInstance = historicProcessInstanceMap.get(task.getProcessInstanceId());
if (Func.isNotEmpty(historicProcessInstance)) {
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
flow.setBusinessTable(businessKey[0]);
flow.setBusinessId(businessKey[1]);
}
ProcessDefinition processDefinition = processDefinitionMap.get(task.getProcessDefinitionId());
if (Func.isNotEmpty(processDefinition)) {
flow.setCategory(processDefinition.getCategory());
flow.setCategoryName("请假流程");
flow.setProcessDefinitionId(processDefinition.getId());
flow.setProcessDefinitionName(processDefinition.getName());
flow.setProcessDefinitionKey(processDefinition.getKey());
flow.setProcessDefinitionVersion(processDefinition.getVersion());
}
flow.setProcessInstanceId(task.getProcessInstanceId());
flow.setStatus(status);
dataList.add(flow);
});
Map<String,List<String>> businessTableMap = new LinkedHashMap<>();
List<String> businessIdList;
for (BladeFlow flow : dataList) {
businessIdList = new ArrayList<>();
if (businessTableMap.get(flow.getBusinessTable()) != null){
businessIdList = businessTableMap.get(flow.getBusinessTable());
}
businessIdList.add(flow.getBusinessId());
businessTableMap.put(flow.getBusinessTable(),businessIdList);
}
List<String> allBusinessIdList = new ArrayList<>();
for (Map.Entry<String,List<String>> entry : businessTableMap.entrySet()){
allBusinessIdList.addAll(flowService.getBusinessIdList(entry.getKey(), entry.getValue()));
}
for (BladeFlow flow : dataList) {
if (allBusinessIdList.contains(flow.getBusinessId())){
flowList.add(flow);
}
}
}
private List<ProcessDefinition> getProcessDefinitionList(Set<String> processDefinitionIdSet) {
if (processDefinitionIdSet.size() > 0){
return repositoryService.createProcessDefinitionQuery().processDefinitionIds(processDefinitionIdSet).list();
}else{
return new ArrayList<>();
}
}
private List<HistoricProcessInstance> getHistoricProcessInstances(Set<String> processInstanceIdSet) {
if (processInstanceIdSet.size() > 0){
return historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIdSet).list();
}else{
return new ArrayList<>();
}
}
/**
* 获取租户ID
*
* @return tenantId
*/
public static String getTenantId() {
BladeUser user = getUser();
return (null == user) ? StringPool.EMPTY : user.getTenantId();
}
private static final String BLADE_USER_REQUEST_ATTR = "_BLADE_USER_REQUEST_ATTR_";
/**
* 获取用户信息
*
* @return BladeUser
*/
public static BladeUser getUser() {
HttpServletRequest request = WebUtil.getRequest();
if (request == null) {
return null;
}
// 优先从 request 中获取
Object bladeUser = request.getAttribute(BLADE_USER_REQUEST_ATTR);
if (bladeUser == null) {
bladeUser = getUser(request);
if (bladeUser != null) {
// 设置到 request 中
request.setAttribute(BLADE_USER_REQUEST_ATTR, bladeUser);
}
}
return (BladeUser) bladeUser;
}
/**
* 获取用户信息
*
* @param request request
* @return BladeUser
*/
public static BladeUser getUser(HttpServletRequest request) {
return new BladeUser();
}
public List<BladeFlow> getFlowBusinessDesc(List<BladeFlow> bladeFlowList){
List<Map<String,String>> paramList = new ArrayList<>();
Map<String,String> paramMap;
for (BladeFlow bladeFlow : bladeFlowList) {
paramMap = new HashMap<>();
paramMap.put("businessTable",bladeFlow.getBusinessTable());
paramMap.put("businessId",bladeFlow.getBusinessId());
paramList.add(paramMap);
}
IFlowBusinessDescService flowBusinessDescService = null;
try {
flowBusinessDescService = (IFlowBusinessDescService) SpringContextUtils.getBean("flowBusinessDescService");
}catch (Exception e){
//表示系统没有写流程描述接口
}
if (flowBusinessDescService != null) {
Map<String, String> flowBusinessDescMap = flowBusinessDescService.getFlowBusinessDesc(paramList);
if (flowBusinessDescMap != null) {
for (BladeFlow bladeFlow : bladeFlowList) {
bladeFlow.setBusinessDesc(flowBusinessDescMap.get(bladeFlow.getBusinessId()));
}
}
}
return bladeFlowList;
}
}
......@@ -4,20 +4,28 @@ 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.skua.core.api.ISysBaseAPI;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.DateUtils;
import com.skua.modules.equipment.entity.EquipmentMaintainTask;
import com.skua.modules.equipment.service.IEquipmentMaintainTaskService;
import com.skua.modules.flow.business.service.FlowBusinessService;
import com.skua.modules.flow.core.entity.BladeFlow;
import com.skua.modules.flow.core.utils.TaskUtil;
import com.skua.modules.flow.service.FlowForThirdBusinessService;
import com.skua.modules.inspection.entity.InspectionUserWorkingGroup;
import com.skua.modules.inspection.service.IInspectionTaskService;
import com.skua.modules.inspection.service.IInspectionUserWorkingGroupService;
import com.skua.modules.process.vo.ProcessStatisticsVO;
import com.skua.modules.process.vo.ThirdProcessVO;
import com.skua.modules.quartz.util.BaseUtil;
import com.skua.modules.system.entity.SysUser;
import com.skua.modules.system.entity.SysUserRole;
import com.skua.modules.system.service.ISysUserRoleService;
import com.skua.modules.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -27,8 +35,9 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Api(tags="测试流程")
......@@ -37,8 +46,14 @@ import java.util.List;
public class ProcessStatisticsController {
@Autowired
private ISysUserService sysUserService;
@Autowired
private ISysBaseAPI sysBaseAPI;
@Autowired
private FlowBusinessService flowBusinessService;
@Autowired
private FlowForThirdBusinessService flowForThirdBusinessService;
@Autowired
private IEquipmentMaintainTaskService equipMaintainExecuteService;
@Autowired
private IInspectionTaskService inspectionTaskService;
......@@ -60,9 +75,6 @@ public class ProcessStatisticsController {
public Result<List<ProcessStatisticsVO>> statistics() {
Result<List<ProcessStatisticsVO>> result = new Result<List<ProcessStatisticsVO>>();
List<ProcessStatisticsVO> processStatisticsList = new ArrayList<>();
/* String taskUser = TaskUtil.getTaskUser();
String taskGroup = TaskUtil.getCandidateGroup();*/
String userId = BaseContextHandler.getUserId();
IPage<BladeFlow> page = new Page<BladeFlow>();
page.setCurrent(1);
......@@ -70,8 +82,6 @@ public class ProcessStatisticsController {
BladeFlow bladeFlow = new BladeFlow();
try {
//巡检任务、维修任务、保养任务、危险作业、事故事件、安全隐患、、药剂入库
String process_key = "AjhRectification";
processStatisticsList.add( queryProcessStatistics("安全隐患", process_key,page,bladeFlow) ) ;
process_key = "problemReport";
......@@ -91,8 +101,6 @@ public class ProcessStatisticsController {
ProcessStatisticsVO maintainerProcessStatisticsVO = new ProcessStatisticsVO("保养任务" ,"" , "0", baoyangTodoCount.toString() );
processStatisticsList.add( maintainerProcessStatisticsVO );
//巡检
//得到巡检任务
//得到进行中的任务
......@@ -155,19 +163,6 @@ public class ProcessStatisticsController {
return result;
}
/***
* @param process_key
* @return
*/
/* private ProcessStatisticsVO queryProcessStatistics(String processName,String process_key,String taskUser , String taskGroup){
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.processDefinitionKey( process_key );
Long todoCount = taskQuery.taskAssignee(taskUser).count();//代办人数
Long claimCount = taskQuery.taskCandidateGroupIn( Func.toStrList(taskGroup) ).count() ;//todoCount
return new ProcessStatisticsVO(processName ,process_key , todoCount.toString(), claimCount.toString() );
}*/
private ProcessStatisticsVO queryProcessStatistics(String processName, String process_key, IPage<BladeFlow> page,BladeFlow bladeFlow){
// String repairProcessDefinitionKey = "equipServicewx";
bladeFlow.setProcessDefinitionKey(process_key);
......@@ -177,4 +172,56 @@ public class ProcessStatisticsController {
return new ProcessStatisticsVO(processName ,process_key , repairToDoCount+"", repairClaimCount+"" );
}
@AutoLog(value = "第三方获取待办流程" )
@ApiOperation(value="第三方获取待办流程", notes="第三方获取待办流程")
@GetMapping(value = "/getProcessByPhone")
public Result<Map<String,Object>> getProcessByPhone(String phone) {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
List<ThirdProcessVO> list = new ArrayList<>();
SysUser sysUser = sysUserService.getUserByPhone(phone);
if(sysUser!=null){
String userName = sysUser.getRealname();
BladeFlow bladeFlow = new BladeFlow();
List<BladeFlow> claimList = new ArrayList<>();
List<BladeFlow> todoList = new ArrayList<>();
List<String> roleList = sysBaseAPI.getRolesByUserId(sysUser.getId());
String roles = roleList.stream().map(s -> s.trim()).collect(Collectors.joining(","));
if(roleList.size() > 0){
claimList = flowForThirdBusinessService.selectClaimPage(bladeFlow, sysUser.getId(), roles);
for (BladeFlow claim : claimList) {
ThirdProcessVO claimVO = new ThirdProcessVO();
claimVO.setMsgid(claim.getTaskId());
claimVO.setMessagenote(claim.getBusinessDesc());
if(claim.getCreateTime()!=null){
claimVO.setSenddate(DateUtils.format(new Date(), "YYYY-MM-dd"));
}
claimVO.setCheckcode(phone);
claimVO.setCheckname(userName);
claimVO.setSendercode(phone);
claimVO.setSendername(userName);
list.add(claimVO);
}
}
todoList = flowForThirdBusinessService.selectTodoPage(bladeFlow, sysUser.getId());
for (BladeFlow todo : todoList) {
ThirdProcessVO todoVO = new ThirdProcessVO();
todoVO.setMsgid(todo.getTaskId());
todoVO.setMessagenote(todo.getBusinessDesc());
if(todo.getCreateTime()!=null){
todoVO.setSenddate(DateUtils.format(new Date(), "YYYY-MM-dd"));
}
todoVO.setCheckcode(phone);
todoVO.setCheckname(userName);
todoVO.setSendercode(phone);
todoVO.setSendername(userName);
list.add(todoVO);
}
}
map.put("DATAS",list);
map.put("COUNT",list.size());
result.setResult(map);
return result;
}
}
......
package com.skua.modules.process.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="待办数据传输对象", description="待办数据传输对象")
public class ThirdProcessVO {
@ApiModelProperty(value = "待办唯一标识ID")
private String msgid;
@ApiModelProperty(value = "PC端待办链接")
private String messageurlpc;
@ApiModelProperty(value = "移动端待办链接")
private String messageurlmobile;
@ApiModelProperty(value = "创建人手机号")
private String sendercode;
@ApiModelProperty(value = "创建人姓名")
private String sendername;
@ApiModelProperty(value = "待办标题")
private String messagenote;
@ApiModelProperty(value = "待办接收日期")
private String senddate;
@ApiModelProperty(value = "审批人手机号")
private String checkcode;
@ApiModelProperty(value = "审批人姓名")
private String checkname;
}
......@@ -46,6 +46,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
filterChainDefinitionMap.put("/sys/appLogin", "anon"); //移动端登录接口排除
filterChainDefinitionMap.put("/sys/thirdLogin", "anon"); //三方系统登录接口排除
filterChainDefinitionMap.put("/sys/sso/login", "anon"); //单点登录接口排除
filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除
filterChainDefinitionMap.put("/sys/getEncryptedString", "anon"); //获取加密串
filterChainDefinitionMap.put("/sys/sms", "anon");//短信验证码
......@@ -64,7 +65,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/web/erp/materialAcceptanceForm/senderSign", "anon");//采购入库,送货方签名
filterChainDefinitionMap.put("/web/erp/materialIN/queryById", "anon");//采购入库,查询采购入库信息
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文
filterChainDefinitionMap.put("/web/process/getProcessByPhone", "anon");//第三方获取待办事
filterChainDefinitionMap.put("/", "anon");
filterChainDefinitionMap.put("/doc.html", "anon");
filterChainDefinitionMap.put("/**/*.js", "anon");
......
......@@ -11,6 +11,8 @@ import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.util.encryption.MD5Util;
import com.skua.modules.system.vo.SsoLogin;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -184,6 +186,39 @@ public class LoginController {
return result;
}
/**
* 单点登录接口
* @param ssoLogin
* @return
*/
@RequestMapping(value = "/sso/login", method = RequestMethod.POST)
@ApiOperation("单点登录接口")
public Result<JSONObject> ssoLogin(@RequestBody SsoLogin ssoLogin){
Result<JSONObject> result = new Result<JSONObject>();
String phone = ssoLogin.getPhone();//手机号
String time = ssoLogin.getTime();//时间戳
String sign = ssoLogin.getSign();//加密信息
String key = "szhqydn";//约定标识
SysUser sysUser = sysUserService.getUserByPhone(ssoLogin.getPhone());
if(sysUser!=null){
String origin = key + time + phone;//标识
String md5 = MD5Util.MD5Encode(origin, null);
if(sign.equals(md5)){
//校验用户是否有效
result = sysUserService.checkUserIsEffective(sysUser);
if (!result.isSuccess()) {
return result;
}
//用户登录信息
userInfo(sysUser, result);
sysBaseAPI.addLog("手机号: " + phone + ",单点登录成功!", CommonConstant.LOG_TYPE_1, null);
}
}else{
result.error500("手机号不存在本系统");
}
return result;
}
@RequestMapping(value = "/getSv30Token", method = RequestMethod.POST)
@ApiOperation("SV30获取token")
public Result<JSONObject> getSv30Token(){
......
package com.skua.modules.system.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 单点登陆参数
*/
@Data
@ApiModel(value="SsoLogin", description="单点登陆参数")
public class SsoLogin {
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "时间戳")
private String time;
@ApiModelProperty(value = "加密信息")
private String sign;
@ApiModelProperty(value = "约定标识")
private String key;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!