Your Name лет назад: 2
Родитель
Сommit
bf94c240e8

+ 53 - 0
service-user/src/main/java/com/java110/user/cmd/wechat/GetCommunityWechatAppIdCmd.java

@@ -0,0 +1,53 @@
+package com.java110.user.cmd.wechat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.wechat.SmallWeChatDto;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.WechatConstant;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * 获取小区微信AppId
+ */
+@Java110Cmd(serviceCode = "wechat.getCommunityWechatAppId")
+public class GetCommunityWechatAppIdCmd extends Cmd {
+
+    @Autowired
+    private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson,"communityId","未包含小区ID");
+        Assert.hasKeyAndValue(reqJson,"objType","未包含类型");
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+        smallWeChatDto.setObjId(reqJson.getString("communityId"));
+        smallWeChatDto.setObjType(reqJson.getString("objType"));
+        List<SmallWeChatDto> smallWeChatDtos = smallWechatV1InnerServiceSMOImpl.querySmallWechats(smallWeChatDto);
+        String appId = "";
+        //todo 读取全局
+        if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) {
+            appId = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId");
+        } else {
+            appId = smallWeChatDtos.get(0).getAppId();
+        }
+
+        context.setResponseEntity(ResultVo.createResponseEntity(appId));
+    }
+}

+ 1 - 0
springboot/src/main/java/com/java110/boot/configuration/ServiceConfiguration.java

@@ -114,6 +114,7 @@ public class ServiceConfiguration {
         exclusions.append("/app/owner.getQrcodeOwner,");// 根据二维码查询业主信息
         exclusions.append("/app/payFeeQrcode.getQrcodeOweFees,");// 根据二维码查询业主欠费
         exclusions.append("/app/wechat.getWechatMiniOpenId,");// 根据二维码查询业主欠费
+        exclusions.append("/app/wechat.getCommunityWechatAppId,");// 查询小区微信appID