Browse Source

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 5 months ago
parent
commit
06abe5fcf3

+ 5 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/notice/NoticeWebsitRecordVO.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.IsYesNoEnum;
 import com.gree.mall.manager.enums.NoticeWebsitEnum;
 import com.gree.mall.manager.plus.entity.NoticeWebsit;
 import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
@@ -50,6 +51,10 @@ public class NoticeWebsitRecordVO    {
     private Date readTime;
 
     @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "是否已接收")
+    private IsYesNoEnum readFlag;
+
+    @ZfireField(tbName = "b")
     @ApiModelProperty(value = "网点编号")
     private String adminWebsitId;
     @ZfireField(tbName = "b")

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/NoticeRecordBeanMapper.java

@@ -39,10 +39,10 @@ public interface NoticeRecordBeanMapper {
 
 
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
-    IPage<NoticeWebsitVO> listNoticeWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds") List<String> adminCompanyIds);
+    IPage<NoticeWebsitVO> listNoticeWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds") List<String> adminCompanyIds,@Param("status") String status);
 
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
-    IPage<NoticeWebsitRecordVO> listWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds")  List<String> adminCompanyIds);
+    IPage<NoticeWebsitRecordVO> listWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds")  List<String> adminCompanyIds,@Param("status") String status);
 
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
     IPage<WorkerWarrantyVO> listWarranty(Page page,@Param("ex")  ZfireParamBean zfireParam,@Param("adminCompanyIds")  List<String> adminCompanyIds);

+ 10 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/notice/NoticeWebsitController.java

@@ -142,6 +142,16 @@ public class NoticeWebsitController {
         return ResponseHelper.success();
     }
 
+    @PostMapping("/mark/readOne")
+    @ApiOperation(value = "标记一条已读")
+    public ResponseHelper readOne(
+            @ApiParam(value = "通知消息id数组", required = true) @RequestParam List<String> id
+    ) throws Exception {
+        noticeWebsitLogic.readOne(id);
+        return ResponseHelper.success();
+    }
+
+
 
     @PostMapping("/mark/read/all")
     @ApiOperation(value = "全部标记已读")

+ 33 - 7
mall-server-api/src/main/java/com/gree/mall/manager/logic/notice/NoticeLogic.java

@@ -14,10 +14,7 @@ import com.gree.mall.manager.enums.IsYesNoEnum;
 import com.gree.mall.manager.logic.admin.AdminUserLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.service.AdminUserService;
-import com.gree.mall.manager.plus.service.NoticeRecordService;
-import com.gree.mall.manager.plus.service.NoticeService;
-import com.gree.mall.manager.plus.service.UserService;
+import com.gree.mall.manager.plus.service.*;
 import com.gree.mall.manager.utils.StringUtil;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import org.springframework.beans.BeanUtils;
@@ -50,6 +47,12 @@ public class NoticeLogic {
     @Autowired
     UserService userService;
 
+    @Autowired
+    NoticeWebsitRecordService noticeWebsitRecordService;
+
+    @Autowired
+    NoticeWebsitService noticeWebsitService;
+
 
 
 
@@ -343,12 +346,35 @@ public class NoticeLogic {
 
         Date date1 = new Date();
 
-        List<NoticeRecord> list = noticeRecordService.lambdaQuery()
+        List<NoticeRecord> list = new ArrayList<>();
+        list.addAll(noticeRecordService.lambdaQuery()
                 .in(!StringUtil.isEmpty(adminUser.getCompanyWechatId()), NoticeRecord::getAdminCompanyId, adminUser.getCompanyWechatId())
                 .eq(!StringUtil.isEmpty(adminUser.getAdminUserId()), NoticeRecord::getAdminUserId, adminUser.getAdminUserId())
-                //.ne( NoticeRecord::getAdminNoticeType, "NOTICE")
+
                 .between(NoticeRecord::getIssueTime, dateTime, date1)
-                .list();
+                .list());
+
+        List<NoticeWebsitRecord> noticeWebsitRecords = noticeWebsitRecordService.lambdaQuery()
+                .in(!StringUtil.isEmpty(adminUser.getCompanyWechatId()), NoticeWebsitRecord::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(!StringUtil.isEmpty(adminUser.getAdminUserId()), NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminUserId())
+
+                .between(NoticeWebsitRecord::getIssueTime, dateTime, date1).list();
+
+        if (CollectionUtils.isNotEmpty(noticeWebsitRecords)){
+            List<NoticeWebsit> noticeWebsits = noticeWebsitService.lambdaQuery().in(NoticeWebsit::getNoticeWebsitId,
+                    noticeWebsitRecords.stream().map(NoticeWebsitRecord::getNoticeWebsitId).collect(Collectors.toList()))
+                    .list();
+
+            for (NoticeWebsit noticeWebsit : noticeWebsits) {
+                NoticeRecord noticeRecord = new NoticeRecord();
+                noticeRecord.setId(noticeWebsit.getNoticeWebsitId());
+                noticeRecord.setType(noticeWebsit.getType());
+                noticeRecord.setAdminNoticeType("WDTZ");
+                noticeRecord.setTitle(noticeWebsit.getTitle());
+                list.add(noticeRecord);
+            }
+        }
+
 
         return list;
     }

+ 28 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/notice/NoticeWebsitLogic.java

@@ -55,7 +55,10 @@ public class NoticeWebsitLogic {
         //1.组装查询条件
         zfireParam = FieldUtils.supplyParam(zfireParam, NoticeWebsitVO.class,adminUser);
 
-        IPage<NoticeWebsitVO> websitDispatchVOIPage = noticeRecordMapper.listNoticeWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds);
+
+        String status = adminUser.getType().equals(0)?"SEND":"";
+
+        IPage<NoticeWebsitVO> websitDispatchVOIPage = noticeRecordMapper.listNoticeWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds,status);
 
         return websitDispatchVOIPage;
     }
@@ -135,7 +138,9 @@ public class NoticeWebsitLogic {
         //1.组装查询条件
         zfireParam = FieldUtils.supplyParam(zfireParam, NoticeWebsitRecordVO.class,adminUser);
 
-        IPage<NoticeWebsitRecordVO> noticeWebsitRecordVOIPage = noticeRecordMapper.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds);
+        String status = adminUser.getType().equals(0)?"SEND":"";
+
+        IPage<NoticeWebsitRecordVO> noticeWebsitRecordVOIPage = noticeRecordMapper.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds,status);
 
         return noticeWebsitRecordVOIPage;
     }
