java110 3 lat temu
rodzic
commit
d033e67e46

+ 71 - 34
java110-bean/src/main/java/com/java110/dto/notepad/NotepadDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.notepad;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -14,18 +15,23 @@ import java.util.Date;
  **/
 public class NotepadDto extends PageDto implements Serializable {
 
+    public static final String STATE_DOING = "W"; // 进行中
+    public static final String STATE_FINISH = "F"; //完成
+
     private String createUserId;
-private String noteId;
-private String createUserName;
-private String objName;
-private String title;
-private String roomId;
-private String roomName;
-private String noteType;
-private String thridId;
-private String objId;
-private String state;
-private String objType;
+    private String noteId;
+    private String createUserName;
+    private String objName;
+    private String title;
+    private String roomId;
+    private String roomName;
+    private String noteType;
+    private String thridId;
+    private String objId;
+    private String state;
+    private String objType;
+
+    private String link;
 
 
     private Date createTime;
@@ -36,73 +42,96 @@ private String objType;
     public String getCreateUserId() {
         return createUserId;
     }
-public void setCreateUserId(String createUserId) {
+
+    public void setCreateUserId(String createUserId) {
         this.createUserId = createUserId;
     }
-public String getNoteId() {
+
+    public String getNoteId() {
         return noteId;
     }
-public void setNoteId(String noteId) {
+
+    public void setNoteId(String noteId) {
         this.noteId = noteId;
     }
-public String getCreateUserName() {
+
+    public String getCreateUserName() {
         return createUserName;
     }
-public void setCreateUserName(String createUserName) {
+
+    public void setCreateUserName(String createUserName) {
         this.createUserName = createUserName;
     }
-public String getObjName() {
+
+    public String getObjName() {
         return objName;
     }
-public void setObjName(String objName) {
+
+    public void setObjName(String objName) {
         this.objName = objName;
     }
-public String getTitle() {
+
+    public String getTitle() {
         return title;
     }
-public void setTitle(String title) {
+
+    public void setTitle(String title) {
         this.title = title;
     }
-public String getRoomId() {
+
+    public String getRoomId() {
         return roomId;
     }
-public void setRoomId(String roomId) {
+
+    public void setRoomId(String roomId) {
         this.roomId = roomId;
     }
-public String getRoomName() {
+
+    public String getRoomName() {
         return roomName;
     }
-public void setRoomName(String roomName) {
+
+    public void setRoomName(String roomName) {
         this.roomName = roomName;
     }
-public String getNoteType() {
+
+    public String getNoteType() {
         return noteType;
     }
-public void setNoteType(String noteType) {
+
+    public void setNoteType(String noteType) {
         this.noteType = noteType;
     }
-public String getThridId() {
+
+    public String getThridId() {
         return thridId;
     }
-public void setThridId(String thridId) {
+
+    public void setThridId(String thridId) {
         this.thridId = thridId;
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
     }
-public String getState() {
+
+    public String getState() {
         return state;
     }
-public void setState(String state) {
+
+    public void setState(String state) {
         this.state = state;
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
     }
 
@@ -122,4 +151,12 @@ public void setObjType(String objType) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
 }

+ 73 - 40
java110-bean/src/main/java/com/java110/po/notepad/NotepadPo.java

@@ -16,7 +16,7 @@
 package com.java110.po.notepad;
 
 import java.io.Serializable;
-import java.util.Date;
+
 /**
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * add by 吴学文 at 2022-08-16 00:02:21 mail: 928255095@qq.com
@@ -28,97 +28,130 @@ import java.util.Date;
 public class NotepadPo implements Serializable {
 
     private String createUserId;
-private String noteId;
-private String createUserName;
-private String statusCd = "0";
-private String objName;
-private String title;
-private String roomId;
-private String roomName;
-private String noteType;
-private String thridId;
-private String objId;
-private String state;
-private String objType;
-public String getCreateUserId() {
+    private String noteId;
+    private String createUserName;
+    private String statusCd = "0";
+    private String objName;
+    private String title;
+    private String roomId;
+    private String roomName;
+    private String noteType;
+    private String thridId;
+    private String objId;
+    private String state;
+    private String objType;
+
+    private String link;
+
+    public String getCreateUserId() {
         return createUserId;
     }
-public void setCreateUserId(String createUserId) {
+
+    public void setCreateUserId(String createUserId) {
         this.createUserId = createUserId;
     }
-public String getNoteId() {
+
+    public String getNoteId() {
         return noteId;
     }
-public void setNoteId(String noteId) {
+
+    public void setNoteId(String noteId) {
         this.noteId = noteId;
     }
-public String getCreateUserName() {
+
+    public String getCreateUserName() {
         return createUserName;
     }
-public void setCreateUserName(String createUserName) {
+
+    public void setCreateUserName(String createUserName) {
         this.createUserName = createUserName;
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
-public String getObjName() {
+
+    public String getObjName() {
         return objName;
     }
-public void setObjName(String objName) {
+
+    public void setObjName(String objName) {
         this.objName = objName;
     }
-public String getTitle() {
+
+    public String getTitle() {
         return title;
     }
-public void setTitle(String title) {
+
+    public void setTitle(String title) {
         this.title = title;
     }
-public String getRoomId() {
+
+    public String getRoomId() {
         return roomId;
     }
-public void setRoomId(String roomId) {
+
+    public void setRoomId(String roomId) {
         this.roomId = roomId;
     }
-public String getRoomName() {
+
+    public String getRoomName() {
         return roomName;
     }
-public void setRoomName(String roomName) {
+
+    public void setRoomName(String roomName) {
         this.roomName = roomName;
     }
-public String getNoteType() {
+
+    public String getNoteType() {
         return noteType;
     }
-public void setNoteType(String noteType) {
+
+    public void setNoteType(String noteType) {
         this.noteType = noteType;
     }
-public String getThridId() {
+
+    public String getThridId() {
         return thridId;
     }
-public void setThridId(String thridId) {
+
+    public void setThridId(String thridId) {
         this.thridId = thridId;
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
     }
-public String getState() {
+
+    public String getState() {
         return state;
     }
-public void setState(String state) {
+
+    public void setState(String state) {
         this.state = state;
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
     }
 
+    public String getLink() {
+        return link;
+    }
 
-
+    public void setLink(String link) {
+        this.link = link;
+    }
 }

+ 148 - 140
java110-db/src/main/resources/mapper/user/NotepadV1ServiceDaoImplMapper.xml

@@ -5,165 +5,173 @@
 <mapper namespace="notepadV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存备忘录信息 add by wuxw 2018-07-03 -->
     <insert id="saveNotepadInfo" parameterType="Map">
         insert into notepad(
-create_user_id,note_id,create_user_name,obj_name,title,room_id,room_name,note_type,thrid_id,obj_id,state,obj_type
-) values (
-#{createUserId},#{noteId},#{createUserName},#{objName},#{title},#{roomId},#{roomName},#{noteType},#{thridId},#{objId},#{state},#{objType}
-)
+        create_user_id,note_id,create_user_name,obj_name,title,room_id,room_name,note_type,thrid_id,obj_id,state,obj_type,link
+        ) values (
+        #{createUserId},#{noteId},#{createUserName},#{objName},#{title},#{roomId},#{roomName},#{noteType},#{thridId},#{objId},#{state},#{objType},#{link}
+        )
     </insert>
 
 
-
     <!-- 查询备忘录信息 add by wuxw 2018-07-03 -->
     <select id="getNotepadInfo" parameterType="Map" resultType="Map">
-        select  t.create_user_id,t.create_user_id createUserId,t.note_id,t.note_id noteId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd statusCd,t.obj_name,t.obj_name objName,t.title,t.room_id,t.room_id roomId,t.room_name,t.room_name roomName,t.note_type,t.note_type noteType,t.thrid_id,t.thrid_id thridId,t.obj_id,t.obj_id objId,t.state,t.obj_type,t.obj_type objType 
-from notepad t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</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="objName !=null and objName != ''">
-   and t.obj_name= #{objName}
-</if> 
-<if test="title !=null and title != ''">
-   and t.title= #{title}
-</if> 
-<if test="roomId !=null and roomId != ''">
-   and t.room_id= #{roomId}
-</if> 
-<if test="roomName !=null and roomName != ''">
-   and t.room_name= #{roomName}
-</if> 
-<if test="noteType !=null and noteType != ''">
-   and t.note_type= #{noteType}
-</if> 
-<if test="thridId !=null and thridId != ''">
-   and t.thrid_id= #{thridId}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</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.note_id,t.note_id
+        noteId,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd
+        statusCd,t.obj_name,t.obj_name objName,t.title,t.room_id,t.room_id roomId,t.room_name,t.room_name
+        roomName,t.note_type,t.note_type noteType,t.thrid_id,t.thrid_id thridId,t.obj_id,t.obj_id
+        objId,t.state,t.obj_type,t.obj_type objType,t.link
+        from notepad t
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </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="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="link !=null and link != ''">
+            and t.link= #{link}
+        </if>
+        <if test="title !=null and title != ''">
+            and t.title= #{title}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            and t.room_id= #{roomId}
+        </if>
+        <if test="roomName !=null and roomName != ''">
+            and t.room_name= #{roomName}
+        </if>
+        <if test="noteType !=null and noteType != ''">
+            and t.note_type= #{noteType}
+        </if>
+        <if test="thridId !=null and thridId != ''">
+            and t.thrid_id= #{thridId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </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="updateNotepadInfo" parameterType="Map">
-        update  notepad 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="createUserName !=null and createUserName != ''">
-, t.create_user_name= #{createUserName}
-</if> 
-<if test="objName !=null and objName != ''">
-, t.obj_name= #{objName}
-</if> 
-<if test="title !=null and title != ''">
-, t.title= #{title}
-</if> 
-<if test="roomId !=null and roomId != ''">
-, t.room_id= #{roomId}
-</if> 
-<if test="roomName !=null and roomName != ''">
-, t.room_name= #{roomName}
-</if> 
-<if test="noteType !=null and noteType != ''">
-, t.note_type= #{noteType}
-</if> 
-<if test="thridId !=null and thridId != ''">
-, t.thrid_id= #{thridId}
-</if> 
-<if test="objId !=null and objId != ''">
-, t.obj_id= #{objId}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-, t.obj_type= #{objType}
-</if> 
- where 1=1 <if test="noteId !=null and noteId != ''">
-and t.note_id= #{noteId}
-</if> 
+        update notepad 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="createUserName !=null and createUserName != ''">
+            , t.create_user_name= #{createUserName}
+        </if>
+        <if test="objName !=null and objName != ''">
+            , t.obj_name= #{objName}
+        </if>
+        <if test="title !=null and title != ''">
+            , t.title= #{title}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            , t.room_id= #{roomId}
+        </if>
+        <if test="roomName !=null and roomName != ''">
+            , t.room_name= #{roomName}
+        </if>
+        <if test="noteType !=null and noteType != ''">
+            , t.note_type= #{noteType}
+        </if>
+        <if test="thridId !=null and thridId != ''">
+            , t.thrid_id= #{thridId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            , t.obj_id= #{objId}
+        </if>
+        <if test="link !=null and link != ''">
+            , t.link= #{link}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="objType !=null and objType != ''">
+            , t.obj_type= #{objType}
+        </if>
+        where 1=1
+        <if test="noteId !=null and noteId != ''">
+            and t.note_id= #{noteId}
+        </if>
 
     </update>
 
     <!-- 查询备忘录数量 add by wuxw 2018-07-03 -->
-     <select id="queryNotepadsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from notepad t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</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="objName !=null and objName != ''">
-   and t.obj_name= #{objName}
-</if> 
-<if test="title !=null and title != ''">
-   and t.title= #{title}
-</if> 
-<if test="roomId !=null and roomId != ''">
-   and t.room_id= #{roomId}
-</if> 
-<if test="roomName !=null and roomName != ''">
-   and t.room_name= #{roomName}
-</if> 
-<if test="noteType !=null and noteType != ''">
-   and t.note_type= #{noteType}
-</if> 
-<if test="thridId !=null and thridId != ''">
-   and t.thrid_id= #{thridId}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
+    <select id="queryNotepadsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from notepad t
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </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="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="link !=null and link != ''">
+            and t.link= #{link}
+        </if>
+        <if test="title !=null and title != ''">
+            and t.title= #{title}
+        </if>
+        <if test="roomId !=null and roomId != ''">
+            and t.room_id= #{roomId}
+        </if>
+        <if test="roomName !=null and roomName != ''">
+            and t.room_name= #{roomName}
+        </if>
+        <if test="noteType !=null and noteType != ''">
+            and t.note_type= #{noteType}
+        </if>
+        <if test="thridId !=null and thridId != ''">
+            and t.thrid_id= #{thridId}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 41 - 7
service-user/src/main/java/com/java110/user/cmd/notepad/SaveNotepadCmd.java

@@ -22,15 +22,21 @@ 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.INotepadV1InnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
 import com.java110.po.notepad.NotepadPo;
 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 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;
 
 /**
  * 类表述:保存
@@ -52,25 +58,53 @@ public class SaveNotepadCmd extends Cmd {
     @Autowired
     private INotepadV1InnerServiceSMO notepadV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "noteType", "请求报文中未包含noteType");
         Assert.hasKeyAndValue(reqJson, "title", "请求报文中未包含title");
         Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType");
-        Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId");
-        Assert.hasKeyAndValue(reqJson, "objName", "请求报文中未包含objName");
-        Assert.hasKeyAndValue(reqJson, "createUserId", "请求报文中未包含createUserId");
-        Assert.hasKeyAndValue(reqJson, "createUserName", "请求报文中未包含createUserName");
-        Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含state");
-
     }
 
     @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());
+
+        if (!StringUtil.jsonHasKayAndValue(reqJson, "roomId")) {
+            reqJson.put("roomId", "-1");
+        }
+        if (!StringUtil.jsonHasKayAndValue(reqJson, "roomName")) {
+            reqJson.put("roomId", "无");
+        }
+
+        if (!StringUtil.jsonHasKayAndValue(reqJson, "objId")) {
+            reqJson.put("objId", "-1");
+        }
+
+        if (!StringUtil.jsonHasKayAndValue(reqJson, "objName")) {
+            reqJson.put("objName", "无");
+        }
+
+        if (!StringUtil.jsonHasKayAndValue(reqJson, "objType")) {
+            reqJson.put("objType", "3309");
+        }
+
         NotepadPo notepadPo = BeanConvertUtil.covertBean(reqJson, NotepadPo.class);
         notepadPo.setNoteId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        notepadPo.setState(NotepadDto.STATE_DOING);
         int flag = notepadV1InnerServiceSMOImpl.saveNotepad(notepadPo);
 
         if (flag < 1) {