فهرست منبع

修改分页问题

Administrator 1 سال پیش
والد
کامیت
5566e65f46

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SendSmsController.java

@@ -45,7 +45,7 @@ public class SendSmsController {
      * @return
      */
     @PostMapping("/sendBatchSmsTable")
-    public AjaxResult investigateTableNotice(InvestigateTable investigateTable) {
+    public AjaxResult investigateTableNotice(@RequestBody InvestigateTable investigateTable) {
         Long investigateTableId = investigateTable.getInvestigateTableId();
         List<InvestigateUser> investigateUserList = investigateTable.getInvestigateUserList();
         investigateTableService.sendBatchSmsTable(investigateTableId, investigateUserList);
@@ -59,7 +59,7 @@ public class SendSmsController {
      * @return
      */
     @PostMapping("/sendBatchSmsTableUpdate")
-    public AjaxResult sendBatchSmsTableUpdate(InvestigateTable investigateTable) {
+    public AjaxResult sendBatchSmsTableUpdate(@RequestBody InvestigateTable investigateTable) {
         Long investigateTableId = investigateTable.getInvestigateTableId();
         List<InvestigateUser> investigateUserList = investigateTable.getInvestigateUserList();
         investigateTableService.sendBatchSmsTableUpdate(investigateTableId, investigateUserList);

+ 105 - 99
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InvestigateTableServiceImpl.java

@@ -29,6 +29,7 @@ import com.ruoyi.system.mapper.InvestigateTableMapper;
 import com.ruoyi.system.domain.InvestigateTable;
 import com.ruoyi.system.service.IInvestigateTableService;
 import org.springframework.web.multipart.MultipartFile;
+
 import static com.ruoyi.common.config.RuoYiConfig.getProfile;
 
 /**
@@ -86,12 +87,12 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
                 Long investigateTableId = table.getInvestigateTableId();
                 sb.append(investigateTableId).append(",");
             }
-            String substring = sb.substring(0,sb.length() - 1);
+            String substring = sb.substring(0, sb.length() - 1);
             //查询考察团全部信息
             investigateTable.setInvestigateTableIds(substring);
             investigateTablesAll = investigateTableMapper.selectInvestigateTableListALL(investigateTable);
         }
-        if (investigateTablesAll != null && investigateTablesAll.size() > 0){
+        if (investigateTablesAll != null && investigateTablesAll.size() > 0) {
             for (InvestigateTable table : investigateTablesAll) {
                 table.setType("进行中");
                 //根据开始时间结束时间计算状态
@@ -99,11 +100,11 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
                 Date endTime = table.getEndTime();
                 Date nowDate = DateUtils.getNowDate();
                 //默认进行中
-                if (nowDate.before(beginTime)){
+                if (nowDate.before(beginTime)) {
                     //未开始
                     table.setType("未开始");
 
-                }else if (nowDate.after(endTime)){
+                } else if (nowDate.after(endTime)) {
                     //已结束
                     table.setType("已结束");
                 }
@@ -179,7 +180,7 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
 
         for (int i = 0; i < investigateDispositionTableList.size(); i++) {
             Date nowDate = new Date();
-            nowDate.setTime(nowDate.getTime()+ (i* 1000L));
+            nowDate.setTime(nowDate.getTime() + (i * 1000L));
             InvestigateDispositionTable investigateDispositionTable = investigateDispositionTableList.get(i);
             investigateDispositionTable.setInvestigateTableId(investigateTableId);
             investigateDispositionTable.setCreateTime(nowDate);
@@ -213,105 +214,110 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
     }
 
     @Override
-    public  void sendBatchSmsTable(Long investigateTableId, List<InvestigateUser> investigateUserList) {
-        for (InvestigateUser investigateUser : investigateUserList) {
-            StringBuffer phoneNumberJson = new StringBuffer();
-            StringBuffer templateParamJson = new StringBuffer();
-            StringBuffer signNameJson = new StringBuffer();
-            phoneNumberJson.append("[");
-            templateParamJson.append("[");
-            signNameJson.append("[");
-
-            // 防止有空行,手机号是必须要有的
-            String phone = investigateUser.getPhonenumber();
-            if (StringUtils.isEmpty(phone)) {
-                continue;
-            }
-            phoneNumberJson.append("\"" + phone + "\",");
-            signNameJson.append("\"中新云\",");
-            //发送短信
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("number", investigateTableId);
-            templateParamJson.append(jsonObject).append(",");
-
-
-            phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
-            templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
-            signNameJson.deleteCharAt(signNameJson.length() - 1);
-            phoneNumberJson.append("]");
-            templateParamJson.append("]");
-            signNameJson.append("]");
-
-            SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
-            //组装电话号码
-            sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
-            //签名名称
-            sendBatchSmsRequest.setSignNameJson(signNameJson.toString());
-            //替换参数
-            sendBatchSmsRequest.setTemplateParamJson(templateParamJson.toString());
-            //固定的模板名称
-            sendBatchSmsRequest.setTemplateCode("SMS_463622836");
-            long startTimeSend = System.currentTimeMillis();
-            SendBatchSmsResponse sendBatchSmsResponse = SendSmsUtils.sendBatchSms(sendBatchSmsRequest);
-            long endTimeSend = System.currentTimeMillis() - startTimeSend;
-            System.out.println("执行批量下发短信接口请求:" + endTimeSend + "ms");
-            String code = sendBatchSmsResponse.getBody().getCode();
-            if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
-                System.out.println("批量短信发送成功");
-            } else {
-                System.out.println("批量短信发送失败");
+    public void sendBatchSmsTable(Long investigateTableId, List<InvestigateUser> investigateUserList) {
+        if (investigateUserList != null && investigateUserList.size() > 0) {
+            for (InvestigateUser investigateUser : investigateUserList) {
+                StringBuffer phoneNumberJson = new StringBuffer();
+                StringBuffer templateParamJson = new StringBuffer();
+                StringBuffer signNameJson = new StringBuffer();
+                phoneNumberJson.append("[");
+                templateParamJson.append("[");
+                signNameJson.append("[");
+
+                // 防止有空行,手机号是必须要有的
+                String phone = investigateUser.getPhonenumber();
+                if (StringUtils.isEmpty(phone)) {
+                    continue;
+                }
+                phoneNumberJson.append("\"" + phone + "\",");
+                signNameJson.append("\"中新云\",");
+                //发送短信
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("number", investigateTableId);
+                templateParamJson.append(jsonObject).append(",");
+
+
+                phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
+                templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
+                signNameJson.deleteCharAt(signNameJson.length() - 1);
+                phoneNumberJson.append("]");
+                templateParamJson.append("]");
+                signNameJson.append("]");
+
+                SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
+                //组装电话号码
+                sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
+                //签名名称
+                sendBatchSmsRequest.setSignNameJson(signNameJson.toString());
+                //替换参数
+                sendBatchSmsRequest.setTemplateParamJson(templateParamJson.toString());
+                //固定的模板名称
+                sendBatchSmsRequest.setTemplateCode("SMS_463622836");
+                long startTimeSend = System.currentTimeMillis();
+                SendBatchSmsResponse sendBatchSmsResponse = SendSmsUtils.sendBatchSms(sendBatchSmsRequest);
+                long endTimeSend = System.currentTimeMillis() - startTimeSend;
+                System.out.println("执行批量下发短信接口请求:" + endTimeSend + "ms");
+                String code = sendBatchSmsResponse.getBody().getCode();
+                if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
+                    System.out.println("批量短信发送成功");
+                } else {
+                    System.out.println("批量短信发送失败");
+                }
             }
         }
     }
 
     @Override
-    public  void sendBatchSmsTableUpdate(Long investigateTableId, List<InvestigateUser> investigateUserList) {
-        for (InvestigateUser investigateUser : investigateUserList) {
-            StringBuffer phoneNumberJson = new StringBuffer();
-            StringBuffer templateParamJson = new StringBuffer();
-            StringBuffer signNameJson = new StringBuffer();
-            phoneNumberJson.append("[");
-            templateParamJson.append("[");
-            signNameJson.append("[");
-
-            // 防止有空行,手机号是必须要有的
-            String phone = investigateUser.getPhonenumber();
-            if (StringUtils.isEmpty(phone)) {
-                continue;
-            }
-            phoneNumberJson.append("\"" + phone + "\",");
-            signNameJson.append("\"中新云\",");
-            //发送短信
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("number", investigateTableId);
-            templateParamJson.append(jsonObject).append(",");
-
-
-            phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
-            templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
-            signNameJson.deleteCharAt(signNameJson.length() - 1);
-            phoneNumberJson.append("]");
-            templateParamJson.append("]");
-            signNameJson.append("]");
-
-            SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
-            //组装电话号码
-            sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
-            //签名名称
-            sendBatchSmsRequest.setSignNameJson(signNameJson.toString());
-            //替换参数
-            sendBatchSmsRequest.setTemplateParamJson(templateParamJson.toString());
-            //固定的模板名称
-            sendBatchSmsRequest.setTemplateCode("SMS_463673720");
-            long startTimeSend = System.currentTimeMillis();
-            SendBatchSmsResponse sendBatchSmsResponse = SendSmsUtils.sendBatchSms(sendBatchSmsRequest);
-            long endTimeSend = System.currentTimeMillis() - startTimeSend;
-            System.out.println("执行批量下发短信接口请求:" + endTimeSend + "ms");
-            String code = sendBatchSmsResponse.getBody().getCode();
-            if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
-                System.out.println("批量短信发送成功");
-            } else {
-                System.out.println("批量短信发送失败");
+    public void sendBatchSmsTableUpdate(Long investigateTableId, List<InvestigateUser> investigateUserList) {
+        if (investigateUserList != null && investigateUserList.size() > 0) {
+
+            for (InvestigateUser investigateUser : investigateUserList) {
+                StringBuffer phoneNumberJson = new StringBuffer();
+                StringBuffer templateParamJson = new StringBuffer();
+                StringBuffer signNameJson = new StringBuffer();
+                phoneNumberJson.append("[");
+                templateParamJson.append("[");
+                signNameJson.append("[");
+
+                // 防止有空行,手机号是必须要有的
+                String phone = investigateUser.getPhonenumber();
+                if (StringUtils.isEmpty(phone)) {
+                    continue;
+                }
+                phoneNumberJson.append("\"" + phone + "\",");
+                signNameJson.append("\"中新云\",");
+                //发送短信
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("number", investigateTableId);
+                templateParamJson.append(jsonObject).append(",");
+
+
+                phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
+                templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
+                signNameJson.deleteCharAt(signNameJson.length() - 1);
+                phoneNumberJson.append("]");
+                templateParamJson.append("]");
+                signNameJson.append("]");
+
+                SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
+                //组装电话号码
+                sendBatchSmsRequest.setPhoneNumberJson(phoneNumberJson.toString());
+                //签名名称
+                sendBatchSmsRequest.setSignNameJson(signNameJson.toString());
+                //替换参数
+                sendBatchSmsRequest.setTemplateParamJson(templateParamJson.toString());
+                //固定的模板名称
+                sendBatchSmsRequest.setTemplateCode("SMS_463673720");
+                long startTimeSend = System.currentTimeMillis();
+                SendBatchSmsResponse sendBatchSmsResponse = SendSmsUtils.sendBatchSms(sendBatchSmsRequest);
+                long endTimeSend = System.currentTimeMillis() - startTimeSend;
+                System.out.println("执行批量下发短信接口请求:" + endTimeSend + "ms");
+                String code = sendBatchSmsResponse.getBody().getCode();
+                if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
+                    System.out.println("批量短信发送成功");
+                } else {
+                    System.out.println("批量短信发送失败");
+                }
             }
         }
     }