From ef6ef89087ffa5d1126a508ff653ed166345ad6c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 11 Apr 2024 14:33:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E6=8C=87?= =?UTF-8?q?=E5=AF=BC=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/sys/contants/UserGuidanceContant.java | 2 +- .../api/sys/controller/UserGuidanceController.java | 23 ++-- .../hz/pm/api/sys/manage/UserGuidanceManage.java | 116 ++++----------------- .../com/hz/pm/api/sys/model/vo/UserGuidanceVO.java | 11 +- 4 files changed, 33 insertions(+), 119 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java index 4cb5313..130156f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java @@ -8,7 +8,7 @@ package com.hz.pm.api.sys.contants; */ public interface UserGuidanceContant { - Integer ALL_FINISHED_NUM = 2; + Integer ALL_FINISHED_NUM = 1; class OrgModel { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java index 8d4dd3d..d71a6df 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java @@ -2,23 +2,22 @@ package com.hz.pm.api.sys.controller; import com.hz.pm.api.sys.manage.UserGuidanceManage; import com.hz.pm.api.sys.model.vo.UserGuidanceVO; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.util.LoginUserUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** - * @Classname UserGuidanceController - * @Description - * @Date 2023/8/8 13:46 - * @Author PoffyZhang + *

+ * UserGuidanceController + *

+ * + * @author WendyYang + * @since 12:24 2024/4/11 */ @Slf4j @Validated @@ -30,16 +29,10 @@ public class UserGuidanceController { private final UserGuidanceManage userGuidanceManage; - @ApiOperation(value = "获取当前用户单位的一些配置是否完成", notes = "获取当前用户单位的一些配置是否完成") + @ApiOperation("获取当前用户单位的一些配置是否完成") @GetMapping("/detail") public UserGuidanceVO detail() { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - return userGuidanceManage.detailUserGuidance(user); + return userGuidanceManage.userGuidanceDetail(); } - @ApiOperation(value = "删除重复用户", notes = "删除重复用户") - @GetMapping("/remove-repeat/{userId}") - public String removeRepeat(@PathVariable Long userId) { - return userGuidanceManage.removeRepeat(userId); - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java index 0031c81..d2f9ce1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java @@ -1,24 +1,12 @@ package com.hz.pm.api.sys.manage; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.expert.entity.ExpertUserFullInfo; -import com.hz.pm.api.expert.service.IExpertUserFullInfoService; -import com.hz.pm.api.signature.entity.CompanySignature; -import com.hz.pm.api.signature.service.ICompanySignatureService; import com.hz.pm.api.sys.contants.UserGuidanceContant; -import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.model.vo.UserGuidanceDetailVO; import com.hz.pm.api.sys.model.vo.UserGuidanceVO; -import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.model.entity.UserAuth; -import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.service.IUserAuthService; -import com.hz.pm.api.user.service.IUserInfoService; +import com.hz.pm.api.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowOrgModels; import com.wflow.enums.ProcessDefTypeEnum; import com.wflow.service.OrgProcdefService; @@ -27,55 +15,42 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; -import java.util.List; +import java.util.Collections; import java.util.Objects; -import java.util.stream.Collectors; /** - * @Classname UserGuidanceManage - * @Description - * @Date 2023/8/8 13:49 - * @Author PoffyZhang + *

+ * UserGuidanceManage + *

+ * + * @author WendyYang + * @since 12:19 2024/4/11 */ -@Component @Slf4j +@Component @AllArgsConstructor public class UserGuidanceManage { private final OrgProcdefService orgProcdefService; - private final IUserInfoService userInfoService; - - private final IUserRoleService userRoleService; - - private final IUserAuthService userAuthService; - - private final ICompanySignatureService signatureService; - - private final IExpertUserFullInfoService expertUserFullInfoService; - /** * 查询用户引导 详情 * - * @param user - * @return + * @return \ */ - public UserGuidanceVO detailUserGuidance(UserInfoDetails user) { - UserGuidanceVO vo = new UserGuidanceVO(); - vo.setOrgCode(user.getMhUnitId()); - //用户信息 - String username = user.getUsername(); - vo.setUsername(username); - Long userId = user.getUserId(); - vo.setUserId(userId); - + public UserGuidanceVO userGuidanceDetail() { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + UserGuidanceVO vo = UserGuidanceVO.builder() + .orgCode(user.getMhUnitId()) + .username(user.getUsername()) + .userId(user.getUserId()) + .build(); //查询引导详情 - List details = Lists.newArrayList(); UserGuidanceDetailVO orgModelGuidance = new UserGuidanceDetailVO(); orgModelGuidance.setName(UserGuidanceContant.OrgModel.GUIDANCE_NAME); orgModelGuidance.setRemark(UserGuidanceContant.OrgModel.GUIDANCE_REMARK); - Integer finishedNum = 0; + int finishedNum = 0; //1.去查询 用户所在单位 有没有单位默认流程配置 并且process 不能为空 WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) .eq(WflowOrgModels::getOrgCode, user.getMhUnitIdStr()) @@ -96,62 +71,11 @@ public class UserGuidanceManage { orgModelGuidance.setIsFinish(Boolean.FALSE); } } - details.add(orgModelGuidance); - - //2.去查询 印章编码 - UserGuidanceDetailVO signatureGuidance = new UserGuidanceDetailVO(); - signatureGuidance.setName(UserGuidanceContant.Signature.GUIDANCE_NAME); - signatureGuidance.setRemark(UserGuidanceContant.Signature.GUIDANCE_REMARK); - signatureGuidance.setPath(UserGuidanceContant.Signature.GUIDANCE_PATH); - CompanySignature signature = signatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, user.getMhUnitIdStr()) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(signature)) { - signatureGuidance.setIsFinish(Boolean.FALSE); - } else { - //判断印章编码是否为空 - if (StringUtils.isNotBlank(signature.getSealSn())) { - signatureGuidance.setIsFinish(Boolean.TRUE); - finishedNum++; - } else { - signatureGuidance.setIsFinish(Boolean.FALSE); - } - } - details.add(signatureGuidance); - - if (UserGuidanceContant.ALL_FINISHED_NUM.equals(finishedNum)) { + if (UserGuidanceContant.ALL_FINISHED_NUM == finishedNum) { vo.setIsAllFinished(Boolean.TRUE); } - vo.setDetails(details); + vo.setDetails(Collections.singletonList(orgModelGuidance)); return vo; } - /** - * 删除重复用户 - * - * @param userId - * @return - */ - public String removeRepeat(Long userId) { - UserInfo user = userInfoService.getById(userId); - Assert.notNull(user, "该用户不存在 删除重复失败"); - List repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getUsername, user.getUsername()) - .ne(UserInfo::getId, userId) - .isNull(UserInfo::getAccountId)); - if (CollUtil.isNotEmpty(repeatUsers)) { - List repeatIds = repeatUsers.stream().map(UserInfo::getId).collect(Collectors.toList()); - userInfoService.removeBatchByIds(repeatIds); - userAuthService.remove(Wrappers.lambdaQuery(UserAuth.class) - .in(UserAuth::getUserId, repeatIds)); - userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getUserId, repeatIds)); - for (Long repeatId : repeatIds) { - ExpertUserFullInfo expert = expertUserFullInfoService.getByUserId(repeatId); - expert.setUserId(userId); - expertUserFullInfoService.updateById(expert); - } - return "删除成功"; - } - return "不存在重复的用户"; - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java index 302f86d..964e8ab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java @@ -2,10 +2,8 @@ package com.hz.pm.api.sys.model.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.ToString; -import lombok.experimental.Accessors; import java.util.List; @@ -16,9 +14,7 @@ import java.util.List; * @Author PoffyZhang */ @Data -@NoArgsConstructor -@ToString(callSuper = true) -@Accessors(chain = true) +@Builder @ApiModel(value = "UserGuidanceVO", description = "用户引导VO") public class UserGuidanceVO { @@ -44,8 +40,9 @@ public class UserGuidanceVO { * 是否全部完成 */ @ApiModelProperty(value = "是否全部完成") - private Boolean isAllFinished = Boolean.FALSE; + private Boolean isAllFinished; @ApiModelProperty(value = "详情") private List details; + }