Browse Source

Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-api

dwkim 2 years ago
parent
commit
7f505fa12c

+ 2 - 0
src/main/java/com/oqpo/api/mapper/stockmng/StockMngMapper.java

@@ -45,6 +45,8 @@ public interface StockMngMapper {
45
 
45
 
46
     int updateStckMgntBaseInfo4BaseChg(@Param("userId") String userId, StckMgntBaseInfoEntity entity) throws Exception;
46
     int updateStckMgntBaseInfo4BaseChg(@Param("userId") String userId, StckMgntBaseInfoEntity entity) throws Exception;
47
 
47
 
48
+    int updateStckMgntBaseInfo4Delete(@Param("userId") String userId, StckMgntBaseInfoEntity entity) throws Exception;
49
+
48
     int insertStckMgntDtlHist(@Param("userId") String userId, StckMgntDtlHistEntity entity) throws Exception;
50
     int insertStckMgntDtlHist(@Param("userId") String userId, StckMgntDtlHistEntity entity) throws Exception;
49
 
51
 
50
     List<StckMgntBaseInfoEntity> selectStockCddGridList(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("whsId") String whsId, @Param("location") String location,
52
     List<StckMgntBaseInfoEntity> selectStockCddGridList(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("whsId") String whsId, @Param("location") String location,

+ 53 - 1
src/main/java/com/oqpo/api/service/loanmng/EasypayPaymentService.java

@@ -429,7 +429,10 @@ public class EasypayPaymentService extends CommonService {
429
                     // payInfo.setCancelDate(null);
429
                     // payInfo.setCancelDate(null);
430
                     unpaidMngMapper.insertPgKiccPayPtcl(userId, payInfo);
430
                     unpaidMngMapper.insertPgKiccPayPtcl(userId, payInfo);
431
 
431
 
432
-                    if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
432
+                    if (PayTpCd.PRE_PAY_CHARGE.getCd().equals(easypayPaymentRequest.getPayTpCd()) //
433
+                            || PayTpCd.AFTER_PRE_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 선결제/충전
434
+                        procPreChargePayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
435
+                    } else if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
433
                         procAfterPayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
436
                         procAfterPayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
434
                     }
437
                     }
435
                 } catch (Exception e) {
438
                 } catch (Exception e) {
@@ -477,6 +480,55 @@ public class EasypayPaymentService extends CommonService {
477
         }
480
         }
478
     }
481
     }
479
 
482
 
483
+    private void procPreChargePayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
484
+        // 1. 여신관리기본정보
485
+        LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());
486
+
487
+        long trscBfBal = infoEntity.getAcctBal();
488
+        long trscAfBal = infoEntity.getAcctBal() + Long.parseLong(r_amount);
489
+        // 계좌잔액 증가
490
+        infoEntity.setAcctBal(trscAfBal);
491
+        dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
492
+
493
+        // 2. 여신관리상세이력
494
+        // 2.1 입금 처리
495
+        LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
496
+        hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
497
+        hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
498
+        hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
499
+        hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
500
+        // 11:신용카드, 21:계좌이체
501
+        if ("11".equals(r_pay_type)) {
502
+            hstEntity.setMediaDvsn(MediaDvsn.CARD.getCd());
503
+        } else if ("21".equals(r_pay_type)) {
504
+            hstEntity.setMediaDvsn(MediaDvsn.ACCOUNT.getCd());
505
+        }
506
+        if (PayTpCd.PRE_PAY_CHARGE.getCd().equals(easypayPaymentRequest.getPayTpCd())) {
507
+            hstEntity.setPayType(PayType.CHARGE_PAYMENT.getCd());
508
+        } else if (PayTpCd.AFTER_PRE_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) {
509
+            hstEntity.setPayType(PayType.PRE_PAYMENT.getCd());
510
+        }
511
+        hstEntity.setTrscAmt(Long.parseLong(r_amount)); // 거래금액
512
+        hstEntity.setTrscBfBal(trscBfBal);
513
+        hstEntity.setTrscAfBal(trscAfBal);
514
+        dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
515
+
516
+        // 4. 여신관리입금처리
517
+        LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
518
+        entity.setDsptMgntNo(fnGetDealNo(21, "")); // 입금관리번호
519
+        entity.setReqDt(DateUtil.getCurrentDate());
520
+        entity.setReqTm(DateUtil.getCurrentTime());
521
+        entity.setDpstAmt(Long.parseLong(r_amount)); // 입금금액
522
+        entity.setDpstDt(entity.getReqDt()); // 입금일자
523
+        entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd());
524
+        entity.setDpstReqId(userId);
525
+        entity.setStoreId(payInfo.getStoreId());
526
+        entity.setBrandId(payInfo.getBrandId());
527
+        entity.setPoOrdNo(payInfo.getPoOrdNo());
528
+        entity.setPgId("KICC");
529
+        dsptMngMapper.insertLoanMgntDsptProcInfo(userId, entity);
530
+    }
531
+
480
     private void procAfterPayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
