2 Commits 9259cb0f29 ... 4496efe72d

Auteur SHA1 Bericht Datum
  lfy 4496efe72d Merge remote-tracking branch 'origin/master' 1 week geleden
  lfy 880f34f3a3 查看仓房列表代码整理 1 week geleden

+ 98 - 90
delivery-module-core/delivery-module-core-biz/src/main/java/com/unis/module/coding/service/dwxx/DwxxServiceImpl.java

@@ -51,6 +51,7 @@ import com.unis.module.system.dal.mysql.permission.UserRoleMapper;
51 51
 import com.unis.module.system.dal.mysql.user.AdminUserMapper;
52 52
 import com.unis.module.system.enums.permission.RoleIdEnum;
53 53
 import lombok.extern.slf4j.Slf4j;
54
+import org.jetbrains.annotations.Nullable;
54 55
 import org.springframework.stereotype.Service;
55 56
 import org.springframework.transaction.annotation.Transactional;
56 57
 import org.springframework.validation.annotation.Validated;
@@ -255,41 +256,8 @@ public class DwxxServiceImpl implements DwxxService {
255 256
         String areaLevel = loginUser.getInfo().get("areaLevel");
256 257
         // 国家交易中心已选
257 258
         if ("0".equals(areaLevel) || ObjectUtil.isEmpty(areaLevel)) {
258
-            if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
259
-                List<StoreRespVO> storeListForNation = dwxxMapper.getStoreListForNation(pageReqVO);
260
-                List<CaxxDO> caxxDOS = caxxMapper.selectListByKqId(pageReqVO.getKqId());
261
-                if (!ObjectUtils.isEmpty(storeListForNation)) {
262
-                    if (!ObjectUtils.isEmpty(caxxDOS)) {
263
-                        List<Long> idsExist = caxxDOS.stream().map(CaxxDO::getId).collect(Collectors.toList());
264
-                        if (!ObjectUtils.isEmpty(idsExist)) {
265
-                            storeListForNation.removeIf(caxxDO -> idsExist.contains(caxxDO.getId()));
266
-                        }
267
-                    }
268
-                    return storeListForNation;
269
-                }
270
-            } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
271
-                List<CaxxDO> caxxDOS = caxxMapper.selectListByKqId(pageReqVO.getKqId());
272
-                if (!ObjectUtils.isEmpty(caxxDOS)) {
273
-                    caxxDOS.stream().forEach(s->{
274
-                        if (s.getSjcr()!=null) {
275
-                            BigDecimal truncatedNumber = s.getSjcr().setScale(0, RoundingMode.DOWN);
276
-                            s.setSjcr(truncatedNumber);
277
-                        }
278
-                    });
279
-                    List<StoreRespVO> selectedStoreSForNation = BeanUtils.toBean(caxxDOS, StoreRespVO.class);
280
-                    return selectedStoreSForNation;
281
-                }
282
-            } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
283
-                List<StoreRespVO> storeRespVOS = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), pageReqVO.getYhmc());
284
-                return storeRespVOS;
285
-            } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
286
-                List<StoreRespVO> storeRespVOS = caxxMapper.selectListForSelect(pageReqVO.getKqId(), pageReqVO.getYhmc());
287
-                return storeRespVOS;
288
-            } else {
289
-                //国家查看省已选仓房列表
290
-                List<StoreRespVO> storeListForProvince = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
291
-                return storeListForProvince;
292
-            }
259
+            List<StoreRespVO> storeListForNation = getStoreListByNation(pageReqVO);
260
+            return storeListForNation;
293 261
         }
