Skip to content

Commit 7096abd

Browse files
author
wuxw7
committed
增加商品目录
1 parent 8047881 commit 7096abd

16 files changed

Lines changed: 796 additions & 6 deletions

File tree

ShopService/doc/savaShopCatalog.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"serviceName": "保存商品目录",
1818
"remark": "备注",
1919
"datas": {
20-
"businessShopCatalog":[{
20+
"businessShopCatalog":{
2121
"catalogId":"-1",
2222
"storeId":"123",
2323
"name":"盖浇饭",
2424
"level":"1",
2525
"parentCatalogId":"-1"
26-
}]
26+
}
2727
},
2828
"attrs": [{
2929
"specCd": "配置的字段ID",

ShopService/src/main/java/com/java110/shop/dao/IShopServiceDao.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public interface IShopServiceDao {
5858
*/
5959
public void saveBusinessShopDesc(Map businessShopDesc) throws DAOException;
6060

61+
/**
62+
* 保存商品目录信息 add by wuxw 2018-09-08
63+
* @param businessShopCatalog 商品目录
64+
* @throws DAOException
65+
*/
66+
public void saveBusinessShopCatalog(Map businessShopCatalog) throws DAOException;
67+
6168
/**
6269
* 查询商品信息(business过程)
6370
* 根据bId 查询商品信息
@@ -110,6 +117,14 @@ public interface IShopServiceDao {
110117
*/
111118
public Map getBusinessShopDesc(Map info) throws DAOException;
112119

120+
/**
121+
* 查询商品目录信息
122+
* @param info bId 信息
123+
* @return 商品目录
124+
* @throws DAOException
125+
*/
126+
public Map getBusinessShopCatalog(Map info) throws DAOException;
127+
113128
/**
114129
* 保存 商品信息 Business数据到 Instance中
115130
* @param info
@@ -154,6 +169,12 @@ public interface IShopServiceDao {
154169
*/
155170
public void saveShopDescInstance(Map info) throws DAOException;
156171

172+
/**
173+
* 保存 商品目录信息 Business数据到 Instance中
174+
* @param info
175+
* @throws DAOException
176+
*/
177+
public void saveShopCatalogInstance(Map info) throws DAOException;
157178

158179
/**
159180
* 查询商品信息(instance过程)
@@ -206,6 +227,14 @@ public interface IShopServiceDao {
206227
*/
207228
public Map getShopDesc(Map info) throws DAOException;
208229

230+
/**
231+
* 查询商品目录信息(instance 过程)
232+
* @param info bId 信息
233+
* @return 商品目录
234+
* @throws DAOException
235+
*/
236+
public Map getShopCatalog(Map info) throws DAOException;
237+
209238
/**
210239
* 修改商品信息
211240
* @param info 修改信息
@@ -250,4 +279,11 @@ public interface IShopServiceDao {
250279
*/
251280
public void updateShopDescInstance(Map info) throws DAOException;
252281

282+
/**
283+
* 修改商品目录信息
284+
* @param info 修改信息
285+
* @throws DAOException
286+
*/
287+
public void updateShopCatalogInstance(Map info) throws DAOException;
288+
253289
}

ShopService/src/main/java/com/java110/shop/dao/impl/ShopServiceDaoImpl.java

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ public void saveBusinessShopDesc(Map businessShopDesc) throws DAOException {
127127
}
128128
}
129129

130+
/**
131+
* 保存商品目录
132+
* @param businessShopCatalog 商品目录
133+
* @throws DAOException
134+
*/
135+
@Override
136+
public void saveBusinessShopCatalog(Map businessShopCatalog) throws DAOException {
137+
businessShopCatalog.put("month", DateUtil.getCurrentMonth());
138+
logger.debug("保存商品目录信息 入参 businessShopCatalog : {}",businessShopCatalog);
139+
140+
int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopCatalog",businessShopCatalog);
141+
142+
if(saveFlag < 1){
143+
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录数据失败:"+ JSONObject.toJSONString(businessShopCatalog));
144+
}
145+
}
146+
130147
/**
131148
* 查询商品信息
132149
* @param info bId 信息
@@ -236,6 +253,26 @@ public Map getBusinessShopDesc(Map info) throws DAOException {
236253
return businessShopDesces.get(0);
237254
}
238255

256+
/**
257+
* 查询商品目录
258+
* @param info bId 信息
259+
* @return
260+
* @throws DAOException
261+
*/
262+
@Override
263+
public Map getBusinessShopCatalog(Map info) throws DAOException {
264+
logger.debug("查询商品证件信息 入参 info : {}",info);
265+
266+
List<Map> businessShopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopCatalog",info);
267+
if(businessShopCatalogs == null){
268+
return null;
269+
}
270+
if(businessShopCatalogs.size() >1){
271+
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopCatalogs,"+ JSONObject.toJSONString(info));
272+
}
273+
274+
return businessShopCatalogs.get(0);
275+
}
239276

240277
/**
241278
* 保存商品信息 到 instance
@@ -313,6 +350,18 @@ public void saveShopDescInstance(Map info) throws DAOException {
313350
}
314351
}
315352

353+
@Override
354+
public void saveShopCatalogInstance(Map info) throws DAOException {
355+
logger.debug("保存商品目录信息Instance 入参 info : {}",info);
356+
357+
int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopCatalogInstance",info);
358+
359+
if(saveFlag < 1){
360+
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
361+
}
362+
}
363+
364+
316365
/**
317366
* 查询商品信息(instance)
318367
* @param info bId 信息
@@ -419,6 +468,26 @@ public Map getShopDesc(Map info) throws DAOException {
419468
return shopDesces.get(0);
420469
}
421470

471+
/**
472+
* 商品描述查询(instance)
473+
* @param info bId 信息
474+
* @return
475+
* @throws DAOException
476+
*/
477+
@Override
478+
public Map getShopCatalog(Map info) throws DAOException {
479+
logger.debug("查询商品证件信息 入参 info : {}",info);
480+
481+
List<Map> shopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopCatalog",info);
482+
if(shopCatalogs == null || shopCatalogs.size() == 0){
483+
return null;
484+
}
485+
if(shopCatalogs.size() >1){
486+
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
487+
}
488+
return shopCatalogs.get(0);
489+
}
490+
422491

423492
/**
424493
* 修改商品信息
@@ -515,4 +584,20 @@ public void updateShopDescInstance(Map info) throws DAOException {
515584
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品描述信息Instance数据失败:"+ JSONObject.toJSONString(info));
516585
}
517586
}
587+
588+
/**
589+
* 修改商品描述信息
590+
* @param info 修改信息
591+
* @throws DAOException
592+
*/
593+
@Override
594+
public void updateShopCatalogInstance(Map info) throws DAOException {
595+
logger.debug("修改商品描述信息Instance 入参 info : {}",info);
596+
597+
int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopCatalogInstance",info);
598+
599+
if(saveFlag < 1){
600+
throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
601+
}
602+
}
518603
}

