12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.service.ITmstruckSmsRusultService;
- import com.steerinfo.dil.util.BaseRESTfulController;
- import com.steerinfo.dil.util.ColumnDataUtil;
- import com.steerinfo.dil.util.PageListAdd;
- import com.steerinfo.framework.controller.RESTfulResult;
- import com.steerinfo.framework.service.pagehelper.PageHelper;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * TmstruckSmsRusult RESTful接口:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-10-18 09:19
- * 类描述
- * 修订历史:
- * 日期:2021-10-18
- * 作者:generator
- * 参考:
- * 描述:TmstruckSmsRusult RESTful接口
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @RestController
- @RequestMapping("/${api.version}/tmstrucksmsrusults")
- public class TmstruckSmsRusultController extends BaseRESTfulController{
- @Autowired
- ITmstruckSmsRusultService tmstruckSmsRusultService;
- @Autowired
- ESFeign esFeign;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @ApiOperation(value = "新增短信实绩", notes = "通过人工稽核判断点击新增短信实绩")
- @PostMapping(value = "/insertSmsResult")//BigDecimal
- public RESTfulResult insertSmsResult(@RequestBody(required = false) Map<String, Object> map) {
- int i = tmstruckSmsRusultService.addSmsResult(map);
- return success(i);
- }
- //查询短信实绩
- @ApiOperation(value="查询短信实绩")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(175)", value = "动态表头", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
- })
- @PostMapping("/getSmsResult")
- public RESTfulResult getSmsResult(@RequestBody(required=false) Map<String,Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String con
- ){
- //框计算
- if(con != null){
- if(!"undefined".equals(con)){
- String index="get_sms_list";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- }
- }
- List<Map<String, Object>> allSmsResult = null;
- //如果有条件查询则跳过初始化,和创建索引
- if(mapValue.size() == 0){
- //将查询结果存入索引中
- allSmsResult = tmstruckSmsRusultService.getSmsResult(mapValue);
- Map<String, Object> map = new HashMap<>();
- //添加索引
- map.put("index","get_sms_list");
- //添加id
- map.put("indexId","smsId");
- allSmsResult.add(map);
- //新建索引
- esFeign.insertIndex(allSmsResult);
- //删除
- allSmsResult.remove(allSmsResult.size()-1);
- }
- if(allSmsResult == null){
- allSmsResult = tmstruckSmsRusultService.getSmsResult(mapValue);
- }
- PageHelper.startPage(pageNum,pageSize);
- //分页数据
- List<Map<String, Object>> smsResult = tmstruckSmsRusultService.getSmsResult(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allSmsResult,smsResult);
- return success(pageList);
- }
- }
|