294 262
         if ("1".equals(areaLevel)) {
295 263
             String roleIds = loginUser.getInfo().get("roleIds");
@@ -305,67 +273,107 @@ public class DwxxServiceImpl implements DwxxService {
305 273
                     if (StringUtils.isBlank(bankType)) {
306 274
                         throw exception(ERROR, "当前银行用户不存在银行信息");
307 275
                     }
308
-                    if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
309
-                        pageReqVO.setType(1);
310
-                        List<StoreRespVO> storeListForBank = provinceMapper.getStoreListForProvince(pageReqVO);
311
-                        List<StoreRespVO> storeListSelelct = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
312
-                        if (!ObjectUtils.isEmpty(storeListForBank)) {
313
-                            if (!ObjectUtils.isEmpty(storeListSelelct)) {
314
-                                List<Long> idsExist = storeListSelelct.stream().map(StoreRespVO::getId).collect(Collectors.toList());
315
-                                if (!ObjectUtils.isEmpty(idsExist)) {
316
-                                    storeListForBank.removeIf(a -> idsExist.contains(a.getId()));
317
-                                }
318
-                            }
319
-                            return storeListForBank;
320
-                        }
321
-                    } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
322
-                        List<StoreRespVO> storeListForBank = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
323
-                        return storeListForBank;
324
-                    } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
325
-                        List<StoreRespVO> storeRespVOS = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), bankType);
326
-                        return storeRespVOS;
327
-                    } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
328
-                        List<StoreRespVO> storeRespVOS = caxxMapper.selectListForSelect(pageReqVO.getKqId(), bankType);
329
-                        return storeRespVOS;
330
-                    }
276
+                    List<StoreRespVO> storeListForBank = getStoreListByBank(pageReqVO, bankType);
277
+                    return storeListForBank;
331 278
                 } else {// 省已选
332
-                    if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
333
-                        List<CaxxDO> caxxDOS = caxxMapper.selectList(pageReqVO);
334
-                        List<StoreRespVO> storeListSelect = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
335
-                        List<StoreRespVO> storeListForProvice = new ArrayList<>();
336
-                        if (!ObjectUtils.isEmpty(caxxDOS)) {
337
-                            if (!ObjectUtils.isEmpty(storeListSelect)) {
338
-                                List<Long> idsExist = storeListSelect.stream().map(StoreRespVO::getId).collect(Collectors.toList());
339
-                                if (!ObjectUtils.isEmpty(idsExist)) {
340
-                                    caxxDOS.removeIf(a -> idsExist.contains(a.getId()));
341
-                                }
342
-                            }
343
-                            if (!ObjectUtils.isEmpty(caxxDOS)) {
344
-                                caxxDOS.stream().forEach(s->{
345
-                                    if (s.getSjcr()!=null) {
346
-                                        BigDecimal truncatedNumber = s.getSjcr().setScale(0, RoundingMode.DOWN);
347
-                                        s.setSjcr(truncatedNumber);
348
-                                    }
349
-                                });
350
-                                storeListForProvice = BeanUtils.toBean(caxxDOS, StoreRespVO.class);
351
-                            }
352
-                            return storeListForProvice;
353
-                        }
354
-                    } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
355
-                        List<StoreRespVO> storeListForProvince = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
356
-                        return storeListForProvince;
357
-                    } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
358
-                        List<StoreRespVO> storeRespVOS = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), pageReqVO.getYhmc());
359
-                        return storeRespVOS;
360
-                    } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
361
-                        List<StoreRespVO> storeRespVOS = caxxMapper.selectListForSelect(pageReqVO.getKqId(), pageReqVO.getYhmc());
362
-                        return storeRespVOS;
279
+                    List<StoreRespVO> storeListForProvice = getStoreListByProvince(pageReqVO);
280
+                    return storeListForProvice;
281
+                }
282
+            }
283
+        }
284
+        return null;
285
+    }
286
+
287
+
288
+    private List<StoreRespVO> getStoreListByNation(StorePageReqVO pageReqVO) {
289
+        List<StoreRespVO> storeListForNation = new ArrayList<>();
290
+        if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
291
+            storeListForNation = dwxxMapper.getStoreListForNation(pageReqVO);
292
+            List<CaxxDO> caxxDOS = caxxMapper.selectListByKqId(pageReqVO.getKqId());
293
+            if (!ObjectUtils.isEmpty(storeListForNation)) {
294
+                if (!ObjectUtils.isEmpty(caxxDOS)) {
295
+                    List<Long> idsExist = caxxDOS.stream().map(CaxxDO::getId).collect(Collectors.toList());
296
+                    if (!ObjectUtils.isEmpty(idsExist)) {
297
+                        storeListForNation.removeIf(caxxDO -> idsExist.contains(caxxDO.getId()));
363 298
                     }
299
+                }
300
+            }
301
+        } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
302
+            List<CaxxDO> caxxDOS = caxxMapper.selectListByKqId(pageReqVO.getKqId());
303
+            if (!ObjectUtils.isEmpty(caxxDOS)) {
304
+                caxxDOS.stream().forEach(s->{
305
+                    if (s.getSjcr()!=null) {
306
+                        BigDecimal truncatedNumber = s.getSjcr().setScale(0, RoundingMode.DOWN);
307
+                        s.setSjcr(truncatedNumber);
308
+                    }
309
+                });
310
+                storeListForNation = BeanUtils.toBean(caxxDOS, StoreRespVO.class);
311
+            }
312
+        } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
313
+            storeListForNation = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), pageReqVO.getYhmc());
314
+        } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
315
+            storeListForNation = caxxMapper.selectListForSelect(pageReqVO.getKqId(), pageReqVO.getYhmc());
316
+        } else {
317
+            //国家查看省已选仓房列表
318
+            storeListForNation = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
319
+        }
320
+        return storeListForNation;
321
+    }
364 322
 
