| | |
| | | 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.*; |
| | | |
| | |
| | | public class BaseSmsaccountController extends BaseController { |
| | | @Autowired |
| | | private IBaseSmsaccountService baseSmsaccountService; |
| | | |
| | | @Value("${visitHosp}") |
| | | private Integer visitHosp; |
| | | |
| | | @Value("${xhsmsPath}") |
| | | private String xhsmsPath; |
| | | |
| | | @Value("${xhsmsAccount}") |
| | | private String xhsmsAccount; |
| | | |
| | | @Value("${xhsmsPwd}") |
| | | private String xhsmsPwd; |
| | | |
| | | /** |
| | | * 查询短信账号列表 |
| | |
| | | @PostMapping("/sendMsg") |
| | | @RepeatSubmit |
| | | public AjaxResult sendMsg(@RequestBody BaseSmsRequest baseSmsRequest) { |
| | | String sendMsg=""; |
| | | if(visitHosp.equals("3")) { |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 批量短信发送 |