TmstruckSmsRusultController.java 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.service.ITmstruckSmsRusultService;
  4. import com.steerinfo.dil.util.BaseRESTfulController;
  5. import com.steerinfo.dil.util.ColumnDataUtil;
  6. import com.steerinfo.dil.util.DataChange;
  7. import com.steerinfo.dil.util.PageListAdd;
  8. import com.steerinfo.framework.controller.RESTfulResult;
  9. import com.steerinfo.framework.service.pagehelper.PageHelper;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiImplicitParams;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.*;
  15. import java.text.SimpleDateFormat;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. /**
  20. * TmstruckSmsRusult RESTful接口:
  21. * @author generator
  22. * @version 1.0-SNAPSHORT 2021-10-18 09:19
  23. * 类描述
  24. * 修订历史:
  25. * 日期:2021-10-18
  26. * 作者:generator
  27. * 参考:
  28. * 描述:TmstruckSmsRusult RESTful接口
  29. * @see null
  30. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  31. */
  32. @RestController
  33. @RequestMapping("/${api.version}/tmstrucksmsrusults")
  34. public class TmstruckSmsRusultController extends BaseRESTfulController{
  35. @Autowired
  36. ITmstruckSmsRusultService tmstruckSmsRusultService;
  37. @Autowired
  38. ESFeign esFeign;
  39. @Autowired
  40. ColumnDataUtil columnDataUtil;
  41. private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  42. //查询短信实绩
  43. @ApiOperation(value="查询短信实绩")
  44. @ApiImplicitParams({
  45. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  46. @ApiImplicitParam(name = "apiId(175)", value = "动态表头", required = false, dataType = "Integer"),
  47. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  48. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  49. })
  50. @PostMapping("/getSmsResult")
  51. public RESTfulResult getSmsResult(@RequestBody(required=false) Map<String,Object> mapValue,
  52. Integer apiId,
  53. Integer pageNum,
  54. Integer pageSize,
  55. String con
  56. ){
  57. PageHelper.startPage(pageNum,pageSize);
  58. if(con!=null){
  59. mapValue.put("con","%"+con+"%");
  60. }
  61. //分页数据
  62. DataChange.queryDataByDateTime(""+mapValue.get("startTime"),""+mapValue.get("endTime") , mapValue,sdfDateTime);//根据时间段查询数据
  63. List<Map<String, Object>> smsResult = tmstruckSmsRusultService.getSmsResult(mapValue);
  64. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,smsResult);
  65. return success(pageList);
  66. }
  67. @PostMapping("/sendMeaage")
  68. public RESTfulResult sendMeaage(@RequestParam String mobile,
  69. @RequestParam String content){
  70. int i = 0;
  71. try {
  72. i = tmstruckSmsRusultService.sendMessage(mobile,content);
  73. } catch (Exception e) {
  74. return failed(e.getMessage());
  75. }
  76. if(i == 0){
  77. return failed("发送失败");
  78. }
  79. return success("发送成功");
  80. }
  81. }