From 1574cc259ecec7217d210c58d2bbf7b44a106234 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期五, 12 九月 2025 20:48:31 +0800 Subject: [PATCH] 通过生日算年龄 --- ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceRelativesconfirmationServiceImpl.java | 195 ++++++++++++++++++++++++++---------------------- 1 files changed, 104 insertions(+), 91 deletions(-) diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceRelativesconfirmationServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceRelativesconfirmationServiceImpl.java index df440fe..6bdbcb1 100644 --- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceRelativesconfirmationServiceImpl.java +++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceRelativesconfirmationServiceImpl.java @@ -1,12 +1,16 @@ package com.ruoyi.project.service.impl; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.List; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.project.common.CalculateDateUtils; import com.ruoyi.project.domain.ServiceDonatebaseinfo; +import com.ruoyi.project.domain.vo.MedicalEvaluationVO; import com.ruoyi.project.domain.vo.RelativeConfirmationVO; import com.ruoyi.project.mapper.ServiceDonatebaseinfoMapper; import com.ruoyi.project.service.IServiceDonatebaseinfoService; @@ -15,8 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + import java.util.ArrayList; import java.util.Map; + import com.ruoyi.common.utils.StringUtils; import com.ruoyi.project.mapper.ServiceRelativesconfirmationMapper; import com.ruoyi.project.domain.ServiceRelativesconfirmation; @@ -24,13 +30,12 @@ /** * 鎹愮尞浜插睘纭Service涓氬姟灞傚鐞� - * + * * @author ruoyi * @date 2021-11-15 */ @Service -public class ServiceRelativesconfirmationServiceImpl extends ServiceImpl<ServiceRelativesconfirmationMapper, ServiceRelativesconfirmation> implements IServiceRelativesconfirmationService -{ +public class ServiceRelativesconfirmationServiceImpl extends ServiceImpl<ServiceRelativesconfirmationMapper, ServiceRelativesconfirmation> implements IServiceRelativesconfirmationService { @Autowired IServiceDonatebaseinfoService serviceDonatebaseinfoService; @@ -44,130 +49,130 @@ /** * 鏌ヨ鎹愮尞浜插睘纭鍒楄〃 - * + * * @param serviceRelativesconfirmation 鎹愮尞浜插睘纭 * @return 鎹愮尞浜插睘纭 */ @Override public List<ServiceRelativesconfirmation> queryList(ServiceRelativesconfirmation serviceRelativesconfirmation) { LambdaQueryWrapper<ServiceRelativesconfirmation> wrappers = Wrappers.lambdaQuery(); - if (serviceRelativesconfirmation.getId() != null){ - wrappers.eq(ServiceRelativesconfirmation::getId ,serviceRelativesconfirmation.getId()); + if (serviceRelativesconfirmation.getId() != null) { + wrappers.eq(ServiceRelativesconfirmation::getId, serviceRelativesconfirmation.getId()); } - if (serviceRelativesconfirmation.getInfoid() != null){ - wrappers.eq(ServiceRelativesconfirmation::getInfoid ,serviceRelativesconfirmation.getInfoid()); + if (serviceRelativesconfirmation.getInfoid() != null) { + wrappers.eq(ServiceRelativesconfirmation::getInfoid, serviceRelativesconfirmation.getInfoid()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getDonorno())){ - wrappers.eq(ServiceRelativesconfirmation::getDonorno ,serviceRelativesconfirmation.getDonorno()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getDonorno())) { + wrappers.eq(ServiceRelativesconfirmation::getDonorno, serviceRelativesconfirmation.getDonorno()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getName())){ - wrappers.like(ServiceRelativesconfirmation::getName ,serviceRelativesconfirmation.getName()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getName())) { + wrappers.like(ServiceRelativesconfirmation::getName, serviceRelativesconfirmation.getName()); } - if (serviceRelativesconfirmation.getIdcardtype() != null){ - wrappers.eq(ServiceRelativesconfirmation::getIdcardtype ,serviceRelativesconfirmation.getIdcardtype()); + if (serviceRelativesconfirmation.getIdcardtype() != null) { + wrappers.eq(ServiceRelativesconfirmation::getIdcardtype, serviceRelativesconfirmation.getIdcardtype()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getIdcardno())){ - wrappers.eq(ServiceRelativesconfirmation::getIdcardno ,serviceRelativesconfirmation.getIdcardno()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getIdcardno())) { + wrappers.eq(ServiceRelativesconfirmation::getIdcardno, serviceRelativesconfirmation.getIdcardno()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getPhone())){ - wrappers.eq(ServiceRelativesconfirmation::getPhone ,serviceRelativesconfirmation.getPhone()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getPhone())) { + wrappers.eq(ServiceRelativesconfirmation::getPhone, serviceRelativesconfirmation.getPhone()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceaddress())){ - wrappers.eq(ServiceRelativesconfirmation::getResidenceaddress ,serviceRelativesconfirmation.getResidenceaddress()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceaddress())) { + wrappers.eq(ServiceRelativesconfirmation::getResidenceaddress, serviceRelativesconfirmation.getResidenceaddress()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovince())){ - wrappers.eq(ServiceRelativesconfirmation::getResidenceprovince ,serviceRelativesconfirmation.getResidenceprovince()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovince())) { + wrappers.eq(ServiceRelativesconfirmation::getResidenceprovince, serviceRelativesconfirmation.getResidenceprovince()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovincename())){ - wrappers.like(ServiceRelativesconfirmation::getResidenceprovincename ,serviceRelativesconfirmation.getResidenceprovincename()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovincename())) { + wrappers.like(ServiceRelativesconfirmation::getResidenceprovincename, serviceRelativesconfirmation.getResidenceprovincename()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecity())){ - wrappers.eq(ServiceRelativesconfirmation::getResidencecity ,serviceRelativesconfirmation.getResidencecity()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecity())) { + wrappers.eq(ServiceRelativesconfirmation::getResidencecity, serviceRelativesconfirmation.getResidencecity()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecityname())){ - wrappers.like(ServiceRelativesconfirmation::getResidencecityname ,serviceRelativesconfirmation.getResidencecityname()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecityname())) { + wrappers.like(ServiceRelativesconfirmation::getResidencecityname, serviceRelativesconfirmation.getResidencecityname()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetown())){ - wrappers.eq(ServiceRelativesconfirmation::getResidencetown ,serviceRelativesconfirmation.getResidencetown()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetown())) { + wrappers.eq(ServiceRelativesconfirmation::getResidencetown, serviceRelativesconfirmation.getResidencetown()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetownname())){ - wrappers.like(ServiceRelativesconfirmation::getResidencetownname ,serviceRelativesconfirmation.getResidencetownname()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetownname())) { + wrappers.like(ServiceRelativesconfirmation::getResidencetownname, serviceRelativesconfirmation.getResidencetownname()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunity())){ - wrappers.eq(ServiceRelativesconfirmation::getResidencecommunity ,serviceRelativesconfirmation.getResidencecommunity()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunity())) { + wrappers.eq(ServiceRelativesconfirmation::getResidencecommunity, serviceRelativesconfirmation.getResidencecommunity()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunityname())){ - wrappers.like(ServiceRelativesconfirmation::getResidencecommunityname ,serviceRelativesconfirmation.getResidencecommunityname()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunityname())) { + wrappers.like(ServiceRelativesconfirmation::getResidencecommunityname, serviceRelativesconfirmation.getResidencecommunityname()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountycode())){ - wrappers.eq(ServiceRelativesconfirmation::getResidencecountycode ,serviceRelativesconfirmation.getResidencecountycode()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountycode())) { + wrappers.eq(ServiceRelativesconfirmation::getResidencecountycode, serviceRelativesconfirmation.getResidencecountycode()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountyname())){ - wrappers.like(ServiceRelativesconfirmation::getResidencecountyname ,serviceRelativesconfirmation.getResidencecountyname()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountyname())) { + wrappers.like(ServiceRelativesconfirmation::getResidencecountyname, serviceRelativesconfirmation.getResidencecountyname()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinship())){ - wrappers.eq(ServiceRelativesconfirmation::getKinship ,serviceRelativesconfirmation.getKinship()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinship())) { + wrappers.eq(ServiceRelativesconfirmation::getKinship, serviceRelativesconfirmation.getKinship()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getSignfamilyrelations())){ - wrappers.eq(ServiceRelativesconfirmation::getSignfamilyrelations ,serviceRelativesconfirmation.getSignfamilyrelations()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getSignfamilyrelations())) { + wrappers.eq(ServiceRelativesconfirmation::getSignfamilyrelations, serviceRelativesconfirmation.getSignfamilyrelations()); } - if (serviceRelativesconfirmation.getKinshipChildrennum() != null){ - wrappers.eq(ServiceRelativesconfirmation::getKinshipChildrennum ,serviceRelativesconfirmation.getKinshipChildrennum()); + if (serviceRelativesconfirmation.getKinshipChildrennum() != null) { + wrappers.eq(ServiceRelativesconfirmation::getKinshipChildrennum, serviceRelativesconfirmation.getKinshipChildrennum()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinshipconfirmationsign())){ - wrappers.eq(ServiceRelativesconfirmation::getKinshipconfirmationsign ,serviceRelativesconfirmation.getKinshipconfirmationsign()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinshipconfirmationsign())) { + wrappers.eq(ServiceRelativesconfirmation::getKinshipconfirmationsign, serviceRelativesconfirmation.getKinshipconfirmationsign()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecision())){ - wrappers.eq(ServiceRelativesconfirmation::getOrgandecision ,serviceRelativesconfirmation.getOrgandecision()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecision())) { + wrappers.eq(ServiceRelativesconfirmation::getOrgandecision, serviceRelativesconfirmation.getOrgandecision()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecisionOther())){ - wrappers.eq(ServiceRelativesconfirmation::getOrgandecisionOther ,serviceRelativesconfirmation.getOrgandecisionOther()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecisionOther())) { + wrappers.eq(ServiceRelativesconfirmation::getOrgandecisionOther, serviceRelativesconfirmation.getOrgandecisionOther()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getRelativeconfirmationsign())){ - wrappers.eq(ServiceRelativesconfirmation::getRelativeconfirmationsign ,serviceRelativesconfirmation.getRelativeconfirmationsign()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getRelativeconfirmationsign())) { + wrappers.eq(ServiceRelativesconfirmation::getRelativeconfirmationsign, serviceRelativesconfirmation.getRelativeconfirmationsign()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getFamilyrelations())){ - wrappers.eq(ServiceRelativesconfirmation::getFamilyrelations ,serviceRelativesconfirmation.getFamilyrelations()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getFamilyrelations())) { + wrappers.eq(ServiceRelativesconfirmation::getFamilyrelations, serviceRelativesconfirmation.getFamilyrelations()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissueno())){ - wrappers.eq(ServiceRelativesconfirmation::getAcquisitiontissueno ,serviceRelativesconfirmation.getAcquisitiontissueno()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissueno())) { + wrappers.eq(ServiceRelativesconfirmation::getAcquisitiontissueno, serviceRelativesconfirmation.getAcquisitiontissueno()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissuename())){ - wrappers.like(ServiceRelativesconfirmation::getAcquisitiontissuename ,serviceRelativesconfirmation.getAcquisitiontissuename()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissuename())) { + wrappers.like(ServiceRelativesconfirmation::getAcquisitiontissuename, serviceRelativesconfirmation.getAcquisitiontissuename()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleuserid())){ - wrappers.eq(ServiceRelativesconfirmation::getResponsibleuserid ,serviceRelativesconfirmation.getResponsibleuserid()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleuserid())) { + wrappers.eq(ServiceRelativesconfirmation::getResponsibleuserid, serviceRelativesconfirmation.getResponsibleuserid()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleusername())){ - wrappers.like(ServiceRelativesconfirmation::getResponsibleusername ,serviceRelativesconfirmation.getResponsibleusername()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleusername())) { + wrappers.like(ServiceRelativesconfirmation::getResponsibleusername, serviceRelativesconfirmation.getResponsibleusername()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduserido())){ - wrappers.eq(ServiceRelativesconfirmation::getCoordinateduserido ,serviceRelativesconfirmation.getCoordinateduserido()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduserido())) { + wrappers.eq(ServiceRelativesconfirmation::getCoordinateduserido, serviceRelativesconfirmation.getCoordinateduserido()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernameo())){ - wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernameo ,serviceRelativesconfirmation.getCoordinatedusernameo()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernameo())) { + wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernameo, serviceRelativesconfirmation.getCoordinatedusernameo()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduseridt())){ - wrappers.eq(ServiceRelativesconfirmation::getCoordinateduseridt ,serviceRelativesconfirmation.getCoordinateduseridt()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduseridt())) { + wrappers.eq(ServiceRelativesconfirmation::getCoordinateduseridt, serviceRelativesconfirmation.getCoordinateduseridt()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernamet())){ - wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernamet ,serviceRelativesconfirmation.getCoordinatedusernamet()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernamet())) { + wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernamet, serviceRelativesconfirmation.getCoordinatedusernamet()); } Map<String, Object> params = serviceRelativesconfirmation.getParams(); if (params.get("beginSigndate") != null && params.get("endSigndate") != null) { - wrappers.between(ServiceRelativesconfirmation::getSigndate ,params.get("beginSigndate"),params.get("endSigndate")); + wrappers.between(ServiceRelativesconfirmation::getSigndate, params.get("beginSigndate"), params.get("endSigndate")); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCreateBy())){ - wrappers.eq(ServiceRelativesconfirmation::getCreateBy ,serviceRelativesconfirmation.getCreateBy()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCreateBy())) { + wrappers.eq(ServiceRelativesconfirmation::getCreateBy, serviceRelativesconfirmation.getCreateBy()); } - if (serviceRelativesconfirmation.getCreateTime() != null){ - wrappers.eq(ServiceRelativesconfirmation::getCreateTime ,serviceRelativesconfirmation.getCreateTime()); + if (serviceRelativesconfirmation.getCreateTime() != null) { + wrappers.eq(ServiceRelativesconfirmation::getCreateTime, serviceRelativesconfirmation.getCreateTime()); } - if (StringUtils.isNotBlank(serviceRelativesconfirmation.getUpdateBy())){ - wrappers.eq(ServiceRelativesconfirmation::getUpdateBy ,serviceRelativesconfirmation.getUpdateBy()); + if (StringUtils.isNotBlank(serviceRelativesconfirmation.getUpdateBy())) { + wrappers.eq(ServiceRelativesconfirmation::getUpdateBy, serviceRelativesconfirmation.getUpdateBy()); } - if (serviceRelativesconfirmation.getUpdateTime() != null){ - wrappers.eq(ServiceRelativesconfirmation::getUpdateTime ,serviceRelativesconfirmation.getUpdateTime()); + if (serviceRelativesconfirmation.getUpdateTime() != null) { + wrappers.eq(ServiceRelativesconfirmation::getUpdateTime, serviceRelativesconfirmation.getUpdateTime()); } return this.list(wrappers); } @@ -179,10 +184,9 @@ String adjustcoordinateUserId = coordinateUserId.substring(coordinateUserId.length() - 2); int first = oldDonateNumber.indexOf("*"); - if(first == -1){ + if (first == -1) { return oldDonateNumber; - } - else { + } else { StringBuilder newDonateNumber = new StringBuilder(oldDonateNumber); newDonateNumber.replace(first, first + 2, adjustcoordinateUserId); String updateNumber = newDonateNumber.toString(); @@ -196,18 +200,27 @@ public List<RelativeConfirmationVO> selectVOList(RelativeConfirmationVO relativeConfirmationVO) { SysUser user = SecurityUtils.getLoginUser().getUser(); - List <SysRole> l = user.getRoles(); + List<SysRole> l = user.getRoles(); Boolean b = false; - for(SysRole r : l){ - if(r.getRoleId().longValue() == 3){ + for (SysRole r : l) { + if (r.getRoleId().longValue() == 3) { b = true; } } - if(b){ - relativeConfirmationVO.setBasecreateby(user.getUserName()); + if (b) { + relativeConfirmationVO.setReporterno(user.getUserName()); } - - return serviceRelativesconfirmationMapper.selectVOList(relativeConfirmationVO); + List<RelativeConfirmationVO> relativeConfirmationVOS = serviceRelativesconfirmationMapper.selectVOList(relativeConfirmationVO); + for (RelativeConfirmationVO relativeConfirmationVO1 : relativeConfirmationVOS) { + if (relativeConfirmationVO1.getBirthday() != null) { + Map<String, String> map = CalculateDateUtils.calculateAge(relativeConfirmationVO1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); + relativeConfirmationVO1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); + relativeConfirmationVO1.setAgeunit(map.get("ageUnit")); + relativeConfirmationVO1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); + relativeConfirmationVO1.setAgeunit2(map.get("ageUnit2")); + } + } + return relativeConfirmationVOS; } } -- Gitblit v1.9.3