Browse Source

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

fanxp 1 year ago
parent
commit
9c73a65b1d

+ 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);
+        }
+    }
+}

+ 91 - 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;
@@ -24,6 +23,8 @@ import com.xjrsoft.module.oa.service.INewsRelationConfigService;
 import com.xjrsoft.module.oa.service.INewsRelationService;
 import com.xjrsoft.module.oa.service.INewsRelationService;
 import com.xjrsoft.module.oa.service.INewsService;
 import com.xjrsoft.module.oa.service.INewsService;
 import com.xjrsoft.module.oa.vo.*;
 import com.xjrsoft.module.oa.vo.*;
+import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.mapper.DepartmentMapper;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -51,6 +52,8 @@ public class NewsController {
 
 
     private INewsRelationService newsRelationService;
     private INewsRelationService newsRelationService;
     private INewsAppendixService newsAppendixService;
     private INewsAppendixService newsAppendixService;
+
+    private DepartmentMapper departmentMapper;
     private INewsRelationConfigService newsRelationConfigService;
     private INewsRelationConfigService newsRelationConfigService;
 
 
     @GetMapping
     @GetMapping
@@ -119,6 +122,11 @@ public class NewsController {
         NewsVo newsVo = BeanUtil.toBean(news, NewsVo.class);
         NewsVo newsVo = BeanUtil.toBean(news, NewsVo.class);
         newsVo.setRelationList(newsRelationVoList);
         newsVo.setRelationList(newsRelationVoList);
 
 
+        Department department = departmentMapper.selectById(newsVo.getSendDeptId());
+        if(department != null){
+            newsVo.setSendDeptIdCN(department.getName());
+        }
+
         if (BooleanUtils.isTrue(isRead)) {
         if (BooleanUtils.isTrue(isRead)) {
 //            NewsRelation newsRelation = new NewsRelation();
 //            NewsRelation newsRelation = new NewsRelation();
 //            newsRelation.setNewsId(id);
 //            newsRelation.setNewsId(id);
@@ -201,18 +209,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 +289,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 +318,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)
+                        .eq(News::getStatus, 2)
+                        .gt(News::getSendEndDate, LocalDateTime.now())
+                        .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)
+                        .eq(News::getStatus, 2)
+                        .gt(News::getSendEndDate, LocalDateTime.now())
+                        .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::getStatus, 2)
+                        .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::getStatus, 2)
+                        .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 +383,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)
+                .eq(News::getStatus, 2)
+                .gt(News::getSendEndDate, LocalDateTime.now())
+                .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::getStatus, 2)
+                .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;
+    }
 }
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/oa/vo/NewsVo.java

@@ -80,6 +80,11 @@ public class NewsVo {
      */
      */
     @ApiModelProperty("发送部门")
     @ApiModelProperty("发送部门")
     private Long sendDeptId;
     private Long sendDeptId;
+    /**
+     * 发送部门
+     */
+    @ApiModelProperty("发送部门")
+    private String sendDeptIdCN;
 
 
     /**
     /**
      * 张贴开起时间
      * 张贴开起时间

+ 9 - 2
src/main/java/com/xjrsoft/module/personnel/controller/BasePersonnelLabourCapitalController.java

@@ -113,10 +113,17 @@ public class BasePersonnelLabourCapitalController {
     }
     }
     @PostMapping("/import")
     @PostMapping("/import")
     @ApiOperation(value = "导入")
     @ApiOperation(value = "导入")
-    public RT<Boolean> importData(@Valid ImportBasePersonnelLabourCapitalDto dto, @RequestParam("file") MultipartFile file) throws IOException {
+    public RT<Boolean> importData(@Valid AddBasePersonnelLabourCapitalDto dto, @RequestParam("file") MultipartFile file) throws IOException {
         List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(dto.getDataRow() - 1).doReadSync();
         List<Map<Integer, Object>> excelDataList = EasyExcel.read(file.getInputStream()).sheet().headRowNumber(dto.getDataRow() - 1).doReadSync();
         //验证数据
         //验证数据
 
 
+        //默认数据
+        dto.setDataRow(4);
+        dto.setIdNumberColumn(1);
+        dto.setIdTypeColumn(0);
+        dto.setPersonnelNameColumn(3);
+        dto.setJobNumberColumn(2);
+        dto.setAmountToColumn(4);
 
 
         //处理表头数据,目前只支持2行表头
         //处理表头数据,目前只支持2行表头
         List<BasePersonnelLabourCapitalTitle> titleList = initTitleList(excelDataList.get(0), excelDataList.get(1));
         List<BasePersonnelLabourCapitalTitle> titleList = initTitleList(excelDataList.get(0), excelDataList.get(1));
@@ -138,7 +145,7 @@ public class BasePersonnelLabourCapitalController {
      * @param excelDataList 表格数据
      * @param excelDataList 表格数据
      * @return 返回集合
      * @return 返回集合
      */
      */
-    List<BasePersonnelLabourCapitalData> initDataList(ImportBasePersonnelLabourCapitalDto dto, List<Map<Integer, Object>> excelDataList){
+    List<BasePersonnelLabourCapitalData> initDataList(AddBasePersonnelLabourCapitalDto dto, List<Map<Integer, Object>> excelDataList){
         List<BasePersonnelLabourCapitalData> resultList = new ArrayList<>();
         List<BasePersonnelLabourCapitalData> resultList = new ArrayList<>();
         for (int i = 0; i < excelDataList.size(); i ++){
         for (int i = 0; i < excelDataList.size(); i ++){
             //跳过表头
             //跳过表头

+ 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"