Browse Source

定时任务

ZeroLiYi 3 months ago
parent
commit
e935fe981b

+ 3 - 3
unis-plugin/unis-plugin-biz/src/main/java/com/unis/financialSupervision/modular/fsstoragesubsidysettle/mapper/mapping/FsStorageSubsidySettleMapper.xml

@@ -10,7 +10,7 @@
10
             sum(ROUND(qmkc/10000, 2)) AS qmkc
10
             sum(ROUND(qmkc/10000, 2)) AS qmkc
11
         FROM
11
         FROM
12
             depot_qh.data_kcgl_kcyjd_default
12
             depot_qh.data_kcgl_kcyjd_default
13
-        where pz!=7144 and nf=#{Year} and UnitID=#{orgId}
13
+        where pz!=7144 and nf=#{year} and UnitID=#{orgId}
14
         GROUP BY
14
         GROUP BY
15
             nf,
15
             nf,
16
             UnitID
16
             UnitID
@@ -24,7 +24,7 @@
24
         FROM
24
         FROM
25
             province_all.biz_pss_storage_empty_period a
25
             province_all.biz_pss_storage_empty_period a
26
         left join depot_qh.business_rp_report b on a.rp_report_id =b.id and plan_type=1
26
         left join depot_qh.business_rp_report b on a.rp_report_id =b.id and plan_type=1
27
-        where a.org_id=#{orgId} and a.plan_year =#{Year} and a.rotation_status=1
27
+        where a.org_id=#{orgId} and a.plan_year =#{year} and a.rotation_status=1
28
         GROUP BY a.org_id
28
         GROUP BY a.org_id
29
 
29
 
30
     </select>
30
     </select>
@@ -36,7 +36,7 @@
36
             sum(ROUND(qmkc/10000, 2)) AS qmkc
36
             sum(ROUND(qmkc/10000, 2)) AS qmkc
37
         FROM
37
         FROM
38
             depot_qh.data_kcgl_kcyjd_default
38
             depot_qh.data_kcgl_kcyjd_default
39
-        where pz=7144 and nf=#{Year}
39
+        where pz=7144 and nf=#{year}
40
         GROUP BY
40
         GROUP BY
41
             nf,
41
             nf,
42
             UnitID
42
             UnitID

+ 90 - 21
unis-plugin/unis-plugin-biz/src/main/java/com/unis/financialSupervision/modular/fsstoragesubsidysettle/service/impl/FsStorageSubsidySettleServiceImpl.java

@@ -14,12 +14,14 @@ package com.unis.financialSupervision.modular.fsstoragesubsidysettle.service.imp
14
 
14
 
15
 import cn.hutool.core.bean.BeanUtil;
15
 import cn.hutool.core.bean.BeanUtil;
16
 import cn.hutool.core.collection.CollStreamUtil;
16
 import cn.hutool.core.collection.CollStreamUtil;
17
+import cn.hutool.core.date.DateUtil;
17
 import cn.hutool.core.util.NumberUtil;
18
 import cn.hutool.core.util.NumberUtil;
18
 import cn.hutool.core.util.ObjectUtil;
19
 import cn.hutool.core.util.ObjectUtil;
19
 import cn.hutool.core.util.StrUtil;
20
 import cn.hutool.core.util.StrUtil;
20
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
21
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
21
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
22
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
22
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
23
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
24
+import com.qcloud.cos.utils.DateUtils;
23
 import com.unis.rotationPlan.info.modular.rpWarnThreshold.mapper.RpWarnThresholdMapper;
25
 import com.unis.rotationPlan.info.modular.rpWarnThreshold.mapper.RpWarnThresholdMapper;
24
 import io.swagger.annotations.ApiModelProperty;
26
 import io.swagger.annotations.ApiModelProperty;
25
 import org.springframework.stereotype.Service;
27
 import org.springframework.stereotype.Service;
@@ -39,6 +41,9 @@ import javax.annotation.Resource;
39
 import java.math.BigDecimal;
41
 import java.math.BigDecimal;
40
 import java.time.LocalDate;
42
 import java.time.LocalDate;
41
 import java.time.LocalDateTime;
43
 import java.time.LocalDateTime;
44
+import java.time.Year;
45
+import java.time.ZoneId;
46
+import java.util.Date;
42
 import java.util.List;
47
 import java.util.List;
43
 import java.util.Map;
48
 import java.util.Map;
44
 
49
 
