From c19de84fa332a00c651f28e3a52292fd14f143a1 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 23 九月 2025 17:30:07 +0800
Subject: [PATCH] 陆常丽反应软件系统财务对账时而数据不准确,分析源码,找到bug原因是,财务对账统计只有用户点击后才会触发统计功能,把历史上及当天进行了统计,如果当天统计时未下班,例如是中午触发统计了,而下午又进行了充值售水,但下班后未再点击触发对账统计,那么今天的对账统计完成了但数据不对。编写自动任务,在下半夜进行对账统计。
---
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java | 51 +++++++--------------------------------------------
1 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
index a0bd00b..614ff75 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
@@ -79,24 +79,12 @@
@Value("${wechat.irr.plan.planTerminateLimitMinutes:5}")
private Integer planTerminateLimitMinutes; // 璁″垝缁堟鍚庨檺鍒跺彂甯冩柊璁″垝鐨勬椂闂撮棿闅�(鍒嗛挓)
- /**
- * 娣诲姞鐏屾簤璁″垝
- *
- * @param po
- * @return
- */
@Transactional(rollbackFor = Exception.class)
public Long addIrrigatePlan(IrIrrigatePlan po) {
irrigatePlanMapper.insert(po);
return po.getId();
}
- /**
- * 鍒犻櫎鐏屾簤璁″垝
- *
- * @param planSimple
- * @return
- */
@Transactional(rollbackFor = Exception.class)
public Map deletePlan(PlanSimple planSimple) {
Long planId = planSimple.getPlanId();
@@ -142,12 +130,6 @@
}
}
- /**
- * 鍙戝竷鐏屾簤璁″垝
- *
- * @param planSimple
- * @return
- */
public Map publishPlan(PlanSimple planSimple) {
Long planId = planSimple.getPlanId();
Long operatorId = planSimple.getOperatorId();
@@ -184,10 +166,6 @@
}
}
- /**
- * 鑾峰彇鐏屾簤璁″垝淇℃伅
- * 鏇存柊鐏屾簤璁″垝璧锋鏃堕棿鍙婅鍒掔姸鎬�
- */
VoPlanSimple plan = irrigatePlanMapper.getPlanSimple(planId);
if (plan == null) {
Map map = new HashMap<>();
@@ -217,39 +195,32 @@
}
planStartTime = Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant());
- // 鏇存柊姣忎釜鐏屾簤娆″簭鐨勫紑濮嬫椂闂村苟璁$畻鏈�鍚庝竴缁勫叧闃�鏃堕棿
List<VoIrrigateSchedule> schedules = getSchedulesByPlanId(planId);
Date scheduleStartTime = null;
LocalDateTime lastScheduleEndTime = null;
Integer sort = 0;
- // 绗竴娆¢亶鍘嗭細鏇存柊姣忎釜鐏屾簤娆″簭鐨勫紑濮嬫椂闂�
for (VoIrrigateSchedule schedule : schedules) {
if (scheduleStartTime == null) {
scheduleStartTime = planStartTime;
}
this.updateScheduleStartTime(schedule.getScheduleId(), scheduleStartTime);
- // 璁$畻褰撳墠娆″簭鐨勭粨鏉熸椂闂�
LocalDateTime currentScheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
LocalDateTime currentScheduleEndTime = currentScheduleStartTime.plusMinutes(schedule.getDuration());
- // 鏇存柊鏈�鍚庝竴缁勭殑缁撴潫鏃堕棿
lastScheduleEndTime = currentScheduleEndTime;
- // 璁$畻涓嬩竴缁勭殑寮�濮嬫椂闂�
LocalDateTime LocalscheduleStartTime = scheduleStartTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
LocalscheduleStartTime = LocalscheduleStartTime.plusMinutes(schedule.getDuration());
LocalscheduleStartTime = LocalscheduleStartTime.minusMinutes(preOpeningTime);
scheduleStartTime = Date.from(LocalscheduleStartTime.atZone(ZoneId.systemDefault()).toInstant());
- // 纭繚涓嬩竴缁勭殑寮�濮嬫椂闂翠笉鏃╀簬璁″垝寮�濮嬫椂闂�
if (scheduleStartTime.before(planStartTime)) {
scheduleStartTime = planStartTime;
}
}
- // 鏍规嵁鏈�鍚庝竴缁勫叧闃�鏃堕棿璁剧疆璁″垝缁撴潫鏃堕棿
if (lastScheduleEndTime != null) {
planStopTime = Date.from(lastScheduleEndTime.atZone(ZoneId.systemDefault()).toInstant());
} else {
@@ -258,7 +229,6 @@
planStopTime = Date.from(stopTime.atZone(ZoneId.systemDefault()).toInstant());
}
- // 鏍规嵁璁″垝ID鏇存柊璁″垝淇℃伅锛堣捣姝㈡椂闂淬�佽鍒掔姸鎬侊級
if (this.updatePlanTimes(planStartTime, planStopTime, planId) == 0) {
Map map = new HashMap<>();
map.put("success", false);
@@ -267,7 +237,6 @@
return map;
}
- // 娣诲姞鐏屾簤璁″垝鎿嶄綔璁板綍
IrPlanOperate planOperate = new IrPlanOperate();
planOperate.setPlanId(planId);
planOperate.setOperator(operatorId);
@@ -285,6 +254,13 @@
for (VoIrrigateSchedule schedule : schedules) {
Long groupId = schedule.getGroupId();
List<Long> intakeIds = getIntakeIdsByGroupId(groupId);
+ if(intakeIds == null || intakeIds.size() <= 0) {
+ Map map = new HashMap<>();
+ map.put("success", false);
+ map.put("msg", "褰撳墠杞亴缁勫唴娌℃湁鏈夋晥鐨勫彇姘村彛");
+ map.put("content", null);
+ return map;
+ }
for (Long intakeId : intakeIds) {
if (schedule.getDuration() > 0) {
// 浠婂彂甯冪亴婧夋椂闀垮ぇ浜�0鐨�
@@ -534,12 +510,6 @@
return irIrrigateUnitMapper.getIntakeIdByUnitId(unitId);
}
- /**
- * 鏍规嵁璁″垝ID鑾峰彇璁″垝鍙戝竷缁撴灉
- *
- * @param planId
- * @return
- */
public VoPlanDetails getPublishResults(Long planId) {
VoPlanDetails planDetails = irrigatePlanMapper.getPlanDetails(planId);
if (planDetails == null) {
@@ -564,15 +534,8 @@
planDetails.setGroups(groupResults);
return planDetails;
-
}
- /**
- * 鏍规嵁璁″垝ID鑾峰彇璁″垝缁堟鎿嶄綔缁撴灉
- *
- * @param planId
- * @return
- */
public VoPlanDetails getTerminateResults(Long planId) {
// 鑾峰彇璁″垝缁堟鏃堕棿
Date terminateTime = Optional.ofNullable(irPlanOperateMapper.getTerminateTime(planId)).orElse(null);
--
Gitblit v1.8.0