4 changed files with 153 additions and 12 deletions
@ -0,0 +1,79 @@ |
|||
package com.zdxt.enforcementcode.controller.web.supervision; |
|||
|
|||
import com.zdxt.enforcementcode.common.util.ZwSmsClient; |
|||
import com.zdxt.enforcementcode.domain.bo.thirdparty.SIQMsgParamBo; |
|||
import com.zdxt.enforcementcode.service.thirdparty.ISIQService; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 监督端-通用接口 |
|||
*/ |
|||
@Slf4j |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/web/common") |
|||
public class CommonController extends BaseController { |
|||
|
|||
private final ZwSmsClient zwSmsClient; |
|||
private final ISIQService siqService; |
|||
|
|||
/** |
|||
* 直接发送短信(内容写死,用于联调测试) |
|||
* |
|||
* |
|||
*/ |
|||
@GetMapping("/sendSms") |
|||
public R<String> sendSmsTest() { |
|||
String content = "【测试短信】尊敬的用户,您有一条执法预约提醒信息,请查收。"; |
|||
String phone = "13751146725"; |
|||
try { |
|||
String result = zwSmsClient.sendMessage(phone, content); |
|||
log.info("测试短信发送完成,phone={},平台返回:{}", phone, result); |
|||
return R.ok("发送成功", result); |
|||
} catch (Exception e) { |
|||
log.error("测试短信发送失败,phone={}", phone, e); |
|||
return R.fail("短信发送失败:" + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 直接发送站内信(内容写死,用于联调测试) |
|||
* |
|||
* @param receiveAccount 接收账号(深i企登录名) |
|||
*/ |
|||
@GetMapping("/sendSiqMsg") |
|||
public R<Void> sendSiqMsgTest(@NotBlank(message = "接收账号不能为空") @RequestParam String receiveAccount) { |
|||
SIQMsgParamBo paramBo = new SIQMsgParamBo(); |
|||
paramBo.setCreateBy(LoginHelper.getUsername()); |
|||
paramBo.setReceiveAccount(receiveAccount); |
|||
paramBo.setSourceId("0"); |
|||
Map<String, String> variables = new HashMap<>(); |
|||
variables.put("enterName", "测试"); |
|||
variables.put("dept", "深圳市司法局"); |
|||
variables.put("time", "2026-10-25 上午"); |
|||
paramBo.setAdditionalData(variables); |
|||
try { |
|||
siqService.sendMsg(paramBo); |
|||
log.info("测试站内信发送完成,receiveAccount={}", paramBo.getReceiveAccount()); |
|||
return R.ok("发送成功", null); |
|||
} catch (Exception e) { |
|||
log.error("测试站内信发送失败,receiveAccount={}", paramBo.getReceiveAccount(), e); |
|||
return R.fail("站内信发送失败:" + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue