提交修改
This commit is contained in:
commit
8bfc81ede9
@ -92,9 +92,15 @@ public class DingTalkUtil {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public String getAccessToken(String appid) {
|
public String getAccessToken(String appid) {
|
||||||
try {
|
|
||||||
|
|
||||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||||
|
return getAccessTokenWitchEntity(thirdAppConfig);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessTokenWitchEntity(ThirdAppConfig thirdAppConfig) {
|
||||||
|
try {
|
||||||
if(thirdAppConfig != null){
|
if(thirdAppConfig != null){
|
||||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
|
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
|
||||||
OapiGettokenRequest req = new OapiGettokenRequest();
|
OapiGettokenRequest req = new OapiGettokenRequest();
|
||||||
@ -103,7 +109,9 @@ public class DingTalkUtil {
|
|||||||
req.setHttpMethod("GET");
|
req.setHttpMethod("GET");
|
||||||
OapiGettokenResponse rsp = client.execute(req);
|
OapiGettokenResponse rsp = client.execute(req);
|
||||||
String resultStr = rsp.getBody();
|
String resultStr = rsp.getBody();
|
||||||
|
logger.info("钉钉请求返回", rsp.getBody());
|
||||||
JSONObject dataObj = JSON.parseObject(resultStr);
|
JSONObject dataObj = JSON.parseObject(resultStr);
|
||||||
|
|
||||||
String tenant_access_token = dataObj.getString("access_token");
|
String tenant_access_token = dataObj.getString("access_token");
|
||||||
return tenant_access_token;
|
return tenant_access_token;
|
||||||
}else{
|
}else{
|
||||||
@ -347,7 +355,7 @@ public class DingTalkUtil {
|
|||||||
user.setType(1);
|
user.setType(1);
|
||||||
user.setRealName(staffEntity.getName());
|
user.setRealName(staffEntity.getName());
|
||||||
user.setUserNo(staffEntity.getMobile());
|
user.setUserNo(staffEntity.getMobile());
|
||||||
return sysUserTokenService.createToken(user);
|
return sysUserTokenService.createTokenSetTokenCode(user, code);
|
||||||
}
|
}
|
||||||
return R.error("用户不存在");
|
return R.error("用户不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ public class ShiroConfig {
|
|||||||
filterMap.put("/dtlg/login", "anon");
|
filterMap.put("/dtlg/login", "anon");
|
||||||
filterMap.put("/dtlg/luck", "anon");
|
filterMap.put("/dtlg/luck", "anon");
|
||||||
filterMap.put("/dtlg/look", "anon");
|
filterMap.put("/dtlg/look", "anon");
|
||||||
|
filterMap.put("/dtlg/jump", "anon");
|
||||||
filterMap.put("/luck/getLuckById", "anon");
|
filterMap.put("/luck/getLuckById", "anon");
|
||||||
filterMap.put("/luck/updateLuck", "anon");
|
filterMap.put("/luck/updateLuck", "anon");
|
||||||
filterMap.put("/**", "oauth2");
|
filterMap.put("/**", "oauth2");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.lz.modules.app.controller;
|
package com.lz.modules.app.controller;
|
||||||
|
|
||||||
|
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||||
import com.lz.common.utils.*;
|
import com.lz.common.utils.*;
|
||||||
import com.lz.modules.app.dto.DepartmentsDto;
|
import com.lz.modules.app.dto.DepartmentsDto;
|
||||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||||
@ -18,6 +19,7 @@ import com.lz.modules.flow.req.ResultDetailReq;
|
|||||||
import com.lz.modules.flow.service.FlowRecordService;
|
import com.lz.modules.flow.service.FlowRecordService;
|
||||||
import com.lz.modules.flow.service.RecordAuthService;
|
import com.lz.modules.flow.service.RecordAuthService;
|
||||||
import com.lz.modules.flow.service.RecordFileService;
|
import com.lz.modules.flow.service.RecordFileService;
|
||||||
|
import com.lz.modules.job.business.DingtalkBusiness;
|
||||||
import com.lz.modules.sys.controller.AbstractController;
|
import com.lz.modules.sys.controller.AbstractController;
|
||||||
import com.lz.modules.sys.entity.SysUserEntity;
|
import com.lz.modules.sys.entity.SysUserEntity;
|
||||||
import com.lz.modules.sys.entity.app.ResultComment;
|
import com.lz.modules.sys.entity.app.ResultComment;
|
||||||
@ -30,12 +32,14 @@ import org.apache.commons.collections.CollectionUtils;
|
|||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -75,7 +79,13 @@ public class ResultRecordController extends AbstractController {
|
|||||||
private RecordFileService recordFileService;
|
private RecordFileService recordFileService;
|
||||||
|
|
||||||
|
|
||||||
|
DingtalkBusiness dingtalkBusiness;
|
||||||
|
|
||||||
|
@Value("${dingtalk.appid}")
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
@Value("${domain.main}")
|
||||||
|
private String domain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
@ -298,10 +308,31 @@ public class ResultRecordController extends AbstractController {
|
|||||||
flowRecordService.updateFlowRecordById(flowRecord);
|
flowRecordService.updateFlowRecordById(flowRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
|
||||||
|
r = R.ok("成功")
|
||||||
|
.put("from", mySelf)
|
||||||
|
.put("to", mySelf)
|
||||||
|
.put("type", WorkMsgTypeEnum.REJECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultCommentService.addOrUpdateComment(req, getUserId(), status);
|
resultCommentService.addOrUpdateComment(req, getUserId(), status);
|
||||||
return r != null ? r : R.ok("成功");
|
if(r != null && (int)r.get("code") == 0){//下面推送消息
|
||||||
|
StaffEntity mySelf = (StaffEntity)r.get("from");
|
||||||
|
StaffEntity toSelf = (StaffEntity)r.get("to");
|
||||||
|
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
|
||||||
|
String url = domain + "/management/dingtalklogin?url=";//免登接口
|
||||||
|
String jump = domain + "/management/recorddetail?id=" + req.getRecordResultId()
|
||||||
|
+ "&recordType=3" ;//跳转接口
|
||||||
|
jump = URLEncoder.encode(jump);
|
||||||
|
String msg = dingtalkBusiness.sendWorkMSGByEntity(appid, mySelf, toSelf, workMsgTypeEnum, url + jump);
|
||||||
|
if(msg.equals("OK")){
|
||||||
|
return r;
|
||||||
|
}else{
|
||||||
|
return R.error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok("成功");
|
||||||
|
//return r != null ? r : R.ok("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -21,6 +21,10 @@ import com.lz.modules.app.service.StaffOccupationService;
|
|||||||
import com.lz.modules.app.service.StaffService;
|
import com.lz.modules.app.service.StaffService;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||||
|
import com.lz.modules.sys.dao.SysUserTokenDao;
|
||||||
|
import com.lz.modules.sys.entity.SysUserTokenEntity;
|
||||||
|
import com.lz.modules.third.entity.ThirdAppConfig;
|
||||||
|
import com.lz.modules.third.service.ThirdAppConfigService;
|
||||||
import com.mchange.lang.IntegerUtils;
|
import com.mchange.lang.IntegerUtils;
|
||||||
import com.taobao.api.ApiException;
|
import com.taobao.api.ApiException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -28,6 +32,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -41,7 +47,8 @@ import java.util.Map;
|
|||||||
@Component(value = "dingtalkBusiness")
|
@Component(value = "dingtalkBusiness")
|
||||||
public class DingtalkBusiness {
|
public class DingtalkBusiness {
|
||||||
protected final static org.slf4j.Logger logger = LoggerFactory.getLogger(DingtalkBusiness.class);
|
protected final static org.slf4j.Logger logger = LoggerFactory.getLogger(DingtalkBusiness.class);
|
||||||
|
//token过期时间12小时
|
||||||
|
private final static int EXPIRE = 3600 * 12;
|
||||||
@Autowired
|
@Autowired
|
||||||
DingTalkUtil dingTalkUtil;
|
DingTalkUtil dingTalkUtil;
|
||||||
|
|
||||||
@ -57,6 +64,12 @@ public class DingtalkBusiness {
|
|||||||
@Resource
|
@Resource
|
||||||
StaffOccupationService staffOccupationService;
|
StaffOccupationService staffOccupationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ThirdAppConfigService thirdAppConfigService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserTokenDao sysUserTokenDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
StaffDao staffDao;
|
StaffDao staffDao;
|
||||||
|
|
||||||
@ -180,24 +193,40 @@ public class DingtalkBusiness {
|
|||||||
//获取Token
|
//获取Token
|
||||||
StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid);
|
StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid);
|
||||||
StaffEntity fromStaffEntity = staffService.selectStaffById(fromStaffid);
|
StaffEntity fromStaffEntity = staffService.selectStaffById(fromStaffid);
|
||||||
|
|
||||||
|
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
|
||||||
|
return sendWorkMSGByEntity(appid, fromStaffEntity, toStaffEntity, workMsgTypeEnum, "https://www.baidu.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String sendWorkMSGByEntity(String appid, StaffEntity fromStaffEntity, StaffEntity toStaffEntity,
|
||||||
|
WorkMsgTypeEnum workMsgTypeEnum, String url){
|
||||||
if(toStaffEntity != null && fromStaffEntity != null){
|
if(toStaffEntity != null && fromStaffEntity != null){
|
||||||
|
|
||||||
WorkMsgTypeEnum workMsgTypeEnum = WorkMsgTypeEnum.findRoleTypeByCode(type);
|
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||||
String token = dingTalkUtil.getAccessToken(appid);
|
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||||
if(token != null && token.length() > 0){
|
if(token != null && token.length() > 0){
|
||||||
|
//下面防止第二次发送消息时钉钉不推送
|
||||||
|
if(url.contains("?")){
|
||||||
|
url += "&halokit=" + System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
url += "?halokit=" + System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
url = URLEncoder.encode(url);
|
||||||
|
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||||
|
"&container_type=work_platform&app_id=0_" + appid + "&redirect_type=jump&redirect_url=" + url;
|
||||||
|
|
||||||
String content = workMsgTypeEnum.getContent().replace("@", fromStaffEntity.getName());
|
String content = workMsgTypeEnum.getContent().replace("@", fromStaffEntity.getName());
|
||||||
return dingTalkUtil.sendSingleActionCardMSG(appid, toStaffEntity, workMsgTypeEnum.getTitle(),
|
return dingTalkUtil.sendSingleActionCardMSG(appid, toStaffEntity, workMsgTypeEnum.getTitle(),
|
||||||
content, workMsgTypeEnum.getBtnText(), "https://www.baidu.com?time=" + System.currentTimeMillis(), token);
|
content, workMsgTypeEnum.getBtnText(), url, token);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
return "token无效";
|
return "token无效";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "无相关人员信息";
|
return "无相关人员信息";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public R login(String code, String appid) {
|
public R login(String code, String appid) {
|
||||||
|
logger.info("钉钉登录appid{}", appid);
|
||||||
String token = dingTalkUtil.getAccessToken(appid);
|
String token = dingTalkUtil.getAccessToken(appid);
|
||||||
if(token != null && token.length() > 0){
|
if(token != null && token.length() > 0){
|
||||||
return dingTalkUtil.getUserIdByCode(code, token);
|
return dingTalkUtil.getUserIdByCode(code, token);
|
||||||
@ -212,4 +241,22 @@ public class DingtalkBusiness {
|
|||||||
}
|
}
|
||||||
return R.error("授权失败,未授权");
|
return R.error("授权失败,未授权");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public R jump(String code) {
|
||||||
|
SysUserTokenEntity tokenEntity = sysUserTokenDao.getByTokenCode(code);
|
||||||
|
if(tokenEntity != null){//token不存在或者超过2分钟
|
||||||
|
long big = System.currentTimeMillis() - tokenEntity.getCodeTime().getTime();
|
||||||
|
logger.info("跳转的时间差{}", big);
|
||||||
|
if(big < 120000L){
|
||||||
|
//这里不更新时间了
|
||||||
|
tokenEntity.setTokenCode("");
|
||||||
|
sysUserTokenDao.updateById(tokenEntity);
|
||||||
|
long expire = tokenEntity.getExpireTime().getTime() - System.currentTimeMillis();
|
||||||
|
return R.ok().put("token", tokenEntity.getToken()).put("expire", expire);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
logger.info("token的token_code不存在");
|
||||||
|
return R.error("未授权登录");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import com.lz.modules.job.business.FeishuBusiness;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +30,8 @@ public class DingtalkSynDataJob implements ITask {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DingtalkBusiness dingtalkBusiness;
|
DingtalkBusiness dingtalkBusiness;
|
||||||
static String appid = "856016278";
|
@Value("${dingtalk.appid}")
|
||||||
|
private String appid;
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ package com.lz.modules.sys.dao;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.lz.modules.sys.entity.SysUserTokenEntity;
|
import com.lz.modules.sys.entity.SysUserTokenEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户Token
|
* 系统用户Token
|
||||||
@ -23,4 +24,6 @@ public interface SysUserTokenDao extends BaseMapper<SysUserTokenEntity> {
|
|||||||
SysUserTokenEntity queryByToken(String token);
|
SysUserTokenEntity queryByToken(String token);
|
||||||
|
|
||||||
Long insertBySysUserTokenEntity(SysUserTokenEntity tokenEntity);
|
Long insertBySysUserTokenEntity(SysUserTokenEntity tokenEntity);
|
||||||
|
|
||||||
|
SysUserTokenEntity getByTokenCode(@Param("code") String code);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,10 @@ public class SysUserTokenEntity implements Serializable {
|
|||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
//0表示系统用户,1表示普通员工
|
//0表示系统用户,1表示普通员工
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
//token对应的code,一次查询有效,查询后置空
|
||||||
|
private String tokenCode;
|
||||||
|
//toke_code对应添加的时间超过该事件+3分钟失效
|
||||||
|
private Date codeTime;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -112,6 +116,22 @@ public class SysUserTokenEntity implements Serializable {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTokenCode() {
|
||||||
|
return tokenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenCode(String tokenCode) {
|
||||||
|
this.tokenCode = tokenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCodeTime() {
|
||||||
|
return codeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodeTime(Date codeTime) {
|
||||||
|
this.codeTime = codeTime;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SysUserToken{" +
|
return "SysUserToken{" +
|
||||||
@ -120,6 +140,8 @@ public class SysUserTokenEntity implements Serializable {
|
|||||||
",expireTime=" + expireTime +
|
",expireTime=" + expireTime +
|
||||||
",updateTime=" + updateTime +
|
",updateTime=" + updateTime +
|
||||||
",type=" + type +
|
",type=" + type +
|
||||||
|
",tokenCode=" + tokenCode +
|
||||||
|
",codeTime=" + codeTime +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,4 +32,5 @@ public interface SysUserTokenService extends IService<SysUserTokenEntity> {
|
|||||||
*/
|
*/
|
||||||
void logout(long userId);
|
void logout(long userId);
|
||||||
|
|
||||||
|
R createTokenSetTokenCode(SysUserEntity user, String code);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.lz.modules.sys.service.app.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||||
import com.lz.common.utils.*;
|
import com.lz.common.utils.*;
|
||||||
import com.lz.modules.app.dao.DepartmentsDao;
|
import com.lz.modules.app.dao.DepartmentsDao;
|
||||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||||
@ -343,7 +344,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
|||||||
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
|
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
|
||||||
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
|
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
|
||||||
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
|
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
|
||||||
return R.ok("流程审批结束");
|
return R.ok("流程审批结束")
|
||||||
|
.put("from", staff)
|
||||||
|
.put("to", staff)
|
||||||
|
.put("type", WorkMsgTypeEnum.PASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FlowRecord flowRecord = new FlowRecord();
|
FlowRecord flowRecord = new FlowRecord();
|
||||||
@ -392,7 +396,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
|||||||
resultRecord.setFlowStaffIdRole(staffRoles);
|
resultRecord.setFlowStaffIdRole(staffRoles);
|
||||||
resultRecord.setStatus(1); //审批中
|
resultRecord.setStatus(1); //审批中
|
||||||
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
|
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
|
||||||
return R.ok("提交审批成功");
|
return R.ok("提交审批成功")
|
||||||
|
.put("from", staff)
|
||||||
|
.put("to", approvalStaff)
|
||||||
|
.put("type", WorkMsgTypeEnum.SUBMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -73,4 +73,40 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
|
|||||||
tokenEntity.setToken(token);
|
tokenEntity.setToken(token);
|
||||||
this.updateById(tokenEntity);
|
this.updateById(tokenEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R createTokenSetTokenCode(SysUserEntity user, String code){
|
||||||
|
//生成一个token
|
||||||
|
String token = TokenGenerator.generateValue();
|
||||||
|
|
||||||
|
//当前时间
|
||||||
|
Date now = new Date();
|
||||||
|
//过期时间
|
||||||
|
Date expireTime = new Date(now.getTime() + EXPIRE * 1000);
|
||||||
|
|
||||||
|
//判断是否生成过token
|
||||||
|
SysUserTokenEntity tokenEntity = this.getById(user.getUserId());
|
||||||
|
if(tokenEntity == null){
|
||||||
|
tokenEntity = new SysUserTokenEntity();
|
||||||
|
tokenEntity.setUserId(user.getUserId());
|
||||||
|
tokenEntity.setToken(token);
|
||||||
|
tokenEntity.setUpdateTime(now);
|
||||||
|
tokenEntity.setExpireTime(expireTime);
|
||||||
|
tokenEntity.setType(user.getType());
|
||||||
|
tokenEntity.setTokenCode(code);
|
||||||
|
tokenEntity.setCodeTime(new Date(System.currentTimeMillis()));
|
||||||
|
//保存token
|
||||||
|
sysUserTokenDao.insertBySysUserTokenEntity(tokenEntity);
|
||||||
|
}else{
|
||||||
|
tokenEntity.setToken(token);
|
||||||
|
tokenEntity.setUpdateTime(now);
|
||||||
|
tokenEntity.setTokenCode(code);
|
||||||
|
tokenEntity.setExpireTime(expireTime);
|
||||||
|
tokenEntity.setCodeTime(new Date(System.currentTimeMillis()));
|
||||||
|
//更新token
|
||||||
|
this.updateById(tokenEntity);
|
||||||
|
}
|
||||||
|
R r = R.ok().put("token", token).put("expire", EXPIRE);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.lz.modules.luck.service.LuckRecordService;
|
|||||||
import com.lz.modules.luck.service.LuckService;
|
import com.lz.modules.luck.service.LuckService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -26,13 +27,19 @@ public class DingTalkLoginController {
|
|||||||
LuckService luckService;
|
LuckService luckService;
|
||||||
@Autowired
|
@Autowired
|
||||||
LuckRecordService luckRecordService;
|
LuckRecordService luckRecordService;
|
||||||
static String appid = "856016278";
|
@Value("${dingtalk.appid}")
|
||||||
|
private String appid;
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public R login(@RequestBody String body){
|
public R login(@RequestBody String body){
|
||||||
log.info("钉钉免登录luck{}", body);
|
log.info("钉钉免登录luck{}", body);
|
||||||
JSONObject json = JSONObject.parseObject(body);
|
JSONObject json = JSONObject.parseObject(body);
|
||||||
return dingtalkBusiness.login(json.getString("code"), appid);
|
return dingtalkBusiness.login(json.getString("code"), appid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/jump")
|
||||||
|
public R jump(@RequestParam String code){
|
||||||
|
log.info("钉钉免登录luck{}", code);
|
||||||
|
return dingtalkBusiness.jump(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/luck")
|
@PostMapping("/luck")
|
||||||
@ -52,10 +59,6 @@ public class DingTalkLoginController {
|
|||||||
List<LuckRecord> luckRecords = luckRecordService.selectLuckRecordByLuckId(luckId);
|
List<LuckRecord> luckRecords = luckRecordService.selectLuckRecordByLuckId(luckId);
|
||||||
String value = "暂无人员报名";
|
String value = "暂无人员报名";
|
||||||
if(luckRecords.size() > 0){
|
if(luckRecords.size() > 0){
|
||||||
/*
|
|
||||||
<p>
|
|
||||||
姓名:<span style="color:#E53333;">吴林</span> 是否中将:<span style="color:#009900;">中将</span>
|
|
||||||
</p>*/
|
|
||||||
value = "";
|
value = "";
|
||||||
for (int i = 0; i < luckRecords.size(); i++){
|
for (int i = 0; i < luckRecords.size(); i++){
|
||||||
LuckRecord luckRecord = luckRecords.get(i);
|
LuckRecord luckRecord = luckRecords.get(i);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.lz.modules.job.business.DingtalkBusiness;
|
|||||||
import com.lz.modules.third.entity.ThirdMsgSendRecord;
|
import com.lz.modules.third.entity.ThirdMsgSendRecord;
|
||||||
import com.lz.modules.third.service.ThirdMsgSendRecordService;
|
import com.lz.modules.third.service.ThirdMsgSendRecordService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -24,8 +25,8 @@ public class ThirdMsgSendRecordController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DingtalkBusiness dingtalkBusiness;
|
private DingtalkBusiness dingtalkBusiness;
|
||||||
|
@Value("${dingtalk.appid}")
|
||||||
static String appid = "856016278";
|
private String appid;
|
||||||
|
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public R list(@RequestBody String body) {
|
public R list(@RequestBody String body) {
|
||||||
|
|||||||
@ -30,6 +30,10 @@ spring:
|
|||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
console:
|
console:
|
||||||
env: dev
|
env: dev
|
||||||
|
dingtalk:
|
||||||
|
appid: 855818566
|
||||||
|
domain:
|
||||||
|
main: "http://192.168.43.94:8001"
|
||||||
|
|
||||||
##多数据源的配置
|
##多数据源的配置
|
||||||
#dynamic:
|
#dynamic:
|
||||||
|
|||||||
@ -30,6 +30,10 @@ spring:
|
|||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
console:
|
console:
|
||||||
env: prod
|
env: prod
|
||||||
|
dingtalk:
|
||||||
|
appid: 856016278
|
||||||
|
domain:
|
||||||
|
main: "https://lzmanagement.ldxinyong.com"
|
||||||
|
|
||||||
##多数据源的配置
|
##多数据源的配置
|
||||||
#dynamic:
|
#dynamic:
|
||||||
|
|||||||
@ -30,6 +30,10 @@ spring:
|
|||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
console:
|
console:
|
||||||
env: test
|
env: test
|
||||||
|
dingtalk:
|
||||||
|
appid: 855818566
|
||||||
|
domain:
|
||||||
|
main: "http:/localhost"
|
||||||
|
|
||||||
##多数据源的配置
|
##多数据源的配置
|
||||||
#dynamic:
|
#dynamic:
|
||||||
|
|||||||
@ -10,12 +10,16 @@
|
|||||||
<if test="token != null">token,</if>
|
<if test="token != null">token,</if>
|
||||||
<if test="expireTime != null">expire_time,</if>
|
<if test="expireTime != null">expire_time,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="type != null">type,</if>
|
||||||
|
<if test="tokenCode != null">token_code,</if>
|
||||||
|
<if test="codeTime != null">code_time,</if>
|
||||||
update_time
|
update_time
|
||||||
)values(
|
)values(
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
<if test="token != null">#{token},</if>
|
<if test="token != null">#{token},</if>
|
||||||
<if test="expireTime != null">#{expireTime},</if>
|
<if test="expireTime != null">#{expireTime},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="type != null">#{type},</if>
|
||||||
|
<if test="tokenCode != null">tokenCode,</if>
|
||||||
|
<if test="codeTime != null">codeTime,</if>
|
||||||
now()
|
now()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
@ -25,6 +29,8 @@
|
|||||||
select * from sys_user_token where token = #{value}
|
select * from sys_user_token where token = #{value}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getByTokenCode" resultType="com.lz.modules.sys.entity.SysUserTokenEntity">
|
||||||
|
select * from sys_user_token where token_code = #{code}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user