Browse Source

修改选择分页防止空仓数量为负数;修改查看选择与备选仓房列表

lfy 2 weeks ago
parent
commit
e1df2f7b9d

+ 2 - 0
delivery-module-core/delivery-module-core-biz/src/main/java/com/unis/module/coding/controller/admin/delivery/vo/DeliveryPageReqVO.java

@@ -61,4 +61,6 @@ public class DeliveryPageReqVO extends PageParam {
61 61
     private String areaSheng;
62 62
     @Schema(description = "所选区县")
63 63
     private String areaXian;
64
+    @Schema(description = "银行名称")
65
+    private String yhmc;
64 66
 }

+ 2 - 1
delivery-module-core/delivery-module-core-biz/src/main/java/com/unis/module/coding/dal/mysql/bank/BankMapper.java

@@ -12,6 +12,7 @@ import com.unis.module.coding.controller.admin.delivery.vo.StoreRespVO;
12 12
 import com.unis.module.coding.dal.dataobject.bank.BankDO;
13 13
 import com.unis.module.coding.dal.dataobject.province.ProvinceDO;
14 14
 import org.apache.ibatis.annotations.Mapper;
15
+import org.apache.ibatis.annotations.Param;
15 16
 
16 17
 import java.util.List;
17 18
 
@@ -35,7 +36,7 @@ public interface BankMapper extends BaseMapperX<BankDO> {
35 36
                 .likeIfPresent(BankDO::getRdyhName, reqVO.getRdyhName())
36 37
                 .orderByDesc(BankDO::getId));
37 38
     }
38
-    List<StoreRespVO> getStoreListForBank( Long  kqId);
39
+    List<StoreRespVO> getStoreListForBank(@Param("kqId") Long  kqId, @Param("yhmc")String yhmc);
39 40
 
