Browse Source

【CHG】处理过的业务,不再显示到消息提醒

zhaomn 3 năm trước cách đây
mục cha
commit
ac138b735c

+ 14 - 10
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcabServiceImpl.java

@@ -56,11 +56,11 @@ public abstract class BusJcabServiceImpl {
     // 设置查询权限
     JcebQueryUtil.setBusJcab(jcab);
     // 如果是段领导、中心领导选择了多个车间,就不再使用deptId查询参数
-    if(CollectionUtils.isNotEmpty(jcab.getDeptIds())){
+    if (CollectionUtils.isNotEmpty(jcab.getDeptIds())) {
       jcab.setDeptId(null);
     }
     // 如果是段领导、中心领导选择了多个车间,就不再使用deptId查询参数
-    if(CollectionUtils.isNotEmpty(jcab.getStationIds())){
+    if (CollectionUtils.isNotEmpty(jcab.getStationIds())) {
       jcab.setStationId(null);
     }
     // 设置查询参数
@@ -143,10 +143,11 @@ public abstract class BusJcabServiceImpl {
    */
   protected void pushSubmit(BusJcab jcab) {
     List<Long> leaderIds = stationService.getStationLeaderId(jcab.getDeptStationId());
-    String title = getJcebTypeEnum().getDescribe() + "检查表需确认" ;
+    String title = getJcebTypeEnum().getDescribe() + "检查表需确认";
     String content = "有一条" + getJcebTypeEnum().getDescribe() + "检查表需确认,请您及时处理";
-    for(Long id : leaderIds){
-      busPushMsgService.create(id, title, content, getPushParam(jcab));
+    for (Long id : leaderIds) {
+      busPushMsgService.create(id, title, content, getPushParam(jcab), jcab.getId(),
+          getJcebTypeEnum().getTypeCode());
     }
   }
 
@@ -156,9 +157,10 @@ public abstract class BusJcabServiceImpl {
   protected void setReject(BusJcab jcab) {
     jcab.setConfirmUser(SecurityUtils.getUsername());
     jcab.setSubmitState(JcebStatusEnum.RETURNED.getCode());
-    String title = getJcebTypeEnum().getDescribe() + "检查表被退回" ;
+    String title = getJcebTypeEnum().getDescribe() + "检查表被退回";
     String content = "您提交的" + getJcebTypeEnum().getDescribe() + "检查表被退回,点击查看详情";
-    busPushMsgService.create(jcab.getCreateBy(), title, content, getPushParam(jcab));
+    busPushMsgService.create(jcab.getCreateBy(), title, content, getPushParam(jcab), jcab.getId(),
+        getJcebTypeEnum().getTypeCode());
   }
 
   /**
@@ -167,12 +169,13 @@ public abstract class BusJcabServiceImpl {
   protected void setConfirm(BusJcab jcab) {
     jcab.setConfirmUser(SecurityUtils.getUsername());
     jcab.setSubmitState(JcebStatusEnum.COMPLETED.getCode());
-    String title = getJcebTypeEnum().getDescribe() + "检查表已确认" ;
+    String title = getJcebTypeEnum().getDescribe() + "检查表已确认";
     String content = "您提交的" + getJcebTypeEnum().getDescribe() + "检查表已确认,点击查看详情";
-    busPushMsgService.create(jcab.getCreateBy(), title, content, getPushParam(jcab));
+    busPushMsgService.create(jcab.getCreateBy(), title, content, getPushParam(jcab), jcab.getId(),
+        getJcebTypeEnum().getTypeCode());
   }
 
-  protected String getPushParam(BusJcab jcab){
+  protected String getPushParam(BusJcab jcab) {
     JSONObject json = new JSONObject();
     json.put("type", getJcebTypeEnum().getTypeCode());
     json.put("id", jcab.getId());
@@ -182,6 +185,7 @@ public abstract class BusJcabServiceImpl {
 
   /**
    * 获取检查表类型名
+   *
    * @return 类型名
    */
   abstract JcebTypeEnum getJcebTypeEnum();

+ 13 - 9
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcebServiceImpl.java

@@ -147,10 +147,11 @@ public abstract class BusJcebServiceImpl<T extends BusJceb> implements IBusJcebS
    */
   protected void pushSubmit(BusJceb jceb) {
     List<Long> leaderIds = stationService.getStationLeaderId(jceb.getDeptStationId());
-    String title = getJcebType() + "检测表需确认" ;
+    String title = getJcebType() + "检测表需确认";
     String content = "有一条" + getJcebType() + "检测表需确认,请您及时处理";
-    for(Long id : leaderIds){
-      busPushMsgService.create(id, title, content, getPushParam(jceb));
+    for (Long id : leaderIds) {
+      busPushMsgService.create(id, title, content, getPushParam(jceb), jceb.getId(),
+          getJcebTypeEnum().getTypeCode());
     }
   }
 
@@ -159,9 +160,10 @@ public abstract class BusJcebServiceImpl<T extends BusJceb> implements IBusJcebS
    */
   protected void setReject(BusJceb jceb) {
     jceb.setSubmitState(JcebStatusEnum.RETURNED.getCode());
-    String title = getJcebType() + "检测表被退回" ;
+    String title = getJcebType() + "检测表被退回";
     String content = "您提交的" + getJcebType() + "检测表被退回,点击查看详情";
-    busPushMsgService.create(jceb.getCreateBy(), title, content, getPushParam(jceb));
+    busPushMsgService.create(jceb.getCreateBy(), title, content, getPushParam(jceb), jceb.getId(),
+        getJcebTypeEnum().getTypeCode());
   }
 
   /**
@@ -169,12 +171,13 @@ public abstract class BusJcebServiceImpl<T extends BusJceb> implements IBusJcebS
    */
   protected void setConfirm(BusJceb jceb) {
     jceb.setSubmitState(JcebStatusEnum.COMPLETED.getCode());
-    String title = getJcebType() + "检测表已确认" ;
+    String title = getJcebType() + "检测表已确认";
     String content = "您提交的" + getJcebType() + "检测表已确认,点击查看详情";
-    busPushMsgService.create(jceb.getCreateBy(), title, content, getPushParam(jceb));
+    busPushMsgService.create(jceb.getCreateBy(), title, content, getPushParam(jceb), jceb.getId(),
+        getJcebTypeEnum().getTypeCode());
   }
 
-  protected String getPushParam(BusJceb jceb){
+  protected String getPushParam(BusJceb jceb) {
     JSONObject json = new JSONObject();
     json.put("type", getJcebTypeEnum().getTypeCode());
     json.put("id", jceb.getId());
@@ -182,12 +185,13 @@ public abstract class BusJcebServiceImpl<T extends BusJceb> implements IBusJcebS
     return json.toJSONString();
   }
 
-  private String getJcebType(){
+  private String getJcebType() {
     return getJcebTypeEnum().getDescribe();
   }
 
   /**
    * 获取检查表类型名
+   *
    * @return 类型名
    */
   abstract JcebTypeEnum getJcebTypeEnum();

+ 11 - 0
railway-business/src/main/java/com/railway/business/push/domain/BusPushMsg.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 import java.util.Date;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import org.hibernate.validator.constraints.Length;
 import org.springframework.format.annotation.DateTimeFormat;
 
 /**
@@ -57,4 +58,14 @@ public class BusPushMsg extends BaseEntity {
   @ApiModelProperty(value = "推送轮数")
   private Integer pushLoop;
 
+  @ApiModelProperty(value = "del_flag")
+  @Length(min = 1, max = 1, message = "【del_flag】长度必须介于 {min} 和 {max} 之间")
+  private String delFlag;
+
+  @ApiModelProperty(value = "业务记录ID")
+  private Long busId;
+
+  @ApiModelProperty(value = "业务类型")
+  private String busType;
+
 }

+ 43 - 37
railway-business/src/main/java/com/railway/business/push/mapper/BusPushMsgMapper.java

@@ -2,6 +2,7 @@ package com.railway.business.push.mapper;
 
 import com.github.pagehelper.Page;
 import com.railway.business.push.domain.BusPushMsg;
+import java.util.Date;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -9,45 +10,50 @@ import org.springframework.stereotype.Repository;
 import java.util.List;
 
 /**
-* 个推消息表
-* @author author
-* @date 2021/11/16
-*/
+ * 个推消息表
+ *
+ * @author author
+ * @date 2021/11/16
+ */
 @Mapper
 @Repository
 public interface BusPushMsgMapper {
 
-    /**
-    * 新增
-    */
-    int insert(BusPushMsg busPushMsg);
-
-    /**
-    * 删除
-    */
-    int delete(@Param("id") String id);
-
-    /**
-    * 更新
-    */
-    int update(BusPushMsg busPushMsg);
-
-    /**
-    * 获取单个
-    */
-    BusPushMsg getInfo(@Param("id") String id);
-
-    /**
-    * 查询列表
-    */
-    Page<BusPushMsg> getList(BusPushMsg busPushMsg);
-
-    List<BusPushMsg> selectAppMsg();
-
-    /**
-     * 查询最近5条
-     * @param busPushMsg
-     * @return
-     */
-    Page<BusPushMsg> getListTop5(BusPushMsg busPushMsg);
+  /**
+   * 新增
+   */
+  int insert(BusPushMsg busPushMsg);
+
+  /**
+   * 删除
+   */
+  int delete(@Param("id") String id);
+
+  /**
+   * 更新
+   */
+  int updateByBusId(@Param("busId") Long busId, @Param("busType") String busType,
+      @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime);
+
+  /**
+   * 更新
+   */
+  int update(BusPushMsg busPushMsg);
+
+  /**
+   * 获取单个
+   */
+  BusPushMsg getInfo(@Param("id") String id);
+
+  /**
+   * 查询列表
+   */
+  Page<BusPushMsg> getList(BusPushMsg busPushMsg);
+
+  List<BusPushMsg> selectAppMsg();
+
+  /**
+   * 查询最近5条
+   */
+  Page<BusPushMsg> getListTop5(BusPushMsg busPushMsg);
 }

+ 46 - 38
railway-business/src/main/java/com/railway/business/push/service/IBusPushMsgService.java

@@ -2,55 +2,63 @@ package com.railway.business.push.service;
 
 import com.railway.business.push.domain.BusPushMsg;
 import java.util.List;
+
 /**
-* 个推消息表
-* @author author
-* @date 2021/11/16
-*/
-public interface IBusPushMsgService{
+ * 个推消息表
+ *
+ * @author author
+ * @date 2021/11/16
+ */
+public interface IBusPushMsgService {
+
+  /**
+   * 消息推送
+   */
+  void create(String userName, String title, String content, String param, Long busId,
+      String busType);
 
-    /**
-     * 消息推送
-     */
-    void create(String userName, String title, String content, String param);
+  /**
+   * 消息推送
+   */
+  void create(Long userId, String title, String content, String param, Long busId, String busType);
 
-    /**
-     * 消息推送
-     */
-    void create(Long userId, String title, String content, String param);
+  /**
+   * 新增
+   */
+  int create(BusPushMsg busPushMsg);
 
-    /**
-    * 新增
-    */
-    int create(BusPushMsg busPushMsg);
+  /**
+   * 删除
+   */
+  int delete(String[] ids);
 
-    /**
-    * 删除
-    */
-    int delete(String[] ids);
+  /**
+   * 更新
+   */
+  int update(Long busId, String busType);
 
-    /**
-    * 更新
-    */
-    int update(BusPushMsg busPushMsg);
+  /**
+   * 更新
+   */
+  int update(BusPushMsg busPushMsg);
 
-    /**
-    * 获取单个
-    */
-    BusPushMsg getInfo(String id);
+  /**
+   * 获取单个
+   */
+  BusPushMsg getInfo(String id);
 
-    /**
-    * 查询列表
-    */
-    List<BusPushMsg> getList(BusPushMsg busPushMsg);
+  /**
+   * 查询列表
+   */
+  List<BusPushMsg> getList(BusPushMsg busPushMsg);
 
-    List<BusPushMsg> selectAppMsg();
+  List<BusPushMsg> selectAppMsg();
 
-    List<BusPushMsg> getListTop5(BusPushMsg busPushMsg);
+  List<BusPushMsg> getListTop5(BusPushMsg busPushMsg);
 
-    String pushToSingle(BusPushMsg busPushMsg);
+  String pushToSingle(BusPushMsg busPushMsg);
 
-    void pushToSingleBatch(List<BusPushMsg> msgPos);
+  void pushToSingleBatch(List<BusPushMsg> msgPos);
 
-    void updateBatch(List<BusPushMsg> msgPos);
+  void updateBatch(List<BusPushMsg> msgPos);
 }

+ 15 - 5
railway-business/src/main/java/com/railway/business/push/service/impl/BusPushMsgServiceImpl.java

@@ -72,21 +72,24 @@ public class BusPushMsgServiceImpl implements IBusPushMsgService {
    * 消息推送
    */
   @Override
-  public void create(String userName, String title, String content, String param) {
+  public void create(String userName, String title, String content, String param, Long busId,
+      String busType) {
     SysUser user = sysUserService.selectUserByUserName(userName);
-    create(user, title, content, param);
+    create(user, title, content, param, busId, busType);
   }
 
   /**
    * 消息推送
    */
   @Override
-  public void create(Long userId, String title, String content, String param) {
+  public void create(Long userId, String title, String content, String param, Long busId,
+      String busType) {
     SysUser user = sysUserService.selectUserById(userId);
-    create(user, title, content, param);
+    create(user, title, content, param, busId, busType);
   }
 
-  private void create(SysUser user, String title, String content, String param) {
+  private void create(SysUser user, String title, String content, String param, Long busId,
+      String busType) {
     BusPushMsg pushMsg = new BusPushMsg();
     pushMsg.setParam(param);
     pushMsg.setUserId(user.getUserId());
@@ -94,6 +97,8 @@ public class BusPushMsgServiceImpl implements IBusPushMsgService {
     pushMsg.setClientId(mobileId);
     pushMsg.setTitle(title);
     pushMsg.setContent(content);
+    pushMsg.setBusId(busId);
+    pushMsg.setBusType(busType);
     this.create(pushMsg);
   }
 
@@ -124,6 +129,11 @@ public class BusPushMsgServiceImpl implements IBusPushMsgService {
     return r;
   }
 
+  @Override
+  public int update(Long busId, String busType) {
+    return busPushMsgMapper.updateByBusId(busId, busType, SecurityUtils.getUsername(), new Date());
+  }
+
   /**
    * 更新
    */

+ 40 - 6
railway-business/src/main/resources/mapper/push/BusPushMsgMapper.xml

@@ -17,10 +17,14 @@
     <result column="push_result_desc" property="pushResultDesc"/>
     <result column="push_loop" property="pushLoop"/>
     <result column="param" property="param"/>
+    <result column="del_flag" property="delFlag"/>
+    <result column="bus_id" property="busId"/>
+    <result column="bus_type" property="busType"/>
   </resultMap>
 
   <sql id="Base_Column_List">
-    id,
+    id
+    ,
     user_id,
     client_id,
     client_type,
@@ -32,7 +36,9 @@
     push_status,
     push_result_desc,
     push_loop,
-    param
+    param,
+    bus_id,
+    bus_type
   </sql>
 
   <insert id="insert" parameterType="com.railway.business.push.domain.BusPushMsg">
@@ -75,7 +81,16 @@
         push_loop,
       </if>
       <if test='null != param'>
-        param
+        param,
+      </if>
+      <if test='null != delFlag'>
+        del_flag,
+      </if>
+      <if test='null != busId'>
+        bus_id,
+      </if>
+      <if test='null != busType'>
+        bus_type
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -113,13 +128,23 @@
         #{pushLoop},
       </if>
       <if test='null != param'>
-        #{param}
+        #{param},
+      </if>
+      <if test='null != delFlag'>
+        #{delFlag},
+      </if>
+      <if test='null != busId'>
+        #{busId},
+      </if>
+      <if test='null != busType'>
+        #{busType}
       </if>
     </trim>
   </insert>
 
   <delete id="delete">
-    DELETE FROM bus_push_msg
+    DELETE
+    FROM bus_push_msg
     WHERE id = #{id}
   </delete>
 
@@ -137,11 +162,18 @@
       <if test='null != pushStatus'>push_status = #{pushStatus},</if>
       <if test='null != pushResultDesc'>push_result_desc = #{pushResultDesc},</if>
       <if test='null != pushLoop'>push_loop = #{pushLoop},</if>
-      <if test='null != param'>param = #{param}</if>
+      <if test='null != param'>param = #{param},</if>
+      <if test='null != delFlag'>del_flag = #{delFlag},</if>
+      <if test='null != busId'>bus_id = #{busId},</if>
+      <if test='null != busType'>bus_type = #{busType}</if>
     </set>
     WHERE id = #{id}
   </update>
 
+  <update id="updateByBusId">
+    UPDATE bus_push_msg set del_flag = '1', update_time = #{updateTime}, update_by = {updateBy}
+    WHERE bus_id = #{busId} and bus_type = #{busType}
+  </update>
 
   <select id="getInfo" resultMap="BaseResultMap">
     SELECT
@@ -156,6 +188,7 @@
     <include refid="Base_Column_List"/>
     FROM bus_push_msg
     <where>
+      del_flag='0'
       <if test="userId!=null and userId!=''">
         and user_id=#{userId}
       </if>
@@ -208,6 +241,7 @@
     <include refid="Base_Column_List"/>
     FROM bus_push_msg
     <where>
+      del_flag='0'
       <if test="userId!=null and userId!=''">
         and user_id=#{userId}
       </if>