Parcourir la source

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

dwkim il y a 2 ans
Parent
commit
c8e1f8b9f4

+ 1 - 0
src/main/java/com/oqpo/api/entity/stinfo/StoreItemUnitEntity.java

@@ -43,6 +43,7 @@ public class StoreItemUnitEntity implements Serializable {
43 43
     private String unitTargetNm;
44 44
     private String spplyId;
45 45
     private String spplyNm;
46
+    private String spplyAmt;
46 47
 
47 48
     private List<FileEntity> fileEntity ;
48 49
 }

+ 46 - 0
src/main/java/com/oqpo/api/enums/StoreDeliType.java

@@ -0,0 +1,46 @@
1
+package com.oqpo.api.enums;
2
+
3
+import com.oqpo.api.exception.GlobalException;
4
+import lombok.Getter;
5
+import lombok.Setter;
6
+
7
+public enum StoreDeliType {
8
+    
9
+    SDT01("10", "본사배송"), //
10
+    SDT02("20", "공급사배송"), //
11
+    ;
12
+
13
+    StoreDeliType(String cd, String nm) {
14
+        this.cd = cd;
15
+        this.name = nm;
16
+    }
17
+
18
+    @Getter
19
+    @Setter
20
+    private String cd;
21
+
22
+    @Getter
23
+    @Setter
24
+    private String name;
25
+
26
+    public static String getCd(String nname) {
27
+        StoreDeliType[] values = StoreDeliType.values();
28
+        for (StoreDeliType icd : values) {
29
+            if (icd.name.equals(nname)) {
30
+                return icd.cd;
31
+            }
32
+        }
33
+        return nname;
34
+    }
35
+
36
+    public static String getName(String ccd) {
37
+        StoreDeliType[] values = StoreDeliType.values();
38
+        for (StoreDeliType icd : values) {
39
+            if (icd.cd.equals(ccd)) {
40
+                return icd.name;
41
+            }
42
+        }
43
+        return ccd;
44
+    }
45
+
46
+}

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

@@ -598,7 +598,7 @@ public class ItemService extends CommonService {
598 598
         entity.setItemType(ItemType.getCd(item.getItemTypeNm()));
599 599
         entity.setBarcode(item.getBarcode());
600 600
         entity.setStoreDeliTypeNm(item.getStoreDeliTypeNm());
601
-        entity.setStoreDeliType(item.getStoreDeliTypeNm() == "본사배송" ? "10" : "20");
601
+        entity.setStoreDeliType(StoreDeliType.getCd(item.getStoreDeliTypeNm()));
602 602
         entity.setSysRegId(userId);
603 603
         entity.setSysChgId(userId);
604 604
         return entity;

+ 4 - 0
src/main/java/com/oqpo/api/web/dto/response/stinfo/itemUnit/StoreItemUnitInfoResponse.java

@@ -60,6 +60,7 @@ public class StoreItemUnitInfoResponse {
60 60
                                 .spplyUnitAmt (m.getSpplyUnitAmt() == null ? 0 :m.getSpplyUnitAmt())
61 61
                                 .spplyId(m.getSpplyId() == null ? "" : m.getSpplyId())
62 62
                                 .spplyNm(m.getSpplyNm() == null ? "" : m.getSpplyNm())
63
+                                .spplyAmt(m.getSpplyAmt() == null ? "" : m.getSpplyAmt())
63 64
                                 .build())
64 65
                         .collect(Collectors.toList()))
65 66
                 .build();
@@ -130,6 +131,9 @@ public class StoreItemUnitInfoResponse {
130 131
 
131 132
         @ApiModelProperty(value = "공급사명")
132 133
         private String spplyNm ;
134
+
135
+        @ApiModelProperty(value = "공급사대표단가")
136
+        private String spplyAmt ;
133 137
     }
134 138
 
135 139
 

+ 35 - 20
src/main/resources/mybatis/sqlmaps/stinfo/StoreItemUnit.xml

@@ -105,26 +105,41 @@
105 105
 -->
106 106
     <select id="selectStoreItemUnitInfo" resultType="com.oqpo.api.entity.stinfo.StoreItemUnitEntity">
107 107
         select /*selectStoreItemUnitInfo*/
