Przeglądaj źródła

优化 业主倒序

java110 5 lat temu
rodzic
commit
37794c8d0a

+ 1 - 0
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -203,6 +203,7 @@
                 #{item}
             </foreach>
         </if>
+        order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>

+ 1 - 1
service-api/src/main/java/com/java110/api/listener/smallWeChat/ListSmallWeChatsListener.java

@@ -61,7 +61,7 @@ public class ListSmallWeChatsListener extends AbstractServiceApiListener {
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
-        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
+        //Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
     }
 
     @Override

+ 35 - 0
service-front/src/main/java/com/java110/front/smo/ownerLogin/impl/OwnerAppLoginSMOImpl.java

@@ -7,6 +7,7 @@ import com.java110.core.context.IPageData;
 import com.java110.core.context.PageData;
 import com.java110.core.factory.AuthenticationFactory;
 import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.dto.user.UserDto;
 import com.java110.front.properties.WechatAuthProperties;
 import com.java110.front.smo.ownerLogin.IOwnerAppLoginSMO;
@@ -18,6 +19,7 @@ import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.exception.SMOException;
 import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
@@ -177,6 +179,15 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
         JSONObject param = JSONObject.parseObject(paramStr);
         String redirectUrl = param.getString("redirectUrl");
         String errorUrl = param.getString("errorUrl");
+        SmallWeChatDto smallWeChatDto = getSmallWechat(pd, paramIn);
+
+        if (smallWeChatDto == null) { //从配置文件中获取 小程序配置信息
+            smallWeChatDto = new SmallWeChatDto();
+            smallWeChatDto.setAppId(wechatAuthProperties.getAppId());
+            smallWeChatDto.setAppSecret(wechatAuthProperties.getSecret());
+            smallWeChatDto.setMchId(wechatAuthProperties.getMchId());
+            smallWeChatDto.setPayPassword(wechatAuthProperties.getKey());
+        }
 
 
         String url = WechatConstant.APP_GET_ACCESS_TOKEN_URL.replace("APPID", wechatAuthProperties.getWechatAppId())
@@ -449,6 +460,30 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
         return null;
     }
 
+    private SmallWeChatDto getSmallWechat(IPageData pd, JSONObject paramIn) {
+
+        ResponseEntity responseEntity = null;
+
+        pd = PageData.newInstance().builder(pd.getUserId(), "", "", pd.getReqData(),
+                "", "", "", "",
+                pd.getAppId());
+        responseEntity = this.callCenterService(restTemplate, pd, "",
+                ServiceConstant.SERVICE_API_URL + "/api/smallWeChat.listSmallWeChats?appId="
+                        + paramIn.getString("appId") + "&page=1&row=1", HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            return null;
+        }
+        JSONObject smallWechatObj = JSONObject.parseObject(responseEntity.getBody().toString());
+        JSONArray smallWeChats = smallWechatObj.getJSONArray("smallWeChats");
+
+        if (smallWeChats == null || smallWeChats.size() < 1) {
+            return null;
+        }
+
+        return BeanConvertUtil.covertBean(smallWeChats.get(0), SmallWeChatDto.class);
+    }
+
     public RestTemplate getRestTemplate() {
         return restTemplate;
     }