Explorar o código

干部作风评议接口发送短信

jz.kai %!s(int64=2) %!d(string=hai) anos
pai
achega
9a436990dc

+ 10 - 10
web/src/main/java/com/jpsoft/excellent/modules/open/OfficeOpinionApiController.java

@@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -55,6 +56,7 @@ public class OfficeOpinionApiController {
 
     @ApiOperation(value="添加反馈信息")
     @PostMapping("add")
+    @Transactional(rollbackFor = Exception.class)
     @ApiImplicitParams({
             @ApiImplicitParam(name="connect", value="联系人", required=true, paramType="query"),
             @ApiImplicitParam(name="connectPhone", value="联系电话", required=true, paramType="query"),
@@ -74,6 +76,10 @@ public class OfficeOpinionApiController {
             officeOpinion.setOfficeId(officeId);
             if("0".equals(isSatisfied)) {
                 officeOpinion.setIsSatisfied(false);
+
+                String MessageContent = "【双优督办】干部监督评议有一条投诉,请查收。";
+                String UserNumber = "13677200818,13647155484,13607214498";
+                SMSUtil.sendSMS(MessageContent, UserNumber, null);
             }
             else{
                 officeOpinion.setIsSatisfied(true);
@@ -84,16 +90,10 @@ public class OfficeOpinionApiController {
             officeOpinion.setCreateTime(new Date());
             officeOpinion.setOpinionStatus(false);
             officeOpinion.setConfirmStatus(false);
-            
-            int affectCount = officeOpinionService.insert(officeOpinion);
-
-            if (affectCount > 0) {
-                msgResult.setResult(true);
-                msgResult.setData(officeOpinion);
-            } else {
-                msgResult.setResult(false);
-                msgResult.setMessage("数据库添加失败");
-            }
+            officeOpinionService.insert(officeOpinion);
+
+            msgResult.setResult(true);
+            msgResult.setData(officeOpinion);
         }
         catch(Exception ex){
             logger.error(ex.getMessage(),ex);

+ 2 - 2
web/src/main/java/com/jpsoft/excellent/modules/textController.java

@@ -63,8 +63,8 @@ public class textController {
     public MessageResult sendSMS(@RequestAttribute String subject){
         MessageResult msgResult = new MessageResult();
 
-        String MessageContent = "【双优督办】您有一条站内消息/文件传输,请登录双由督察平台电脑端查看。(http://39.104.144.104/excellent-portal/)";
-        String UserNumber = "19972671252,15827719088,15586481185";
+        String MessageContent = "【双优督办】干部监督评议有一条投诉,请查收。";
+        String UserNumber = "19972671252,15827719088";
 
         try {
             MessageResult message = SMSUtil.sendSMS(MessageContent, UserNumber, null);