Sfoglia il codice sorgente

优化和商城的对接

wuxw 1 anno fa
parent
commit
c1241ae082

+ 45 - 0
service-common/src/main/java/com/java110/common/bmo/mall/impl/GetFreeCommunitysImpl.java

@@ -0,0 +1,45 @@
+package com.java110.common.bmo.mall.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.bmo.mall.IMallCommonApiBmo;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.dto.community.CommunityDto;
+import com.java110.intf.community.ICommunityInnerServiceSMO;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("getFreeCommunitysImpl")
+public class GetFreeCommunitysImpl implements IMallCommonApiBmo {
+
+    @Autowired
+    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(ICmdDataFlowContext context, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "areaCode", "未包含地区");
+
+    }
+
+    @Override
+    public void doCmd(ICmdDataFlowContext context, JSONObject reqJson) {
+
+        JSONArray notInCommunityId = reqJson.getJSONArray("notInCommunityId");
+
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setCityCode(reqJson.getString("areaCode"));
+        if (!ListUtil.isNull(notInCommunityId)) {
+            communityDto.setNotInCommunityId(notInCommunityId.toArray(new String[notInCommunityId.size()]));
+        }
+
+        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+
+        context.setResponseEntity(ResultVo.createResponseEntity(communityDtos));
+
+    }
+}

+ 1 - 1
service-common/src/main/java/com/java110/common/cmd/mall/OpenCommonApiCmd.java

@@ -38,7 +38,7 @@ public class OpenCommonApiCmd extends Cmd {
 
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
-        mallCommonApiBmoImpl = ApplicationContextFactory.getBean(reqJson.getString("iotApiCode"), IMallCommonApiBmo.class);
+        mallCommonApiBmoImpl = ApplicationContextFactory.getBean(reqJson.getString("mallApiCode"), IMallCommonApiBmo.class);
         if (mallCommonApiBmoImpl == null) {
             throw new CmdException("未实现该能力");
         }