|
@@ -2,6 +2,8 @@ package com.oqpo.api.service.oper;
|
2
|
2
|
|
3
|
3
|
|
4
|
4
|
import com.oqpo.api.entity.oper.AfflEntity;
|
|
5
|
+import com.oqpo.api.entity.oper.AfflSaleInfoEntity;
|
|
6
|
+import com.oqpo.api.exception.GlobalException;
|
5
|
7
|
import com.oqpo.api.mapper.oper.AfflMapper;
|
6
|
8
|
import com.oqpo.api.service.CommonService;
|
7
|
9
|
import com.oqpo.api.web.dto.request.GridRequest;
|
|
@@ -83,10 +85,68 @@ public class AfflService extends CommonService {
|
83
|
85
|
return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
|
84
|
86
|
}
|
85
|
87
|
|
|
88
|
+ /* 가맹점 정보 */
|
86
|
89
|
public AfflShopInfoResponse selectAfflShopInfo(String afflShopId) throws Exception {
|
87
|
90
|
return AfflShopInfoResponse.toDTO(afflMapper.selectAfflShopBaseInfo(afflShopId),
|
88
|
91
|
afflMapper.selectAfflSaleTargetList(afflShopId));
|
89
|
92
|
}
|
90
|
93
|
|
|
94
|
+ /* 가맹점 저장 */
|
|
95
|
+ @Transactional
|
|
96
|
+ public void saveAfflList(String userId, SaveAfflRequest saveAfflRequest) throws Exception {
|
|
97
|
+ try {
|
|
98
|
+
|
|
99
|
+ AfflEntity entity = new AfflEntity();
|
|
100
|
+ entity.setAfflShopId (saveAfflRequest.getAfflShopId());
|
|
101
|
+ entity.setAfflShopNm (saveAfflRequest.getAfflShopNm());
|
|
102
|
+ entity.setStCd (saveAfflRequest.getStCd());
|
|
103
|
+ entity.setAfflAbbr (saveAfflRequest.getAfflAbbr().replaceAll(" ",""));
|
|
104
|
+ entity.setBsnsRegNo (saveAfflRequest.getBsnsRegNo().replaceAll("-",""));
|
|
105
|
+ entity.setCorpRegNo (saveAfflRequest.getCorpRegNo().replaceAll("-",""));
|
|
106
|
+ entity.setBsnsCndt (saveAfflRequest.getBsnsCndt());
|
|
107
|
+ entity.setCtgrBsns (saveAfflRequest.getCtgrBsns());
|
|
108
|
+ entity.setOwnerNm (saveAfflRequest.getOwnerNm());
|
|
109
|
+ entity.setOwnerTelNo (saveAfflRequest.getOwnerTelNo().replaceAll("-",""));
|
|
110
|
+ entity.setRprstFaxNo (saveAfflRequest.getRprstFaxNo().replaceAll("-",""));
|
|
111
|
+ entity.setRprstEmai (saveAfflRequest.getRprstEmai());
|
|
112
|
+ entity.setZipNo (saveAfflRequest.getZipNo());
|
|
113
|
+ entity.setAddr1 (saveAfflRequest.getAddr1());
|
|
114
|
+ entity.setAddr2 (saveAfflRequest.getAddr2());
|
|
115
|
+ entity.setRprstTelNo (saveAfflRequest.getRprstTelNo().replaceAll("-",""));
|
|
116
|
+ entity.setLatX (saveAfflRequest.getLatX());
|
|
117
|
+ entity.setLongY (saveAfflRequest.getLongY());
|
|
118
|
+ entity.setRegDt (saveAfflRequest.getRegDt().replaceAll(".",""));
|
|
119
|
+ entity.setJoinSttDt (saveAfflRequest.getJoinSttDt().replaceAll(".",""));
|
|
120
|
+ entity.setJoinEndDt (saveAfflRequest.getJoinEndDt().replaceAll(".",""));
|
|
121
|
+ entity.setCmpnyLogoFileNo (saveAfflRequest.getCmpnyLogoFileNo());
|
|
122
|
+ entity.setCorpType (saveAfflRequest.getCorpType());
|
|
123
|
+
|
|
124
|
+ if ("C".equals(saveAfflRequest.getViewCd())) {
|
|
125
|
+ // 상품코드 채번
|
|
126
|
+ afflMapper.insertAfflShopBaseInfo(userId, entity);
|
|
127
|
+ } else if ("U".equals(saveAfflRequest.getViewCd())) {
|
|
128
|
+ afflMapper.updateAfflShopBaseInfo(userId, entity);
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ // 영업담당자 상세 정보 저장
|
|
132
|
+ // 신규건
|
|
133
|
+ List<AfflSaleInfoEntity> gridInsertData = saveAfflRequest.toCodeEntities(saveAfflRequest.getGridInsertData());
|
|
134
|
+ if (gridInsertData.size() > 0) {
|
|
135
|
+ afflMapper.insertAfflSaleInfo(userId, gridInsertData) ;
|
|
136
|
+ }
|
|
137
|
+ // 삭제건
|
|
138
|
+ List<AfflSaleInfoEntity> gridDeleteData = saveAfflRequest.toCodeEntities(saveAfflRequest.getGridDeleteData());
|
|
139
|
+ if (gridDeleteData.size() > 0) {
|
|
140
|
+ afflMapper.deleteUserAuth(userId, gridDeleteData) ;
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ } catch (GlobalException e) {
|
|
144
|
+ e.getStackTrace();
|
|
145
|
+ throw new GlobalException(e.getSystemMessageCode());
|
|
146
|
+ } catch (Exception e) {
|
|
147
|
+ e.getStackTrace();
|
|
148
|
+ throw new RuntimeException();
|
|
149
|
+ }
|
|
150
|
+ }
|
91
|
151
|
|
92
|
152
|
}
|