Преглед на файлове

修改用户指导提示

tags/24080901
WendyYang преди 7 месеца
родител
ревизия
ef6ef89087
променени са 4 файла, в които са добавени 33 реда и са изтрити 119 реда
  1. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java
  2. +8
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/UserGuidanceController.java
  3. +20
    -96
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java
  4. +4
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java

+ 1
- 1
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 {



+ 8
- 15
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
* <p>
* UserGuidanceController
* </p>
*
* @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);
}
}

+ 20
- 96
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
* <p>
* UserGuidanceManage
* </p>
*
* @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<UserGuidanceDetailVO> 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<UserInfo> repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getUsername, user.getUsername())
.ne(UserInfo::getId, userId)
.isNull(UserInfo::getAccountId));
if (CollUtil.isNotEmpty(repeatUsers)) {
List<Long> 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 "不存在重复的用户";
}
}

+ 4
- 7
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<UserGuidanceDetailVO> details;

}

Loading…
Отказ
Запис