Merge branch 'lixuetao'
This commit is contained in:
@@ -87,6 +87,9 @@ public class ShiroFilterConfiguration {
|
||||
/* 校验单点登录ticket 不需要认证 */
|
||||
filterChainDefinitionMap.put(restPath + "/login", ANON);
|
||||
|
||||
/* 校验单点登录ticket 不需要认证 */
|
||||
filterChainDefinitionMap.put(restPath + "/ssoLogin", ANON);
|
||||
|
||||
/* 登出不需认证 */
|
||||
filterChainDefinitionMap.put(restPath + "/logout/**", ANON);
|
||||
|
||||
@@ -123,6 +126,8 @@ public class ShiroFilterConfiguration {
|
||||
/* 流程需要 */
|
||||
filterChainDefinitionMap.put(restPath + "/service/model/**", ANON);
|
||||
filterChainDefinitionMap.put(restPath + "/service/editor/stencilset", ANON);
|
||||
/* 同步需要 */
|
||||
filterChainDefinitionMap.put(restPath + "/sync/**", ANON);
|
||||
|
||||
filterChainDefinitionMap.put(restPath + "/**", AUTHC);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.login.rest;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.adc.da.log.annotation.BusinessLog;
|
||||
import com.adc.da.login.entity.OnlineUserEO;
|
||||
import com.adc.da.login.security.SystemAuthorizingRealm;
|
||||
@@ -36,18 +37,12 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
@@ -362,10 +357,10 @@ public class LoginRestController {
|
||||
return Result.error("r0012", "您输入的验证码不正确", systemAuthorizingRealm.isNeedValidCode(username));
|
||||
} catch (UnknownAccountException e) {
|
||||
log.info("用户[{}]身份验证失败", username);
|
||||
return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
|
||||
return Result.error("r0011", "您输入的用户名或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
|
||||
} catch (IncorrectCredentialsException e) {
|
||||
log.info("用户[{}]密码验证失败", username);
|
||||
return Result.error("r0011", "您输入的帐号或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
|
||||
return Result.error("r0011", "您输入的用户名或密码有误", systemAuthorizingRealm.isNeedValidCode(username));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("r0013", e.getMessage(), systemAuthorizingRealm.isNeedValidCode(username));
|
||||
@@ -507,6 +502,20 @@ public class LoginRestController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/ssoLogin")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "SSO,根据Code返回用户信息")
|
||||
public ResponseMessage ssoLogin(String code, HttpServletRequest request){
|
||||
// if (StrUtil.isBlank(code)) {
|
||||
// return Result.error("无法单点登录,code为空");
|
||||
// }
|
||||
// String username = userService.ssoLogin(code);
|
||||
|
||||
UsernamePasswordToken token = new UsernamePasswordToken("chh");
|
||||
|
||||
return login(request, token);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String decrypt = EncryptUtil.decrypt("F6lnqMmPc/zkC8LcdSnDIMkH3Pt3DC1/53blM5P0FkM=");
|
||||
System.out.println(decrypt);
|
||||
|
||||
@@ -132,17 +132,20 @@ huawei.OBS.fileMaxSize=10 #\u6587\u4EF6\u4E0A\u4F20\u6700\u5927M\u6570
|
||||
|
||||
logging.level.com.adc: debug
|
||||
|
||||
# CMP???????????
|
||||
# CMP TEST ENV
|
||||
cmp.url=https://cmp-uat.faw-vw.in/
|
||||
cmp.appkey=TI062S001Uat
|
||||
cmp.appSecret=ee493505524d4f628e52058f4df3a4fb
|
||||
|
||||
# CMP???????????
|
||||
# CMP PROD ENV
|
||||
#cmp.url=https://cmp.faw-vw.in/employee/v1/
|
||||
#cmp.appkey=TI062S001Uat
|
||||
#cmp.appSecret=ee493505524d4f628e52058f4df3a4fb
|
||||
|
||||
# SSO????
|
||||
# SSO TEST ENV
|
||||
sso.url=https://iamuat.faw-vw.com/
|
||||
sso.clientId=43da19911e74a14dd5d9
|
||||
sso.clientSecret=67da1e83183e854535cae9027cfbdb12cbc3
|
||||
sso.clientSecret=67da1e83183e854535cae9027cfbdb12cbc3
|
||||
|
||||
# ROLE FIX USER
|
||||
user.fix.role=wei.sheng,miao.qi
|
||||
@@ -72,7 +72,6 @@ queue.capacity=8
|
||||
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
||||
|
||||
spring.activiti.database-schema-update=true
|
||||
# ????????:true-???????false-??
|
||||
spring.activiti.check-process-definitions=false
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +152,13 @@ public class ReportManageConroller {
|
||||
if (count1 > 0){
|
||||
return Result.error("报告名称已流程中存在");
|
||||
}
|
||||
|
||||
//有报告id说明不是新增报告 走得不是新增流程
|
||||
if(StringUtils.isNotEmpty(vo.getId())){
|
||||
long count2 = reportDao.selectByReportId(vo.getId());
|
||||
if (count2==0){
|
||||
return Result.error("报告已经不存在");
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,4 +77,5 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
||||
List<ReportEntity> selectDDL();
|
||||
|
||||
|
||||
long selectByReportId(String id);
|
||||
}
|
||||
|
||||
@@ -298,4 +298,11 @@
|
||||
<select id="selectDDL" resultType="com.adc.da.report.eo.ReportEntity">
|
||||
SELECT * FROM tt_report_manage WHERE secrecy_last <= NOW()
|
||||
</select>
|
||||
<select id="selectByReportId" resultType="java.lang.Long">
|
||||
select count(1) from tt_report_manage rep
|
||||
<where>
|
||||
rep.del_flag = 0
|
||||
and rep.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -40,15 +41,15 @@ public class SyncIAMTimer {
|
||||
* IAM的前缀地址
|
||||
*/
|
||||
@Value("${cmp.url}")
|
||||
private String cmpUrl="https://cmp-uat.faw-vw.in/";
|
||||
private String cmpUrl;
|
||||
|
||||
@Value("${cmp.appkey}")
|
||||
private String appkey = "TI062S001Uat";
|
||||
private String appkey;
|
||||
|
||||
@Value("${cmp.appSecret}")
|
||||
private String appSecret = "ee493505524d4f628e52058f4df3a4fb";
|
||||
private String appSecret;
|
||||
|
||||
private String xCustom = "TI062S-001"; // 写死的
|
||||
private final String xCustom = "TI062S-001"; // 写死的
|
||||
|
||||
/**
|
||||
* 组织机构增量同步接口地址
|
||||
@@ -71,7 +72,8 @@ public class SyncIAMTimer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SyncIAMTimer syncIAMTimer = new SyncIAMTimer();
|
||||
syncIAMTimer.syncOrgIncrData(1, 10);
|
||||
// syncIAMTimer.syncOrgIncrData(1, 1000);
|
||||
syncIAMTimer.syncUserIncrData(39, 1000, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +82,7 @@ public class SyncIAMTimer {
|
||||
* @Param pageIndex 页码,默认为1,小于1按1处理
|
||||
* @Param pageSize 每页条数,默认10,小于1按1处 于1000按1000处理
|
||||
*/
|
||||
public void syncOrgIncrData(int pageIndex, int pageSize){
|
||||
public CmpOrgResult syncOrgIncrData(int pageIndex, int pageSize){
|
||||
String suffixUrl = ORG_INCREMENT_URL + "?pageIndex=" + pageIndex + "&pageSize=" + pageSize;
|
||||
String syncUrl = this.cmpUrl + suffixUrl;
|
||||
|
||||
@@ -101,7 +103,7 @@ public class SyncIAMTimer {
|
||||
|
||||
CmpOrgResult cmpOrgResult = GsonUtil.json2T(orgDataStr, CmpOrgResult.class);
|
||||
if (cmpOrgResult != null){
|
||||
List<OrgVoIAM> orgVoIAMList = cmpOrgResult.getData();
|
||||
List<OrgVoIAM> orgVoIAMList = cmpOrgResult.getData().getRecords();
|
||||
|
||||
// 同步的VO 转换成 数据库EO
|
||||
List<OrgEO> orgEOList = new ArrayList<>();
|
||||
@@ -114,13 +116,15 @@ public class SyncIAMTimer {
|
||||
|
||||
this.addSyncLog(null, new Date(), SyncTypeEnum.ORG_INCREMENT_DATA.getValue());
|
||||
}
|
||||
|
||||
return cmpOrgResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步组织机构-增量数据并入库
|
||||
* @Param syncModel 同步模式
|
||||
*/
|
||||
public void syncUserIncrData(int pageIndex, int pageSize, String enterTime){
|
||||
public CmpUserResult syncUserIncrData(int pageIndex, int pageSize, String enterTime){
|
||||
String suffixUrl = USER_INCREMENT_URL + "?pageIndex=" + pageIndex + "&pageSize=" + pageSize;
|
||||
if (StringUtils.isNotEmpty(enterTime)){
|
||||
suffixUrl += "&enterTime=" + enterTime;
|
||||
@@ -129,9 +133,9 @@ public class SyncIAMTimer {
|
||||
String syncUrl = this.cmpUrl + suffixUrl;
|
||||
|
||||
String gmtDate = SignUtils.getGMTDate();
|
||||
String sign = SignUtils.generate(HttpMethod.GET, syncUrl, this.xCustom, this.appkey, gmtDate, this.appSecret);
|
||||
String sign = SignUtils.generate(HttpMethod.GET, suffixUrl, this.xCustom, this.appkey, gmtDate, this.appSecret);
|
||||
|
||||
String userDataStr = HttpRequest.post(syncUrl)
|
||||
String userDataStr = HttpRequest.get(syncUrl)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Date", gmtDate)
|
||||
.header("X-HMAC-ACCESS-KEY", this.appkey)
|
||||
@@ -144,32 +148,21 @@ public class SyncIAMTimer {
|
||||
|
||||
CmpUserResult cmpUserResult = GsonUtil.json2T(userDataStr, CmpUserResult.class);
|
||||
if (cmpUserResult != null){
|
||||
List<UserVoIAM> userVoIAMList =cmpUserResult.getData();
|
||||
List<UserVoIAM> userVoIAMList =cmpUserResult.getData().getRecords();
|
||||
|
||||
List<UserEO> waitSaveUserList = new ArrayList<>();
|
||||
// 同步的VO 转换成 数据库EO,并存库
|
||||
for (UserVoIAM userVoIAM : userVoIAMList){
|
||||
UserEO userEO = this.transUserIAMVoToUserEO(userVoIAM);
|
||||
this.iUserEoService.syncSaveOrUpdate(userEO);
|
||||
waitSaveUserList.add(userEO);
|
||||
}
|
||||
|
||||
this.iUserEoService.syncSaveOrUpdate(waitSaveUserList);
|
||||
|
||||
this.addSyncLog(null, new Date(), SyncTypeEnum.USER_INCREMENT_DATA.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key和secret获取JWT_TOKEN
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
public String getJwtToken(String appKey, String appSecret) {
|
||||
String token = JWT.create()
|
||||
.withIssuer(appKey)
|
||||
.withIssuedAt(new Date())
|
||||
.withJWTId(IdUtil.fastSimpleUUID())
|
||||
.sign(Algorithm.HMAC256(appSecret));
|
||||
return String.join(" ", "Bearer", token);
|
||||
return cmpUserResult;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +216,7 @@ public class SyncIAMTimer {
|
||||
userEO.setAccount(userVoIAM.getAccount());
|
||||
userEO.setCellPhoneNumber(userVoIAM.getMobile() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userVoIAM.getMobile()));
|
||||
userEO.setCreateTime(userVoIAM.getEnterTime());
|
||||
userEO.setUpdateTime(userVoIAM.getEnterTime());
|
||||
userEO.setUpdateTime(DateUtil.formatDateTime(new Date()));
|
||||
userEO.setEmail(userVoIAM.getEmail() == null ? EncryptUtil.encrypt("") : EncryptUtil.encrypt(userVoIAM.getEmail()));
|
||||
userEO.setUsname(userVoIAM.getCnName());
|
||||
userEO.setStatus(userVoIAM.getStatus());
|
||||
@@ -243,11 +236,12 @@ public class SyncIAMTimer {
|
||||
|
||||
// 固定角色数据
|
||||
List<String> roleIdList = new ArrayList<>();
|
||||
// TODO 根据level固定为一般管理人员 或 总监
|
||||
|
||||
// 配置文件写死几个账号作为管理员,不调整对应的角色
|
||||
if ("1".equals(userEO.getLevelId()) || "2".equals(userEO.getLevelId()) || "3".equals(userEO.getLevelId()) || "4".equals(userEO.getLevelId())){
|
||||
roleIdList.add("1");
|
||||
roleIdList.add("4FWTB649DG");
|
||||
} else {
|
||||
roleIdList.add("2");
|
||||
roleIdList.add("3QD37LZJD6");
|
||||
}
|
||||
userEO.setRoleIdList(roleIdList);
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.adc.da.sync.service.controller;
|
||||
|
||||
import com.adc.da.sync.service.SyncIAMTimer;
|
||||
import com.adc.da.sys.vo.DictQueryVo;
|
||||
import com.adc.da.sys.vo.iam.CmpOrgResult;
|
||||
import com.adc.da.sys.vo.iam.CmpUserResult;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 数据同步测试服务
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/sync")
|
||||
@Api(tags = {"数据同步"})
|
||||
public class SyncController {
|
||||
|
||||
@Autowired
|
||||
private SyncIAMTimer syncIAMTimer;
|
||||
|
||||
@ApiOperation(value = "全量同步orgs")
|
||||
@GetMapping("/full/orgs")
|
||||
public ResponseMessage syncFullOrgs() {
|
||||
int pageIndex = 1;
|
||||
int pageSize = 1000;
|
||||
|
||||
CmpOrgResult cmpOrgResult = this.syncIAMTimer.syncOrgIncrData(pageIndex, pageSize);
|
||||
if (cmpOrgResult != null){
|
||||
int totalPages = cmpOrgResult.getData().getPages();
|
||||
for (int i = pageIndex + 1; i <= totalPages; i++){
|
||||
this.syncIAMTimer.syncOrgIncrData(i, pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增量同步orgs")
|
||||
@GetMapping("/incr/orgs")
|
||||
public ResponseMessage syncIncrOrgs(@RequestParam Integer pageIndex, @RequestParam Integer pageSize) {
|
||||
if (pageIndex == null || pageIndex == 0){
|
||||
pageIndex = 1;
|
||||
}
|
||||
if (pageSize == null || pageSize == 0){
|
||||
pageSize = 1000;
|
||||
}
|
||||
|
||||
CmpOrgResult cmpOrgResult = this.syncIAMTimer.syncOrgIncrData(pageIndex, pageSize);
|
||||
return Result.success(cmpOrgResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "全量同步users")
|
||||
@GetMapping("/full/users")
|
||||
public ResponseMessage syncFullUsers() {
|
||||
int pageIndex = 1;
|
||||
int pageSize = 1000;
|
||||
|
||||
CmpUserResult cmpUserResult = this.syncIAMTimer.syncUserIncrData(pageIndex, pageSize, null);
|
||||
if (cmpUserResult != null){
|
||||
int totalPages = cmpUserResult.getData().getPages();
|
||||
for (int i = pageIndex + 1; i <= totalPages; i++){
|
||||
this.syncIAMTimer.syncUserIncrData(i, pageSize, null);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增量同步users")
|
||||
@GetMapping("/incr/users")
|
||||
public ResponseMessage syncIncrUsers(@RequestParam Integer pageIndex, @RequestParam Integer pageSize) {
|
||||
if (pageIndex == null || pageIndex == 0){
|
||||
pageIndex = 1;
|
||||
}
|
||||
if (pageSize == null || pageSize == 0){
|
||||
pageSize = 1000;
|
||||
}
|
||||
|
||||
this.syncIAMTimer.syncUserIncrData(pageIndex, pageSize, null);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.adc.da.sys.constant;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/17 14:02
|
||||
* @Description: SSO单点登录所需常量
|
||||
*/
|
||||
public class SsoConstants {
|
||||
|
||||
/**
|
||||
* 获取Token的路径
|
||||
*/
|
||||
public static final String GET_TOKEN_PATH = "esc-sso/oauth2.0/accessToken?";
|
||||
|
||||
/**
|
||||
* 获取Token的路径
|
||||
*/
|
||||
public static final String GET_USERINFO_PATH = "esc-sso/oauth2.0/profile?";
|
||||
|
||||
/**
|
||||
* 应用注册ID
|
||||
*/
|
||||
public static final String CLIENT_ID = "client_id=";
|
||||
|
||||
/**
|
||||
* 属性常量
|
||||
*/
|
||||
public static final String GRANT_TYPE = "grant_type=";
|
||||
|
||||
/**
|
||||
* 属性常量
|
||||
*/
|
||||
public static final String AUTHORIZATION_CODE = "authorization_code";
|
||||
|
||||
/**
|
||||
* 接受到的code值
|
||||
*/
|
||||
public static final String CODE = "code=";
|
||||
|
||||
/**
|
||||
* client_secret
|
||||
*/
|
||||
public static final String CLIENT_SECRET = "client_secret=";
|
||||
|
||||
/**
|
||||
* 应用回调地址,需要http格式化
|
||||
*/
|
||||
public static final String REDIRECT_URI = "redirect_uri=";
|
||||
|
||||
/**
|
||||
* 获取的token的值 必须
|
||||
*/
|
||||
public static final String ACCESS_TOKEN = "access_token=";
|
||||
|
||||
}
|
||||
@@ -119,8 +119,8 @@ public class UserEOController extends BaseController<UserEO> {
|
||||
|
||||
@ApiOperation("获取所有用户")
|
||||
@GetMapping("/list")
|
||||
public ResponseMessage list(int pageNo, int pageSize, String account, String roleName) {
|
||||
IPage<Map<String, Object>> list = userEOService.list(pageNo, pageSize, account, roleName);
|
||||
public ResponseMessage list(int page, int pageSize, String account, String roleName) {
|
||||
IPage<Map<String, Object>> list = userEOService.list(page, pageSize, account, roleName);
|
||||
list.getRecords().forEach(c -> {
|
||||
try {
|
||||
c.put("CELLPHONE_NUMBER", StringUtils.isNotEmpty(c.get("CELLPHONE_NUMBER")) ? EncryptUtil.decrypt(c.get("CELLPHONE_NUMBER").toString())
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface UserOrgEODao extends BaseMapper<UserOrgEO> {
|
||||
|
||||
int insertBatch(@Param("userOrgEOList") List<UserOrgEO> userOrgEOList);
|
||||
|
||||
void deleteBatchByUserIds(@Param("userIds") List<String> userIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ import java.util.List;
|
||||
public interface UserRoleEODao extends BaseMapper<UserRoleEO> {
|
||||
int insertBatch(@Param("userRoleEOList") List<UserRoleEO> userRoleEOList);
|
||||
|
||||
void deleteBatchByUserIds(@Param("userIds") List<String> userIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.adc.da.sys.constant.SsoConstants;
|
||||
import com.adc.da.sys.constant.SysConstants;
|
||||
import com.adc.da.sys.constant.UserBelongEnum;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
@@ -10,18 +14,31 @@ import com.adc.da.sys.service.iservice.IUserEoService;
|
||||
import com.adc.da.sys.util.EncryptUtil;
|
||||
import com.adc.da.sys.vo.UserImportVO;
|
||||
import com.adc.da.sys.vo.UserVO;
|
||||
import com.adc.da.sys.vo.iam.SsoResponse;
|
||||
import com.adc.da.sys.vo.iam.SsoUserInfoResponse;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import org.apache.ibatis.binding.MapperMethod;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -36,12 +53,16 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service("userEOService")
|
||||
@Transactional
|
||||
@Slf4j
|
||||
public class UserEOServiceImpl implements IUserEoService {
|
||||
|
||||
|
||||
@Value("${isPassEncrypted}")
|
||||
private boolean isPassEncrypted;
|
||||
|
||||
@Value("${user.fix.role}")
|
||||
private String fixUserAccount; // 同步过来需要固定角色的账号
|
||||
|
||||
@Resource
|
||||
private UserEODao dao;
|
||||
|
||||
@@ -54,6 +75,15 @@ public class UserEOServiceImpl implements IUserEoService {
|
||||
@Resource
|
||||
private RoleEOService roleEOService;
|
||||
|
||||
@Value("${sso.clientId}")
|
||||
private String ssoClientId;
|
||||
|
||||
@Value("${sso.clientSecret}")
|
||||
private String ssoClientSecret;
|
||||
|
||||
@Value("${sso.url}")
|
||||
private String ssoUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色信息,用户名,用于新增用户校验
|
||||
@@ -128,41 +158,111 @@ public class UserEOServiceImpl implements IUserEoService {
|
||||
|
||||
/**
|
||||
* 同步保存或更新
|
||||
* @param eo
|
||||
* @param eoList
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void syncSaveOrUpdate(UserEO eo) {
|
||||
UserEO userEO = dao.selectById(eo.getUsid());
|
||||
if (userEO == null) {
|
||||
this.save(userEO);
|
||||
} else {
|
||||
//删除旧的角色
|
||||
QueryWrapper<UserRoleEO> deleteRoleWapper =new QueryWrapper<>();
|
||||
deleteRoleWapper.eq("user_id",userEO.getUsid());
|
||||
userRoleEODao.delete(deleteRoleWapper);
|
||||
|
||||
//删除旧的角色
|
||||
QueryWrapper<UserOrgEO> deleteOrgWapper =new QueryWrapper<>();
|
||||
deleteOrgWapper.eq("user_id",userEO.getUsid());
|
||||
userOrgEODao.delete(deleteOrgWapper);
|
||||
public void syncSaveOrUpdate(List<UserEO> eoList) {
|
||||
if (eoList == null || eoList.isEmpty()){
|
||||
throw new AdcDaBaseException("无用户数据取回");
|
||||
}
|
||||
|
||||
// 加入角色关联表
|
||||
eo.getRoleIdList().forEach(c -> {
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setUserId(eo.getUsid());
|
||||
userRoleEO.setRoleId(c);
|
||||
userRoleEODao.insert(userRoleEO);
|
||||
});
|
||||
List<UserRoleEO> userRoleEOList = new ArrayList<>();
|
||||
List<UserOrgEO> userOrgEOList = new ArrayList<>();
|
||||
|
||||
// 插入组织关联表
|
||||
eo.getOrgEOList().forEach(c -> {
|
||||
UserOrgEO userOrgEO = new UserOrgEO();
|
||||
userOrgEO.setUserId(eo.getUsid());
|
||||
userOrgEO.setOrgId(c.getId());
|
||||
userOrgEODao.insert(userOrgEO);
|
||||
});
|
||||
List<String> userIds = new ArrayList<>();
|
||||
|
||||
String[] fixAccountArr = fixUserAccount.split(","); //处理固定的数据
|
||||
List<String> fixAccountList = Arrays.asList(fixAccountArr);
|
||||
|
||||
for (UserEO userEO : eoList){
|
||||
if (!fixAccountList.contains(userEO.getAccount())){
|
||||
userIds.add(userEO.getUsid());
|
||||
|
||||
// 加入角色关联表
|
||||
userEO.getRoleIdList().forEach(c -> {
|
||||
UserRoleEO userRoleEO = new UserRoleEO();
|
||||
userRoleEO.setUserId(userEO.getUsid());
|
||||
userRoleEO.setRoleId(c);
|
||||
if (StringUtils.isNotEmpty(userRoleEO.getRoleId())){
|
||||
userRoleEOList.add(userRoleEO);
|
||||
}
|
||||
});
|
||||
|
||||
// 插入组织关联表
|
||||
userEO.getOrgEOList().forEach(c -> {
|
||||
UserOrgEO userOrgEO = new UserOrgEO();
|
||||
userOrgEO.setUserId(userEO.getUsid());
|
||||
userOrgEO.setOrgId(c.getId());
|
||||
if (StringUtils.isNotEmpty(userOrgEO.getOrgId())){
|
||||
userOrgEOList.add(userOrgEO);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.saveOrUpdateBatch(eoList, 1000);
|
||||
|
||||
//删除旧的角色
|
||||
userRoleEODao.deleteBatchByUserIds(userIds);
|
||||
|
||||
//删除旧的组织
|
||||
userOrgEODao.deleteBatchByUserIds(userIds);
|
||||
|
||||
// 批量插入新角色关联
|
||||
this.userRoleEODao.insertBatch(userRoleEOList);
|
||||
|
||||
// 批量插入新组织关联
|
||||
this.userOrgEODao.insertBatch(userOrgEOList);
|
||||
|
||||
}
|
||||
|
||||
protected String sqlStatement(SqlMethod sqlMethod) {
|
||||
return SqlHelper.table(UserEO.class).getSqlStatement(sqlMethod.getMethod());
|
||||
}
|
||||
|
||||
private boolean saveOrUpdateBatch(List<UserEO> entityList, int batchSize) {
|
||||
Assert.notEmpty(entityList, "error: entityList must not be empty", new Object[0]);
|
||||
SqlSession batchSqlSession = SqlHelper.sqlSessionBatch(UserEO.class);
|
||||
Throwable var7 = null;
|
||||
|
||||
try {
|
||||
int i = 0;
|
||||
|
||||
for(UserEO userEO : entityList) {
|
||||
|
||||
if (!com.baomidou.mybatisplus.core.toolkit.StringUtils.checkValNull(userEO.getUsid()) && !Objects.isNull(this.getUserById((userEO.getUsid())))) {
|
||||
MapperMethod.ParamMap<UserEO> param = new MapperMethod.ParamMap();
|
||||
param.put("et", userEO);
|
||||
batchSqlSession.update(this.sqlStatement(SqlMethod.UPDATE_BY_ID), param);
|
||||
} else {
|
||||
batchSqlSession.insert(this.sqlStatement(SqlMethod.INSERT_ONE), userEO);
|
||||
}
|
||||
|
||||
if (i >= 1 && i % batchSize == 0) {
|
||||
batchSqlSession.flushStatements();
|
||||
}
|
||||
}
|
||||
|
||||
batchSqlSession.flushStatements();
|
||||
return true;
|
||||
} catch (Throwable var20) {
|
||||
var7 = var20;
|
||||
throw var20;
|
||||
} finally {
|
||||
if (batchSqlSession != null) {
|
||||
if (var7 != null) {
|
||||
try {
|
||||
batchSqlSession.close();
|
||||
} catch (Throwable var19) {
|
||||
var7.addSuppressed(var19);
|
||||
}
|
||||
} else {
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -342,6 +442,65 @@ public class UserEOServiceImpl implements IUserEoService {
|
||||
return dao.getOwnLeader(orgEOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【通过Code获取accessToken接口】的Url
|
||||
* @param code code
|
||||
* @return Url
|
||||
*/
|
||||
private String getTokenByCodeUrl(String code) {
|
||||
return ssoUrl + SsoConstants.GET_TOKEN_PATH
|
||||
+ SsoConstants.GRANT_TYPE + SsoConstants.AUTHORIZATION_CODE + "&"
|
||||
+ SsoConstants.CLIENT_ID + ssoClientId + "&"
|
||||
+ SsoConstants.CLIENT_SECRET + ssoClientSecret + "&"
|
||||
+ SsoConstants.CODE + code + "&"
|
||||
+ SsoConstants.REDIRECT_URI + "XXX";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【通过accessToken获取用户信息接口】的Url
|
||||
* @param accessToken accessToken
|
||||
* @return Url
|
||||
*/
|
||||
private String getUserInfoByTokenUrl(String accessToken) {
|
||||
return ssoUrl + SsoConstants.GET_USERINFO_PATH
|
||||
+ SsoConstants.ACCESS_TOKEN + accessToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String ssoLogin(String code) {
|
||||
log.info("SSO登录: Code为【{}】", code);
|
||||
//向SSO服务器发送code获取用户token
|
||||
String getTokenByCodeUrl = this.getTokenByCodeUrl(code);
|
||||
|
||||
String tokenResponse = HttpRequest.post(getTokenByCodeUrl).execute().body();
|
||||
|
||||
SsoResponse tokenResponseObject = JSONUtil.toBean(tokenResponse, SsoResponse.class);
|
||||
//获取返回值中的token
|
||||
String accessToken = tokenResponseObject.getAccess_token();
|
||||
log.info("SSO登录: accessToken为【{}】", accessToken);
|
||||
//向SSO服务器发送token获取用户数据
|
||||
if (StrUtil.isBlank(accessToken)) {
|
||||
log.info("通过code获取accessToken失败");
|
||||
throw new AdcDaBaseException("通过code获取accessToken失败");
|
||||
}
|
||||
|
||||
String getUserInfoByTokenUrl = this.getUserInfoByTokenUrl(accessToken);
|
||||
String userInfoResponse = HttpRequest.get(getUserInfoByTokenUrl).execute().body();
|
||||
|
||||
SsoUserInfoResponse userInfoResponseObject = JSONUtil.toBean(userInfoResponse, SsoUserInfoResponse.class);
|
||||
|
||||
//获取返回值中的用户id
|
||||
String userId = userInfoResponseObject.getId();
|
||||
log.info("SSO登录: userId为【{}】", userId);
|
||||
//根据用户id取出用户名
|
||||
UserEO user = getUserById(userId);
|
||||
if (user == null) {
|
||||
log.info("根据用户id取出用户失败");
|
||||
throw new AdcDaBaseException("根据用户id取出用户失败");
|
||||
}
|
||||
return user.getUsname();
|
||||
}
|
||||
|
||||
void checkExcel(List<UserImportVO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
throw new AdcDaBaseException("数据不能为空");
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface IUserEoService {
|
||||
* 从同步处新增或编辑用户
|
||||
* @param eo
|
||||
*/
|
||||
void syncSaveOrUpdate(UserEO eo);
|
||||
void syncSaveOrUpdate(List<UserEO> eoList);
|
||||
|
||||
UserEO getUserById(String usid);
|
||||
|
||||
@@ -70,4 +70,12 @@ public interface IUserEoService {
|
||||
UserVO getUserByIdNodel(String userId);
|
||||
|
||||
List<UserEO> getOwnLeader(List<OrgEO> orgEOList);
|
||||
|
||||
/**
|
||||
* IAM单点登录逻辑
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String ssoLogin(String code);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CmpOrgInnerResult {
|
||||
|
||||
private List<OrgVoIAM> records;
|
||||
|
||||
private int total; // 返回总条数
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private int pageIndex;
|
||||
|
||||
private int pages; // 总页数
|
||||
|
||||
}
|
||||
@@ -18,6 +18,6 @@ public class CmpOrgResult {
|
||||
|
||||
private String traceId;
|
||||
|
||||
private List<OrgVoIAM> data;
|
||||
private CmpOrgInnerResult data;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CmpUserInnerResult {
|
||||
|
||||
private List<UserVoIAM> records;
|
||||
|
||||
private int total; // 返回总条数
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private int pageIndex;
|
||||
|
||||
private int pages; // 总页数
|
||||
|
||||
}
|
||||
@@ -18,6 +18,6 @@ public class CmpUserResult {
|
||||
|
||||
private String traceId;
|
||||
|
||||
private List<UserVoIAM> data;
|
||||
private CmpUserInnerResult data;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/17 14:22
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SsoResponse {
|
||||
|
||||
/**
|
||||
* 返回的token 必须
|
||||
*/
|
||||
private String access_token;
|
||||
|
||||
/**
|
||||
* 刷新token(在应用配置里,打开【token刷新】的开关,即可返回该参数) 非必须
|
||||
*/
|
||||
private String refresh_token;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import cn.hutool.system.UserInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/17 15:04
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SsoUserInfo {
|
||||
|
||||
private String account_no;
|
||||
|
||||
private String token_expired;
|
||||
|
||||
private String token_gtime;
|
||||
|
||||
private UserDetailInfo user_detail_info;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/17 15:08
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SsoUserInfoResponse {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
private SsoUserInfo attributes;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.adc.da.sys.vo.iam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/17 15:06
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDetailInfo {
|
||||
|
||||
private List<String> jobs;
|
||||
private List<String> userTypes;
|
||||
private List<String> orgs;
|
||||
}
|
||||
@@ -97,5 +97,13 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除记录 -->
|
||||
<delete id="deleteBatchByUserIds" parameterType="java.lang.String">
|
||||
delete from TR_USER_ORG
|
||||
where user_id in
|
||||
<foreach collection="userIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -97,5 +97,14 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除记录 -->
|
||||
<delete id="deleteBatchByUserIds" parameterType="java.lang.String">
|
||||
delete from TR_USER_ROLE
|
||||
where user_id in
|
||||
<foreach collection="userIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
+55
-38
@@ -39,6 +39,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -940,15 +941,24 @@ public class TodoTaskController {
|
||||
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
|
||||
});
|
||||
|
||||
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
|
||||
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
|
||||
page1.setCurrent(taskCommonQuery.getCurrent());
|
||||
page1.setSize(taskCommonQuery.getSize());
|
||||
page1 = iBusProcessNameService.page(page1, queryWrapper);
|
||||
List<BusProcessName> list = page1.getRecords();
|
||||
|
||||
List<Task> taskList = taskService.createTaskQuery().active().list();
|
||||
Map<String, List<Task>> taskCollect =
|
||||
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
|
||||
|
||||
Page page = new Page();
|
||||
if (list != null && list.size() > 0) {
|
||||
List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
// List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
for (BusProcessName busProcessName : list1) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
userIdList.add(task.getAssignee());
|
||||
@@ -979,10 +989,10 @@ public class TodoTaskController {
|
||||
userVOList.addAll(userInfoList);
|
||||
}
|
||||
|
||||
for (BusProcessName busProcessName : list1) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
String assignee = "";
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
if(CollectionUtils.isNotEmpty(userVOList)){
|
||||
@@ -1079,7 +1089,7 @@ public class TodoTaskController {
|
||||
}
|
||||
|
||||
}
|
||||
page.setList(list1);
|
||||
page.setList(list);
|
||||
page.setCount(Long.valueOf(list.size()));
|
||||
page.setPageSize(taskCommonQuery.getSize());
|
||||
page.setPageNo(taskCommonQuery.getCurrent());
|
||||
@@ -1134,14 +1144,23 @@ public class TodoTaskController {
|
||||
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
|
||||
});
|
||||
|
||||
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
|
||||
// List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
|
||||
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
|
||||
page1.setCurrent(taskCommonQuery.getCurrent());
|
||||
page1.setSize(taskCommonQuery.getSize());
|
||||
page1 = iBusProcessNameService.page(page1, queryWrapper);
|
||||
List<BusProcessName> list = page1.getRecords();
|
||||
// List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
|
||||
List<Task> taskList = taskService.createTaskQuery().active().list();
|
||||
Map<String, List<Task>> taskCollect =
|
||||
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
|
||||
|
||||
List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
if (list != null && list.size() > 0) {
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
for (BusProcessName busProcessName : listPage) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
userIdList.add(task.getAssignee());
|
||||
@@ -1163,10 +1182,10 @@ public class TodoTaskController {
|
||||
userVOList.addAll(userInfoList);
|
||||
}
|
||||
|
||||
for (BusProcessName busProcessName : listPage) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
String assignee = "";
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
if(CollectionUtils.isNotEmpty(userVOList)){
|
||||
@@ -1229,17 +1248,6 @@ public class TodoTaskController {
|
||||
busProcessName.setTaskDefinitionKey(task.getActivityId());
|
||||
}
|
||||
});
|
||||
//获取 审批结果
|
||||
// if (StringUtils.isNotEmpty(busProcessName.getTaskId())) {
|
||||
// List<BusProcessApprove> busProcessApproves = iBusProcessApproveService.selectEoByPrcIdAndTask(busProcessName.getPrcId());
|
||||
// if(busProcessApproves.size() != 0){
|
||||
// BusProcessApprove busProcessApprove = busProcessApproves.get(0);
|
||||
// JSONObject dataJson = JSONObject.parseObject(busProcessApprove.getFromValsJson());
|
||||
// if (StringUtils.isNotEmpty(dataJson.getString("flag"))) {
|
||||
// busProcessName.setStatus(dataJson.getString("flag"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Date createTime = null;
|
||||
Date endTime = null;
|
||||
@@ -1256,7 +1264,7 @@ public class TodoTaskController {
|
||||
busProcessName.setApprovalTime(approvalTime + "天");
|
||||
|
||||
}
|
||||
page.setList(listPage);
|
||||
page.setList(list);
|
||||
page.setCount(Long.valueOf(list.size()));
|
||||
page.setPageSize(taskCommonQuery.getSize());
|
||||
page.setPageNo(taskCommonQuery.getCurrent());
|
||||
@@ -1311,19 +1319,28 @@ public class TodoTaskController {
|
||||
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
|
||||
});
|
||||
|
||||
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
|
||||
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
|
||||
page1.setCurrent(taskCommonQuery.getCurrent());
|
||||
page1.setSize(taskCommonQuery.getSize());
|
||||
page1 = iBusProcessNameService.page(page1, queryWrapper);
|
||||
List<BusProcessName> list = page1.getRecords();
|
||||
// List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
|
||||
List<Task> taskList = taskService.createTaskQuery().active().list();
|
||||
Map<String, List<Task>> taskCollect =
|
||||
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
|
||||
|
||||
|
||||
Page page = new Page();
|
||||
if (list != null && list.size() > 0) {
|
||||
List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
// List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
|
||||
long startTime1 = System.currentTimeMillis();
|
||||
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
for (BusProcessName busProcessName : list1) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
if (busProcessName.getPrcId() != null) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
userIdList.add(task.getAssignee());
|
||||
@@ -1345,11 +1362,11 @@ public class TodoTaskController {
|
||||
List<UserVO> userInfoList = getUserInfoByIdList(userIdList);
|
||||
userVOList.addAll(userInfoList);
|
||||
}
|
||||
for (BusProcessName busProcessName : list1) {
|
||||
for (BusProcessName busProcessName : list) {
|
||||
String assignee = "";
|
||||
if (busProcessName.getPrcId() != null) {
|
||||
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
|
||||
if (list2.size() > 0) {
|
||||
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (Task task : list2) {
|
||||
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
|
||||
if(CollectionUtils.isNotEmpty(userVOList)){
|
||||
@@ -1426,7 +1443,7 @@ public class TodoTaskController {
|
||||
long endTime1 = System.currentTimeMillis() - startTime1;
|
||||
System.out.println("11111浪费时间为:" + endTime1);
|
||||
|
||||
page.setList(list1);
|
||||
page.setList(list);
|
||||
page.setCount(Long.valueOf(list.size()));
|
||||
page.setPageSize(taskCommonQuery.getSize());
|
||||
page.setPageNo(taskCommonQuery.getCurrent());
|
||||
|
||||
Reference in New Issue
Block a user