From 293ebf33ff0b15b9b3c902ddc0685fa506252dbb Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 2 Jan 2024 16:24:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=88=97=E8=A1=A8=E5=A7=93=E5=90=8D=E6=98=9F?= =?UTF-8?q?=E5=8F=B7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionRegistrationServiceImpl.java | 28 ++++++++---- .../HandleNameAsteriskReplacementUtil.java | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 competition/src/main/java/com/huoran/competition/utils/HandleNameAsteriskReplacementUtil.java diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java index 2a25baf..e085c6d 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -12,7 +12,10 @@ import com.huoran.common.entity.School; import com.huoran.common.exception.CustomException; import com.huoran.common.exception.ExceptionEnum; import com.huoran.common.response.R; -import com.huoran.competition.entity.*; +import com.huoran.competition.entity.Competition; +import com.huoran.competition.entity.CompetitionRegistration; +import com.huoran.competition.entity.CompetitionTeam; +import com.huoran.competition.entity.CompleteCompetitionSetup; import com.huoran.competition.entity.req.PageRegistrationStaffReq; import com.huoran.competition.entity.vo.ExcelData; import com.huoran.competition.entity.vo.PersonalExcelData; @@ -23,6 +26,7 @@ import com.huoran.competition.service.CompetitionRegistrationService; import com.huoran.competition.service.CompetitionTeamService; import com.huoran.competition.service.TeamParticipantService; import com.huoran.competition.utils.ExcelStyleUtil; +import com.huoran.competition.utils.HandleNameAsteriskReplacementUtil; import org.apache.poi.ss.usermodel.Workbook; import org.jetbrains.annotations.NotNull; import org.springframework.beans.BeanUtils; @@ -79,6 +83,12 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl page = new Page(req.getPageNum(), req.getPageSize()); IPage pageList = baseMapper.selectRegistrationByCondition(page, req); + + pageList + .getRecords().forEach(registrationVO -> { + registrationVO.setUsername( HandleNameAsteriskReplacementUtil.desensitizedName(registrationVO.getUsername())); + }); + return R.ok().put("data", pageList); } @@ -196,15 +206,15 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("competition_id", competitionRegistration.getCompetitionId()); - List competitionRegistrations = baseMapper.selectList(wrapper); - if (competitionRegistrations != null && competitionRegistrations.size() >= competition.getQuantityLimit()) { - throw new CustomException(ExceptionEnum.TEAM_LIMIT3); - } + //个人赛人数限制 + if (competition.getQuantityLimit() != null) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("competition_id", competitionRegistration.getCompetitionId()); + List competitionRegistrations = baseMapper.selectList(wrapper); + if (competitionRegistrations != null && competitionRegistrations.size() >= competition.getQuantityLimit()) { + throw new CustomException(ExceptionEnum.TEAM_LIMIT3); } + } //内部添加,一路绿灯 QueryWrapper wrapper = getCompetitionRegistrationQueryWrapper(competitionRegistration, competition); diff --git a/competition/src/main/java/com/huoran/competition/utils/HandleNameAsteriskReplacementUtil.java b/competition/src/main/java/com/huoran/competition/utils/HandleNameAsteriskReplacementUtil.java new file mode 100644 index 0000000..b394c82 --- /dev/null +++ b/competition/src/main/java/com/huoran/competition/utils/HandleNameAsteriskReplacementUtil.java @@ -0,0 +1,43 @@ +package com.huoran.competition.utils; + +import org.apache.commons.lang3.StringUtils; + +public class HandleNameAsteriskReplacementUtil { + /** + * @description: 名字脱敏 + * 脱敏规则: 隐藏中中间部分,比如:李某人 置换为 李*人 , 李某置换为 *某,司徒司翘置换为 司**翘 + * @return: + * @author: *** + * @time: 2022/6/22 + */ + public static String desensitizedName(String fullName) { + if (!com.mysql.cj.util.StringUtils.isNullOrEmpty(fullName)) { + int length = fullName.length(); + if (length == 2) { + return fullName.substring(0, 1).concat("*"); + } else if (length == 3) { + return StringUtils.left(fullName, 1).concat("*").concat(StringUtils.right(fullName, 1)); + } else if (length > 3) { + return StringUtils.left(fullName, 1).concat(generateAsterisk(fullName.substring(1, length - 1).length())).concat(StringUtils.right(fullName, 1)); + } else { + return fullName; + } + } + return fullName; + } + + + /** + * @description: 返回指定长度*字符串 + * @return: + * @author: *** + * @time: 2022/6/22 + */ + private static String generateAsterisk(int length) { + String result = ""; + for (int i = 0; i < length; i++) { + result += "*"; + } + return result; + } +} From 06b46226b7822f3dd35e5d272baaac995c0e9aaa Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 2 Jan 2024 16:30:06 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E8=B0=83=E7=94=A8=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/req/PageRegistrationStaffReq.java | 4 ++++ .../impl/CompetitionRegistrationServiceImpl.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java index 0a9f02d..3a00dba 100644 --- a/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java +++ b/competition/src/main/java/com/huoran/competition/entity/req/PageRegistrationStaffReq.java @@ -32,4 +32,8 @@ public class PageRegistrationStaffReq extends PageReq{ @ApiModelProperty(value = "团队排序标识",example = "null") private Integer teamOrder; + + @ApiModelProperty(value = "查询来源(1.前台/2.后台)") + private Integer querySource; + } \ No newline at end of file diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java index e085c6d..3eb69ac 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -81,13 +81,17 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl page = new Page(req.getPageNum(), req.getPageSize()); IPage pageList = baseMapper.selectRegistrationByCondition(page, req); - pageList - .getRecords().forEach(registrationVO -> { - registrationVO.setUsername( HandleNameAsteriskReplacementUtil.desensitizedName(registrationVO.getUsername())); - }); + if (req.getQuerySource() == 1) { + pageList + .getRecords().forEach(registrationVO -> { + registrationVO.setUsername(HandleNameAsteriskReplacementUtil.desensitizedName(registrationVO.getUsername())); + }); + } return R.ok().put("data", pageList); } From a454ec4f00c0567a0e9fdf0459701b6533d22f1a Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 2 Jan 2024 16:32:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CompetitionRegistrationServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java index 3eb69ac..f027552 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -33,6 +33,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -86,6 +87,11 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl page = new Page(req.getPageNum(), req.getPageSize()); IPage pageList = baseMapper.selectRegistrationByCondition(page, req); + //默认设置后台 + + if (ObjectUtils.isEmpty(req.getQuerySource())){ + req.setQuerySource(2); + } if (req.getQuerySource() == 1) { pageList .getRecords().forEach(registrationVO -> { From bf08bc0b8bb9e57c7b578d1faa85e39736092e4b Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Tue, 2 Jan 2024 16:50:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=9B=A2=E9=98=9F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8F=96=E4=B8=AA=E4=BA=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/xml/PlatformTeamAccountMapper.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml index 44a912a..afaa018 100644 --- a/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml +++ b/nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml @@ -111,9 +111,21 @@ resultType="com.huoran.nakadai.entity.res.PlatformTeamAccountResp"> SELECT hpa.manage_id, - hpa.invitation_account, - u.user_name, - u.last_login_time, + hpa.invitation_account + , + ( + SELECT + u.user_name + FROM + hr_user_account ua + INNER JOIN hr_user_info u ON u.user_id = ua.user_id + AND u.is_del = 0 + WHERE + ua.is_del = 0 + AND ua.app_open_id = a.app_open_id + AND ua.platform_id = 7 + ) AS userName, + u.last_login_time, u.login_number, a.work_number, a.user_id,