java110 лет назад: 3
Родитель
Сommit
c88e182e25

+ 9 - 0
java110-bean/src/main/java/com/java110/po/notice/NoticePo.java

@@ -26,6 +26,7 @@ public class NoticePo implements Serializable {
 
     private String state;
     private String stateName;
+    private String statusCd = "0";
 
 
     public String getNoticeId() {
@@ -123,4 +124,12 @@ public class NoticePo implements Serializable {
     public void setStateName(String stateName) {
         this.stateName = stateName;
     }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
 }

+ 160 - 0
java110-db/src/main/resources/mapper/community/NoticeV1ServiceDaoImplMapper.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="noticeV1ServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存通知信息 add by wuxw 2018-07-03 -->
+    <insert id="saveNoticeInfo" parameterType="Map">
+        insert into n_notice(
+notice_type_cd,context,obj_id,start_time,end_time,state,title,community_id,user_id,obj_type,notice_id
+) values (
+#{noticeTypeCd},#{context},#{objId},#{startTime},#{endTime},#{state},#{title},#{communityId},#{userId},#{objType},#{noticeId}
+)
+    </insert>
+
+
+
+    <!-- 查询通知信息 add by wuxw 2018-07-03 -->
+    <select id="getNoticeInfo" parameterType="Map" resultType="Map">
+        select  t.notice_type_cd,t.notice_type_cd noticeTypeCd,t.context,t.obj_id,t.obj_id objId,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time endTime,t.state,t.title,t.community_id,t.community_id communityId,t.user_id,t.user_id userId,t.obj_type,t.obj_type objType,t.notice_id,t.notice_id noticeId 
+from n_notice t 
+where 1 =1 
+<if test="noticeTypeCd !=null and noticeTypeCd != ''">
+   and t.notice_type_cd= #{noticeTypeCd}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="endTime !=null and endTime != ''">
+   and t.end_time= #{endTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="title !=null and title != ''">
+   and t.title= #{title}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="objType !=null and objType != ''">
+   and t.obj_type= #{objType}
+</if> 
+<if test="noticeId !=null and noticeId != ''">
+   and t.notice_id= #{noticeId}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改通知信息 add by wuxw 2018-07-03 -->
+    <update id="updateNoticeInfo" parameterType="Map">
+        update  n_notice t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="noticeTypeCd !=null and noticeTypeCd != ''">
+, t.notice_type_cd= #{noticeTypeCd}
+</if> 
+<if test="context !=null and context != ''">
+, t.context= #{context}
+</if> 
+<if test="objId !=null and objId != ''">
+, t.obj_id= #{objId}
+</if> 
+<if test="startTime !=null and startTime != ''">
+, t.start_time= #{startTime}
+</if> 
+<if test="endTime !=null and endTime != ''">
+, t.end_time= #{endTime}
+</if> 
+<if test="state !=null and state != ''">
+, t.state= #{state}
+</if> 
+<if test="title !=null and title != ''">
+, t.title= #{title}
+</if> 
+<if test="communityId !=null and communityId != ''">
+, t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+<if test="objType !=null and objType != ''">
+, t.obj_type= #{objType}
+</if> 
+ where 1=1 <if test="noticeId !=null and noticeId != ''">
+and t.notice_id= #{noticeId}
+</if> 
+
+    </update>
+
+    <!-- 查询通知数量 add by wuxw 2018-07-03 -->
+     <select id="queryNoticesCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from n_notice t 
+where 1 =1 
+<if test="noticeTypeCd !=null and noticeTypeCd != ''">
+   and t.notice_type_cd= #{noticeTypeCd}
+</if> 
+<if test="context !=null and context != ''">
+   and t.context= #{context}
+</if> 
+<if test="objId !=null and objId != ''">
+   and t.obj_id= #{objId}
+</if> 
+<if test="startTime !=null and startTime != ''">
+   and t.start_time= #{startTime}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="endTime !=null and endTime != ''">
+   and t.end_time= #{endTime}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="title !=null and title != ''">
+   and t.title= #{title}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="objType !=null and objType != ''">
+   and t.obj_type= #{objType}
+</if> 
+<if test="noticeId !=null and noticeId != ''">
+   and t.notice_id= #{noticeId}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/community/INoticeV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.intf.community;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.notice.NoticeDto;
+import com.java110.po.notice.NoticePo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@FeignClient(name = "community-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/noticeV1Api")
+public interface INoticeV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveNotice", method = RequestMethod.POST)
+    public int saveNotice(@RequestBody  NoticePo noticePo);
+
+    @RequestMapping(value = "/updateNotice", method = RequestMethod.POST)
+    public int updateNotice(@RequestBody  NoticePo noticePo);
+
+    @RequestMapping(value = "/deleteNotice", method = RequestMethod.POST)
+    public int deleteNotice(@RequestBody  NoticePo noticePo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param noticeDto 数据对象分享
+     * @return NoticeDto 对象数据
+     */
+    @RequestMapping(value = "/queryNotices", method = RequestMethod.POST)
+    List<NoticeDto> queryNotices(@RequestBody NoticeDto noticeDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param noticeDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryNoticesCount", method = RequestMethod.POST)
+    int queryNoticesCount(@RequestBody NoticeDto noticeDto);
+}

+ 0 - 54
service-api/src/main/java/com/java110/api/listener/notice/DeleteNoticeListener.java

@@ -1,54 +0,0 @@
-package com.java110.api.listener.notice;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.api.bmo.notice.INoticeBMO;
-import com.java110.api.listener.AbstractServiceApiPlusListener;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.core.event.service.api.ServiceDataFlowEvent;
-import com.java110.utils.constant.ServiceCodeConstant;
-import com.java110.utils.util.Assert;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpMethod;
-
-/**
- * 保存小区侦听
- * add by wuxw 2019-06-30
- */
-@Java110Listener("deleteNoticeListener")
-public class DeleteNoticeListener extends AbstractServiceApiPlusListener {
-
-    @Autowired
-    private INoticeBMO noticeBMOImpl;
-
-    @Override
-    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
-        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
-        Assert.hasKeyAndValue(reqJson, "noticeId", "公告ID不能为空");
-
-    }
-
-    @Override
-    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
-
-
-        noticeBMOImpl.deleteNotice(reqJson, context);
-
-
-    }
-
-    @Override
-    public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_DELETE_NOTICE;
-    }
-
-    @Override
-    public HttpMethod getHttpMethod() {
-        return HttpMethod.POST;
-    }
-
-    @Override
-    public int getOrder() {
-        return DEFAULT_ORDER;
-    }
-}