@@ -198,4 +203,25 @@ public class NoticeWebsitLogic {
                     .update();
         }
     }
+
+    public void readOne(List<String> id) {
+
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        noticeWebsitRecordService.lambdaUpdate()
+                .in(NoticeWebsitRecord::getId,id)
+                .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
+                .set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
+                .set(NoticeWebsitRecord::getReadTime, new Date())
+                .update();
+
+        for (String idOne : id) {
+
+            NoticeWebsitRecord noticeWebsitRecord = noticeWebsitRecordService.getById(idOne);
+            NoticeWebsit one = noticeWebsitService.getById(noticeWebsitRecord.getNoticeWebsitId());
+            if (one != null){
+                one.setNum(one.getNum()+1);
+                one.updateById();
+            }
+        }
+    }
 }

+ 15 - 0
mall-server-api/src/main/resources/mapper/NoticeRecordBeanMapper.xml

@@ -86,7 +86,11 @@
         a.*
         FROM
         notice_websit a
+        join notice_websit_record b on a.notice_websit_id = b.notice_websit_id
         ${ex.query}
+        <if test="status != null and status !=''">
+            and a.status = #{status}
+        </if>
         <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
             and a.company_wechat_id  in
             <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator=","
@@ -94,10 +98,18 @@
                 #{item}
             </foreach>
         </if>
+        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
+            AND b.admin_websit_id IN
+            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         ${ex.orderBy}
+        group by a.notice_websit_id
         <if test="ex.orderBy == null or  ex.orderBy == ''">
             order by a.create_time desc
         </if>
+
     </select>
     <select id="listWebsit" resultType="com.gree.mall.manager.bean.notice.NoticeWebsitRecordVO">
         SELECT
@@ -114,6 +126,9 @@
                 #{item}
             </foreach>
         </if>
+        <if test="status != null and status !=''">
+            and a.status = #{status}
+        </if>
         <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
             AND b.admin_websit_id IN
             <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">