@@ -112,16 +117,23 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
112
     /**
117
     /**
113
      * 定时添加保管费用补贴清算表
118
      * 定时添加保管费用补贴清算表
114
      */
119
      */
120
+    @Transactional
115
     @Override
121
     @Override
116
     public void addFsStorageSubsidySettle() {
122
     public void addFsStorageSubsidySettle() {
117
         int year = LocalDate.now().getYear();
123
         int year = LocalDate.now().getYear();
124
+        Year PlayYear = Year.of(year);
118
 
125
 
119
         LocalDate today = LocalDate.now();
126
         LocalDate today = LocalDate.now();
120
 
127
 
121
         // 获取当前月份
128
         // 获取当前月份
122
         int ys = today.getMonthValue();
129
         int ys = today.getMonthValue();
130
+        QueryWrapper<FsStorageSubsidySettle> queryWrapper = new QueryWrapper<>();
131
+        queryWrapper.lambda().eq(FsStorageSubsidySettle::getPlanYear,PlayYear);
132
+        List<FsStorageSubsidySettle> subsidySettles = this.list(queryWrapper);
133
+         if(subsidySettles.size()>0){
134
+             this.removeByIds(subsidySettles);
135
+         }
123
         //查询data_kcgl_kcyjd_default单位
136
         //查询data_kcgl_kcyjd_default单位
124
-
125
         List<Map<String, Object>> listOrg = fsStorageSubsidySettleMapper.selectOrgInfo();
137
         List<Map<String, Object>> listOrg = fsStorageSubsidySettleMapper.selectOrgInfo();
126
 
138
 
127
         for (int i = 0; i < listOrg.size(); i++) {
139
         for (int i = 0; i < listOrg.size(); i++) {
@@ -136,6 +148,7 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
136
             BigDecimal averageRawGrainInventoryEmpty = new BigDecimal(0.0);/** 储备粮-原粮平均库存数量-平均正常轮空期内轮空数量 */
148
             BigDecimal averageRawGrainInventoryEmpty = new BigDecimal(0.0);/** 储备粮-原粮平均库存数量-平均正常轮空期内轮空数量 */
137
             BigDecimal averageRawGrainInventory = new BigDecimal(0.00);    /** 储备粮-原粮平均库存数量-小计 */
149
             BigDecimal averageRawGrainInventory = new BigDecimal(0.00);    /** 储备粮-原粮平均库存数量-小计 */
138
             BigDecimal averageRawGrainInventoryPhysical = new BigDecimal(0.0);/** 储备粮-原粮平均库存数量-平均月末实物库存 */
150
             BigDecimal averageRawGrainInventoryPhysical = new BigDecimal(0.0);/** 储备粮-原粮平均库存数量-平均月末实物库存 */
151
+
139
             List<Map<String, Object>> listyy = fsStorageSubsidySettleMapper.getOrgAndKcSum(year,orgId);
152
             List<Map<String, Object>> listyy = fsStorageSubsidySettleMapper.getOrgAndKcSum(year,orgId);
140
             for (int j = 0; j < listyy.size(); j++) {
153
             for (int j = 0; j < listyy.size(); j++) {
141
                 Map<String, Object> map = listyy.get(j);
154
                 Map<String, Object> map = listyy.get(j);
@@ -150,8 +163,9 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
150
                 if (ys != 0) {
163
                 if (ys != 0) {
151
                     averageRawGrainInventoryPhysical = qmkc.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
164
                     averageRawGrainInventoryPhysical = qmkc.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
152
                 }
165
                 }
166
+                averageRawGrainInventoryPhysical = (averageRawGrainInventoryPhysical != null) ? averageRawGrainInventoryPhysical :new BigDecimal(0.00) ;
153
 
167
 
154
-                fsStorageSubsidySettle.setAverageInventory(averageRawGrainInventoryPhysical); //平均月末实物库存
168
+                fsStorageSubsidySettle.setAverageRawGrainInventoryPhysical(averageRawGrainInventoryPhysical); //平均月末实物库存
155
 
169
 
156
                 //根据单位 和 日期 查询架空期
170
                 //根据单位 和 日期 查询架空期
157
                 Map<String, Object> staetAndEnd = fsStorageSubsidySettleMapper.getStaetAndEnd(orgId, year);
171
                 Map<String, Object> staetAndEnd = fsStorageSubsidySettleMapper.getStaetAndEnd(orgId, year);
@@ -163,12 +177,18 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
163
                 if (ys != 0) {
177
                 if (ys != 0) {
164
                     averageRawGrainInventoryEmpty = quantity.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
178
                     averageRawGrainInventoryEmpty = quantity.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
165
                 }
179
                 }
180
+                averageRawGrainInventoryEmpty = (averageRawGrainInventoryEmpty != null) ? averageRawGrainInventoryEmpty :new BigDecimal(0.00) ;
181
+
166
                 fsStorageSubsidySettle.setAverageRawGrainInventoryEmpty(averageRawGrainInventoryEmpty);//平均正常轮空期内轮空数量
182
                 fsStorageSubsidySettle.setAverageRawGrainInventoryEmpty(averageRawGrainInventoryEmpty);//平均正常轮空期内轮空数量
167
                 averageRawGrainInventory = averageRawGrainInventoryPhysical.add(averageRawGrainInventoryEmpty);
183
                 averageRawGrainInventory = averageRawGrainInventoryPhysical.add(averageRawGrainInventoryEmpty);
168
-                averageRawGrainInventory = averageRawGrainInventory.multiply(new BigDecimal("0.2"));
184
+               // averageRawGrainInventory = averageRawGrainInventory.multiply(new BigDecimal("0.2"));
185
+                fsStorageSubsidySettle.setAverageRawGrainInventory(averageRawGrainInventory);//(1)
186
+            }
187
+            if(listyy.isEmpty()){
188
+                fsStorageSubsidySettle.setAverageRawGrainInventoryPhysical(averageRawGrainInventoryPhysical);
189
+                fsStorageSubsidySettle.setAverageRawGrainInventoryEmpty(averageRawGrainInventoryEmpty);
169
                 fsStorageSubsidySettle.setAverageRawGrainInventory(averageRawGrainInventory);//(1)
190
                 fsStorageSubsidySettle.setAverageRawGrainInventory(averageRawGrainInventory);//(1)
170
             }
191
             }
171
-
172
 
192
 
173
 
193
 
174
             /**
194
             /**
@@ -182,42 +202,75 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
182
             BigDecimal sjsysl = new BigDecimal(0.0);
202
             BigDecimal sjsysl = new BigDecimal(0.0);
183
             for (int j1 = 0; j1 < list1.size(); j1++) {
203
             for (int j1 = 0; j1 < list1.size(); j1++) {
184
                 Map<String, Object> map1 = list1.get(j1);
204
                 Map<String, Object> map1 = list1.get(j1);
185
-                LocalDateTime firstTime = (LocalDateTime) map1.getOrDefault("startTime", LocalDateTime.now()); //第一车出库时间
186
-                LocalDateTime firstDayOfNextMonth = firstTime.plusMonths(1).withDayOfMonth(1);
187
-                LocalDateTime futureDate = firstDayOfNextMonth.plusMonths(4);
188
-                LocalDateTime endTime = (LocalDateTime) map1.get("endTime");
189
-                if (endTime != null && endTime.isBefore(futureDate)) {
190
-                    BigDecimal wcsl = (BigDecimal) map1.getOrDefault("wcsl", BigDecimal.ZERO);
191
-                    sjlcsl = sjlcsl.add(wcsl);
192
-                    BigDecimal sysl = (BigDecimal) map1.getOrDefault("sysl", BigDecimal.ZERO);
193
-                    sjsysl = sjsysl.add(sysl);
205
+                Object startTimeObj = map1.get("startTime");
206
+                Date firstTime;
207
+                if (startTimeObj == null || startTimeObj.toString().isEmpty()) {
208
+                    firstTime = new Date(); // 设置默认值为当前日期
209
+                } else {
210
+                    firstTime = DateUtil.parseDate(startTimeObj.toString());
211
+                } // 第一车出库时间
212
+                Date endTime;
213
+                // 检查 firstTime 不为 null
214
+                if (firstTime != null) {
215
+                    LocalDateTime localDateTime = firstTime.toInstant()
216
+                            .atZone(ZoneId.systemDefault())
217
+                            .toLocalDateTime();
218
+                    LocalDateTime firstDayOfNextMonth = localDateTime.plusMonths(1).withDayOfMonth(1);
219
+                    LocalDateTime futureDate = firstDayOfNextMonth.plusMonths(4);
220
+                    Object endTimeObj = map1.get("endTime");
221
+                    if (endTimeObj == null || endTimeObj.toString().isEmpty()) {
222
+                        endTime = new Date(); // 设置默认值为当前日期
223
+                    } else {
224
+                        endTime = DateUtil.parseDate(endTimeObj.toString());
225
+                    }
226
+
227
+                    // 检查 endTime 不为 null
228
+                    if (endTime != null) {
229
+                        LocalDateTime endTime1 = endTime.toInstant()
230
+                                .atZone(ZoneId.systemDefault())
231
+                                .toLocalDateTime();
232
+
233
+                        // 先确保 endTime 不为 null,然后进行比较
234
+                        if (endTime1.isBefore(futureDate)) {
235
+                            BigDecimal wcsl = (BigDecimal) map1.getOrDefault("wcsl", BigDecimal.ZERO);
236
+                            sjlcsl = sjlcsl.add(wcsl);
237
+                            BigDecimal sysl = (BigDecimal) map1.getOrDefault("sysl", BigDecimal.ZERO);
238
+                            sjsysl = sjsysl.add(sysl);
239
+                        }
240
+                    }
194
                 }
241
                 }
195
-
196
             }
242
             }
197
             if (ys != 0) {
243
             if (ys != 0) {
198
                 averageProcessedGrainInventoryEmpty = sjlcsl.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
244
                 averageProcessedGrainInventoryEmpty = sjlcsl.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
199
             }
245
             }
246
+            averageProcessedGrainInventoryEmpty = (averageProcessedGrainInventoryEmpty != null) ? averageProcessedGrainInventoryEmpty :new BigDecimal(0.00) ;
247
+
248
+
200
             fsStorageSubsidySettle.setAverageProcessedGrainInventoryEmpty(averageProcessedGrainInventoryEmpty);/** 储备粮-成品粮平均库存数量-平均正常轮空期内轮空数量 */
249
             fsStorageSubsidySettle.setAverageProcessedGrainInventoryEmpty(averageProcessedGrainInventoryEmpty);/** 储备粮-成品粮平均库存数量-平均正常轮空期内轮空数量 */
201
 
250
 
202
             BigDecimal averageProcessedGrainInventoryPhysical = new BigDecimal(0.0); /** 储备粮-成品粮平均库存数量-平均月末实物库存 */
251
             BigDecimal averageProcessedGrainInventoryPhysical = new BigDecimal(0.0); /** 储备粮-成品粮平均库存数量-平均月末实物库存 */
203
             if (ys != 0) {
252
             if (ys != 0) {
204
                 averageProcessedGrainInventoryPhysical = sjsysl.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
253
                 averageProcessedGrainInventoryPhysical = sjsysl.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
205
             }
254
             }
255
+            averageProcessedGrainInventoryPhysical = (averageProcessedGrainInventoryPhysical != null) ? averageProcessedGrainInventoryPhysical :new BigDecimal(0.00) ;
256
+
206
             fsStorageSubsidySettle.setAverageProcessedGrainInventoryPhysical(averageProcessedGrainInventoryPhysical);/** 储备粮-成品粮平均库存数量-平均月末实物库存 */
257
             fsStorageSubsidySettle.setAverageProcessedGrainInventoryPhysical(averageProcessedGrainInventoryPhysical);/** 储备粮-成品粮平均库存数量-平均月末实物库存 */
207
 
258
 
208
             BigDecimal averageProcessedGrainInventory = new BigDecimal(0.0);//(2)  /** 储备粮-成品粮平均库存数量-小计 */
259
             BigDecimal averageProcessedGrainInventory = new BigDecimal(0.0);//(2)  /** 储备粮-成品粮平均库存数量-小计 */
260
+            averageProcessedGrainInventory=averageProcessedGrainInventoryPhysical.add(averageProcessedGrainInventory);
261
+            fsStorageSubsidySettle.setAverageProcessedGrainInventory(averageProcessedGrainInventory); /** (2)储备粮-成品粮平均库存数量-小计 */
209
 
262
 
210
 
263
 
211
             BigDecimal averageInventory = new BigDecimal(0.0);/** 储备粮平均库存数量 */
264
             BigDecimal averageInventory = new BigDecimal(0.0);/** 储备粮平均库存数量 */
212
-            averageInventory = averageRawGrainInventory.add(averageProcessedGrainInventoryEmpty);
213
-            fsStorageSubsidySettle.setAverageOilInventory(averageInventory);//(1)+(2)
265
+            averageInventory = averageProcessedGrainInventory.add(averageRawGrainInventory);
266
+            fsStorageSubsidySettle.setAverageInventory(averageInventory);//(1)+(2)
214
 
267
 
215
             /**
268
             /**
216
              * 保管费用补贴
269
              * 保管费用补贴
217
              */
270
              */
218
             BigDecimal storageSubsidyStandardRawGrain = new BigDecimal(0.0);//(1) /** 储备粮-原粮保管费用补贴(标准:0.12元/公斤)应拨数 */
271
             BigDecimal storageSubsidyStandardRawGrain = new BigDecimal(0.0);//(1) /** 储备粮-原粮保管费用补贴(标准:0.12元/公斤)应拨数 */
219
             storageSubsidyStandardRawGrain = averageRawGrainInventory.multiply(new BigDecimal("0.12"));//单位:万元
272
             storageSubsidyStandardRawGrain = averageRawGrainInventory.multiply(new BigDecimal("0.12"));//单位:万元
220
-            fsStorageSubsidySettle.setStorageSubsidyRawGrain(storageSubsidyStandardRawGrain);
273
+            fsStorageSubsidySettle.setStorageSubsidyStandardRawGrain(storageSubsidyStandardRawGrain);
221
 
274
 
222
             BigDecimal storageSubsidyProcessedGrain = new BigDecimal(0.0);/** 储备粮-成品粮保管费用补贴(标准:0.20元/公斤)应拨数 */
275
             BigDecimal storageSubsidyProcessedGrain = new BigDecimal(0.0);/** 储备粮-成品粮保管费用补贴(标准:0.20元/公斤)应拨数 */
223
             storageSubsidyProcessedGrain = averageProcessedGrainInventory.multiply(new BigDecimal("0.20"));//单位:万元
276
             storageSubsidyProcessedGrain = averageProcessedGrainInventory.multiply(new BigDecimal("0.20"));//单位:万元
@@ -233,6 +286,8 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
233
             BigDecimal averageOilInventoryPhysical = new BigDecimal(0.0);/** 储备油-储油平均库存数量-平均月末实物库存 */
286
             BigDecimal averageOilInventoryPhysical = new BigDecimal(0.0);/** 储备油-储油平均库存数量-平均月末实物库存 */
234
             BigDecimal averageOilInventoryEmpty = new BigDecimal(0.0);/** 储备油-储油平均库存数量-平均正常轮空期内轮空数量 */
287
             BigDecimal averageOilInventoryEmpty = new BigDecimal(0.0);/** 储备油-储油平均库存数量-平均正常轮空期内轮空数量 */
235
             BigDecimal averageOilInventory = new BigDecimal(0.0);/** 储备油-储油平均库存数量-小计 */
288
             BigDecimal averageOilInventory = new BigDecimal(0.0);/** 储备油-储油平均库存数量-小计 */
289
+
290
+            BigDecimal storageSubsidyOil = new BigDecimal(0.0);/** 储备油-油料保管费用补贴(标准:0.40元/公斤)应拨数 */
236
             List<Map<String, Object>> list2 = fsStorageSubsidySettleMapper.getOrgAndYlKcSum(year, orgId);
291
             List<Map<String, Object>> list2 = fsStorageSubsidySettleMapper.getOrgAndYlKcSum(year, orgId);
237
             for (int j2 = 0; j2< list2.size(); j2++) {
292
             for (int j2 = 0; j2< list2.size(); j2++) {
238
                 Map<String, Object> mapy = listyy.get(j2);
293
                 Map<String, Object> mapy = listyy.get(j2);
@@ -246,27 +301,41 @@ public class FsStorageSubsidySettleServiceImpl extends ServiceImpl<FsStorageSubs
246
                 if (ys != 0) {
301
                 if (ys != 0) {
247
                     averageOilInventoryPhysical = qmkc.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
302
                     averageOilInventoryPhysical = qmkc.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
248
                 }
303
                 }
304
+                averageOilInventoryPhysical = (averageOilInventoryPhysical != null) ? averageOilInventoryPhysical :new BigDecimal(0.00) ;
249
 
305
 
250
                 fsStorageSubsidySettle.setAverageOilInventoryPhysical(averageOilInventoryPhysical); //平均月末实物库存
306
                 fsStorageSubsidySettle.setAverageOilInventoryPhysical(averageOilInventoryPhysical); //平均月末实物库存
251
 
307
 
252
                 //根据单位 和 日期 查询架空期
308
                 //根据单位 和 日期 查询架空期
253
                 Map<String, Object> staetAndEnd = fsStorageSubsidySettleMapper.getStaetAndEnd(orgId, year);
309
                 Map<String, Object> staetAndEnd = fsStorageSubsidySettleMapper.getStaetAndEnd(orgId, year);
254
-                LocalDateTime startTime = (LocalDateTime) mapy.getOrDefault("rotationStart", LocalDateTime.now()); //开始时间
255
-                LocalDateTime endTime = (LocalDateTime) mapy.getOrDefault("rotationEnd", LocalDateTime.now()); //截至时间
310
+//                LocalDateTime startTime = (LocalDateTime) mapy.getOrDefault("rotationStart", LocalDateTime.now()); //开始时间
311
+//                LocalDateTime endTime = (LocalDateTime) mapy.getOrDefault("rotationEnd", LocalDateTime.now()); //截至时间
256
                 // 获取 quantity 的值,如果没有则默认为 0.0
312
                 // 获取 quantity 的值,如果没有则默认为 0.0
257
                 BigDecimal quantity = NumberUtil.toBigDecimal(mapy.getOrDefault("quantity", "0.0").toString());
313
                 BigDecimal quantity = NumberUtil.toBigDecimal(mapy.getOrDefault("quantity", "0.0").toString());
258
 
314
 
259
                 if (ys != 0) {
315
                 if (ys != 0) {
260
                     averageOilInventoryEmpty = quantity.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
316
                     averageOilInventoryEmpty = quantity.divide(BigDecimal.valueOf(ys), 2, BigDecimal.ROUND_HALF_UP);
261
                 }
317
                 }
318
+                averageOilInventoryEmpty = (averageOilInventoryEmpty != null) ? averageOilInventoryEmpty :new BigDecimal(0.00) ;
319
+
262
                 fsStorageSubsidySettle.setAverageOilInventoryEmpty(averageOilInventoryEmpty);//平均正常轮空期内轮空数量
320
                 fsStorageSubsidySettle.setAverageOilInventoryEmpty(averageOilInventoryEmpty);//平均正常轮空期内轮空数量
263
                 averageOilInventory = averageOilInventoryPhysical.add(averageOilInventoryEmpty);
321
                 averageOilInventory = averageOilInventoryPhysical.add(averageOilInventoryEmpty);
322
+                fsStorageSubsidySettle.setAverageOilInventory(averageOilInventory);
264
 
323
 
265
-                BigDecimal storageSubsidyOil = new BigDecimal(0.0);/** 储备油-油料保管费用补贴(标准:0.40元/公斤)应拨数 */
266
-                storageSubsidyOil = averageOilInventory.multiply(new BigDecimal("0.2"));
324
+                storageSubsidyOil = averageOilInventory.multiply(new BigDecimal("0.4"));
267
                 fsStorageSubsidySettle.setStorageSubsidyOil(storageSubsidyOil);//(5)
325
                 fsStorageSubsidySettle.setStorageSubsidyOil(storageSubsidyOil);//(5)
268
 
326
 
327
+
328
+            }
329
+            if(list2.isEmpty()){
330
+                fsStorageSubsidySettle.setAverageOilInventoryPhysical(averageOilInventoryPhysical); //平均月末实物库存
331
+                fsStorageSubsidySettle.setAverageOilInventoryEmpty(averageOilInventoryEmpty);//平均正常轮空期内轮空数量
332
+                fsStorageSubsidySettle.setAverageOilInventory(averageOilInventory);
333
+                fsStorageSubsidySettle.setStorageSubsidyOil(storageSubsidyOil);//(5)
269
             }
334
             }
335
+            fsStorageSubsidySettle.setOrgId(Integer.parseInt(orgId));
336
+
337
+
338
+            fsStorageSubsidySettle.setPlanYear(PlayYear);
270
             this.save(fsStorageSubsidySettle);
339
             this.save(fsStorageSubsidySettle);
271
         }
340
         }
272
 
341
 

+ 1 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/rotationPlan/info/modular/rpWarnThreshold/mapper/mapping/RpWarnThresholdMapper.xml

@@ -209,7 +209,7 @@
209
             depot_qh.business_pg_gops_plan
209
             depot_qh.business_pg_gops_plan
210
 
210
 
211
         WHERE
211
         WHERE
212
-            org_id=#{orgId} and YEAR(plan_year)=#{year} and plan_type=1
212
+            org_id=#{orgId} and YEAR(plan_start_time)=#{year} and plan_type=1
213
     </select>
213
     </select>
214
 
214
 
215
 </mapper>
215
 </mapper>