Browse Source

反馈意见 作风评议 短信

jz.kai 2 years ago
parent
commit
1a979b9695

+ 21 - 0
web/src/main/java/com/jpsoft/excellent/modules/base/controller/FeedbackOpinionController.java

@@ -11,6 +11,7 @@ import com.jpsoft.excellent.modules.common.utils.OSSUtil;
 import com.jpsoft.excellent.modules.common.utils.PojoUtils;
 import com.jpsoft.excellent.modules.common.dto.Sort;
 import com.jpsoft.excellent.modules.common.dto.MessageResult;
+import com.jpsoft.excellent.modules.common.utils.SMSUtil;
 import com.jpsoft.excellent.modules.sys.entity.User;
 import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
 import com.jpsoft.excellent.modules.sys.service.UserService;
@@ -948,6 +949,11 @@ public class FeedbackOpinionController {
                 feedbackStepStatusService.insert(feedbackStepStatus);
             }
 
+            //发送交办单位短信
+            String MessageContent = "";
+            MessageContent = "【双优督办】您有一条待办反馈,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
+            sendSMSing(MessageContent, nextStepDTO.getOrgIds(), null);
+
             msgResult.setResult(true);
         }
         catch(Exception ex){
@@ -960,6 +966,21 @@ public class FeedbackOpinionController {
         return msgResult;
     }
 
+    private void sendSMSing(String MessageContent, String[] orgIds, String ScheduleTime){
+        if(orgIds.length > 0) {
+            List<String> phones = new ArrayList<>();
+            for(String orgId : orgIds){
+                List<User> userList = userService.findListByOrgId(orgId);
+                for(User user : userList){
+                    if(StringUtils.isNotEmpty(user.getPhone())) {
+                        phones.add(user.getPhone().replace(" ",""));
+                    }
+                }
+            }
+            SMSUtil.sendSMS(MessageContent, StringUtils.join(phones.toArray(), ","), ScheduleTime);
+        }
+    }
+
     @ApiOperation(value="完成")
     @PostMapping("finish")
     @Transactional(rollbackFor = Exception.class)

+ 41 - 6
web/src/main/java/com/jpsoft/excellent/modules/base/controller/OfficeOpinionController.java

@@ -3,12 +3,14 @@ package com.jpsoft.excellent.modules.base.controller;
 import com.github.pagehelper.Page;
 import com.jpsoft.excellent.config.OSSConfig;
 import com.jpsoft.excellent.modules.base.dto.AttachmentDTO;
+import com.jpsoft.excellent.modules.base.dto.NextStepDTO;
 import com.jpsoft.excellent.modules.base.entity.*;
 import com.jpsoft.excellent.modules.base.service.*;
 import com.jpsoft.excellent.modules.common.utils.OSSUtil;
 import com.jpsoft.excellent.modules.common.utils.PojoUtils;
 import com.jpsoft.excellent.modules.common.dto.Sort;
 import com.jpsoft.excellent.modules.common.dto.MessageResult;
+import com.jpsoft.excellent.modules.common.utils.SMSUtil;
 import com.jpsoft.excellent.modules.sys.entity.User;
 import com.jpsoft.excellent.modules.sys.service.UserService;
 import io.swagger.annotations.Api;
@@ -112,7 +114,7 @@ public class OfficeOpinionController {
 
             //附件列表
             List<AttachmentDTO> attachmentDTOList1 = new ArrayList<>();
-            List<OfficeAttachment> officeAttachmentList1 = officeAttachmentService.findListByOfficeOpinionId(id,"1");
+            List<OfficeAttachment> officeAttachmentList1 = officeAttachmentService.findListByOfficeOpinionId(id,"3");
             for(OfficeAttachment officeAttachment : officeAttachmentList1){
                 AttachmentDTO attachmentDTO = new AttachmentDTO();
                 attachmentDTO.setName(officeAttachment.getAttachmentTitle());
@@ -626,31 +628,49 @@ public class OfficeOpinionController {
     @ApiOperation(value="步进")
     @PostMapping("nextStep")
     @Transactional(rollbackFor = Exception.class)
-    public MessageResult nextStep(String opinionId, String[] orgIds, String allotedDate, @RequestAttribute String subject){
+    public MessageResult nextStep(@RequestBody NextStepDTO nextStepDTO, @RequestAttribute String subject){
         MessageResult msgResult = new MessageResult<>();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 
         try {
             //群众评议
-            OfficeOpinion officeOpinion = officeOpinionService.get(opinionId);
+            OfficeOpinion officeOpinion = officeOpinionService.get(nextStepDTO.getOpinionId());
             officeOpinion.setConfirmStatus(true);
-            officeOpinion.setAllotedDate(sdf.parse(allotedDate));
+            officeOpinion.setAllotedDate(sdf.parse(nextStepDTO.getAllotedDate()));
             officeOpinionService.update(officeOpinion);
 
+            //反馈意见附件
+            for(AttachmentDTO dto : nextStepDTO.getAttList()) {
+                OfficeAttachment officeAttachment = new OfficeAttachment();
+                officeAttachment.setId(UUID.randomUUID().toString());
+                officeAttachment.setOfficeOpinionId(officeOpinion.getId());
+                officeAttachment.setAttachmentType("3");
+                officeAttachment.setAttachmentTitle(dto.getName());
+                officeAttachment.setAttachmentUrl(dto.getUrl());
+                officeAttachment.setCreateBy(subject);
+                officeAttachment.setCreateTime(new Date());
+                officeAttachmentService.insert(officeAttachment);
+            }
+
             //群众评议反馈
-            for(String org : orgIds) {
+            for(String org : nextStepDTO.getOrgIds()) {
                 OfficeReply officeReply = new OfficeReply();
                 officeReply.setId(UUID.randomUUID().toString());
                 officeReply.setOpinionId(officeOpinion.getId());
                 officeReply.setOrgId(org);
                 officeReply.setStatus(false);
-                officeReply.setAllotedDate(sdf.parse(allotedDate));
+                officeReply.setAllotedDate(sdf.parse(nextStepDTO.getAllotedDate()));
                 officeReply.setDelFlag(false);
                 officeReply.setCreateTime(new Date());
                 officeReply.setCreateBy(subject);
                 officeReplyService.insert(officeReply);
             }
 
+            //发送交办单位短信
+            String MessageContent = "";
+            MessageContent = "【双优督办】您有一条待办评议,请登录双优督办平台电脑端查看。(http://39.104.144.104/excellent-portal)";
+            sendSMSing(MessageContent, nextStepDTO.getOrgIds(), null);
+
             msgResult.setResult(true);
         }
         catch(Exception ex){
@@ -663,6 +683,21 @@ public class OfficeOpinionController {
         return msgResult;
     }
 
+    private void sendSMSing(String MessageContent, String[] orgIds, String ScheduleTime){
+        if(orgIds.length > 0) {
+            List<String> phones = new ArrayList<>();
+            for(String orgId : orgIds){
+                List<User> userList = userService.findListByOrgId(orgId);
+                for(User user : userList){
+                    if(StringUtils.isNotEmpty(user.getPhone())) {
+                        phones.add(user.getPhone().replace(" ",""));
+                    }
+                }
+            }
+            SMSUtil.sendSMS(MessageContent, StringUtils.join(phones.toArray(), ","), ScheduleTime);
+        }
+    }
+
     @ApiOperation(value="完成")
     @PostMapping("finish")
     @Transactional(rollbackFor = Exception.class)