wuxw
2024-05-09 c1241ae082adc1b58820fac045a558cd4e71cd8d
优化和商城的对接
1个文件已修改
1个文件已添加
47 ■■■■■ 已修改文件
service-common/src/main/java/com/java110/common/bmo/mall/impl/GetFreeCommunitysImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/mall/OpenCommonApiCmd.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/bmo/mall/impl/GetFreeCommunitysImpl.java
New file
@@ -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));
    }
}
service-common/src/main/java/com/java110/common/cmd/mall/OpenCommonApiCmd.java
@@ -38,7 +38,7 @@
    @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("未实现该能力");
        }