history.js 1.81 KB
/*
 * @Author: limin 
 * @Date: 2020-04-15 15:53:03 
 * @Last Modified by: limin
 * @Last Modified time: 2020-04-17 10:21:49
 */

"use strict";

const Controller = require("egg").Controller;
/**
 * @Controller history
 * @Description 历史保单数据
 */
class HistoryController extends Controller {
  constructor(ctx) {
    super(ctx);
    this.validate = ctx.app.validator.validate;
    this.request = ctx.request;
    this.helper = ctx.helper;
    this.redis = ctx.app.redis;
    this.HistoryService = ctx.service.history;
    // this.CacheService = ctx.service.cache; //redis 缓存服务
    this.ServerResponseCode = ctx.response.ServerResponseCode;
    this.ServerResponse = ctx.response.ServerResponse;
  }

  /**
   * @Router POST /history/findAll
   * @Description 查询所有保单数据
   * @Request pager current = 1 当前页 默认1, size = 10  每页条数 默认10
   * @Request searcher search_text 查询条件(模糊查询 车主、店面名称、保单号、车架号、设备号、序列号), insurance_status 提报状态 ,channel_code :渠道 ,success_date_start:提单成功开始时间,success_date_end:提单成功结束时间,effect_date_start:生效开始时间,effect_date_end:生效结束时间,card_version:版本类型,device_type:设备类型,insure_period: 保单期限(月),company_code:承保公司,mileage_start:累计里程起始,mileage_end:累计里程结束
   */
  async findAll({request:{ body: { pager, searcher } }}) { //get : async findAll( {query: { pager, searcher } })
    // /:{search_text:'天顺',success_date_start:'2015-09-25 00:00:00',success_date_end:'2019-09-25 23:59:59'}
    const result = await this.HistoryService.findAll({pager,searcher});
    this.ctx.body = this.ServerResponse.Success(result);
  }
}
module.exports = HistoryController;