532
     private void procAfterPayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
481
         // 2. 여신관리기본정보
533
         // 2. 여신관리기본정보
482
         LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());
534
         LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());

+ 1 - 0
src/main/java/com/oqpo/api/service/stinfo/StoreBaseInfoService.java

@@ -74,6 +74,7 @@ public class StoreBaseInfoService extends CommonService {
74
                         .storeNm(m.getStoreNm())
74
                         .storeNm(m.getStoreNm())
75
                         .storeStCd(m.getStoreStCd())
75
                         .storeStCd(m.getStoreStCd())
76
                         .storeStNm(m.getStoreStNm())
76
                         .storeStNm(m.getStoreStNm())
77
+                        .loanDvsn(m.getLoanDvsn())      // 정산타입
77
                         .build())
78
                         .build())
78
                 .collect(Collectors.toList());
79
                 .collect(Collectors.toList());
79
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
80
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);

+ 10 - 2
src/main/java/com/oqpo/api/service/stockmng/StockBaseMngService.java

@@ -28,8 +28,16 @@ public class StockBaseMngService extends CommonService {
28
     @Transactional
28
     @Transactional
29
     public void saveStockBaseInfo(String userId, SaveStockBaseInfoRequest saveStockBaseInfoRequest) throws Exception {
29
     public void saveStockBaseInfo(String userId, SaveStockBaseInfoRequest saveStockBaseInfoRequest) throws Exception {
30
         try {
30
         try {
31
-            List<StckMgntBaseInfoEntity> list = saveStockBaseInfoRequest.toEntities(saveStockBaseInfoRequest.getGridUpdateData());
32
-            for (StckMgntBaseInfoEntity item : list) {
31
+            List<StckMgntBaseInfoEntity> deleteList = saveStockBaseInfoRequest.toEntities(saveStockBaseInfoRequest.getGridDeleteData());
32
+            for (StckMgntBaseInfoEntity item : deleteList) {
33
+                stockMngMapper.updateStckMgntBaseInfo4Delete(userId, item);
34
+            }
35
+            List<StckMgntBaseInfoEntity> insertList = saveStockBaseInfoRequest.toEntities(saveStockBaseInfoRequest.getGridInsertData());
36
+            for (StckMgntBaseInfoEntity item : insertList) {
37
+                stockMngMapper.insertStckMgntBaseInfo(userId, item);
38
+            }
39
+            List<StckMgntBaseInfoEntity> updateList = saveStockBaseInfoRequest.toEntities(saveStockBaseInfoRequest.getGridUpdateData());
40
+            for (StckMgntBaseInfoEntity item : updateList) {
33
                 stockMngMapper.updateStckMgntBaseInfo4BaseChg(userId, item);
41
                 stockMngMapper.updateStckMgntBaseInfo4BaseChg(userId, item);
34
             }
42
             }
35
         } catch (GlobalException e) {
43
         } catch (GlobalException e) {

+ 3 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/SaveStockBaseInfoRequest.java

@@ -37,6 +37,7 @@ public class SaveStockBaseInfoRequest {
37
             entity.setWhsId(whsId);
37
             entity.setWhsId(whsId);
38
             entity.setLocation(location);
38
             entity.setLocation(location);
39
             entity.setItemId(x.getItemId());
39
             entity.setItemId(x.getItemId());
40
+            entity.setUnit(x.getUnit());
40
             entity.setPrpStckQty(x.getPrpStckQty());
41
             entity.setPrpStckQty(x.getPrpStckQty());
41
             entity.setSftStckRt(x.getSftStckRt());
42
             entity.setSftStckRt(x.getSftStckRt());
42
             entities.add(entity);
43
             entities.add(entity);
@@ -51,6 +52,8 @@ public class SaveStockBaseInfoRequest {
51
 
52
 
52
         @ApiModelProperty(value = "품목아이디")
53
         @ApiModelProperty(value = "품목아이디")
53
         private String itemId;
54
         private String itemId;
55
+        @ApiModelProperty(value = "단위")
56
+        private String unit;
54
         @ApiModelProperty(value = "적정재고수량")
57
         @ApiModelProperty(value = "적정재고수량")
55
         private int prpStckQty;
58
         private int prpStckQty;
56
         @ApiModelProperty(value = "안전재고비율")
59
         @ApiModelProperty(value = "안전재고비율")

+ 3 - 0
src/main/java/com/oqpo/api/web/dto/response/stinfo/store/StorePopSearchResponse.java

@@ -31,4 +31,7 @@ public class StorePopSearchResponse {
31
 
31
 
32
     @ApiModelProperty(value = "상태명")
32
     @ApiModelProperty(value = "상태명")
33
     private String storeStNm;
33
     private String storeStNm;
34
+
35
+    @ApiModelProperty(value = "정산타입")
36
+    private String loanDvsn;
34
 }
37
 }

+ 9 - 7
src/main/resources/mybatis/sqlmaps/stinfo/Store.xml

@@ -5,26 +5,28 @@
5
 
5
 
6
     <select id="selectPopStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
6
     <select id="selectPopStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
7
         select /* selectPopStoreGridList */
7
         select /* selectPopStoreGridList */
8
-               brand_id, fn_brand_nm(brand_id) as brand_nm, store_id, store_nm, store_st_cd, fn_code_nm('STORE_ST_CD',store_st_cd) as store_st_nm
9
-        from store_base_info
8
+            A.brand_id, fn_brand_nm(A.brand_id) as brand_nm,
9
+            A.store_id, A.store_nm, A.store_st_cd, fn_code_nm('STORE_ST_CD', A.store_st_cd) as store_st_nm,
10
+            A.loan_dvsn
11
+        from store_base_info A
10
         where 1=1
12
         where 1=1
11
-        and brand_id = #{sBrandId}
13
+        and A.brand_id = #{sBrandId}
12
         <if test="sStoreNm != null and sStoreNm != ''">
14
         <if test="sStoreNm != null and sStoreNm != ''">
13
-            and store_nm like concat('%',#{sStoreNm},'%')
15
+            and A.store_nm like concat('%',#{sStoreNm},'%')
14
         </if>
16
         </if>
15
         <choose>
17
         <choose>
16
             <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
18
             <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
17
                 <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
19
                 <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
18
                     <if test="gridRequest.sord == 'asc'.toString()">
20
                     <if test="gridRequest.sord == 'asc'.toString()">
19
-                        order by store_nm asc
21
+                        order by A.store_nm asc
20
                     </if>
22
                     </if>
21
                     <if test="gridRequest.sord == 'desc'.toString()">
23
                     <if test="gridRequest.sord == 'desc'.toString()">
22
-                        order by store_nm desc
24
+                        order by A.store_nm desc
23
                     </if>
25
                     </if>
24
                 </if>
26
                 </if>
25
             </when>
27
             </when>
26
             <otherwise>
28
             <otherwise>
27
-                order by store_nm asc
29
+                order by A.store_nm asc
28
             </otherwise>
30
             </otherwise>
29
         </choose>
31
         </choose>
30
         <if test="gridRequest.pagingYn == true">
32
         <if test="gridRequest.pagingYn == true">

+ 28 - 4
src/main/resources/mybatis/sqlmaps/stockmng/StockMng.xml

@@ -26,7 +26,8 @@
26
                 </if>
26
                 </if>
27
             </if>
27
             </if>
28
         </if>
28
         </if>
29
-        WHERE A.brand_id = #{sBrandId}
29
+        WHERE A.del_yn = 'N'
30
+        AND A.brand_id = #{sBrandId}
30
         <if test="sStoreId != null and sStoreId != ''">
31
         <if test="sStoreId != null and sStoreId != ''">
31
         AND C.store_id = #{sStoreId}
32
         AND C.store_id = #{sStoreId}
32
         </if>
33
         </if>
@@ -94,7 +95,8 @@
94
                 </if>
95
                 </if>
95
             </if>
96
             </if>
96
         </if>
97
         </if>
97
-        WHERE A.brand_id = #{sBrandId}
98
+        WHERE A.del_yn = 'N'
99
+        AND A.brand_id = #{sBrandId}
98
         <if test="sStoreId != null and sStoreId != ''">
100
         <if test="sStoreId != null and sStoreId != ''">
99
             AND C.store_id = #{sStoreId}
101
             AND C.store_id = #{sStoreId}
100
         </if>
102
         </if>
@@ -154,12 +156,22 @@
154
     <insert id="insertStckMgntBaseInfo" >
156
     <insert id="insertStckMgntBaseInfo" >
155
         /* StockMngMapper.insertStckMgntBaseInfo */
157
         /* StockMngMapper.insertStckMgntBaseInfo */
156
         INSERT INTO stck_mgnt_base_info
158
         INSERT INTO stck_mgnt_base_info
157
-            (brand_id, whs_id, location, item_id, unit, stck_qty, prp_stck_qty, sft_stck_rt, cur_stck_rt,
159
+            (brand_id, whs_id, location, item_id, unit, stck_qty, wait_qty, prp_stck_qty, sft_stck_rt, cur_stck_rt,
158
              sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
160
              sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
159
         VALUES
161
         VALUES
160
             (#{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId}, #{entity.unit}, #{entity.stckQty},
162
             (#{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId}, #{entity.unit}, #{entity.stckQty},
161
-             #{entity.prpStckQty}, #{entity.sftStckRt}, #{entity.curStckRt},
163
+             #{entity.waitQty}, #{entity.prpStckQty}, #{entity.sftStckRt}, #{entity.curStckRt},
162
              NOW(), #{userId}, NOW(), #{userId})
164
              NOW(), #{userId}, NOW(), #{userId})
165
+        ON DUPLICATE KEY UPDATE
166
+            unit = #{entity.unit},
167
+            stck_qty = #{entity.stckQty},
168
+            wait_qty = #{entity.waitQty},
169
+            prp_stck_qty = #{entity.prpStckQty},
170
+            sft_stck_rt = #{entity.sftStckRt},
171
+            cur_stck_rt = #{entity.curStckRt},
172
+            del_yn = 'N',
173
+            sys_chg_dttm = NOW(),
174
+            sys_chg_id = #{userId}
163
     </insert>
175
     </insert>
164
 
176
 
165
     <update id="updateStckMgntBaseInfo4StckProc" >
177
     <update id="updateStckMgntBaseInfo4StckProc" >
@@ -188,6 +200,18 @@
188
         AND item_id = #{entity.itemId}
200
         AND item_id = #{entity.itemId}
189
     </update>
201
     </update>
190
 
202
 
203
+    <update id="updateStckMgntBaseInfo4Delete" >
204
+        /* StockMngMapper.updateStckMgntBaseInfo4Delete */
205
+        UPDATE stck_mgnt_base_info SET
206
+            del_yn = 'Y',
207
+            sys_chg_dttm = NOW(),
208
+            sys_chg_id = #{userId}
209
+        WHERE brand_id = #{entity.brandId}
210
+        AND whs_id = #{entity.whsId}
211
+        AND location = #{entity.location}
212
+        AND item_id = #{entity.itemId}
213
+    </update>
214
+
191
     <insert id="insertStckMgntDtlHist" >
215
     <insert id="insertStckMgntDtlHist" >
192
         /* StockMngMapper.insertStckMgntDtlHist */
216
         /* StockMngMapper.insertStckMgntDtlHist */
193
         INSERT INTO stck_mgnt_dtl_hist
217
         INSERT INTO stck_mgnt_dtl_hist