Skip to content

Commit 8d34f35

Browse files
author
wuxw7
committed
商品服务开发测试完成
1 parent de0b5d3 commit 8d34f35

17 files changed

Lines changed: 138 additions & 59 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
#### debug model prod
3+
#nohup java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar -Dspring.profiles.active=dev ShopService.jar > shop.log 2>&1 &
4+
5+
#### normal prod model
6+
#nohup java -jar -Dspring.profiles.active=prod ShopService.jar > shop.log 2>&1 &
7+
8+
#### normal test model
9+
#nohup java -jar -Dspring.profiles.active=test ShopService.jar > shop.log 2>&1 &
10+
11+
#### normal dev model
12+
nohup java -jar -Dspring.profiles.active=dev ShopService.jar > shop.log 2>&1 &
13+
14+
tail -100f shop.log

ShopService/pom.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>ShopService</artifactId>
13-
13+
<packaging>jar</packaging>
1414
<name>ShopService</name>
1515
<!-- FIXME change it to the project's website -->
1616
<url>http://www.example.com</url>
1717

1818
<properties>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
<maven.compiler.source>1.7</maven.compiler.source>
21-
<maven.compiler.target>1.7</maven.compiler.target>
2220
</properties>
2321

2422
<dependencies>
@@ -34,7 +32,6 @@
3432

3533
<build>
3634
<finalName>ShopService</finalName>
37-
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
3835
<plugins>
3936
<plugin>
4037
<groupId>org.apache.maven.plugins</groupId>
@@ -66,10 +63,9 @@
6663
<groupId>org.springframework.boot</groupId>
6764
<artifactId>spring-boot-maven-plugin</artifactId>
6865
<configuration>
69-
<mainClass>com.java110.store.ShopServiceApplicationStart</mainClass>
66+
<mainClass>com.java110.shop.ShopServiceApplicationStart</mainClass>
7067
</configuration>
7168
</plugin>
7269
</plugins>
73-
</pluginManagement>
7470
</build>
7571
</project>

