|  |  | 
 |  |  | package com.ruoyi.web.controller.smartor.tools; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONArray; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.ruoyi.common.annotation.Log; | 
 |  |  | import com.ruoyi.common.annotation.RepeatSubmit; | 
 |  |  | import com.ruoyi.common.core.controller.BaseController; | 
 |  |  | 
 |  |  | import com.ruoyi.common.core.page.TableDataInfo; | 
 |  |  | import com.ruoyi.common.enums.BusinessType; | 
 |  |  | import com.ruoyi.common.utils.poi.ExcelUtil; | 
 |  |  | import com.ruoyi.common.utils.sms.smsUtils; | 
 |  |  | import com.smartor.domain.BaseSmsRequest; | 
 |  |  | import com.smartor.domain.BaseSmsaccount; | 
 |  |  | import com.smartor.domain.BatchBaseSmsRequest; | 
 |  |  | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import io.swagger.annotations.ApiParam; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private IBaseSmsaccountService baseSmsaccountService; | 
 |  |  |  | 
 |  |  |     @Value("${xhsmsPath}") | 
 |  |  |     private String xhsmsPath; | 
 |  |  |  | 
 |  |  |     @Value("${xhsmsAccount}") | 
 |  |  |     private String xhsmsAccount; | 
 |  |  |  | 
 |  |  |     @Value("${xhsmsPwd}") | 
 |  |  |     private String xhsmsPwd; | 
 |  |  |  | 
 |  |  |     @Value("${spring.profiles.active}") | 
 |  |  |     private String active; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查询短信账号列表 | 
 |  |  |      */ | 
 |  |  |     //@PreAuthorize("@ss.hasPermi('smartor:smsaccount:list')") | 
 |  |  |    @PostMapping("/list") | 
 |  |  |     @PostMapping("/list") | 
 |  |  |     public TableDataInfo list(@RequestBody BaseSmsaccount baseSmsaccount) { | 
 |  |  |         startPage(); | 
 |  |  |         List<BaseSmsaccount> list = baseSmsaccountService.selectBaseSmsaccountList(baseSmsaccount); | 
 |  |  | 
 |  |  |     @PostMapping("/sendMsg") | 
 |  |  |     @RepeatSubmit | 
 |  |  |     public AjaxResult sendMsg(@RequestBody BaseSmsRequest baseSmsRequest) { | 
 |  |  |         if (baseSmsaccountService.sendMsg(baseSmsRequest) == null) { | 
 |  |  |             return error(); | 
 |  |  |         String sendMsg = ""; | 
 |  |  |         if (active.equals("hzszlyy")) { | 
 |  |  |             try { | 
 |  |  |                 JSONObject jsTemp = JSON.parseObject(baseSmsRequest.getTemplateParam()); | 
 |  |  |                 String content = jsTemp.getString("name"); | 
 |  |  |                 sendMsg = smsUtils.sendSms(xhsmsPath, xhsmsAccount, xhsmsPwd, baseSmsRequest.getPhoneNumber(), content); | 
 |  |  |             } catch (Exception ex) { | 
 |  |  |                 return AjaxResult.error(ex.getMessage()); | 
 |  |  |             } | 
 |  |  |             return AjaxResult.success(sendMsg); | 
 |  |  |         } else { | 
 |  |  |             if (baseSmsaccountService.sendMsg(baseSmsRequest) == null) { | 
 |  |  |                 return error(); | 
 |  |  |             } | 
 |  |  |             return success(baseSmsaccountService.sendMsg(baseSmsRequest)); | 
 |  |  |         } | 
 |  |  |         return success(baseSmsaccountService.sendMsg(baseSmsRequest)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** |