323
+    private List<StoreRespVO> getStoreListByBank(StorePageReqVO pageReqVO, String bankType) {
324
+        List<StoreRespVO> storeListForBank = new ArrayList<>();
325
+        if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
326
+            pageReqVO.setType(1);
327
+            storeListForBank = provinceMapper.getStoreListForProvince(pageReqVO);
328
+            List<StoreRespVO> storeListSelelct = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
329
+            if (!ObjectUtils.isEmpty(storeListForBank)) {
330
+                if (!ObjectUtils.isEmpty(storeListSelelct)) {
331
+                    List<Long> idsExist = storeListSelelct.stream().map(StoreRespVO::getId).collect(Collectors.toList());
332
+                    if (!ObjectUtils.isEmpty(idsExist)) {
333
+                        storeListForBank.removeIf(a -> idsExist.contains(a.getId()));
334
+                    }
365 335
                 }
366 336
             }
337
+        } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
338
+            storeListForBank = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
339
+        } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
340
+            storeListForBank = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), bankType);
341
+        } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
342
+            storeListForBank= caxxMapper.selectListForSelect(pageReqVO.getKqId(), bankType);
367 343
         }
368
-        return null;
344
+        return storeListForBank;
345
+    }
346
+
347
+    private List<StoreRespVO> getStoreListByProvince(StorePageReqVO pageReqVO) {
348
+        List<StoreRespVO> storeListForProvice = new ArrayList<>();
349
+        if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
350
+            List<CaxxDO> caxxDOS = caxxMapper.selectList(pageReqVO);
351
+            List<StoreRespVO> storeListSelect = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
352
+            if (!ObjectUtils.isEmpty(caxxDOS)) {
353
+                if (!ObjectUtils.isEmpty(storeListSelect)) {
354
+                    List<Long> idsExist = storeListSelect.stream().map(StoreRespVO::getId).collect(Collectors.toList());
355
+                    if (!ObjectUtils.isEmpty(idsExist)) {
356
+                        caxxDOS.removeIf(a -> idsExist.contains(a.getId()));
357
+                    }
358
+                }
359
+                if (!ObjectUtils.isEmpty(caxxDOS)) {
360
+                    caxxDOS.stream().forEach(s->{
361
+                        if (s.getSjcr()!=null) {
362
+                            BigDecimal truncatedNumber = s.getSjcr().setScale(0, RoundingMode.DOWN);
363
+                            s.setSjcr(truncatedNumber);
364
+                        }
365
+                    });
366
+                    storeListForProvice = BeanUtils.toBean(caxxDOS, StoreRespVO.class);
367
+                }
368
+            }
369
+        } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
370
+            storeListForProvice = provinceMapper.getStoreListForProvinceOnly(pageReqVO.getKqId(), 0);
371
+        } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
372
+            storeListForProvice = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), pageReqVO.getYhmc());
373
+        } else if (YXZT.SELECT.getCode().equals(pageReqVO.getYxcf())) {
374
+            storeListForProvice = caxxMapper.selectListForSelect(pageReqVO.getKqId(), pageReqVO.getYhmc());
375
+        }
376
+        return storeListForProvice;
369 377
     }
370 378
 
371 379
     @Override