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

+ 73 - 77
java110-db/src/main/resources/mapper/user/NotepadDetailV1ServiceDaoImplMapper.xml

@@ -5,102 +5,98 @@
 <mapper namespace="notepadDetailV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存跟踪记录信息 add by wuxw 2018-07-03 -->
     <insert id="saveNotepadDetailInfo" parameterType="Map">
         insert into notepad_detail(
-create_user_id,detail_id,note_id,create_user_name,content
-) values (
-#{createUserId},#{detailId},#{noteId},#{createUserName},#{content}
-)
+        create_user_id,detail_id,note_id,create_user_name,content
+        ) values (
+        #{createUserId},#{detailId},#{noteId},#{createUserName},#{content}
+        )
     </insert>
 
 
-
     <!-- 查询跟踪记录信息 add by wuxw 2018-07-03 -->
     <select id="getNotepadDetailInfo" parameterType="Map" resultType="Map">
-        select  t.create_user_id,t.create_user_id createUserId,t.detail_id,t.detail_id detailId,t.note_id,t.note_id noteId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd statusCd,t.content 
-from notepad_detail t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="detailId !=null and detailId != ''">
-   and t.detail_id= #{detailId}
-</if> 
-<if test="noteId !=null and noteId != ''">
-   and t.note_id= #{noteId}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="content !=null and content != ''">
-   and t.content= #{content}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.create_user_id,t.create_user_id createUserId,t.detail_id,t.detail_id detailId,t.note_id,t.note_id
+        noteId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd statusCd,t.content,t.create_time createTime
+        from notepad_detail t
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
+        <if test="noteId !=null and noteId != ''">
+            and t.note_id= #{noteId}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="content !=null and content != ''">
+            and t.content= #{content}
+        </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="updateNotepadDetailInfo" parameterType="Map">
-        update  notepad_detail t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="createUserId !=null and createUserId != ''">
-, t.create_user_id= #{createUserId}
-</if> 
-<if test="noteId !=null and noteId != ''">
-, t.note_id= #{noteId}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-, t.create_user_name= #{createUserName}
-</if> 
-<if test="content !=null and content != ''">
-, t.content= #{content}
-</if> 
- where 1=1 <if test="detailId !=null and detailId != ''">
-and t.detail_id= #{detailId}
-</if> 
+        update notepad_detail t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="createUserId !=null and createUserId != ''">
+            , t.create_user_id= #{createUserId}
+        </if>
+        <if test="noteId !=null and noteId != ''">
+            , t.note_id= #{noteId}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            , t.create_user_name= #{createUserName}
+        </if>
+        <if test="content !=null and content != ''">
+            , t.content= #{content}
+        </if>
+        where 1=1
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
 
     </update>
 
     <!-- 查询跟踪记录数量 add by wuxw 2018-07-03 -->
-     <select id="queryNotepadDetailsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from notepad_detail t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="detailId !=null and detailId != ''">
-   and t.detail_id= #{detailId}
-</if> 
-<if test="noteId !=null and noteId != ''">
-   and t.note_id= #{noteId}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="content !=null and content != ''">
-   and t.content= #{content}
-</if> 
+    <select id="queryNotepadDetailsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from notepad_detail t
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
+        <if test="noteId !=null and noteId != ''">
+            and t.note_id= #{noteId}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="content !=null and content != ''">
+            and t.content= #{content}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 2 - 3
service-user/src/main/java/com/java110/user/cmd/notepadDetail/DeleteNotepadDetailCmd.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.java110.user.cmd.notepadDetail;
+package com.java110.user.cmd.notepad;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
@@ -21,7 +21,6 @@ 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.user.INotepadDetailV1InnerServiceSMO;
 import com.java110.po.notepadDetail.NotepadDetailPo;
 import com.java110.utils.exception.CmdException;
@@ -41,7 +40,7 @@ import org.slf4j.LoggerFactory;
  * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  */