+ 0 - 56
service-api/src/main/java/com/java110/api/listener/notice/UpdateNoticeListener.java

@@ -1,56 +0,0 @@
-package com.java110.api.listener.notice;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.api.bmo.notice.INoticeBMO;
-import com.java110.api.listener.AbstractServiceApiPlusListener;
-import com.java110.core.annotation.Java110Listener;
-import com.java110.core.context.DataFlowContext;
-import com.java110.core.event.service.api.ServiceDataFlowEvent;
-import com.java110.utils.constant.ServiceCodeConstant;
-import com.java110.utils.util.Assert;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpMethod;
-
-/**
- * 保存公告侦听
- * add by wuxw 2019-06-30
- */
-@Java110Listener("updateNoticeListener")
-public class UpdateNoticeListener extends AbstractServiceApiPlusListener {
-
-    @Autowired
-    private INoticeBMO noticeBMOImpl;
-
-    @Override
-    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
-
-        Assert.hasKeyAndValue(reqJson, "noticeId", "公告ID不能为空");
-        Assert.hasKeyAndValue(reqJson, "title", "必填,请填写标题");
-        Assert.hasKeyAndValue(reqJson, "noticeTypeCd", "必填,请选择公告类型");
-        Assert.hasKeyAndValue(reqJson, "context", "必填,请填写公告内容");
-        Assert.hasKeyAndValue(reqJson, "startTime", "必选,请填写开始时间 2019-01-02");
-
-    }
-
-    @Override
-    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
-
-        noticeBMOImpl.updateNotice(reqJson, context);
-    }
-
-    @Override
-    public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_UPDATE_NOTICE;
-    }
-
-    @Override
-    public HttpMethod getHttpMethod() {
-        return HttpMethod.POST;
-    }
-
-    @Override
-    public int getOrder() {
-        return DEFAULT_ORDER;
-    }
-
-}

