@@ -29,7 +29,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||||
"com.ningdatech.pmapi.workbench.controller", | "com.ningdatech.pmapi.workbench.controller", | ||||
"com.ningdatech.pmapi.ding.controller", | "com.ningdatech.pmapi.ding.controller", | ||||
"com.ningdatech.pmapi.filemanage.controller", | "com.ningdatech.pmapi.filemanage.controller", | ||||
"com.ningdatech.pmapi.performance.controller" | |||||
"com.ningdatech.pmapi.performance.controller", | |||||
"com.ningdatech.pmapi.irs.controller" | |||||
}) | }) | ||||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | ||||
@@ -86,10 +86,7 @@ public class AppIrsManage { | |||||
ApiApplyDTO apiApply = new ApiApplyDTO(); | ApiApplyDTO apiApply = new ApiApplyDTO(); | ||||
apiApply.setAppId(appCode); | apiApply.setAppId(appCode); | ||||
JSONObject jsonObject = this.searchApp(apiApply); | JSONObject jsonObject = this.searchApp(apiApply); | ||||
VUtils.isTrue(Objects.isNull(jsonObject)).throwMessage("应用在IRS不存在!"); | |||||
JSONArray data = jsonObject.getJSONArray("data"); | |||||
VUtils.isTrue(CollUtil.isNotEmpty(data)).throwMessage("应用在IRS不存在!"); | |||||
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(data.get(0)),ApiApplySearchResult.class); | |||||
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject),ApiApplySearchResult.class); | |||||
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); | VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!"); | ||||
long timestamp = System.currentTimeMillis(); | long timestamp = System.currentTimeMillis(); | ||||
@@ -148,7 +148,7 @@ public class TodoCenterManage { | |||||
String employeeCode = param.getEmployeeCode(); | String employeeCode = param.getEmployeeCode(); | ||||
if(StringUtils.isBlank(employeeCode)){ | if(StringUtils.isBlank(employeeCode)){ | ||||
// 获取登录用户ID | // 获取登录用户ID | ||||
Long userId = LoginUserUtil.getUserId(); | |||||
Long userId = Optional.ofNullable(param.getLoginUserId()).orElseGet(LoginUserUtil::getUserId); | |||||
// 获取登录用户全量信息 | // 获取登录用户全量信息 | ||||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | ||||
// 获取员工浙政钉code | // 获取员工浙政钉code | ||||
@@ -48,4 +48,7 @@ public class ToBeProcessedReq extends PagePo implements Serializable { | |||||
@ApiModelProperty("登录人员工号") | @ApiModelProperty("登录人员工号") | ||||
private String employeeCode; | private String employeeCode; | ||||
private Long loginUserId; | |||||
} | } |
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; | |||||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.util.BizUtils; | import com.ningdatech.pmapi.common.util.BizUtils; | ||||
import com.ningdatech.pmapi.common.util.StrUtils; | |||||
import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; | import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | ||||
@@ -37,6 +38,7 @@ import com.ningdatech.zwdd.ZwddIntegrationProperties; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | import com.ningdatech.zwdd.client.ZwddClient; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.aop.framework.AopContext; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -85,7 +87,7 @@ public class UserInfoManage { | |||||
.like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) | .like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) | ||||
.like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) | .like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) | ||||
.in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) | .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) | ||||
.eq(Objects.nonNull(regionId), UserInfo::getRegionCode,regionId) | |||||
.eq(Objects.nonNull(regionId), UserInfo::getRegionCode, regionId) | |||||
.like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) | .like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) | ||||
.eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) | .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) | ||||
.orderByDesc(UserInfo::getUpdateOn); | .orderByDesc(UserInfo::getUpdateOn); | ||||
@@ -188,7 +190,7 @@ public class UserInfoManage { | |||||
* @param userRoleList | * @param userRoleList | ||||
*/ | */ | ||||
private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) { | private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) { | ||||
if(CollUtil.isNotEmpty(userRoleList)){ | |||||
if (CollUtil.isNotEmpty(userRoleList)) { | |||||
userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); | userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); | ||||
} | } | ||||
if (CollUtil.isEmpty(userRoleList)) { | if (CollUtil.isEmpty(userRoleList)) { | ||||
@@ -250,12 +252,21 @@ public class UserInfoManage { | |||||
return userRoleInfoList; | return userRoleInfoList; | ||||
} | } | ||||
public void disableOrEnable(ReqUserDisableOrEnablePO reqUserDisableOrEnablePO) { | |||||
Long userId = generateUserId(reqUserDisableOrEnablePO.getEmployeeCode()); | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void disableOrEnable(ReqUserDisableOrEnablePO req) { | |||||
Long userId; | |||||
if (req.getUserId() != null) { | |||||
userId = req.getUserId(); | |||||
} else if (StrUtils.isNotBlank(req.getEmployeeCode())) { | |||||
UserInfoManage proxy = (UserInfoManage) AopContext.currentProxy(); | |||||
userId = proxy.generateUserId(req.getEmployeeCode()); | |||||
} else { | |||||
throw BizException.wrap("用户参数缺失"); | |||||
} | |||||
UserInfo userInfo = iUserInfoService.getById(userId); | UserInfo userInfo = iUserInfoService.getById(userId); | ||||
userInfo.setAvailable(reqUserDisableOrEnablePO.getOperation()); | |||||
userInfo.setAvailable(req.getOperation()); | |||||
iUserInfoService.updateById(userInfo); | iUserInfoService.updateById(userInfo); | ||||
if (userInfo.getAvailable().equals("DISABLE")) { | |||||
if ("DISABLE".equals(userInfo.getAvailable())) { | |||||
userAuthManage.kickOff(userId); | userAuthManage.kickOff(userId); | ||||
} | } | ||||
@@ -353,24 +364,24 @@ public class UserInfoManage { | |||||
String mobile = userInfo.getMobile(); | String mobile = userInfo.getMobile(); | ||||
Long userId = userInfo.getId(); | Long userId = userInfo.getId(); | ||||
// if (StringUtils.isBlank(mobile)) { | // if (StringUtils.isBlank(mobile)) { | ||||
// 校验手机号是否重复 | |||||
UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||||
.eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); | |||||
if (Objects.nonNull(repeatMobileUserInfo)) { | |||||
throw new BizException("该手机号码已被绑定,请问重复绑定"); | |||||
} | |||||
String phoneNo = reqUserDetailEditPO.getPhoneNo(); | |||||
userInfo.setMobile(phoneNo); | |||||
// 更新浙政钉相关数据 | |||||
if (StringUtils.isNotBlank(phoneNo)) { | |||||
iDingEmployeeInfoService | |||||
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true") | |||||
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) | |||||
.set(DingEmployeeInfo::getBindUserMobile, phoneNo)); | |||||
iUserInfoService.updateById(userInfo); | |||||
} | |||||
// 校验手机号是否重复 | |||||
UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||||
.eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); | |||||
if (Objects.nonNull(repeatMobileUserInfo)) { | |||||
throw new BizException("该手机号码已被绑定,请问重复绑定"); | |||||
} | |||||
String phoneNo = reqUserDetailEditPO.getPhoneNo(); | |||||
userInfo.setMobile(phoneNo); | |||||
// 更新浙政钉相关数据 | |||||
if (StringUtils.isNotBlank(phoneNo)) { | |||||
iDingEmployeeInfoService | |||||
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true") | |||||
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) | |||||
.set(DingEmployeeInfo::getBindUserMobile, phoneNo)); | |||||
iUserInfoService.updateById(userInfo); | |||||
} | |||||
// } | // } | ||||
} | } | ||||
@@ -450,13 +461,14 @@ public class UserInfoManage { | |||||
//生成头像 链接 | //生成头像 链接 | ||||
private String makeAvatar(String avatar) { | private String makeAvatar(String avatar) { | ||||
try{ | |||||
try { | |||||
GenericResult<String> accessToken = zwddClient.getAccessToken(); | GenericResult<String> accessToken = zwddClient.getAccessToken(); | ||||
String token = accessToken.getData(); | String token = accessToken.getData(); | ||||
String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + | String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + | ||||
"access_token=" + token + "&media_id=" + avatar; | "access_token=" + token + "&media_id=" + avatar; | ||||
return res; | return res; | ||||
}catch (Exception e){} | |||||
} catch (Exception e) { | |||||
} | |||||
return org.apache.commons.lang3.StringUtils.EMPTY; | return org.apache.commons.lang3.StringUtils.EMPTY; | ||||
} | } | ||||
@@ -18,7 +18,6 @@ public class ReqUserDisableOrEnablePO { | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("浙政钉 用户编码") | @ApiModelProperty("浙政钉 用户编码") | ||||
private String employeeCode; | private String employeeCode; | ||||
@@ -5,6 +5,7 @@ import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | |||||
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||||
import com.ningdatech.pmapi.sys.manage.NoticeManage; | import com.ningdatech.pmapi.sys.manage.NoticeManage; | ||||
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; | import com.ningdatech.pmapi.sys.model.req.NoticeListReq; | ||||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | ||||
@@ -17,6 +18,8 @@ import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | |||||
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.ArrayList; | |||||
import java.util.concurrent.CompletableFuture; | import java.util.concurrent.CompletableFuture; | ||||
import java.util.concurrent.ForkJoinPool; | import java.util.concurrent.ForkJoinPool; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
@@ -43,30 +46,32 @@ public class WorkbenchManage { | |||||
private final ProjectLibManage projectLibManage; | private final ProjectLibManage projectLibManage; | ||||
public WorkbenchVO getWorkbenchData(Integer year){ | |||||
public WorkbenchVO getWorkbenchData(Integer year) { | |||||
WorkbenchVO res = new WorkbenchVO(); | WorkbenchVO res = new WorkbenchVO(); | ||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||||
Long userId = LoginUserUtil.getUserId(); | |||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); | |||||
CompletableFuture.allOf( | CompletableFuture.allOf( | ||||
CompletableFuture.runAsync(()-> { | |||||
CompletableFuture.runAsync(() -> { | |||||
//1.待办中心数据 | //1.待办中心数据 | ||||
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); | TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); | ||||
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); | ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); | ||||
toBeProcessedReq.setPageNumber(1); | toBeProcessedReq.setPageNumber(1); | ||||
toBeProcessedReq.setPageSize(5); | toBeProcessedReq.setPageSize(5); | ||||
toBeProcessedReq.setLoginUserId(userId); | |||||
toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); | toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); | ||||
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() | statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() | ||||
.stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); | |||||
.stream().map(WorkbenchConverter::convert).collect(Collectors.toList())); | |||||
res.setTodoCerter(statisticsVO); | res.setTodoCerter(statisticsVO); | ||||
}, ForkJoinPool.commonPool()), | }, ForkJoinPool.commonPool()), | ||||
CompletableFuture.runAsync(()-> { | |||||
CompletableFuture.runAsync(() -> { | |||||
//2.项目统计数据 | //2.项目统计数据 | ||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year,user))); | |||||
if(userInfoHelper.isSuperOrRegionAdmin(user.getUserId())){ | |||||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year,user))); | |||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year, user))); | |||||
if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { | |||||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year, user))); | |||||
} | } | ||||
}, ForkJoinPool.commonPool()), | }, ForkJoinPool.commonPool()), | ||||
CompletableFuture.runAsync(()-> { | |||||
CompletableFuture.runAsync(() -> { | |||||
//3.所有公告按类型分 | //3.所有公告按类型分 | ||||
NoticeListReq noticeListReq = new NoticeListReq(); | NoticeListReq noticeListReq = new NoticeListReq(); | ||||
noticeListReq.setPageNumber(1); | noticeListReq.setPageNumber(1); | ||||
@@ -81,8 +86,7 @@ public class WorkbenchManage { | |||||
projectListReq.setPageSize(5); | projectListReq.setPageSize(5); | ||||
projectListReq.setProjectYear(year); | projectListReq.setProjectYear(year); | ||||
projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); | projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); | ||||
res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq,user).getRecords().stream().collect(Collectors.toList())); | |||||
res.setProjects(new ArrayList<>(projectLibManage.projectLibListWithPermission(projectListReq, user).getRecords())); | |||||
return res; | return res; | ||||
} | } | ||||
} | } |