From 3af54cb1f55464f03d58e361c197b700804013e9 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 25 Dec 2024 14:36:57 +0800 Subject: [PATCH] =?UTF-8?q?=20QC3445872=20=E7=BE=8E=E4=B9=8B=E9=AB=98?= =?UTF-8?q?=E9=97=A8=E6=88=B7=E5=85=83=E7=B4=A0=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mzgsecond/entity/BirthdayRemindVo.java | 1 + .../service/PortalElementCusService.java | 4 +- .../impl/PortalElementCusServiceImpl.java | 49 ++++++++++++++++--- src/test/MainTest.java | 7 +++ 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/com/engine/mzgsecond/entity/BirthdayRemindVo.java b/src/com/engine/mzgsecond/entity/BirthdayRemindVo.java index f692111..6b7f514 100644 --- a/src/com/engine/mzgsecond/entity/BirthdayRemindVo.java +++ b/src/com/engine/mzgsecond/entity/BirthdayRemindVo.java @@ -20,4 +20,5 @@ public class BirthdayRemindVo { private String lastname; private Integer day; + } diff --git a/src/com/engine/mzgsecond/service/PortalElementCusService.java b/src/com/engine/mzgsecond/service/PortalElementCusService.java index 2ebb6c1..4ee0c8a 100644 --- a/src/com/engine/mzgsecond/service/PortalElementCusService.java +++ b/src/com/engine/mzgsecond/service/PortalElementCusService.java @@ -35,11 +35,11 @@ public interface PortalElementCusService { List todoNoticeTrain(HttpServletRequest request, HttpServletResponse response); /** - * @Description: 生日提醒 + * @Description: 生日提醒 (当月) * @Author: liang.cheng * @Date: 2024/12/23 2:23 PM * @param: [] * @return: com.engine.mzgsecond.entity.BirthdayRemindVo */ - BirthdayRemindVo birthdayRemind(); + List birthdayRemind(); } diff --git a/src/com/engine/mzgsecond/service/impl/PortalElementCusServiceImpl.java b/src/com/engine/mzgsecond/service/impl/PortalElementCusServiceImpl.java index c488a44..07ff45f 100644 --- a/src/com/engine/mzgsecond/service/impl/PortalElementCusServiceImpl.java +++ b/src/com/engine/mzgsecond/service/impl/PortalElementCusServiceImpl.java @@ -6,14 +6,17 @@ import com.api.doc.mobile.systemDoc.util.CategoryUtil; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.kq.biz.KQBalanceOfLeaveBiz; import com.engine.mzgsecond.entity.BirthdayRemindVo; import com.engine.mzgsecond.entity.PersonInfoVo; import com.engine.mzgsecond.entity.TodoNoticeTrainVo; import com.engine.mzgsecond.service.PortalElementCusService; import com.engine.workflow.service.impl.RequestListServiceImpl; import org.apache.commons.lang.StringUtils; +import weaver.common.DateUtil; import weaver.conn.RecordSet; import weaver.general.Util; +import weaver.hrm.common.database.dialect.DialectUtil; import weaver.hrm.job.JobTitlesComInfo; import weaver.hrm.resource.ResourceComInfo; @@ -23,8 +26,10 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Author liang.cheng @@ -38,6 +43,13 @@ public class PortalElementCusServiceImpl extends Service implements PortalElemen RecordSet rs = new RecordSet(); JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo(); + String amountId = rs.getPropValue("mzgsecond", "amountId"); + String currentDate = DateUtil.getCurrentDate(); + String restAmount = KQBalanceOfLeaveBiz.getRestAmount(String.valueOf(user.getUID()),amountId,currentDate); + String txAmountId = rs.getPropValue("mzgsecond", "txAmountId"); + String txRestAmount = KQBalanceOfLeaveBiz.getRestAmount(String.valueOf(user.getUID()),txAmountId,currentDate); + + PersonInfoVo personInfo = PersonInfoVo.builder() .id(user.getUID()) .imageUrl(getImageFile(String.valueOf(user.getUID()))) @@ -45,8 +57,8 @@ public class PortalElementCusServiceImpl extends Service implements PortalElemen .status(getStatus(user.getStatus())) .jobTitle(jobTitlesComInfo.getJobTitlesname(user.getJobtitle())) .day(0) - .amount("0.00") - .txAmount("0.00") + .amount(restAmount) + .txAmount(txRestAmount) .performance("未开始") .build(); @@ -55,12 +67,11 @@ public class PortalElementCusServiceImpl extends Service implements PortalElemen if (rs.next()) { companystartdate = Util.null2String(rs.getString("companystartdate")); } + if (StringUtils.isNotEmpty(companystartdate)) { personInfo.setDay(getCompanyDay(companystartdate)); } - - return personInfo; } @@ -126,8 +137,34 @@ public class PortalElementCusServiceImpl extends Service implements PortalElemen } @Override - public BirthdayRemindVo birthdayRemind() { - return null; + public List birthdayRemind() { + List birthdayRemindVos = new ArrayList<>(); + + String currentMonth = DateUtil.getCurrentDate().substring(5, 7); + int day = Integer.parseInt(DateUtil.getCurrentDate().substring(8, 10)); + RecordSet rs = new RecordSet(); + String substrFun = ("oracle".equals(rs.getDBType()) || DialectUtil.isMySql(rs.getDBType())) ? "substr" : "substring"; + + rs.executeQuery("select lastname,"+substrFun+"(birthday,9,2) as days from hrmresource where birthday is not null and birthday <> ''\n" + + " and "+substrFun+"(birthday,6,2) = ? order by secLevel desc",currentMonth); + + while (rs.next()) { + String lastname = Util.null2String(rs.getString("lastname")); + int days = Util.getIntValue(rs.getString("days")); + int betweenDay = days - day; + if (betweenDay >= 0) { + birthdayRemindVos.add(BirthdayRemindVo.builder() + .lastname(lastname) + .day(betweenDay) + .build()); + } + } + + //获取前3条数据 + return birthdayRemindVos.stream() + .sorted(Comparator.comparing(BirthdayRemindVo::getDay)) + .limit(3) + .collect(Collectors.toList()); } diff --git a/src/test/MainTest.java b/src/test/MainTest.java index 2bfc0b3..2854f27 100644 --- a/src/test/MainTest.java +++ b/src/test/MainTest.java @@ -1,5 +1,7 @@ package test; +import weaver.common.DateUtil; + /** * @Author weaver_cl * @Description: @@ -9,6 +11,11 @@ package test; public class MainTest { public static void main(String[] args) { + String currentMonth = DateUtil.getCurrentDate().substring(5, 7); + + int day = Integer.parseInt(DateUtil.getCurrentDate().substring(8, 10)); + System.out.println(currentMonth); + System.out.println(day); } }