Skip to content

Commit 9adbbca

Browse files
author
wuxw7
committed
商户服务开发完成,待测试
1 parent da79b93 commit 9adbbca

15 files changed

Lines changed: 1339 additions & 422 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"orders": {
3+
"appId": "外系统ID,分配得到",
4+
"transactionId": "100000000020180409224736000001",
5+
"userId": "用户ID",
6+
"orderTypeCd": "订单类型,查询,受理",
7+
"requestTime": "20180409224736",
8+
"remark": "备注",
9+
"sign": "这个服务是否要求MD5签名",
10+
"attrs": [{
11+
"specCd": "配置的字段ID",
12+
"value": "具体值"
13+
}]
14+
},
15+
"business": [{
16+
"serviceCode": "delete.store.info",
17+
"serviceName": "修改商户信息",
18+
"remark": "备注",
19+
"datas": {
20+
"businessStore": {
21+
"storeId": "123456"
22+
},
23+
"businessStoreAttr": [{
24+
"storeId": "123456",
25+
"attrId":"1234546"
26+
}],
27+
"businessStorePhoto":[{
28+
"storePhotoId":"12321",
29+
"storeId": "123456"
30+
}],
31+
"businessStoreCerdentials":[{
32+
"storeCerdentialsId":"123123",
33+
"storeId": "123456"
34+
}]
35+
},
36+
"attrs": [{
37+
"specCd": "配置的字段ID",
38+
"value": "具体值"
39+
}]
40+
}]
41+
}

