Commit 7b5466a5 by 何文超

bugfix

parent 17d3d2ff
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<gic-thirdparty-sdk>4.0-SNAPSHOT</gic-thirdparty-sdk> <gic-thirdparty-sdk>4.0-SNAPSHOT</gic-thirdparty-sdk>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data> <gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
<gic-goods-api>4.0-SNAPSHOT</gic-goods-api> <gic-goods-api>4.0-SNAPSHOT</gic-goods-api>
<gic-mall-api>4.0-SNAPSHOT</gic-mall-api>
<gic-mall-share-api>4.0-SNAPSHOT</gic-mall-share-api> <gic-mall-share-api>4.0-SNAPSHOT</gic-mall-share-api>
<gic-member-config-api>4.0-SNAPSHOT</gic-member-config-api> <gic-member-config-api>4.0-SNAPSHOT</gic-member-config-api>
</properties> </properties>
...@@ -160,6 +161,12 @@ ...@@ -160,6 +161,12 @@
<artifactId>gic-platform-auth-api </artifactId> <artifactId>gic-platform-auth-api </artifactId>
<version>${gic-platform-auth-api} </version> <version>${gic-platform-auth-api} </version>
</dependency> </dependency>
<dependency>
<groupId>com.gic </groupId>
<artifactId>gic-mall-api </artifactId>
<version>${gic-mall-api} </version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -5,10 +5,11 @@ import com.gic.api.base.commons.ServiceResponse; ...@@ -5,10 +5,11 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.goods.api.dto.GoodsCordDTO; import com.gic.goods.api.dto.GoodsCordDTO;
import com.gic.goods.api.dto.SpecCordDTO;
import com.gic.goods.api.service.CordApiService; import com.gic.goods.api.service.CordApiService;
import com.gic.goods.api.service.MallGoodsBusinessApiService; import com.gic.goods.api.service.MallGoodsBusinessApiService;
import com.gic.goods.api.util.Constant; import com.gic.goods.api.util.Constant;
import com.gic.mall.api.dto.goods.MallGoodsCordDTO;
import com.gic.mall.api.service.MallCordApiService;
import com.gic.mall.base.api.enums.ErrorCodeEnums; import com.gic.mall.base.api.enums.ErrorCodeEnums;
import com.gic.mall.share.api.dto.shop.ShopDTO; import com.gic.mall.share.api.dto.shop.ShopDTO;
import com.gic.mall.share.api.service.ShopApiService; import com.gic.mall.share.api.service.ShopApiService;
...@@ -46,6 +47,9 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -46,6 +47,9 @@ public class AppletConfigGoodsController extends BaseGoodsController {
private CordApiService cordApiService; private CordApiService cordApiService;
@Autowired @Autowired
private MallCordApiService mallCordApiService;
@Autowired
private ShopApiService shopApiService; private ShopApiService shopApiService;
@Autowired @Autowired
...@@ -65,7 +69,6 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -65,7 +69,6 @@ public class AppletConfigGoodsController extends BaseGoodsController {
@RequestMapping("get-mall-cord-list") @RequestMapping("get-mall-cord-list")
public RestResponse getMallCordList(String appConfigId, Long shopId) { public RestResponse getMallCordList(String appConfigId, Long shopId) {
Long areaId = null;
if (StringUtils.isNotBlank(appConfigId)) { if (StringUtils.isNotBlank(appConfigId)) {
ServiceResponse<AppletsConfigSimpleOutputDTO> appServiceResponse = appletsConfigApiService.selectAppletsConfigIdByAppId(appConfigId, getEnterpriseId()); ServiceResponse<AppletsConfigSimpleOutputDTO> appServiceResponse = appletsConfigApiService.selectAppletsConfigIdByAppId(appConfigId, getEnterpriseId());
if (appServiceResponse.getResult() == null) { if (appServiceResponse.getResult() == null) {
...@@ -75,15 +78,9 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -75,15 +78,9 @@ public class AppletConfigGoodsController extends BaseGoodsController {
if (shopDTOServiceResponse.getResult() == null) { if (shopDTOServiceResponse.getResult() == null) {
return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺"); return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺");
} }
areaId = shopDTOServiceResponse.getResult().getAreaId(); shopId = shopDTOServiceResponse.getResult().getAreaId();
} else if (shopId != null) {
ServiceResponse<ShopDTO> shopDTOServiceResponse = shopApiService.getShopDetailsById(shopId, getEnterpriseId());
if (shopDTOServiceResponse.getResult() == null) {
return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺");
}
areaId = shopDTOServiceResponse.getResult().getAreaId();
} }
ServiceResponse<List<SpecCordDTO>> listServiceResponse = cordApiService.listSpecCordDTO(areaId, getEnterpriseId()); ServiceResponse<List<MallGoodsCordDTO>> listServiceResponse = mallCordApiService.listSpecCordDTO(shopId, getEnterpriseId());
return RestResponse return RestResponse
.success(EntityUtil.changeEntityListByOrika(MallGoodsCordVO.class, listServiceResponse.getResult())); .success(EntityUtil.changeEntityListByOrika(MallGoodsCordVO.class, listServiceResponse.getResult()));
} }
...@@ -102,7 +99,6 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -102,7 +99,6 @@ public class AppletConfigGoodsController extends BaseGoodsController {
public RestResponse listGoodsByChannel(@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage, public RestResponse listGoodsByChannel(@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize, String appConfigId, String search, Long cordId, @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize, String appConfigId, String search, Long cordId,
Long shopId) { Long shopId) {
Long areaId = null;
if (StringUtils.isNotBlank(appConfigId)) { if (StringUtils.isNotBlank(appConfigId)) {
ServiceResponse<AppletsConfigSimpleOutputDTO> appServiceResponse = appletsConfigApiService.selectAppletsConfigIdByAppId(appConfigId, getEnterpriseId()); ServiceResponse<AppletsConfigSimpleOutputDTO> appServiceResponse = appletsConfigApiService.selectAppletsConfigIdByAppId(appConfigId, getEnterpriseId());
if (appServiceResponse.getResult() == null) { if (appServiceResponse.getResult() == null) {
...@@ -113,13 +109,10 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -113,13 +109,10 @@ public class AppletConfigGoodsController extends BaseGoodsController {
if (shopDTOServiceResponse.getResult() == null) { if (shopDTOServiceResponse.getResult() == null) {
return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺"); return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺");
} }
areaId = shopDTOServiceResponse.getResult().getAreaId(); shopId = shopDTOServiceResponse.getResult().getId();
} else if (shopId != null) { }
ServiceResponse<ShopDTO> shopDTOServiceResponse = shopApiService.getShopDetailsById(shopId, getEnterpriseId()); if (shopId == null) {
if (shopDTOServiceResponse.getResult() == null) { return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺");
return RestResponse.failure(ErrorCodeEnums.MAll_ERR.getCode(), "不存在店铺");
}
areaId = shopDTOServiceResponse.getResult().getAreaId();
} }
JSONObject cordJSON = null; JSONObject cordJSON = null;
if (cordId != null) { if (cordId != null) {
...@@ -132,8 +125,8 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -132,8 +125,8 @@ public class AppletConfigGoodsController extends BaseGoodsController {
cordJSON = QueryConditionAssemblyUtil.createSimpleQueryNode("cordId", cordJSON = QueryConditionAssemblyUtil.createSimpleQueryNode("cordId",
OperateEnum.OPERATE_CONTAIN, Joiner.on(" ").join(cordList)); OperateEnum.OPERATE_CONTAIN, Joiner.on(" ").join(cordList));
} }
ServiceResponse<ESResponseQueryBatchDTO> serviceResponse = searchGoods(currentPage, pageSize, areaId, search, ServiceResponse<ESResponseQueryBatchDTO> serviceResponse = searchGoods(currentPage, pageSize, null, shopId, search,
Constant.CHANNEL_CODE_MALL, cordJSON); Constant.CHANNEL_CODE_MALL, cordJSON, 1);
if (serviceResponse.isSuccess()) { if (serviceResponse.isSuccess()) {
List<Long> goodsIds = new ArrayList<>(); List<Long> goodsIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(serviceResponse.getResult().getRes())) { if (CollectionUtils.isNotEmpty(serviceResponse.getResult().getRes())) {
...@@ -202,8 +195,8 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -202,8 +195,8 @@ public class AppletConfigGoodsController extends BaseGoodsController {
OperateEnum.OPERATE_LTE, endStock, queryObject, OperateEnum.OPERATE_AND); OperateEnum.OPERATE_LTE, endStock, queryObject, OperateEnum.OPERATE_AND);
} }
} }
ServiceResponse<ESResponseQueryBatchDTO> serviceResponse = searchGoods(currentPage, pageSize, null, search, ServiceResponse<ESResponseQueryBatchDTO> serviceResponse = searchGoods(currentPage, pageSize, null, null , search,
channelCode, queryObject); channelCode, queryObject, 1);
if (serviceResponse.isSuccess()) { if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult()); return RestResponse.success(serviceResponse.getResult());
} }
...@@ -229,14 +222,29 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -229,14 +222,29 @@ public class AppletConfigGoodsController extends BaseGoodsController {
} }
//type 1商城本体 2商品资料
private ServiceResponse<ESResponseQueryBatchDTO> searchGoods(Integer currentPage, Integer pageSize, private ServiceResponse<ESResponseQueryBatchDTO> searchGoods(Integer currentPage, Integer pageSize,
Long goodsDomainId, String search, String channelCode, JSONObject queryObject) { Long goodsDomainId, Long shopId, String search, String channelCode,
JSONObject queryObject, int type) {
DynamicSearchDTO searchDTO = new DynamicSearchDTO(); DynamicSearchDTO searchDTO = new DynamicSearchDTO();
String searchCode = ""; String searchCode = "";
if (Constant.CHANNEL_CODE_MALL.equals(channelCode)) { JSONObject status = new JSONObject();
searchCode = "gic_mall_goods"; if (type == 1) {
} else if (Constant.CHANNEL_CODE_ERP.equals(channelCode)) { if (Constant.CHANNEL_CODE_MALL.equals(channelCode)) {
searchCode = "erp_goods"; searchCode = "gic_mall_goods";
} else if (Constant.CHANNEL_CODE_ERP.equals(channelCode)) {
searchCode = "erp_goods";
}
} else if (type == 2) {
if (Constant.CHANNEL_CODE_MALL.equals(channelCode)) {
searchCode = "gic_mall_goods_self";
}
if (!Objects.equals(Constant.CHANNEL_CODE_ERP, channelCode)) {
status = QueryConditionAssemblyUtil.createSimpleQueryNode("status", OperateEnum.OPERATE_EQ, 2);
}
if (Constant.CHANNEL_CODE_MALL.equals(channelCode)) {
status = QueryConditionAssemblyUtil.addQueryNodeForSiblin(status, QueryConditionAssemblyUtil.createSimpleQueryNode("upShelfTime", OperateEnum.OPERATE_LTE, new Date().getTime()), OperateEnum.OPERATE_AND);
}
} }
String enterpriseId = getEnterpriseId() + ""; String enterpriseId = getEnterpriseId() + "";
String esName = esScreeningSearchService.getCurrentEsName(enterpriseId, searchCode); String esName = esScreeningSearchService.getCurrentEsName(enterpriseId, searchCode);
...@@ -247,20 +255,20 @@ public class AppletConfigGoodsController extends BaseGoodsController { ...@@ -247,20 +255,20 @@ public class AppletConfigGoodsController extends BaseGoodsController {
searchDTO.setBegin((currentPage - 1) * pageSize); searchDTO.setBegin((currentPage - 1) * pageSize);
searchDTO.setRecordNumber(pageSize); searchDTO.setRecordNumber(pageSize);
JSONObject jsonObject = null; JSONObject jsonObject = null;
JSONObject status = new JSONObject(); if (shopId == null && goodsDomainId == null) {
if (!Objects.equals(Constant.CHANNEL_CODE_ERP, channelCode)) {
status = QueryConditionAssemblyUtil.createSimpleQueryNode("status", OperateEnum.OPERATE_EQ, 2);
}
if (Constant.CHANNEL_CODE_MALL.equals(channelCode)) {
status = QueryConditionAssemblyUtil.addQueryNodeForSiblin(status, QueryConditionAssemblyUtil.createSimpleQueryNode("upShelfTime", OperateEnum.OPERATE_LTE, new Date().getTime()), OperateEnum.OPERATE_AND);
}
if (goodsDomainId == null) {
jsonObject = status; jsonObject = status;
} else { }
if (goodsDomainId != null) {
jsonObject = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsDomainId", jsonObject = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsDomainId",
OperateEnum.OPERATE_EQ, goodsDomainId); OperateEnum.OPERATE_EQ, goodsDomainId);
jsonObject = QueryConditionAssemblyUtil.addQueryNodeForSiblin(status, jsonObject, OperateEnum.OPERATE_AND); jsonObject = QueryConditionAssemblyUtil.addQueryNodeForSiblin(status, jsonObject, OperateEnum.OPERATE_AND);
} }
if (shopId != null) {
jsonObject = QueryConditionAssemblyUtil.createSimpleQueryNode("shopId",
OperateEnum.OPERATE_EQ, shopId);
jsonObject = QueryConditionAssemblyUtil.addQueryNodeForSiblin(status, jsonObject, OperateEnum.OPERATE_AND);
}
if (StringUtils.isNotBlank(search)) { if (StringUtils.isNotBlank(search)) {
JSONObject goodsCodeJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsCode", JSONObject goodsCodeJson = QueryConditionAssemblyUtil.createSimpleQueryNode("goodsCode",
OperateEnum.OPERATE_LIKE, search); OperateEnum.OPERATE_LIKE, search);
......
...@@ -60,4 +60,5 @@ ...@@ -60,4 +60,5 @@
<dubbo:reference interface="com.gic.auth.service.UserResourceApiService" id="userResourceApiService" timeout="10000" retries="0" /> <dubbo:reference interface="com.gic.auth.service.UserResourceApiService" id="userResourceApiService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.auth.service.ResourceApiService" id="resourceApiService" timeout="10000" retries="0" /> <dubbo:reference interface="com.gic.auth.service.ResourceApiService" id="resourceApiService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.store.service.StoreTagApiService" id="storeTagApiService" timeout="10000" retries="0" /> <dubbo:reference interface="com.gic.store.service.StoreTagApiService" id="storeTagApiService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.mall.api.service.MallCordApiService" id="mallCordApiService" timeout="10000" retries="0" />
</beans> </beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment