Browse Source

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

dzx 1 year ago
parent
commit
1ce62c07b1

+ 7 - 1
src/main/java/com/xjrsoft/module/form/utils/FormDataTransUtil.java

@@ -1,9 +1,11 @@
 package com.xjrsoft.module.form.utils;
 package com.xjrsoft.module.form.utils;
 
 
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.db.Entity;
 import cn.hutool.db.Entity;
 import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -80,7 +82,11 @@ public final class FormDataTransUtil {
                     }
                     }
                     Map<String, Object> detailMap = detailList.stream().filter(x -> StrUtil.equalsIgnoreCase(x.getItemId().toString(), MapUtils.getString(options, "itemId"))).collect(Collectors.toMap(DictionaryDetail::getValue, DictionaryDetail::getName, (e1, e2) -> e1));
                     Map<String, Object> detailMap = detailList.stream().filter(x -> StrUtil.equalsIgnoreCase(x.getItemId().toString(), MapUtils.getString(options, "itemId"))).collect(Collectors.toMap(DictionaryDetail::getValue, DictionaryDetail::getName, (e1, e2) -> e1));
                     fieldValuesMap.put(bindField, detailMap);
                     fieldValuesMap.put(bindField, detailMap);
-                } else if (StrUtil.equalsIgnoreCase(datasourceType, "api") || isCascade) {
+                }else if(StrUtil.equalsIgnoreCase(ComponentTypeConstant.SELECT, type) && StrUtil.equalsIgnoreCase(datasourceType, "staticData")){ // 处理下拉静态数据
+                    List<JSONObject> staticOptions = Convert.toList(JSONObject.class, options.get("staticOptions"));
+                    Map<String, Object> dataMap = staticOptions.stream().collect(Collectors.toMap(data -> data.get("value").toString(), data -> data.get("label"), (e1, e2) -> e1));
+                    fieldValuesMap.put(bindField, dataMap);
+                }else if (StrUtil.equalsIgnoreCase(datasourceType, "api") || isCascade) {
                     String apiId = MapUtils.getString(MapUtils.getMap(options, "apiConfig"), "apiId");
                     String apiId = MapUtils.getString(MapUtils.getMap(options, "apiConfig"), "apiId");
                     if (apiDataMap.get(apiId) == null) {
                     if (apiDataMap.get(apiId) == null) {
                         Object resultApiData = magicApiService.executeApi(apiId);
                         Object resultApiData = magicApiService.executeApi(apiId);

+ 30 - 0
src/main/java/com/xjrsoft/module/liteflow/node/NewsSendMessageNode.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.liteflow.node;
+
+import cn.hutool.core.convert.Convert;
+import com.xjrsoft.module.oa.service.INewsService;
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 新闻审核成功后发送消息
+ */
+@Component("news_send_message_node")
+public class NewsSendMessageNode extends NodeComponent {
+    @Autowired
+    private INewsService newsService;
+
+    @Override
+    public void process() throws Exception {
+        // 获取表单中数据编号
+        Map<String, Object> params = this.getFirstContextBean();
+        Object value = util.getFormDatKey(params,"id");
+        Long formId = Convert.toLong(value);
+        if (formId != null) {
+            // 数据处理
+            newsService.dataHandle(formId);
+        }
+    }
+}

+ 82 - 36
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.constant.GlobalConstant;
-import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.page.PageOutput;
@@ -201,18 +200,27 @@ public class NewsController {
     @PutMapping("/read")
     @PutMapping("/read")
     @ApiOperation(value = "读新闻")
     @ApiOperation(value = "读新闻")
     public RT<Boolean> read(@RequestBody List<Long> ids) {
     public RT<Boolean> read(@RequestBody List<Long> ids) {
-        List<NewsRelation> toSaveList = newsRelationService.list(
-                Wrappers.<NewsRelation>query().lambda()
-                        .in(NewsRelation::getNewsId, ids)
-                        .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
-        for (NewsRelation newsRelation : toSaveList) {
-            newsRelation.setReadMark(1);
-            newsRelation.setReadDate(LocalDateTime.now());
+        for (Long id : ids) {
+            NewsRelation newsRelation = newsRelationService.getOne(
+                    Wrappers.<NewsRelation>query().lambda()
+                            .eq(NewsRelation::getNewsId, id)
+                            .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
+            if (newsRelation == null) {
+                newsRelationService.save(new NewsRelation(){{
+                    setNewsId(id);
+                    setUserId(StpUtil.getLoginIdAsLong());
+                    setReadMark(1);
+                    setReadDate(LocalDateTime.now());
+                }});
+                continue;
+            }
+            newsRelationService.updateById(new NewsRelation(){{
+                setId(newsRelation.getId());
+                setReadMark(1);
+                setReadDate(LocalDateTime.now());
+            }});
         }
         }
-//        newsRelationService.remove(Wrappers.<NewsRelation>query().lambda()
-//                .in(NewsRelation::getNewsId, ids)
-//                .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()));
-        return RT.ok(newsRelationService.updateBatchById(toSaveList));
+        return RT.ok(true);
     }
     }
 
 
     @PutMapping("/reply")
     @PutMapping("/reply")
@@ -272,13 +280,13 @@ public class NewsController {
     }
     }
 
 
     @GetMapping("/count-relation")
     @GetMapping("/count-relation")
-    @ApiOperation(value = "新闻阅读权限统计")
+    @ApiOperation(value = "公告阅读权限统计")
     public RT<Long[]> countRelation(@RequestParam Long id) {
     public RT<Long[]> countRelation(@RequestParam Long id) {
         Long total = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id));
         Long total = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id));
         Long notRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 0));
         Long notRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 0));
         Long isRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 1));
         Long isRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 1));
-        Long isReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNull(NewsRelation::getReplyContent));
-        Long notReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNotNull(NewsRelation::getReplyContent));
+        Long isReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNotNull(NewsRelation::getReplyContent));
+        Long notReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNull(NewsRelation::getReplyContent));
         Long[] arrayRefVar = {total, notRead, isRead, isReply, notReply};
         Long[] arrayRefVar = {total, notRead, isRead, isReply, notReply};
         return RT.ok(arrayRefVar);
         return RT.ok(arrayRefVar);
     }
     }
@@ -301,24 +309,54 @@ public class NewsController {
         List<NewsCountTypeVo> newsCountTypeVoList = new ArrayList<>();
         List<NewsCountTypeVo> newsCountTypeVoList = new ArrayList<>();
         Integer typeIds[] = {1, 2, 3};
         Integer typeIds[] = {1, 2, 3};
         for (Integer typeId : typeIds) {
         for (Integer typeId : typeIds) {
-            Long totalType = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()).eq(NewsRelation::getReadMark, 0).in(NewsRelation::getNewsId, "SELECT id from xjr_oa_news where type_id=" + typeId));
             NewsCountTypeVo newsCountTypeVo = new NewsCountTypeVo();
             NewsCountTypeVo newsCountTypeVo = new NewsCountTypeVo();
-            newsCountTypeVo.setTypeId(typeId);
-            newsCountTypeVo.setTotal(totalType);
             News news = new News();
             News news = new News();
+
+            //新闻
             if(typeId == 1){
             if(typeId == 1){
-                news = newsService.getOne(Wrappers.<News>query().lambda().eq(News::getTypeId, typeId).orderByDesc(News::getReleaseTime).last("limit 1"));
+                Long notReadCount = newsService.count(Wrappers.<News>query().lambda()
+                        .eq(News::getTypeId, typeId)
+                        .gt(News::getSendEndDate, LocalDateTime.now())
+                        .eq(News::getDeleteMark, 0)
+                        .eq(News::getWfStatus, 1)
+                        .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where user_id = " + StpUtil.getLoginIdAsLong()));
+
+                newsCountTypeVo.setTypeId(typeId);
+                newsCountTypeVo.setTotal(notReadCount);
+
+                news = newsService.getOne(Wrappers.<News>query().lambda()
+                        .eq(News::getTypeId, typeId)
+                        .gt(News::getSendEndDate, LocalDateTime.now())
+                        .eq(News::getDeleteMark, 0)
+                        .eq(News::getWfStatus, 1)
+                        .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where user_id = " + StpUtil.getLoginIdAsLong())
+                        .orderByDesc(News::getReleaseTime)
+                        .last("limit 1"));
             }
             }
+
+            //公告
             if(typeId == 2){
             if(typeId == 2){
-                news = newsService.selectJoinOne(News.class,
-                        new MPJLambdaWrapper<News>()
-                                .disableSubLogicDel()
-                                .eq(News::getTypeId, typeId)
-                                .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
-                                .orderByDesc(News::getReleaseTime)
-                                .last("limit 1")
-                                .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId));
+                Long notReadCount = newsService.count(Wrappers.<News>query().lambda()
+                        .eq(News::getTypeId, typeId)
+                        .eq(News::getDeleteMark, 0)
+                        .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
+                        .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
+                                .or()
+                                .isNull(News::getSendEndDate)));
+
+                news = newsService.getOne(Wrappers.<News>query().lambda()
+                        .eq(News::getTypeId, typeId)
+                        .eq(News::getDeleteMark, 0)
+                        .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
+                        .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
+                                .or()
+                                .isNull(News::getSendEndDate))
+                        .orderByDesc(News::getReleaseTime)
+                        .last("limit 1"));
+                newsCountTypeVo.setTypeId(typeId);
+                newsCountTypeVo.setTotal(notReadCount);
             }
             }
+
             if (news != null) {
             if (news != null) {
                 newsCountTypeVo.setTime(news.getReleaseTime());
                 newsCountTypeVo.setTime(news.getReleaseTime());
                 newsCountTypeVo.setTitle(news.getBriefHead());
                 newsCountTypeVo.setTitle(news.getBriefHead());
@@ -336,14 +374,22 @@ public class NewsController {
 
 
     @GetMapping("/unread-count")
     @GetMapping("/unread-count")
     @ApiOperation(value = "获取登录人未读消息数量")
     @ApiOperation(value = "获取登录人未读消息数量")
-    public RT<Integer> unreadCount() {
-        Integer count = newsService.selectJoinCount(
-            new MPJLambdaWrapper<News>()
-            .eq(NewsRelation::getReadMark, 0)
-            .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
-            .eq(News::getDeleteMark, DeleteMark.NODELETE.getCode())
-            .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
-        );
-        return RT.ok(count);
+    public RT<Long> unreadCount() {
+        Long notReadCountNews = newsService.count(Wrappers.<News>query().lambda()
+                .eq(News::getTypeId, 1)
+                .gt(News::getSendEndDate, LocalDateTime.now())
+                .eq(News::getDeleteMark, 0)
+                .eq(News::getWfStatus, 1)
+                .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where user_id = " + StpUtil.getLoginIdAsLong()));
+
+        Long notReadCountProclamation = newsService.count(Wrappers.<News>query().lambda()
+                .eq(News::getTypeId, 2)
+                .eq(News::getDeleteMark, 0)
+                .notIn(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
+                .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
+                        .or()
+                        .isNull(News::getSendEndDate)));
+        Long notReadCount = notReadCountNews + notReadCountProclamation;
+        return RT.ok(notReadCount);
     }
     }
 }
 }

+ 37 - 17
src/main/java/com/xjrsoft/module/oa/controller/ProclamationController.java

@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 
 
 /**
 /**
  * 公告
  * 公告
@@ -75,7 +76,13 @@ public class ProclamationController {
     @PostMapping
     @PostMapping
     @ApiOperation(value = "新增公告")
     @ApiOperation(value = "新增公告")
     public RT<Boolean> add(@RequestBody AddProclamationDto addProclamationDto) {
     public RT<Boolean> add(@RequestBody AddProclamationDto addProclamationDto) {
-        return RT.ok(newsService.addProclamation(addProclamationDto));
+        Long newsId = newsService.addProclamation(addProclamationDto);
+        if(newsId != null){
+            CompletableFuture.runAsync(() -> {
+                newsService.SendMessage(newsId);
+            });
+        }
+        return RT.ok(true);
     }
     }
 
 
     @GetMapping(value = "/info")
     @GetMapping(value = "/info")
@@ -107,9 +114,11 @@ public class ProclamationController {
     @ApiOperation(value = "发布或下架公告")
     @ApiOperation(value = "发布或下架公告")
     public RT<Boolean> changeStatus(@RequestBody ChangeNewsDto changeNewsDto){
     public RT<Boolean> changeStatus(@RequestBody ChangeNewsDto changeNewsDto){
         if(newsService.changeStatus(changeNewsDto)){
         if(newsService.changeStatus(changeNewsDto)){
-            return RT.ok(newsService.SendMessage(changeNewsDto.getId()));
+            CompletableFuture.runAsync(() -> {
+                newsService.SendMessage(changeNewsDto.getId());
+            });
         }
         }
-        return RT.ok("操作失败",null);
+        return RT.ok(true);
     }
     }
 
 
     @PutMapping("/read")
     @PutMapping("/read")
@@ -185,18 +194,6 @@ public class ProclamationController {
         return RT.ok(pageOutput);
         return RT.ok(pageOutput);
     }
     }
 
 
-    @GetMapping("/count-relation")
-    @ApiOperation(value = "公告阅读权限统计")
-    public RT<Long[]> countRelation(@RequestParam Long id) {
-        Long total = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id));
-        Long notRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 0));
-        Long isRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 1));
-        Long isReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNull(NewsRelation::getReplyContent));
-        Long notReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNotNull(NewsRelation::getReplyContent));
-        Long[] arrayRefVar = {total, notRead, isRead, isReply, notReply};
-        return RT.ok(arrayRefVar);
-    }
-
     @PutMapping("/update-relation")
     @PutMapping("/update-relation")
     @ApiOperation(value = "设置公告阅读权限")
     @ApiOperation(value = "设置公告阅读权限")
     public RT<Boolean> updateRelation(@RequestBody UpdateNewsRelationDto updateRelationDto) {
     public RT<Boolean> updateRelation(@RequestBody UpdateNewsRelationDto updateRelationDto) {
@@ -209,13 +206,25 @@ public class ProclamationController {
         return RT.ok(newsService.deleteRelation(deleteNewsRelationDto));
         return RT.ok(newsService.deleteRelation(deleteNewsRelationDto));
     }
     }
 
 
+    @GetMapping("/count-relation")
+    @ApiOperation(value = "公告阅读权限统计")
+    public RT<Long[]> countRelation(@RequestParam Long id) {
+        Long total = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id));
+        Long notRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 0));
+        Long isRead = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).eq(NewsRelation::getReadMark, 1));
+        Long isReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNotNull(NewsRelation::getReplyContent));
+        Long notReply = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getNewsId, id).isNull(NewsRelation::getReplyContent));
+        Long[] arrayRefVar = {total, notRead, isRead, isReply, notReply};
+        return RT.ok(arrayRefVar);
+    }
+
     @GetMapping("/count-type")
     @GetMapping("/count-type")
     @ApiOperation(value = "未读类型统计")
     @ApiOperation(value = "未读类型统计")
     public RT<List<NewsCountTypeVo>> countType() {
     public RT<List<NewsCountTypeVo>> countType() {
         List<NewsCountTypeVo> newsCountTypeVoList = new ArrayList<>();
         List<NewsCountTypeVo> newsCountTypeVoList = new ArrayList<>();
         Integer typeIds[] = {1, 2, 3};
         Integer typeIds[] = {1, 2, 3};
         for (Integer typeId : typeIds) {
         for (Integer typeId : typeIds) {
-            Long totalType = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()).eq(NewsRelation::getReadMark, 0).in(NewsRelation::getNewsId, "SELECT id from xjr_oa_news where type_id=" + typeId));
+            Long totalType = newsRelationService.count(Wrappers.<NewsRelation>query().lambda().eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()).eq(NewsRelation::getReadMark, 0).in(NewsRelation::getNewsId, "SELECT id from xjr_oa_news where delete_mark = 0 and type_id=" + typeId));
             NewsCountTypeVo newsCountTypeVo = new NewsCountTypeVo();
             NewsCountTypeVo newsCountTypeVo = new NewsCountTypeVo();
             newsCountTypeVo.setTypeId(typeId);
             newsCountTypeVo.setTypeId(typeId);
             newsCountTypeVo.setTotal(totalType);
             newsCountTypeVo.setTotal(totalType);
@@ -224,7 +233,8 @@ public class ProclamationController {
                 news = newsService.getOne(Wrappers.<News>query().lambda().eq(News::getTypeId, typeId).orderByDesc(News::getReleaseTime).last("limit 1"));
                 news = newsService.getOne(Wrappers.<News>query().lambda().eq(News::getTypeId, typeId).orderByDesc(News::getReleaseTime).last("limit 1"));
             }
             }
             if(typeId == 2){
             if(typeId == 2){
-                news = newsService.selectJoinOne(News.class,
+                //找到和该登录用户有关系的最后一条公告
+                News newsRelation = newsService.selectJoinOne(News.class,
                         new MPJLambdaWrapper<News>()
                         new MPJLambdaWrapper<News>()
                                 .disableSubLogicDel()
                                 .disableSubLogicDel()
                                 .eq(News::getTypeId, typeId)
                                 .eq(News::getTypeId, typeId)
@@ -232,6 +242,16 @@ public class ProclamationController {
                                 .orderByDesc(News::getReleaseTime)
                                 .orderByDesc(News::getReleaseTime)
                                 .last("limit 1")
                                 .last("limit 1")
                                 .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId));
                                 .innerJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId));
+
+                news = newsRelation;
+                //找到晚于和该登录用户有关系的所有公告
+                List<News> newsList = newsService.list(Wrappers.<News>query().lambda().eq(News::getTypeId, typeId).lt(News::getReleaseTime, newsRelation.getReleaseTime()).orderByDesc(News::getReleaseTime));
+                for (News n : newsList) {
+                    if(n.getSendRange() == 1){//是发给所有人的
+                        news = n;
+                        break;
+                    }
+                }
             }
             }
             if (news != null) {
             if (news != null) {
                 newsCountTypeVo.setTime(news.getReleaseTime());
                 newsCountTypeVo.setTime(news.getReleaseTime());

+ 0 - 12
src/main/java/com/xjrsoft/module/oa/dto/NewsPageDto.java

@@ -21,18 +21,6 @@ public class NewsPageDto extends PageInput {
     @Min(value = 1, message = "类型必须大于0")
     @Min(value = 1, message = "类型必须大于0")
     private Integer type;
     private Integer type;
 
 
-    @ApiModelProperty("班级(base_class)")
-    private Long classId;
-
-    @ApiModelProperty("级别 1=校级 2=班级")
-    private Integer level;
-
-    /**
-     * 作者
-     */
-    @ApiModelProperty("作者")
-    private String authorName;
-
     /**
     /**
      * 完整标题
      * 完整标题
      */
      */

+ 3 - 0
src/main/java/com/xjrsoft/module/oa/entity/News.java

@@ -116,6 +116,9 @@ public class News extends AuditEntity implements Serializable {
     @ApiModelProperty("发送范围 1=所有人 2=根据权限")
     @ApiModelProperty("发送范围 1=所有人 2=根据权限")
     private Integer sendRange;
     private Integer sendRange;
 
 
+    @ApiModelProperty("审核是否通过")
+    private Integer wfStatus;
+
     /**
     /**
      * 附件子表
      * 附件子表
      */
      */

+ 3 - 1
src/main/java/com/xjrsoft/module/oa/service/INewsService.java

@@ -35,7 +35,7 @@ public interface INewsService extends MPJBaseService<News> {
      * @param addProclamationDto
      * @param addProclamationDto
      * @return
      * @return
      */
      */
-    Boolean addProclamation(AddProclamationDto addProclamationDto);
+    Long addProclamation(AddProclamationDto addProclamationDto);
 
 
     /**
     /**
      * 根据id获取公告详情
      * 根据id获取公告详情
@@ -129,4 +129,6 @@ public interface INewsService extends MPJBaseService<News> {
     boolean deleteRelation(DeleteNewsRelationDto deleteNewsRelationDto);
     boolean deleteRelation(DeleteNewsRelationDto deleteNewsRelationDto);
 
 
     boolean SendMessage(Long id);
     boolean SendMessage(Long id);
+
+    boolean dataHandle(Long id);
 }
 }

+ 19 - 6
src/main/java/com/xjrsoft/module/oa/service/impl/NewsServiceImpl.java

@@ -56,6 +56,7 @@ import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -142,7 +143,9 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
     }
     }
 
 
     @Override
     @Override
-    public Boolean addProclamation(AddProclamationDto addProclamationDto) {
+    @Transactional
+    public Long addProclamation(AddProclamationDto addProclamationDto) {
+        Boolean isSuccess = false;
         News news = BeanUtil.toBean(addProclamationDto, News.class);
         News news = BeanUtil.toBean(addProclamationDto, News.class);
         news.setTypeId(2);
         news.setTypeId(2);
         news.setEnabledMark(EnabledMark.ENABLED.getCode());
         news.setEnabledMark(EnabledMark.ENABLED.getCode());
@@ -168,7 +171,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
         if (addProclamationDto.getSendRange() == 3 && addProclamationDto.getRelationList() != null) {
         if (addProclamationDto.getSendRange() == 3 && addProclamationDto.getRelationList() != null) {
             addRelationConfig(news, addProclamationDto);
             addRelationConfig(news, addProclamationDto);
         }
         }
-        return true;
+        return news.getId();
     }
     }
 
 
     @Override
     @Override
@@ -314,6 +317,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
     }
     }
 
 
     @Override
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean updateProclamation(UpdateProclamationDto updateProclamationDto) {
     public boolean updateProclamation(UpdateProclamationDto updateProclamationDto) {
         News news = BeanUtil.toBean(updateProclamationDto, News.class);
         News news = BeanUtil.toBean(updateProclamationDto, News.class);
         news.setModifyDate(LocalDateTime.now());
         news.setModifyDate(LocalDateTime.now());
@@ -817,7 +821,6 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
         return true;
         return true;
     }
     }
 
 
-
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public boolean delete(List<Long> ids) {
     public boolean delete(List<Long> ids) {
@@ -831,7 +834,8 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
     public boolean SendMessage(Long id) {
     public boolean SendMessage(Long id) {
         try {
         try {
             News news = newsMapper.selectById(id);
             News news = newsMapper.selectById(id);
-            if (news.getSendRange() == 2) {
+            Department department = departmentMapper.selectById(news.getSendDeptId());
+            if (news.getSendRange() == 1) {
                 List<User> userList = userMapper.selectList(Wrappers.<User>query().lambda().isNotNull(User::getOpenId).ne(User::getOpenId, ""));
                 List<User> userList = userMapper.selectList(Wrappers.<User>query().lambda().isNotNull(User::getOpenId).ne(User::getOpenId, ""));
                 if (userList.size() > 0) {
                 if (userList.size() > 0) {
                     for (User user : userList) {
                     for (User user : userList) {
@@ -847,7 +851,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
                         data.put("thing23", data1);
                         data.put("thing23", data1);
 
 
                         JSONObject data2 = new JSONObject();
                         JSONObject data2 = new JSONObject();
-                        data2.put("value", news.getAuthorName());
+                        data2.put("value", (department == null) ? "重庆铜梁职业教育中心" : department.getName());
                         data.put("thing18", data2);
                         data.put("thing18", data2);
 
 
                         JSONObject data3 = new JSONObject();
                         JSONObject data3 = new JSONObject();
@@ -856,6 +860,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
                         weChatSendMessageDto.setContent(data);
                         weChatSendMessageDto.setContent(data);
                         weChatService.sendTemplateMessage(weChatSendMessageDto);
                         weChatService.sendTemplateMessage(weChatSendMessageDto);
                     }
                     }
+//
                 }
                 }
             } else {
             } else {
                 List<NewsRelationVo> newsRelationVoList = newsRelationMapper.selectJoinList(NewsRelationVo.class,
                 List<NewsRelationVo> newsRelationVoList = newsRelationMapper.selectJoinList(NewsRelationVo.class,
@@ -879,7 +884,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
                         data.put("thing23", data1);
                         data.put("thing23", data1);
 
 
                         JSONObject data2 = new JSONObject();
                         JSONObject data2 = new JSONObject();
-                        data2.put("value", news.getAuthorName());
+                        data2.put("value", (department == null) ? "重庆铜梁职业教育中心" : department.getName());
                         data.put("thing18", data2);
                         data.put("thing18", data2);
 
 
                         JSONObject data3 = new JSONObject();
                         JSONObject data3 = new JSONObject();
@@ -894,4 +899,12 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
         }
         }
         return true;
         return true;
     }
     }
+
+    @Override
+    public boolean dataHandle(Long id) {
+        CompletableFuture.runAsync(() -> {
+            this.SendMessage(id);
+        });
+        return true;
+    }
 }
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/workflow/model/NoticePolicyParam.java

@@ -17,7 +17,7 @@ public class NoticePolicyParam {
     private String taskId;
     private String taskId;
 
 
     /**
     /**
-     * 用户名称
+     * 任务名称
      */
      */
     private String taskName;
     private String taskName;
 
 

+ 7 - 20
src/main/resources/mapper/oa/NewsMapper.xml

@@ -9,22 +9,16 @@
         t.*,
         t.*,
         t2.name as classIdCN
         t2.name as classIdCN
         from xjr_oa_news t
         from xjr_oa_news t
-        left join base_class t2 on t2.id = t.class_id
         where t.delete_mark = 0
         where t.delete_mark = 0
         <if test="dto.type != null and dto.type > 0">
         <if test="dto.type != null and dto.type > 0">
             and t.type_id = #{dto.type}
             and t.type_id = #{dto.type}
         </if>
         </if>
-        <if test="dto.authorName != null and dto.authorName != ''">
-            and t.author_name LIKE CONCAT('%',#{dto.authorName},'%')
+        <if test="dto.type != null and dto.type = 1">
+            and t.wf_status = 1
         </if>
         </if>
         <if test="dto.fullHead != null and dto.fullHead != ''">
         <if test="dto.fullHead != null and dto.fullHead != ''">
             and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
             and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
         </if>
         </if>
-        <if test="dto.keyword != null and dto.keyword != ''">
-            and (t.keyword LIKE CONCAT('%',#{dto.keyword},'%')
-            or t.full_head LIKE CONCAT('%',#{dto.keyword},'%')
-            or t.author_name LIKE CONCAT('%',#{dto.keyword},'%'))
-        </if>
         <if test="dto.loginId != null and dto.loginId > 0">
         <if test="dto.loginId != null and dto.loginId > 0">
             and t.create_user_id = #{dto.loginId}
             and t.create_user_id = #{dto.loginId}
         </if>
         </if>
@@ -34,33 +28,26 @@
     <select id="receiptBox" parameterType="com.xjrsoft.module.oa.dto.NewsPageDto"
     <select id="receiptBox" parameterType="com.xjrsoft.module.oa.dto.NewsPageDto"
             resultType="com.xjrsoft.module.oa.vo.NewsPageVo">
             resultType="com.xjrsoft.module.oa.vo.NewsPageVo">
         select
         select
-        t.*,
-        t2.name as classIdCN
+        t.*
         from xjr_oa_news t
         from xjr_oa_news t
         left join xjr_oa_news_relation t1 on t1.news_id = t.id
         left join xjr_oa_news_relation t1 on t1.news_id = t.id
-        left join base_class t2 on t2.id = t.class_id
         where t.delete_mark = 0 and
         where t.delete_mark = 0 and
         (t.send_end_date > now() or t.send_end_date is null)
         (t.send_end_date > now() or t.send_end_date is null)
           and t.status = 2
           and t.status = 2
         <if test="dto.type != null and dto.type == 2 and dto.loginId != null and dto.loginId > 0">
         <if test="dto.type != null and dto.type == 2 and dto.loginId != null and dto.loginId > 0">
             and (t1.user_id = #{dto.loginId} or t.send_range = 1)
             and (t1.user_id = #{dto.loginId} or t.send_range = 1)
         </if>
         </if>
+        <if test="dto.type != null and dto.type == 1">
+            and t.wf_status = 1
+        </if>
         <if test="dto.type != null and dto.type > 0">
         <if test="dto.type != null and dto.type > 0">
             and t.type_id = #{dto.type}
             and t.type_id = #{dto.type}
         </if>
         </if>
-        <if test="dto.authorName != null and dto.authorName != ''">
-            and t.author_name LIKE CONCAT('%',#{dto.authorName},'%')
-        </if>
         <if test="dto.fullHead != null and dto.fullHead != ''">
         <if test="dto.fullHead != null and dto.fullHead != ''">
             and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
             and t.full_head LIKE CONCAT('%',#{dto.fullHead},'%')
         </if>
         </if>
-        <if test="dto.keyword != null and dto.keyword != ''">
-            and (t.keyword LIKE CONCAT('%',#{dto.keyword},'%')
-                or t.full_head LIKE CONCAT('%',#{dto.keyword},'%')
-                or t.author_name LIKE CONCAT('%',#{dto.keyword},'%'))
-        </if>
         order by
         order by
-        t.send_start_date desc,t.release_time desc
+        t.release_time desc
     </select>
     </select>
 
 
     <select id="getDeptIdOrClassId" parameterType="java.util.List"
     <select id="getDeptIdOrClassId" parameterType="java.util.List"