ShopService/src/main/java/com/java110/shop/ShopServiceApplicationStart.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
* @date 2016年8月6日
2626
* @tag
2727
*/
28-
@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.store","com.java110.core","com.java110.cache"})
28+
@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.shop","com.java110.core","com.java110.cache"})
2929
@EnableDiscoveryClient
3030
@Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
31-
basePackages = {"com.java110.store.listener"})
31+
basePackages = {"com.java110.shop.listener"})
3232
public class ShopServiceApplicationStart {
3333

34-
private final static String LISTENER_PATH = "java110.StoreService.listeners";
34+
private final static String LISTENER_PATH = "java110.ShopService.listeners";
3535

3636
/**
3737
* 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力.

ShopService/src/main/java/com/java110/shop/api/ShopApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ShopApi extends BaseController {
2828
@Autowired
2929
IShopServiceSMO shopServiceSMOImpl;
3030

31-
@RequestMapping(path = "/storeApi/service",method= RequestMethod.GET)
31+
@RequestMapping(path = "/shopApi/service",method= RequestMethod.GET)
3232
public String serviceGet(HttpServletRequest request) {
3333
return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"不支持Get方法请求").toJSONString();
3434
}
@@ -39,7 +39,7 @@ public String serviceGet(HttpServletRequest request) {
3939
* @param request
4040
* @return
4141
*/
42-
@RequestMapping(path = "/storeApi/service",method= RequestMethod.POST)
42+
@RequestMapping(path = "/shopApi/service",method= RequestMethod.POST)
4343
public String servicePost(@RequestBody String orderInfo, HttpServletRequest request) {
4444
BusinessServiceDataFlow businessServiceDataFlow = null;
4545
JSONObject responseJson = null;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,14 +503,14 @@ public Map getShopDesc(Map info) throws DAOException {
503503
}
504504

505505
/**
506-
* 商品描述查询(instance)
506+
* 商品目录查询(instance)
507507
* @param info bId 信息
508508
* @return
509509
* @throws DAOException
510510
*/
511511
@Override
512512
public Map getShopCatalog(Map info) throws DAOException {
513-
logger.debug("查询商品证件信息 入参 info : {}",info);
513+
logger.debug("查询商品目录信息 入参 info : {}",info);
514514

515515
List<Map> shopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopCatalog",info);
516516
if(shopCatalogs == null || shopCatalogs.size() == 0){
@@ -660,7 +660,7 @@ public void updateShopDescInstance(Map info) throws DAOException {
660660
*/
661661
@Override
662662
public void updateShopCatalogInstance(Map info) throws DAOException {
663-
logger.debug("修改商品描述信息Instance 入参 info : {}",info);
663+
logger.debug("修改商品目录信息Instance 入参 info : {}",info);
664664

665665
int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopCatalogInstance",info);
666666

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public int getOrder() {
4343

4444
@Override
4545
public String getServiceCode() {
46-
return ServiceCodeConstant.SERVICE_CODE_DELETE_STORE_INFO;
46+
return ServiceCodeConstant.SERVICE_CODE_DELETE_SHOP_INFO;
4747
}
4848

4949
/**

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,14 @@ private void flushShopBuyId(JSONObject data) {
7777
String buyId = GenerateCodeFactory.getShopBuyId();
7878
JSONObject businessBuyShop = data.getJSONObject("businessBuyShop");
7979
businessBuyShop.put("buyId",buyId);
80+
81+
//刷商品属性
82+
if(data.containsKey("businessBuyShopAttr")) {
83+
JSONArray businessBuyShopAttrs = data.getJSONArray("businessBuyShopAttr");
84+
for(int businessBuyShopAttrIndex = 0;businessBuyShopAttrIndex < businessBuyShopAttrs.size();businessBuyShopAttrIndex++) {
85+
JSONObject businessBuyShopAttr = businessBuyShopAttrs.getJSONObject(businessBuyShopAttrIndex);
86+
businessBuyShopAttr.put("buyId", buyId);
87+
}
88+
}
8089
}
8190
}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business
7878
//刷新 shopPreferentialId
7979
if(data.containsKey("businessShopPreferential")){
8080
JSONObject businessShopPreferential = data.getJSONObject("businessShopPreferential");
81-
if(!businessShopPreferential.containsKey("shopPreferentialId") || businessShopPreferential.getString("shopId").startsWith("-")){
81+
if(!businessShopPreferential.containsKey("shopPreferentialId") || businessShopPreferential.getString("shopPreferentialId").startsWith("-")){
8282
businessShopPreferential.put("shopPreferentialId",GenerateCodeFactory.getShopPreferentialId());
8383
}
8484
}
@@ -118,6 +118,14 @@ private void flushShopId(JSONObject data) {
118118
businessStoreAttr.put("shopId", shopId);
119119
}
120120
}
121+
//刷商品属性
122+
if(data.containsKey("businessShopAttrParam")) {
123+
JSONArray businessShopAttrParams = data.getJSONArray("businessShopAttrParam");
124+
for(int businessShopAttrParamIndex = 0;businessShopAttrParamIndex < businessShopAttrParams.size();businessShopAttrParamIndex++) {
125+
JSONObject businessStoreAttrParam = businessShopAttrParams.getJSONObject(businessShopAttrParamIndex);
126+
businessStoreAttrParam.put("shopId", shopId);
127+
}
128+
}
121129
//刷 是商品照片 的 shopId
122130
if(data.containsKey("businessShopPhoto")) {
123131
JSONArray businessShopPhotos = data.getJSONArray("businessShopPhoto");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected void doRecover(DataFlowContext dataFlowContext, Business business) {
119119
*/
120120
private void doBusinessShopCatalog(Business business,JSONObject businessShopCatalog){
121121

122-
Assert.jsonObjectHaveKey(businessShopCatalog,"shopId","businessShopCatalog 节点下没有包含 shopId 节点");
122+
Assert.jsonObjectHaveKey(businessShopCatalog,"storeId","businessShopCatalog 节点下没有包含 storeId 节点");
123123

124124
businessShopCatalog.put("bId",business.getbId());
125125
businessShopCatalog.put("operate", StatusConstant.OPERATE_ADD);

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,21 @@ private void doBusinessShop(Business business,JSONObject businessShop){
125125

126126
Assert.jsonObjectHaveKey(businessShop,"shopId","businessShop 节点下没有包含 storeId 节点");
127127

128+
Assert.jsonObjectHaveKey(businessShop,"startDate","businessShop 节点下没有包含 startDate 节点");
129+
Assert.jsonObjectHaveKey(businessShop,"endDate","businessShop 节点下没有包含 endDate 节点");
130+
128131
businessShop.put("bId",business.getbId());
129132
businessShop.put("operate", StatusConstant.OPERATE_ADD);
130133
//对日期处理
131134
Date startDate = null;
132135
Date entDate = null;
133136
try {
134137
startDate = DateUtil.getDateFromString(businessShop.getString("startDate"), DateUtil.DATE_FORMATE_STRING_A);
135-
entDate = DateUtil.getDateFromString(businessShop.getString("entDate"), DateUtil.DATE_FORMATE_STRING_A);
138+
entDate = DateUtil.getDateFromString(businessShop.getString("endDate"), DateUtil.DATE_FORMATE_STRING_A);
136139
businessShop.put("startDate",startDate);
137-
businessShop.put("entDate",entDate);
138-
} catch (ParseException e) {
139-
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 startDate entDate 格式不正确,请填写 "
140+
businessShop.put("endDate",entDate);
141+
} catch (Exception e) {
142+
throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 startDate endDate 格式不正确,请填写 "
140143
+DateUtil.DATE_FORMATE_STRING_A +" 格式,"+businessShop);
141144
}
142145
//保存商户信息

0 commit comments

Comments
 (0)