40 41
     default int deleteListByKqIdAndCaIdsAndBank(Long  kqId, List<Long> caIds,String bankType) {
41 42
         return delete(

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

@@ -237,6 +237,11 @@ public class DwxxServiceImpl implements DwxxService {
237 237
                 String[] items = roleIdsReal.split(",");
238 238
                 List<String> roleIdList = Arrays.asList(items);
239 239
                 if (roleIdList.contains(RoleIdEnum.BANK_ADMIN.getRoleId())) {
240
+                    String bankType = loginUser.getInfo().get("bankType");
241
+                    if (StringUtils.isBlank(bankType)) {
242
+                        throw exception(ERROR, "当前银行用户不存在银行信息");
243
+                    }
244
+                    pageReqVO.setYhmc(bankType);
240 245
                     page = dwxxMapper.selectWrapperPageForBank(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
241 246
                 } else {
242 247
                     page = dwxxMapper.selectWrapperPageForSheng(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
@@ -312,7 +317,7 @@ public class DwxxServiceImpl implements DwxxService {
312 317
                     }
313 318
                     if (YXZT.NOT_SELECTED.getCode().equals(pageReqVO.getYxcf())) {
314 319
                         List<StoreRespVO> storeListForBank = provinceMapper.getStoreListForProvince(pageReqVO.getKqId(), 1);
315
-                        List<StoreRespVO> storeListSelelct = bankMapper.getStoreListForBank(pageReqVO.getKqId());
320
+                        List<StoreRespVO> storeListSelelct = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
316 321
                         if (!ObjectUtils.isEmpty(storeListForBank)) {
317 322
                             if (!ObjectUtils.isEmpty(storeListSelelct)) {
318 323
                                 List<Long> idsExist = storeListSelelct.stream().map(StoreRespVO::getId).collect(Collectors.toList());
@@ -323,7 +328,7 @@ public class DwxxServiceImpl implements DwxxService {
323 328
                             return storeListForBank;
324 329
                         }
325 330
                     } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
326
-                        List<StoreRespVO> storeListForBank = bankMapper.getStoreListForBank(pageReqVO.getKqId());
331
+                        List<StoreRespVO> storeListForBank = bankMapper.getStoreListForBank(pageReqVO.getKqId(),bankType);
327 332
                         return storeListForBank;
328 333
                     } else if (YXZT.IDENTIFY.getCode().equals(pageReqVO.getYxcf())) {
329 334
                         List<StoreRespVO> storeRespVOS = caxxMapper.selectListForIdentify(pageReqVO.getKqId(), bankType);
@@ -349,7 +354,6 @@ public class DwxxServiceImpl implements DwxxService {
349 354
                             }
350 355
                             return storeListForProvice;
351 356
                         }
352
-
353 357
                     } else if (YXZT.SELECTED.getCode().equals(pageReqVO.getYxcf()) || YXZT.OPTION.getCode().equals(pageReqVO.getYxcf())) {
354 358
                         List<StoreRespVO> storeListForProvince = provinceMapper.getStoreListForProvince(pageReqVO.getKqId(), 0);
355 359
                         return storeListForProvince;

+ 1 - 1
delivery-module-core/delivery-module-core-biz/src/main/resources/mapper/bank/BankMapper.xml

@@ -21,7 +21,7 @@
21 21
                 cc.yxcf
22 22
         from  DELIVERY_CAXX cc
23 23
         join  DELIVERY_BANK bk on bk.CA_ID=cc.ID
24
-        where bk.KQ_ID=#{kqId} and   bk.deleted=0
24
+        where bk.KQ_ID=#{kqId} and   bk.deleted=0  and bk.rdyh_id = #{pageReqVO.yhmc}
25 25
         order by bk.KQ_ID desc
26 26
     </select>
27 27
 </mapper>

+ 23 - 22
delivery-module-core/delivery-module-core-biz/src/main/resources/mapper/dwxx/DwxxMapper.xml

@@ -13,12 +13,12 @@
13 13
             cd.DWMC,
14 14
             ck.KQMC,
15 15
             t1.sjcrNum,
16
-            t1.cfnum- ifnull(t2.yxcfnum, 0)  cfnum,
16
+            ifnull(t1.cfnum, 0) cfnum,
17 17
             ifnull(t2.yxcfnum, 0) yxcfnum,
18 18
             ck.xzqhdm
19 19
         from  CODING_DWXX cd
20 20
         left join coding_kqxx ck on ck.DWID=cd.id
21
-        inner join
21
+        left join
22 22
         (
23 23
                 select
24 24
                         cf.BASE_KQXX_ID,
@@ -27,11 +27,12 @@
27 27
                         ck.xzqhdm
28 28
                 from
29 29
                         CODING_CAXX cc
30
-                inner join CODING_FMXX cf on cc.id=cf.BASE_CAXX_ID
31
-                inner join CODING_KQXX ck on cc.KQID=ck.id
30
+                join CODING_FMXX cf on cc.id=cf.BASE_CAXX_ID
31
+                join CODING_KQXX ck on cc.KQID=ck.id
32 32
                 <where>
33 33
                         cf.deleted=0
34 34
                     and cf.lsxz='000'
35
+                    AND NOT EXISTS (SELECT 1  from  DELIVERY_CAXX dc   where dc.DELETED=0 AND  cc.id=dc.id)
35 36
                     <if test="pageReqVO.cflx!=null and pageReqVO.cflx!=''">
36 37
                         and cc.CFLX=#{pageReqVO.cflx}
37 38
                     </if>
@@ -49,7 +50,6 @@
49 50
                     </if>
50 51
                 </where>
51 52
                 group by cf.BASE_KQXX_ID
52
-                having  count(cf.BASE_CAXX_ID)>0
53 53
         ) t1 on t1.BASE_KQXX_ID=ck.id
54 54
         left join
55 55
         (
@@ -57,10 +57,9 @@
57 57
                 cc.KQID,
58 58
                 count(cc.id) yxcfnum,
59 59
                 ck.xzqhdm
60
-        from DELIVERY_DWXX cd
61
-        inner join DELIVERY_KQXX ck on ck.DWID=cd.id
62
-        inner join DELIVERY_CAXX cc on cc.KQID=ck.id
63
-        where cd.DELETED=0 and cc.yxcf=1 and ck.deleted=0 and  cc.deleted=0
60
+        from  DELIVERY_KQXX ck
61
+        join  DELIVERY_CAXX cc on cc.KQID=ck.id
62
+        where cc.yxcf=1 and ck.deleted=0 and  cc.deleted=0
64 63
         group by ck.id
65 64
         ) t2 on t2.KQID=ck.id
66 65
         <where>
@@ -97,19 +96,19 @@
97 96
             cd.DWMC,
98 97
             ck.KQMC,
99 98
             t1.sjcrNum,
100
-            t1.cfnum- ifnull(t2.yxcfnum, 0) cfnum,
99
+            ifnull(t1.cfnum, 0) cfnum,
101 100
             ifnull(t2.yxcfnum, 0) yxcfnum
102 101
         from  DELIVERY_DWXX cd
103 102
         left join DELIVERY_KQXX ck on ck.DWID=cd.id
104
-        inner join
103
+        left join
105 104
         (
106 105
                 select
107 106
                         cc.KQID,
108 107
                         sum(cc.SJCR) sjcrNum,
109 108
                         count(cc.ID) cfnum
110 109
                 from DELIVERY_CAXX cc
111
-                inner join DELIVERY_KQXX ck on cc.KQID=ck.id
112 110
                 <where>
111
+                     NOT EXISTS (SELECT 1  from  DELIVERY_PROVINCE dp   where dp.DELETED=0 AND  cc.id=dp.CA_ID)
113 112
                     <if test="pageReqVO.cflx!=null and pageReqVO.cflx!=''">
114 113
                         and cc.CFLX=#{pageReqVO.cflx}
115 114
                     </if>
@@ -127,7 +126,6 @@
127 126
                     </if>
128 127
                 </where>
129 128
                 group by cc.KQID
130
-                having  count(cc.ID)>0
131 129
         ) t1 on t1.KQID=ck.id
132 130
         left join
133 131
         (
@@ -178,7 +176,7 @@
178 176
             cd.DWMC,
179 177
             ck.KQMC,
180 178
             t1.sjcrNum,
181
-            t1.cfnum-ifnull(t3.yxcfnum, 0) cfnum,
179
+            ifnull(t1.cfnum, 0) cfnum,
182 180
             ifnull(t3.yxcfnum, 0) yxcfnum,
183 181
             ifnull(t2.SYNDZZC, 0) zzc,
184 182
             ifnull(t2.JLR, 0) sndjlr,
@@ -186,7 +184,7 @@
186 184
             ck.LXDH lxdh
187 185
         from  DELIVERY_DWXX cd
188 186
         join DELIVERY_KQXX ck on ck.DWID=cd.id
189
-        join
187
+        left join
190 188
         (
191 189
                 select
192 190
                         pe.KQ_ID,
@@ -195,7 +193,8 @@
195 193
                 from  DELIVERY_CAXX cc
196 194
                 join DELIVERY_PROVINCE  pe  on cc.id=pe.CA_ID
197 195
                 <where>
198
-                    pe.HY_STATE=1   and    pe.DELETED=0
196
+                    pe.HY_STATE=1  and  pe.DELETED=0
197
+                    AND NOT EXISTS (SELECT 1  from  DELIVERY_BANK bk   where bk.DELETED=0 AND  cc.id=bk.CA_ID )
199 198
                     <if test="pageReqVO.cflx!=null and pageReqVO.cflx!=''">
200 199
                         and cc.CFLX=#{pageReqVO.cflx}
201 200
                     </if>
@@ -213,7 +212,6 @@
213 212
                     </if>
214 213
                 </where>
215 214
                 group by pe.KQ_ID
216
-                having   count(cc.id)>0
217 215
         ) t1 on t1.KQ_ID=ck.id
218 216
         left join
219 217
         (
@@ -237,11 +235,14 @@
237 235
         left join
238 236
         (
239 237
         select
240
-                bk.KQ_ID,
241
-                count( distinct bk.CA_ID) yxcfnum
242
-        from  DELIVERY_BANK  bk
243
-        where bk.DELETED=0
244
-        group by bk.KQ_ID
238
+                KQ_ID,
239
+                count( distinct CA_ID) yxcfnum
240
+        from  DELIVERY_BANK
241
+        where DELETED=0
242
+        <if test="pageReqVO.yhmc!=null and pageReqVO.yhmc!=''">
243
+             and rdyh_id = #{pageReqVO.yhmc}
244
+        </if>
245
+        group by KQ_ID
245 246
         ) t3 on t3.KQ_ID=ck.id
246 247
         <where>
247 248
             cd.qyxz!='10' and cd.DELETED=0