108
-                        case when unit.store_unit_unq_no is null then 'C' else 'R' end view_cd,
109
-                        unit.store_unit_unq_no, item.brand_id, item.item_id, item.item_nm,
110
-                        case when unit.cont_stt_dt is null or unit.cont_stt_dt = '' then date_format(#{contSttDt},'%Y.%m.%d') else date_format(unit.cont_stt_dt,'%Y.%m.%d') end as cont_stt_dt,
111
-                        case when unit.cont_end_dt is null or unit.cont_end_dt = '' then date_format(#{contEndDt},'%Y.%m.%d') else date_format(unit.cont_end_dt,'%Y.%m.%d') end as cont_end_dt,
112
-                        case when unit.unit is null or  unit.unit = '' or store.loan_dvsn = 'LD03' then item.unit else unit.unit end as unit   ,
113
-                        case when unit.unit is null or  unit.unit = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT',item.unit) else fn_code_nm('DSTRBT_COST_UNIT',unit.unit) end as unit_nm   ,
114
-                        case when nvl(unit.stdd_qty,0) = 0 or store.loan_dvsn = 'LD03' then item.store_sale_stdd_qty else unit.stdd_qty end as stdd_qty  ,
115
-                        case when unit.curr is null or  unit.curr = '' or store.loan_dvsn = 'LD03' then item.curr else unit.curr end as curr,
116
-                        case when unit.curr is null or  unit.curr = '' or store.loan_dvsn = 'LD03' then fn_code_nm('CURR',item.curr) else fn_code_nm('CURR',unit.curr) end as curr_nm,
117
-                        case when unit.unit_amt is null or  unit.unit_amt = 0 or store.loan_dvsn = 'LD03' then item.store_sale_unit_amt else unit.unit_amt end as unit_amt,
118
-                        case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then 'Y' else unit.unit_target_cd end as unit_target_cd,
119
-                        case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT','Y') else  fn_code_nm('DSTRBT_COST_UNIT',unit.unit_target_cd)  end as unit_target_nm,
120
-                        nvl(item.unit_amt,0) as spply_unit_amt
121
-                        ,item.brand_unit_unq_no,item.spply_id,fn_spply_nm(item.spply_id) as spply_nm
122
-                from   brand_item_unit_info item
123
-                left outer join store_item_unit_info unit on  item.brand_unit_unq_no = unit.brand_unit_unq_no and  item.brand_id = unit.brand_id and item.item_id = unit.item_id and unit.store_id = #{storeId}
124
-                                  and unit.cont_stt_dt = #{contSttDt} and unit.cont_end_dt = #{contEndDt}
125
-                left outer join store_base_info store on unit.store_id = store.store_id and store.store_id = #{storeId}
126
-                where item.brand_id = #{brandId}
127
-                order by view_cd, item.item_id, item.unit_amt
108
+                case when unit.store_unit_unq_no is null then 'C' else 'R' end view_cd,
109
+                unit.store_unit_unq_no, item.brand_id, item.item_id, item.item_nm,
110
+                case when unit.cont_stt_dt is null or unit.cont_stt_dt = '' then date_format(#{contSttDt},'%Y.%m.%d') else date_format(unit.cont_stt_dt,'%Y.%m.%d') end as cont_stt_dt,
111
+                case when unit.cont_end_dt is null or unit.cont_end_dt = '' then date_format(#{contEndDt},'%Y.%m.%d') else date_format(unit.cont_end_dt,'%Y.%m.%d') end as cont_end_dt,
112
+                case when unit.unit is null or  unit.unit = '' or store.loan_dvsn = 'LD03' then item.unit else unit.unit end as unit   ,
113
+                case when unit.unit is null or  unit.unit = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT',item.unit) else fn_code_nm('DSTRBT_COST_UNIT',unit.unit) end as unit_nm   ,
114
+                case when nvl(unit.stdd_qty,0) = 0 or store.loan_dvsn = 'LD03' then item.store_sale_stdd_qty else unit.stdd_qty end as stdd_qty  ,
115
+                case when unit.curr is null or  unit.curr = '' or store.loan_dvsn = 'LD03' then item.curr else unit.curr end as curr,
116
+                case when unit.curr is null or  unit.curr = '' or store.loan_dvsn = 'LD03' then fn_code_nm('CURR',item.curr) else fn_code_nm('CURR',unit.curr) end as curr_nm,
117
+                case when unit.unit_amt is null or  unit.unit_amt = 0 or store.loan_dvsn = 'LD03' then item.store_sale_unit_amt else unit.unit_amt end as unit_amt,
118
+                case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then 'Y' else unit.unit_target_cd end as unit_target_cd,
119
+                case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT','Y') else  fn_code_nm('DSTRBT_COST_UNIT',unit.unit_target_cd)  end as unit_target_nm,
120
+                nvl(item.unit_amt,0) as spply_unit_amt
121
+                , item.brand_unit_unq_no,item.spply_id,fn_spply_nm(item.spply_id) as spply_nm
122
+                , spply.spply_amt
123
+        from   brand_item_unit_info item
124
+            left outer join store_item_unit_info unit 
125
+                on  item.brand_unit_unq_no = unit.brand_unit_unq_no 
126
+                and  item.brand_id = unit.brand_id 
127
+                and item.item_id = unit.item_id 
128
+                and unit.store_id = #{storeId}
129
+                and unit.cont_stt_dt = #{contSttDt} and unit.cont_end_dt = #{contEndDt}
130
+            left outer join store_base_info store 
131
+                on unit.store_id = store.store_id 
132
+                and store.store_id = #{storeId}
133
+            LEFT join ( 
134
+                SELECT brand_id, item_id, MAX(unit_amt) AS spply_amt 
135
+                FROM brand_item_unit_info 
136
+                GROUP BY brand_id, item_id 
137
+            ) spply 
138
+                ON item.brand_id=spply.brand_id 
139
+                AND item.ITEM_ID = spply.item_id  
140
+        where 
141
+            item.brand_id = #{brandId}
142
+        order by view_cd, item.item_id, item.unit_amt
128 143
     </select>
129 144
 
130 145
     <select id="selectStoreItemUnitContDateInfo" resultType="String">