From 0547707e29364a36df05c5afcddd37f30702421e Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期三, 13 三月 2024 14:31:58 +0800 Subject: [PATCH] bug修改 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java index 8538ff5..5b6298e 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java @@ -32,6 +32,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.MathContext; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; @@ -244,7 +245,7 @@ Participant participant = participantClient.getParticipant(participantId); participantVo.setId(participant.getId()); participantVo.setName(participant.getName()); - participantVo.setAvatar(appUser.getHeadImg()); + participantVo.setAvatar(participant.getHeadImg()); int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())); participantVo.setAge(age); participantVo.setIdcard(participant.getIdcard()); @@ -295,12 +296,13 @@ for (WorldCupPaymentParticipant on : list1) { WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId()); Map<String, Object> map1 = new HashMap<>(); + AppUser appUser = appUserClient.getAppUser(on.getAppUserId()); if(on.getParticipantType() == 1){ TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcode) && tStudent.getIdCard().indexOf(idcode) == -1){ @@ -311,7 +313,7 @@ map1.put("name", tStudent.getName()); map1.put("gender", tStudent.getSex() == 1 ? "男" : "女"); map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()))); - map1.put("phone", tStudent.getPhone()); + map1.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()); map1.put("idcard", tStudent.getIdCard()); map1.put("state", worldCupPayment.getPayStatus() - 1); }else{ @@ -319,7 +321,7 @@ if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcode) && participant.getIdcard().indexOf(idcode) == -1){ @@ -330,7 +332,7 @@ map1.put("name", participant.getName()); map1.put("gender", participant.getGender() == 1 ? "男" : "女"); map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday()))); - map1.put("phone", participant.getPhone()); + map1.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()); map1.put("idcard", participant.getIdcard()); map1.put("state", worldCupPayment.getPayStatus() - 1); } @@ -380,7 +382,7 @@ userGameRecordList.put("win", win); Integer lose = totalSession - win; userGameRecordList.put("lose", lose); - userGameRecordList.put("winRate", totalSession == 0 ? 0 : win / totalSession * 100); + userGameRecordList.put("winRate", totalSession == 0 ? 0 : new BigDecimal(win).divide(new BigDecimal(totalSession), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).doubleValue()); userGameRecordList.put("participantType", participantType); userGameRecordList.put("participantId", participantId); AppUser appUser = appUserClient.getAppUser(appUserId); @@ -390,7 +392,7 @@ if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){ @@ -405,7 +407,7 @@ if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){ -- Gitblit v1.7.1