Selaa lähdekoodia

fix 清空消息

he2802 3 vuotta sitten
vanhempi
commit
82103ce8c2

+ 10 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/inform/InformUserController.java

@@ -56,6 +56,7 @@ public class InformUserController extends BaseController {
         startPage();
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
+        bo.setStatus(1);
         List<InformUserVo> list = iInformUserService.queryList(bo);
         return getDataTable(list);
     }
@@ -94,5 +95,14 @@ public class InformUserController extends BaseController {
         return toAjax(iInformUserService.updateAllRead(bo) ? 1 : 0);
     }
 
+    @ApiOperation("清空系统消息")
+    @Log(title = "清空系统消息", businessType = BusinessType.UPDATE)
+    @PostMapping("/removeAll")
+    public AjaxResult<Void> removeAll() {
+        InformUserEditBo bo = new InformUserEditBo();
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return toAjax(iInformUserService.removeAll(bo) ? 1 : 0);
+    }
 
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/bo/InformUserQueryBo.java

@@ -126,4 +126,8 @@ public class InformUserQueryBo extends BaseEntity {
      */
     @ApiModelProperty("订单商品ID")
     private Long orderGoodsId;
+
+    /** 状态 1有效 0无效 */
+    @ApiModelProperty("状态 1有效 0无效")
+    private Integer status;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/domain/InformUser.java

@@ -97,4 +97,7 @@ public class InformUser implements Serializable {
      * 订单商品ID
      */
     private Long orderGoodsId;
+
+    /** 状态 1有效 0无效 */
+    private Integer status;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformUserService.java

@@ -58,4 +58,6 @@ public interface IInformUserService extends IService<InformUser> {
 	InformUserVo queryByIdUser(Long id, Long userId);
 
 	Boolean updateAllRead(InformUserEditBo bo);
+
+	Boolean removeAll(InformUserEditBo bo);
 }

+ 23 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformUserServiceImpl.java

@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.course.domain.CourseBusiness;
+import com.zhongzheng.modules.course.domain.CoursePhotoLog;
 import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
@@ -85,6 +88,7 @@ public class InformUserServiceImpl extends ServiceImpl<InformUserMapper, InformU
         lqw.eq(bo.getSendTime() != null, InformUser::getSendTime, bo.getSendTime());
         lqw.eq(bo.getSendStatus() != null, InformUser::getSendStatus, bo.getSendStatus());
         lqw.eq(bo.getReceiptStatus() != null, InformUser::getReceiptStatus, bo.getReceiptStatus());
+        lqw.eq(bo.getStatus() != null, InformUser::getStatus, bo.getStatus());
         lqw.eq( InformUser::getSendStatus, 1);
         lqw.in( bo.getSystemStatusList() != null,InformUser::getSystemStatus, bo.getSystemStatusList());
         lqw.orderByDesc(InformUser::getSendTime);
@@ -235,4 +239,23 @@ public class InformUserServiceImpl extends ServiceImpl<InformUserMapper, InformU
         }
         return true;
     }
+
+    /**
+     * 清除用户系统通知
+     * @param bo
+     * @return
+     */
+    @Override
+    public Boolean removeAll(InformUserEditBo bo) {
+        if(Validator.isEmpty(bo.getUserId())){
+            throw new CustomException("参数错误");
+        }
+        LambdaUpdateWrapper<InformUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+        objectLambdaUpdateWrapper.eq(InformUser::getUserId, bo.getUserId());
+        objectLambdaUpdateWrapper.eq(InformUser::getSendStatus, 1);
+        objectLambdaUpdateWrapper.set(InformUser::getStatus, 0);
+        objectLambdaUpdateWrapper.set(InformUser::getUpdateTime,DateUtils.getNowTime());
+        this.update(null, objectLambdaUpdateWrapper);
+        return true;
+    }
 }

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/inform/InformUserMapper.xml

@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
         <result property="orderGoodsId" column="order_goods_id"/>
+        <result property="status" column="status"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.inform.vo.InformUserVo" id="InformUserVo">