+ 71 - 0
service-community/src/main/java/com/java110/community/cmd/notice/DeleteNoticeCmd.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.cmd.notice;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.community.INoticeV1InnerServiceSMO;
+import com.java110.po.notice.NoticePo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:删除
+ * 服务编码:notice.deleteNotice
+ * 请求路劲:/app/notice.DeleteNotice
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "notice.deleteNotice")
+public class DeleteNoticeCmd extends Cmd {
+    private static Logger logger = LoggerFactory.getLogger(DeleteNoticeCmd.class);
+
+    @Autowired
+    private INoticeV1InnerServiceSMO noticeV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "noticeId", "noticeId不能为空");
+        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        NoticePo noticePo = BeanConvertUtil.covertBean(reqJson, NoticePo.class);
+        int flag = noticeV1InnerServiceSMOImpl.deleteNotice(noticePo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 64 - 33
service-api/src/main/java/com/java110/api/listener/notice/SaveNoticeListener.java

@@ -1,38 +1,67 @@
-package com.java110.api.listener.notice;
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.cmd.notice;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.api.bmo.notice.INoticeBMO;
-import com.java110.api.listener.AbstractServiceApiPlusListener;
-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.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.community.CommunityDto;
+import com.java110.dto.notice.NoticeDto;
 import com.java110.dto.org.OrgCommunityDto;
 import com.java110.dto.org.OrgDto;
 import com.java110.dto.org.OrgStaffRelDto;
 import com.java110.intf.community.ICommunityInnerServiceSMO;
+import com.java110.intf.community.INoticeV1InnerServiceSMO;
 import com.java110.intf.user.IOrgCommunityInnerServiceSMO;
 import com.java110.intf.user.IOrgInnerServiceSMO;
 import com.java110.intf.user.IOrgStaffRelInnerServiceSMO;
-import com.java110.utils.constant.ServiceCodeConstant;
+import com.java110.po.notice.NoticePo;
 import com.java110.utils.constant.StateConstant;
+import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
 import com.java110.vo.api.community.ApiCommunityDataVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpMethod;
 
 import java.util.List;
 
 /**
- * 保存小区侦听
- * add by wuxw 2019-06-30
+ * 类表述:保存
+ * 服务编码:notice.saveNotice
+ * 请求路劲:/app/notice.SaveNotice
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  */
-@Java110Listener("saveNoticeListener")
-public class SaveNoticeListener extends AbstractServiceApiPlusListener {
-    @Autowired
-    private INoticeBMO noticeBMOImpl;
+@Java110Cmd(serviceCode = "notice.saveNotice")
+public class SaveNoticeCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveNoticeCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
 
     @Autowired
     private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
@@ -46,24 +75,25 @@ public class SaveNoticeListener extends AbstractServiceApiPlusListener {
     @Autowired
     private IOrgInnerServiceSMO orgInnerServiceSMOImpl;
 
-    @Override
-    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
-        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
+    @Autowired
+    private INoticeV1InnerServiceSMO noticeV1InnerServiceSMOImpl;
 
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "title", "必填,请填写标题");
         Assert.hasKeyAndValue(reqJson, "noticeTypeCd", "必填,请选择公告类型");
         Assert.hasKeyAndValue(reqJson, "context", "必填,请填写公告内容");
         Assert.hasKeyAndValue(reqJson, "startTime", "必选,请填写开始时间 ");
         Assert.hasKeyAndValue(reqJson, "endTime", "必选,请填写结束时间 ");
 
-
     }
 
     @Override
-    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
         if (!reqJson.containsKey("isAll") || StringUtil.isEmpty(reqJson.getString("isAll")) || "N".equals(reqJson.getString("isAll"))) {
-            noticeBMOImpl.addNotice(reqJson, context);
+            addNotice(reqJson);
             return;
         }
 
@@ -110,25 +140,26 @@ public class SaveNoticeListener extends AbstractServiceApiPlusListener {
             if (reqJson.containsKey("objType") && "001".equals(reqJson.getString("objType"))) {
                 reqJson.put("objId", apiCommunityDataVo.getCommunityId());
             }
-            noticeBMOImpl.addNotice(reqJson, context);
+            addNotice(reqJson);
         }
 
 
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 
-    @Override
-    public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_SAVE_NOTICE;
-    }
+    public void addNotice(JSONObject paramInJson) {
 
-    @Override
-    public HttpMethod getHttpMethod() {
-        return HttpMethod.POST;
-    }
+        JSONObject businessNotice = new JSONObject();
+        businessNotice.putAll(paramInJson);
+        if (!paramInJson.containsKey("state")) {
+            businessNotice.put("state", NoticeDto.STATE_FINISH);
+        }
+        NoticePo noticePo = BeanConvertUtil.covertBean(businessNotice, NoticePo.class);
+        noticePo.setNoticeId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = noticeV1InnerServiceSMOImpl.saveNotice(noticePo);
 
-    @Override
-    public int getOrder() {
-        return DEFAULT_ORDER;
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
     }
-
 }

