|
|
@@ -1,27 +1,22 @@
|
|
|
-package com.java110.api.listener.notice;
|
|
|
+package com.java110.community.cmd.notice;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.java110.api.listener.AbstractServiceApiListener;
|
|
|
-import com.java110.core.annotation.Java110Listener;
|
|
|
-import com.java110.core.context.DataFlowContext;
|
|
|
-import com.java110.core.event.service.api.ServiceDataFlowEvent;
|
|
|
+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.FloorDto;
|
|
|
import com.java110.dto.RoomDto;
|
|
|
import com.java110.dto.community.CommunityDto;
|
|
|
import com.java110.dto.notice.NoticeDto;
|
|
|
import com.java110.dto.unit.FloorAndUnitDto;
|
|
|
-import com.java110.intf.community.ICommunityInnerServiceSMO;
|
|
|
-import com.java110.intf.community.IFloorInnerServiceSMO;
|
|
|
-import com.java110.intf.community.INoticeInnerServiceSMO;
|
|
|
-import com.java110.intf.community.IRoomInnerServiceSMO;
|
|
|
-import com.java110.intf.community.IUnitInnerServiceSMO;
|
|
|
-import com.java110.utils.constant.ServiceCodeConstant;
|
|
|
+import com.java110.intf.community.*;
|
|
|
+import com.java110.utils.exception.CmdException;
|
|
|
import com.java110.utils.util.BeanConvertUtil;
|
|
|
import com.java110.utils.util.StringUtil;
|
|
|
import com.java110.vo.api.notice.ApiNoticeDataVo;
|
|
|
import com.java110.vo.api.notice.ApiNoticeVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
|
@@ -30,12 +25,8 @@ import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
-
|
|
|
-/**
|
|
|
- * 查询小区侦听类
|
|
|
- */
|
|
|
-@Java110Listener("listNoticesListener")
|
|
|
-public class ListNoticesListener extends AbstractServiceApiListener {
|
|
|
+@Java110Cmd(serviceCode = "notice.listNotices")
|
|
|
+public class ListNoticesCmd extends Cmd {
|
|
|
|
|
|
@Autowired
|
|
|
private INoticeInnerServiceSMO noticeInnerServiceSMOImpl;
|
|
|
@@ -53,46 +44,26 @@ public class ListNoticesListener extends AbstractServiceApiListener {
|
|
|
private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
|
|
|
|
|
|
@Override
|
|
|
- public String getServiceCode() {
|
|
|
- return ServiceCodeConstant.SERVICE_CODE_LIST_NOTICES;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HttpMethod getHttpMethod() {
|
|
|
- return HttpMethod.GET;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public int getOrder() {
|
|
|
- return DEFAULT_ORDER;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public INoticeInnerServiceSMO getNoticeInnerServiceSMOImpl() {
|
|
|
- return noticeInnerServiceSMOImpl;
|
|
|
- }
|
|
|
-
|
|
|
- public void setNoticeInnerServiceSMOImpl(INoticeInnerServiceSMO noticeInnerServiceSMOImpl) {
|
|
|
- this.noticeInnerServiceSMOImpl = noticeInnerServiceSMOImpl;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
|
|
|
+ public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
|
super.validatePageInfo(reqJson);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
|
|
|
-
|
|
|
+ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
|
|
|
NoticeDto noticeDto = BeanConvertUtil.covertBean(reqJson, NoticeDto.class);
|
|
|
- if(!StringUtil.isEmpty("clientType") && "H5".equals(reqJson.get("clientType"))){
|
|
|
- Date day=new Date();
|
|
|
+ if (!StringUtil.isEmpty("clientType") && "H5".equals(reqJson.get("clientType"))) {
|
|
|
+ Date day = new Date();
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
noticeDto.setStartTime(df.format(day));
|
|
|
noticeDto.setEndTime(df.format(day));
|
|
|
}
|
|
|
|
|
|
+ // 多类型同时查询
|
|
|
+ if (StringUtil.isEmpty(noticeDto.getNoticeTypeCd()) && noticeDto.getNoticeTypeCd().contains(",")) {
|
|
|
+ noticeDto.setNoticeTypeCds(noticeDto.getNoticeTypeCd().split(","));
|
|
|
+ noticeDto.setNoticeTypeCd("");
|
|
|
+ }
|
|
|
+
|
|
|
int count = noticeInnerServiceSMOImpl.queryNoticesCount(noticeDto);
|
|
|
|
|
|
List<ApiNoticeDataVo> notices = null;
|
|
|
@@ -112,8 +83,7 @@ public class ListNoticesListener extends AbstractServiceApiListener {
|
|
|
|
|
|
ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiNoticeVo), HttpStatus.OK);
|
|
|
|
|
|
- context.setResponseEntity(responseEntity);
|
|
|
-
|
|
|
+ cmdDataFlowContext.setResponseEntity(responseEntity);
|
|
|
}
|
|
|
|
|
|
private void refreshNotice(List<ApiNoticeDataVo> notices) {
|