StoreService/doc/saveStoreInfo.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
"storeTypeCd": "M",
2828
"nearbyLandmarks": "王府井内",
2929
"mapX": "101.801909",
30-
"mapY": "36.597263",
31-
"businessStoreAttr": [{
32-
"attrId":"-1",
33-
"specCd":"1001",
34-
"value":"01"
35-
}]
30+
"mapY": "36.597263"
3631
},
32+
"businessStoreAttr": [{
33+
"storeId": "-1",
34+
"attrId":"-1",
35+
"specCd":"1001",
36+
"value":"01"
37+
}],
3738
"businessStorePhoto":[{
3839
"storePhotoId":"-1",
3940
"storeId":"-1",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"orders": {
3+
"appId": "外系统ID,分配得到",
4+
"transactionId": "100000000020180409224736000001",
5+
"userId": "用户ID",
6+
"orderTypeCd": "订单类型,查询,受理",
7+
"requestTime": "20180409224736",
8+
"remark": "备注",
9+
"sign": "这个服务是否要求MD5签名",
10+
"attrs": [{
11+
"specCd": "配置的字段ID",
12+
"value": "具体值"
13+
}]
14+
},
15+
"business": [{
16+
"serviceCode": "update.store.info",
17+
"serviceName": "修改商户信息",
18+
"remark": "备注",
19+
"datas": {
20+
"businessStore": {
21+
"storeId": "123456",
22+
"userId": "用户ID",
23+
"name": "齐天超时(王府井店)",
24+
"address": "青海省西宁市城中区129号",
25+
"password": "ERCBHDUYFJDNDHDJDNDJDHDUDHDJDDKDK",
26+
"tel": "15897089471",
27+
"storeTypeCd": "M",
28+
"nearbyLandmarks": "王府井内",
29+
"mapX": "101.801909",
30+
"mapY": "36.597263"
31+
},
32+
"businessStoreAttr": [{
33+
"storeId": "123456",
34+
"attrId":"1234546",
35+
"specCd":"1001",
36+
"value":"01"
37+
}],
38+
"businessStorePhoto":[{
39+
"storePhotoId":"12321",
40+
"storeId": "123456",
41+
"storePhotoTypeCd":"T",
42+
"photo":"12345678.jpg"
43+
}],
44+
"businessStoreCerdentials":[{
45+
"storeCerdentialsId":"123123",
46+
"storeId": "123456",
47+
"credentialsCd":"1",
48+
"value":"632126XXXXXXXX2011",
49+
"validityPeriod":"有效期,长期有效请写3000/01/01",
50+
"positivePhoto":"正面照片地址,1234567.jpg",
51+
"negativePhoto":"反面照片地址,没有不填写"
52+
}]
53+
},
54+
"attrs": [{
55+
"specCd": "配置的字段ID",
56+
"value": "具体值"
57+
}]
58+
}]
59+
}

StoreService/src/main/java/com/java110/store/dao/IStoreServiceDao.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,5 @@ public interface IStoreServiceDao {
181181
* @throws DAOException
182182
*/
183183
public void updateStoreCerdentailsInstance(Map info) throws DAOException;
184+
184185
}
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
package com.java110.store.listener;
2+
3+
import com.alibaba.fastjson.JSONObject;
4+
import com.java110.common.constant.ResponseConstant;
5+
import com.java110.common.constant.StatusConstant;
6+
import com.java110.common.exception.ListenerExecuteException;
7+
import com.java110.entity.center.Business;
8+
import com.java110.event.service.AbstractBusinessServiceDataFlowListener;
9+
import com.java110.store.dao.IStoreServiceDao;
10+
11+
import java.util.HashMap;
12+
import java.util.List;
13+
import java.util.Map;
14+
15+
/**
16+
*
17+
* 商户 服务侦听 父类
18+
* Created by wuxw on 2018/7/4.
19+
*/
20+
public abstract class AbstractStoreBusinessServiceDataFlowListener extends AbstractBusinessServiceDataFlowListener{
21+
22+
23+
/**
24+
* 获取 DAO工具类
25+
* @return
26+
*/
27+
public abstract IStoreServiceDao getStoreServiceDaoImpl();
28+
29+
/**
30+
* 刷新 businessStoreInfo 数据
31+
* 主要将 数据库 中字段和 接口传递字段建立关系
32+
* @param businessStoreInfo
33+
*/
34+
protected void flushBusinessStoreInfo(Map businessStoreInfo,String statusCd){
35+
businessStoreInfo.put("newBId",businessStoreInfo.get("b_id"));
36+
businessStoreInfo.put("storeId",businessStoreInfo.get("store_id"));
37+
businessStoreInfo.put("userId",businessStoreInfo.get("user_id"));
38+
businessStoreInfo.put("storeTypeCd",businessStoreInfo.get("store_type_cd"));
39+
businessStoreInfo.put("nearbyLandmarks",businessStoreInfo.get("nearby_landmarks"));
40+
businessStoreInfo.put("mapX",businessStoreInfo.get("map_x"));
41+
businessStoreInfo.put("mapY",businessStoreInfo.get("map_y"));
42+
businessStoreInfo.put("statusCd", statusCd);
43+
}
44+
45+
/**
46+
刷新 businessStoreAttr 数据
47+
* 主要将 数据库 中字段和 接口传递字段建立关系
48+
* @param businessStoreAttr
49+
* @param statusCd
50+
*/
51+
protected void flushBusinessStoreAttr(Map businessStoreAttr,String statusCd){
52+
businessStoreAttr.put("attrId",businessStoreAttr.get("attr_id"));
53+
businessStoreAttr.put("specCd",businessStoreAttr.get("spec_cd"));
54+
businessStoreAttr.put("storeId",businessStoreAttr.get("store_id"));
55+
businessStoreAttr.put("newBId",businessStoreAttr.get("b_id"));
56+
businessStoreAttr.put("statusCd",statusCd);
57+
}
58+
59+
/**
60+
* 刷新 businessStorePhoto 数据
61+
* @param businessStorePhoto
62+
* @param statusCd
63+
*/
64+
protected void flushBusinessStorePhoto(Map businessStorePhoto,String statusCd){
65+
businessStorePhoto.put("storeId",businessStorePhoto.get("store_id"));
66+
businessStorePhoto.put("storePhotoId",businessStorePhoto.get("store_photo_id"));
67+
businessStorePhoto.put("storePhotoTypeCd",businessStorePhoto.get("store_photo_type_cd"));
68+
businessStorePhoto.put("newBId",businessStorePhoto.get("b_id"));
69+
businessStorePhoto.put("statusCd",statusCd);
70+
}
71+
72+
/**
73+
* 刷新 businessStoreCerdentials 数据
74+
* @param businessStoreCerdentials
75+
* @param statusCd
76+
*/
77+
protected void flushBusinessStoreCredentials(Map businessStoreCerdentials ,String statusCd){
78+
businessStoreCerdentials.put("storeId",businessStoreCerdentials.get("store_id"));
79+
businessStoreCerdentials.put("storeCerdentialsId",businessStoreCerdentials.get("store_cerdentials_id"));
80+
businessStoreCerdentials.put("credentialsCd",businessStoreCerdentials.get("credentials_cd"));
81+
businessStoreCerdentials.put("validityPeriod",businessStoreCerdentials.get("validity_period"));
82+
businessStoreCerdentials.put("positivePhoto",businessStoreCerdentials.get("positive_photo"));
83+
businessStoreCerdentials.put("negativePhoto",businessStoreCerdentials.get("negative_photo"));
84+
businessStoreCerdentials.put("newBId",businessStoreCerdentials.get("b_id"));
85+
businessStoreCerdentials.put("statusCd",statusCd);
86+
}
87+
88+
/**
89+
* 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
90+
* @param businessStore 商户信息
91+
*/
92+
protected void autoSaveDelBusinessStore(Business business, JSONObject businessStore){
93+
//自动插入DEL
94+
Map info = new HashMap();
95+
info.put("storeId",businessStore.getString("storeId"));
96+
info.put("statusCd",StatusConstant.STATUS_CD_VALID);
97+
Map currentStoreInfo = getStoreServiceDaoImpl().getStoreInfo(info);
98+
if(currentStoreInfo == null || currentStoreInfo.isEmpty()){
99+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
100+
}
101+
currentStoreInfo.put("bId",business.getbId());
102+
currentStoreInfo.put("storeId",currentStoreInfo.get("store_id"));
103+
currentStoreInfo.put("userId",currentStoreInfo.get("user_id"));
104+
currentStoreInfo.put("storeTypeCd",currentStoreInfo.get("store_type_cd"));
105+
currentStoreInfo.put("nearbyLandmarks",currentStoreInfo.get("nearby_landmarks"));
106+
currentStoreInfo.put("mapX",currentStoreInfo.get("map_x"));
107+
currentStoreInfo.put("mapY",currentStoreInfo.get("map_y"));
108+
currentStoreInfo.put("operate",StatusConstant.OPERATE_DEL);
109+
getStoreServiceDaoImpl().saveBusinessStoreInfo(currentStoreInfo);
110+
}
111+
112+
/**
113+
* 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
114+
* @param business 当前业务
115+
* @param storeAttr 商户属性
116+
*/
117+
protected void autoSaveDelBusinessStoreAttr(Business business, JSONObject storeAttr){
118+
Map info = new HashMap();
119+
info.put("attrId",storeAttr.getString("attrId"));
120+
info.put("storeId",storeAttr.getString("storeId"));
121+
info.put("statusCd",StatusConstant.STATUS_CD_VALID);
122+
List<Map> currentStoreAttrs = getStoreServiceDaoImpl().getStoreAttrs(info);
123+
if(currentStoreAttrs == null || currentStoreAttrs.size() != 1){
124+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
125+
}
126+
Map currentStoreAttr = currentStoreAttrs.get(0);
127+
currentStoreAttr.put("bId",business.getbId());
128+
currentStoreAttr.put("attrId",currentStoreAttr.get("attr_id"));
129+
currentStoreAttr.put("storeId",currentStoreAttr.get("store_id"));
130+
currentStoreAttr.put("specCd",currentStoreAttr.get("spec_cd"));
131+
currentStoreAttr.put("operate",StatusConstant.OPERATE_DEL);
132+
getStoreServiceDaoImpl().saveBusinessStoreAttr(currentStoreAttr);
133+
}
134+
135+
/**
136+
* 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
137+
* @param business
138+
* @param businessStorePhoto 商户照片
139+
*/
140+
protected void autoSaveDelBusinessStorePhoto(Business business,JSONObject businessStorePhoto){
141+
Map info = new HashMap();
142+
info.put("storePhotoId",businessStorePhoto.getString("storePhotoId"));
143+
info.put("storeId",businessStorePhoto.getString("storeId"));
144+
info.put("statusCd",StatusConstant.STATUS_CD_VALID);
145+
List<Map> currentStorePhotos = getStoreServiceDaoImpl().getStorePhoto(info);
146+
if(currentStorePhotos == null || currentStorePhotos.size() != 1){
147+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
148+
}
149+
Map currentStorePhoto = currentStorePhotos.get(0);
150+
currentStorePhoto.put("bId",business.getbId());
151+
currentStorePhoto.put("storePhotoId",currentStorePhoto.get("store_photo_id"));
152+
currentStorePhoto.put("storeId",currentStorePhoto.get("store_id"));
153+
currentStorePhoto.put("storePhotoTypeCd",currentStorePhoto.get("store_photo_type_cd"));
154+
currentStorePhoto.put("operate",StatusConstant.OPERATE_DEL);
155+
getStoreServiceDaoImpl().saveBusinessStorePhoto(currentStorePhoto);
156+
}
157+
158+
/**
159+
* 当修改数据时,查询instance表中的数据 自动保存删除数据到business中
160+
* @param business
161+
* @param businessStoreCerdentials 商户证件
162+
*/
163+
protected void autoSaveDelBusinessStoreCerdentials(Business business,JSONObject businessStoreCerdentials){
164+
Map info = new HashMap();
165+
info.put("storeCerdentialsId",businessStoreCerdentials.getString("storeCerdentialsId"));
166+
info.put("storeId",businessStoreCerdentials.getString("storeId"));
167+
info.put("statusCd",StatusConstant.STATUS_CD_VALID);
168+
List<Map> currentStoreCerdentailses = getStoreServiceDaoImpl().getStoreCerdentials(info);
169+
if(currentStoreCerdentailses == null || currentStoreCerdentailses.size() != 1){
170+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info);
171+
}
172+
Map currentStoreCerdentials = currentStoreCerdentailses.get(0);
173+
174+
currentStoreCerdentials.put("bId",business.getbId());
175+
currentStoreCerdentials.put("storeCerdentialsId",currentStoreCerdentials.get("store_cerdentials_id"));
176+
currentStoreCerdentials.put("storeId",currentStoreCerdentials.get("store_id"));
177+
currentStoreCerdentials.put("credentialsCd",currentStoreCerdentials.get("credentials_cd"));
178+
currentStoreCerdentials.put("validityPeriod",currentStoreCerdentials.get("validity_period"));
179+
currentStoreCerdentials.put("positivePhoto",currentStoreCerdentials.get("positive_photo"));
180+
currentStoreCerdentials.put("negativePhoto",currentStoreCerdentials.get("negative_photo"));
181+
currentStoreCerdentials.put("operate",StatusConstant.OPERATE_DEL);
182+
getStoreServiceDaoImpl().saveBusinessStoreAttr(currentStoreCerdentials);
183+
}
184+
}

0 commit comments

Comments
 (0)