+ 78 - 0
service-community/src/main/java/com/java110/community/cmd/notice/UpdateNoticeCmd.java

@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.cmd.notice;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.community.INoticeV1InnerServiceSMO;
+import com.java110.po.notice.NoticePo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:notice.updateNotice
+ * 请求路劲:/app/notice.UpdateNotice
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "notice.updateNotice")
+public class UpdateNoticeCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(UpdateNoticeCmd.class);
+
+
+    @Autowired
+    private INoticeV1InnerServiceSMO noticeV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "noticeId", "公告ID不能为空");
+        Assert.hasKeyAndValue(reqJson, "title", "必填,请填写标题");
+        Assert.hasKeyAndValue(reqJson, "noticeTypeCd", "必填,请选择公告类型");
+        Assert.hasKeyAndValue(reqJson, "context", "必填,请填写公告内容");
+        Assert.hasKeyAndValue(reqJson, "startTime", "必选,请填写开始时间 2019-01-02");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       NoticePo noticePo = BeanConvertUtil.covertBean(reqJson, NoticePo.class);
+        int flag = noticeV1InnerServiceSMOImpl.updateNotice(noticePo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 21 - 51
service-api/src/main/java/com/java110/api/listener/room/SaveRoomListener.java

@@ -1,54 +1,35 @@
-package com.java110.api.listener.room;
+package com.java110.community.cmd.room;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.api.bmo.room.IRoomBMO;
-import com.java110.api.listener.AbstractServiceApiPlusListener;
-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.core.factory.GenerateCodeFactory;
 import com.java110.dto.RoomDto;
 import com.java110.dto.UnitDto;
+import com.java110.intf.community.IRoomV1InnerServiceSMO;
 import com.java110.intf.community.IUnitInnerServiceSMO;
-import com.java110.utils.constant.ServiceCodeConstant;
+import com.java110.po.room.RoomPo;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
-import org.slf4j.Logger;
-import com.java110.core.log.LoggerFactory;
+import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpMethod;
 
 import java.util.List;
 
-/**
- * @ClassName SaveUnitListener
- * @Description TODO 保存房屋信息
- * @Author wuxw
- * @Date 2019/5/3 11:54
- * @Version 1.0
- * add by wuxw 2019/5/3
- **/
-@Java110Listener("saveRoomListener")
-public class SaveRoomListener extends AbstractServiceApiPlusListener {
-    private static Logger logger = LoggerFactory.getLogger(SaveRoomListener.class);
+@Java110Cmd(serviceCode = "room.saveRoom")
+public class SaveRoomCmd extends Cmd {
 
-
-    @Autowired
-    private IRoomBMO roomBMOImpl;
     @Autowired
     private IUnitInnerServiceSMO unitInnerServiceSMOImpl;
 
-    @Override
-    public String getServiceCode() {
-        return ServiceCodeConstant.SERVICE_CODE_SAVE_ROOM;
-    }
-
-    @Override
-    public HttpMethod getHttpMethod() {
-        return HttpMethod.POST;
-    }
-
+    @Autowired
+    private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl;
 
     @Override
-    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId节点");
         Assert.jsonObjectHaveKey(reqJson, "unitId", "请求报文中未包含unitId节点");
         Assert.jsonObjectHaveKey(reqJson, "roomNum", "请求报文中未包含roomNum节点");
@@ -100,26 +81,15 @@ public class SaveRoomListener extends AbstractServiceApiPlusListener {
     }
 
     @Override
-    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         if ("0".equals(reqJson.getString("unitNum"))) { // 处理为商铺
             reqJson.put("roomType", RoomDto.ROOM_TYPE_SHOPS);
         } else {
             reqJson.put("roomType", RoomDto.ROOM_TYPE_ROOM);
         }
-        roomBMOImpl.addRoom(reqJson, context);
-    }
-
-
-    @Override
-    public int getOrder() {
-        return DEFAULT_ORDER;
-    }
-
-    public IUnitInnerServiceSMO getUnitInnerServiceSMOImpl() {
-        return unitInnerServiceSMOImpl;
-    }
-
-    public void setUnitInnerServiceSMOImpl(IUnitInnerServiceSMO unitInnerServiceSMOImpl) {
-        this.unitInnerServiceSMOImpl = unitInnerServiceSMOImpl;
+        reqJson.put("roomId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_roomId));
+        reqJson.put("userId", context.getReqHeaders().get(CommonConstant.HTTP_USER_ID));
+        RoomPo roomPo = BeanConvertUtil.covertBean(reqJson, RoomPo.class);
+        roomV1InnerServiceSMOImpl.saveRoom(roomPo);
     }
 }

+ 77 - 0
service-community/src/main/java/com/java110/community/dao/INoticeV1ServiceDao.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public interface INoticeV1ServiceDao {
+
+
+    /**
+     * 保存 通知信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveNoticeInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询通知信息(instance过程)
+     * 根据bId 查询通知信息
+     * @param info bId 信息
+     * @return 通知信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getNoticeInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改通知信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateNoticeInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询通知总数
+     *
+     * @param info 通知信息
+     * @return 通知数量
+     */
+    int queryNoticesCount(Map info);
+
+}

+ 112 - 0
service-community/src/main/java/com/java110/community/dao/impl/NoticeV1ServiceDaoImpl.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.community.dao.INoticeV1ServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Service("noticeV1ServiceDaoImpl")
+public class NoticeV1ServiceDaoImpl extends BaseServiceDao implements INoticeV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(NoticeV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存通知信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveNoticeInfo(Map info) throws DAOException {
+        logger.debug("保存 saveNoticeInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("noticeV1ServiceDaoImpl.saveNoticeInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询通知信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getNoticeInfo(Map info) throws DAOException {
+        logger.debug("查询 getNoticeInfo 入参 info : {}",info);
+
+        List<Map> businessNoticeInfos = sqlSessionTemplate.selectList("noticeV1ServiceDaoImpl.getNoticeInfo",info);
+
+        return businessNoticeInfos;
+    }
+
+
+    /**
+     * 修改通知信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateNoticeInfo(Map info) throws DAOException {
+        logger.debug("修改 updateNoticeInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("noticeV1ServiceDaoImpl.updateNoticeInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询通知数量
+     * @param info 通知信息
+     * @return 通知数量
+     */
+    @Override
+    public int queryNoticesCount(Map info) {
+        logger.debug("查询 queryNoticesCount 入参 info : {}",info);
+
+        List<Map> businessNoticeInfos = sqlSessionTemplate.selectList("noticeV1ServiceDaoImpl.queryNoticesCount", info);
+        if (businessNoticeInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessNoticeInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-community/src/main/java/com/java110/community/smo/impl/NoticeV1InnerServiceSMOImpl.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.smo.impl;
+
+
+import com.java110.community.dao.INoticeV1ServiceDao;
+import com.java110.intf.community.INoticeV1InnerServiceSMO;
+import com.java110.dto.notice.NoticeDto;
+import com.java110.po.notice.NoticePo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-07-22 19:20:18 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@RestController
+public class NoticeV1InnerServiceSMOImpl extends BaseServiceSMO implements INoticeV1InnerServiceSMO {
+
+    @Autowired
+    private INoticeV1ServiceDao noticeV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveNotice(@RequestBody  NoticePo noticePo) {
+        int saveFlag = noticeV1ServiceDaoImpl.saveNoticeInfo(BeanConvertUtil.beanCovertMap(noticePo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateNotice(@RequestBody  NoticePo noticePo) {
+        int saveFlag = noticeV1ServiceDaoImpl.updateNoticeInfo(BeanConvertUtil.beanCovertMap(noticePo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteNotice(@RequestBody  NoticePo noticePo) {
+       noticePo.setStatusCd("1");
+       int saveFlag = noticeV1ServiceDaoImpl.updateNoticeInfo(BeanConvertUtil.beanCovertMap(noticePo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<NoticeDto> queryNotices(@RequestBody  NoticeDto noticeDto) {
+
+        //校验是否传了 分页信息
+
+        int page = noticeDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            noticeDto.setPage((page - 1) * noticeDto.getRow());
+        }
+
+        List<NoticeDto> notices = BeanConvertUtil.covertBeanList(noticeV1ServiceDaoImpl.getNoticeInfo(BeanConvertUtil.beanCovertMap(noticeDto)), NoticeDto.class);
+
+        return notices;
+    }
+
+
+    @Override
+    public int queryNoticesCount(@RequestBody NoticeDto noticeDto) {
+        return noticeV1ServiceDaoImpl.queryNoticesCount(BeanConvertUtil.beanCovertMap(noticeDto));    }
+
+}