ShopService/src/main/java/com/java110/shop/listener/AbstractShopBusinessServiceDataFlowListener.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ protected void flushBusinessShopDesc(Map businessShopDesc ,String statusCd){
116116
businessShopDesc.put("statusCd",statusCd);
117117
}
118118

119+
/**
120+
* 刷新 businessShopCatalog 数据
121+
* @param businessShopCatalog
122+
* @param statusCd
123+
*/
124+
protected void flushBusinessShopCatalog(Map businessShopCatalog ,String statusCd){
125+
businessShopCatalog.put("catalogId",businessShopCatalog.get("catalog_id"));
126+
businessShopCatalog.put("storeId",businessShopCatalog.get("store_id"));
127+
businessShopCatalog.put("parentCatalogId",businessShopCatalog.get("parent_catalog_id"));
128+
businessShopCatalog.put("newBId",businessShopCatalog.get("b_id"));
129+
businessShopCatalog.put("statusCd",statusCd);
130+
}
131+
132+
119133
/**
120134
* 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
121135
* @param businessShop 商户信息
@@ -260,4 +274,27 @@ protected void autoSaveDelBusinessShopDesc(Business business,JSONObject business
260274
currentShopDesc.put("operate",StatusConstant.OPERATE_DEL);
261275
getShopServiceDaoImpl().saveBusinessShopDesc(currentShopDesc);
262276
}
277+
278+
/**
279+
* 商品目录 自动刷 DEL数据
280+
* @param business
281+
* @param businessShopCalalog
282+
*/
283+
protected void autoSaveDelBusinessShopCatalog(Business business,JSONObject businessShopCalalog){
284+
Map info = new HashMap();
285+
info.put("catalogId",businessShopCalalog.getString("catalogId"));
286+
info.put("storeId",businessShopCalalog.getString("storeId"));
287+
info.put("statusCd",StatusConstant.STATUS_CD_VALID);
288+
Map currentShopCatalog = getShopServiceDaoImpl().getShopCatalog(info);
289+
if(currentShopCatalog == null || currentShopCatalog.isEmpty()){
290+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
291+
}
292+
293+
currentShopCatalog.put("bId",business.getbId());
294+
currentShopCatalog.put("catalogId",currentShopCatalog.get("catalog_id"));
295+
currentShopCatalog.put("storeId",currentShopCatalog.get("store_id"));
296+
currentShopCatalog.put("parentCatalogId",currentShopCatalog.get("parent_catalog_id"));
297+
currentShopCatalog.put("operate",StatusConstant.OPERATE_DEL);
298+
getShopServiceDaoImpl().saveBusinessShopCatalog(currentShopCatalog);
299+
}
263300
}

0 commit comments

Comments
 (0)