-@Java110Cmd(serviceCode = "notepadDetail.deleteNotepadDetail")
+@Java110Cmd(serviceCode = "notepad.deleteNotepadDetail")
 public class DeleteNotepadDetailCmd extends Cmd {
   private static Logger logger = LoggerFactory.getLogger(DeleteNotepadDetailCmd.class);
 

+ 2 - 6
service-user/src/main/java/com/java110/user/cmd/notepadDetail/ListNotepadDetailCmd.java

@@ -13,19 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.java110.user.cmd.notepadDetail;
+package com.java110.user.cmd.notepad;
 
 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.user.INotepadDetailV1InnerServiceSMO;
-import com.java110.po.notepadDetail.NotepadDetailPo;
 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;
@@ -48,7 +44,7 @@ import org.slf4j.LoggerFactory;
  * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  */
-@Java110Cmd(serviceCode = "notepadDetail.listNotepadDetail")
+@Java110Cmd(serviceCode = "notepad.listNotepadDetail")
 public class ListNotepadDetailCmd extends Cmd {
 
   private static Logger logger = LoggerFactory.getLogger(ListNotepadDetailCmd.class);

+ 40 - 7
service-user/src/main/java/com/java110/user/cmd/notepadDetail/SaveNotepadDetailCmd.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.java110.user.cmd.notepadDetail;
+package com.java110.user.cmd.notepad;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
@@ -22,15 +22,22 @@ 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.notepad.NotepadDto;
+import com.java110.dto.user.UserDto;
 import com.java110.intf.user.INotepadDetailV1InnerServiceSMO;
+import com.java110.intf.user.INotepadV1InnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.po.notepad.NotepadPo;
 import com.java110.po.notepadDetail.NotepadDetailPo;
 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;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
 
 /**
  * 类表述:保存
@@ -42,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  */
-@Java110Cmd(serviceCode = "notepadDetail.saveNotepadDetail")
+@Java110Cmd(serviceCode = "notepad.saveNotepadDetail")
 public class SaveNotepadDetailCmd extends Cmd {
 
     private static Logger logger = LoggerFactory.getLogger(SaveNotepadDetailCmd.class);
@@ -51,21 +58,34 @@ public class SaveNotepadDetailCmd extends Cmd {
 
     @Autowired
     private INotepadDetailV1InnerServiceSMO notepadDetailV1InnerServiceSMOImpl;
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Autowired
+    private INotepadV1InnerServiceSMO notepadV1InnerServiceSMOImpl;
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "noteId", "请求报文中未包含noteId");
-Assert.hasKeyAndValue(reqJson, "content", "请求报文中未包含content");
-Assert.hasKeyAndValue(reqJson, "createUserId", "请求报文中未包含createUserId");
-Assert.hasKeyAndValue(reqJson, "createUserName", "请求报文中未包含createUserName");
+        Assert.hasKeyAndValue(reqJson, "content", "请求报文中未包含content");
 
     }
 
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+        String userId = cmdDataFlowContext.getReqHeaders().get("user-id");
+        UserDto userDto = new UserDto();
+        userDto.setUserId(userId);
+        userDto.setPage(1);
+        userDto.setRow(1);
+        List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto);
+        Assert.listOnlyOne(userDtos, "用户不存在");
+
+        reqJson.put("createUserId", userDtos.get(0).getUserId());
+        reqJson.put("createUserName", userDtos.get(0).getName());
 
-       NotepadDetailPo notepadDetailPo = BeanConvertUtil.covertBean(reqJson, NotepadDetailPo.class);
+        NotepadDetailPo notepadDetailPo = BeanConvertUtil.covertBean(reqJson, NotepadDetailPo.class);
         notepadDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
         int flag = notepadDetailV1InnerServiceSMOImpl.saveNotepadDetail(notepadDetailPo);
 
@@ -73,6 +93,19 @@ Assert.hasKeyAndValue(reqJson, "createUserName", "请求报文中未包含create
             throw new CmdException("保存数据失败");
         }
 
+        if(!NotepadDto.STATE_FINISH.equals(reqJson.getString("state"))){
+            return;
+        }
+
+        NotepadPo notepadPo = new NotepadPo();
+        notepadPo.setNoteId(reqJson.getString("noteId"));
+        notepadPo.setState(reqJson.getString("state"));
+        flag = notepadV1InnerServiceSMOImpl.updateNotepad(notepadPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 }

+ 0 - 75
service-user/src/main/java/com/java110/user/cmd/notepadDetail/UpdateNotepadDetailCmd.java

@@ -1,75 +0,0 @@
-/*
- * 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.user.cmd.notepadDetail;
-
-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.user.INotepadDetailV1InnerServiceSMO;
-import com.java110.po.notepadDetail.NotepadDetailPo;
-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;
-
-
-/**
- * 类表述:更新
- * 服务编码:notepadDetail.updateNotepadDetail
- * 请求路劲:/app/notepadDetail.UpdateNotepadDetail
- * add by 吴学文 at 2022-08-16 00:08:00 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 = "notepadDetail.updateNotepadDetail")
-public class UpdateNotepadDetailCmd extends Cmd {
-
-  private static Logger logger = LoggerFactory.getLogger(UpdateNotepadDetailCmd.class);
-
-
-    @Autowired
-    private INotepadDetailV1InnerServiceSMO notepadDetailV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "detailId", "detailId不能为空");
-Assert.hasKeyAndValue(reqJson, "objId", "objId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-       NotepadDetailPo notepadDetailPo = BeanConvertUtil.covertBean(reqJson, NotepadDetailPo.class);
-        int flag = notepadDetailV1InnerServiceSMOImpl.updateNotepadDetail(notepadDetailPo);
-
-        if (flag < 1) {
-            throw new CmdException("更新数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}