瀏覽代碼

提交手机端的数据通过当前年、月、日统计
1.保费报表 2.增员报表 3. 收入报表

hxl13994548489 2 年之前
父節點
當前提交
b0db11ff5b

+ 91 - 0
src/main/java/com/ydtech/modules/admin/controller/AppReportController.java

@@ -0,0 +1,91 @@
+package com.ydtech.modules.admin.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportAllDto;
+import com.ydtech.modules.admin.model.dto.PremiumReportAllDto;
+import com.ydtech.modules.admin.model.dto.RevenueReportAllDto;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+import com.ydtech.modules.admin.service.AppReportService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "app统计报表功能")
+@RestController
+@RequestMapping("/app/reporet")
+@RequiredArgsConstructor
+public class AppReportController {
+
+    @Autowired
+    private AppReportService appReportService;
+
+    @ApiOperation(value = "保费报表")
+    @PostMapping(value = "/premiumReport")
+    public HttpResult<PremiumReportAllDto> premiumReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.premiumReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 15:58
+     *  @Description: 参数验证
+     */
+    private static void getListHttpResult(ReportQueryVo reportQueryVo) {
+        if(StringUtils.isBlank(reportQueryVo.getSearchType())){
+            new SystemException("查询类型(1.年2.月3.日)searchtype不能为空");
+        }
+        //年
+        if("1".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchYear())){
+                new SystemException("查询类型为(1.年)时searchYear不能为空");
+            }
+        }
+        if("2".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchMonth()) || StringUtils.isBlank(reportQueryVo.getSearchYear()) ){
+                new SystemException("查询类型为(3.月)时searchYear,searchMonth不能为空");
+            }
+        }
+        if("3".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchDay()) || StringUtils.isBlank(reportQueryVo.getSearchMonth()) ||  StringUtils.isBlank(reportQueryVo.getSearchYear())){
+                new SystemException("查询类型为(3.日)时searchYear,searchMonth,searchDay不能为空");
+            }
+        }
+    }
+
+    @ApiOperation(value = "增员报表")
+    @PostMapping(value = "/employeeIncreaseReport")
+    public HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.employeeIncreaseReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+
+    @ApiOperation(value = "收入报表")
+    @PostMapping(value = "/revenueReport")
+    public HttpResult<RevenueReportAllDto> revenueReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.revenueReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+}

+ 25 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserAccountHistoryMapper.java

@@ -1,8 +1,12 @@
 package com.ydtech.modules.admin.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.dto.RevenueReportDto;
 import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 
+import java.util.HashMap;
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【sys_user_account_history(用户账户表)】的数据库操作Mapper
@@ -11,6 +15,27 @@ import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 */
 public interface SysUserAccountHistoryMapper extends BaseMapper<SysUserAccountHistory> {
 
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:38
+     *  @Description: 查询年分
+     */
+    List<RevenueReportDto> revenueReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:39
+     *  @Description: 月分
+     */
+    List<RevenueReportDto> revenueReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:39
+     *  @Description: 日
+     */
+    List<RevenueReportDto> revenueReportDay(HashMap<String,String> map);
 }
 
 

+ 42 - 0
src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportAllDto.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 保费统计的数据
+ */
+@Data
+@ApiModel("增援报表统计返回对象")
+public class EmployeeIncreaseReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "增员人数")
+    private int  employeeIncreaseCount;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+    @ApiModelProperty(value = "增员人数集合")
+    private List<Integer>  employeeIncreaseReportList=new ArrayList<Integer>();
+
+    public EmployeeIncreaseReportAllDto() {
+    }
+
+    public EmployeeIncreaseReportAllDto(String reportDate, int employeeIncreaseCount, List<String> dateList, List<Integer> employeeIncreaseReportList) {
+        this.reportDate = reportDate;
+        this.employeeIncreaseCount = employeeIncreaseCount;
+        this.dateList = dateList;
+        this.employeeIncreaseReportList = employeeIncreaseReportList;
+    }
+}

+ 32 - 0
src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportDto.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:28
+ *  @Description: 增援报表统计  查询推荐人数据表
+ */
+@Data
+@ApiModel("增援报表统计")
+public class EmployeeIncreaseReportDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "增员人数")
+    private int  employeeIncreaseCount;
+
+    public EmployeeIncreaseReportDto() {
+    }
+
+    public EmployeeIncreaseReportDto(String reportDate, int employeeIncreaseCount) {
+        this.reportDate = reportDate;
+        this.employeeIncreaseCount = employeeIncreaseCount;
+    }
+}

+ 60 - 0
src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportAllDto.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 保费统计的数据
+ */
+@Data
+@ApiModel("保费报表统计返回对象")
+public class PremiumReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "交强保费")
+    private BigDecimal jqPremium;
+
+    @ApiModelProperty(value = "商业保费")
+    private BigDecimal syPremium;
+
+    @ApiModelProperty(value = "总保费")
+    private BigDecimal sumPremium;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+    @ApiModelProperty(value = "交强保费集合")
+    private List<BigDecimal>  jqPremiumList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "商业保费集合")
+    private List<BigDecimal>  syPremiumList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "总保费集合")
+    private List<BigDecimal>  sumPremiumList=new ArrayList<BigDecimal>();
+
+
+    public PremiumReportAllDto() {
+    }
+
+    public PremiumReportAllDto(String reportDate, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal sumPremium, List<String> dateList, List<BigDecimal> jqPremiumList,List<BigDecimal> syPremiumList,List<BigDecimal> sumPremiumList) {
+        this.reportDate = reportDate;
+        this.jqPremium = jqPremium;
+        this.syPremium = syPremium;
+        this.sumPremium = sumPremium;
+        this.dateList = dateList;
+        this.jqPremiumList = jqPremiumList;
+        this.syPremiumList = syPremiumList;
+        this.sumPremiumList = sumPremiumList;
+    }
+}

+ 41 - 0
src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportDto.java

@@ -0,0 +1,41 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:28
+ *  @Description: 保费报表统计  查询渠道的数据表
+ */
+@Data
+@ApiModel("保费报表统计")
+public class PremiumReportDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "交强保费")
+    private BigDecimal  jqPremium;
+
+    @ApiModelProperty(value = "商业保费")
+    private BigDecimal syPremium;
+
+    @ApiModelProperty(value = "总保费")
+    private BigDecimal sumPremium;
+
+    public PremiumReportDto() {
+    }
+
+    public PremiumReportDto(String reportDate, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal sumPremium) {
+        this.reportDate = reportDate;
+        this.jqPremium = jqPremium;
+        this.syPremium = syPremium;
+        this.sumPremium = sumPremium;
+    }
+}

+ 60 - 0
src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportAllDto.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 收入报表的数据
+ */
+@Data
+@ApiModel("收入报表统计返回对象")
+public class RevenueReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "手续费金额")
+    private BigDecimal  haldingAmount;
+
+    @ApiModelProperty(value = "非跟单金额")
+    private BigDecimal documentaryAmount;
+
+    @ApiModelProperty(value = "推广费金额")
+    private BigDecimal promotionAmount;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+
+    @ApiModelProperty(value = "手续费金额集合")
+    private List<BigDecimal>  haldingAmountList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "非跟单金额集合")
+    private List<BigDecimal>  documentaryAmountList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "推广费金额集合")
+    private List<BigDecimal>  promotionAmountList=new ArrayList<BigDecimal>();
+
+    public RevenueReportAllDto() {
+    }
+
+    public RevenueReportAllDto(String reportDate, BigDecimal haldingAmount, BigDecimal documentaryAmount, BigDecimal promotionAmount, List<String> dateList, List<BigDecimal> haldingAmountList, List<BigDecimal> documentaryAmountList, List<BigDecimal> promotionAmountList) {
+        this.reportDate = reportDate;
+        this.haldingAmount = haldingAmount;
+        this.documentaryAmount = documentaryAmount;
+        this.promotionAmount = promotionAmount;
+        this.dateList = dateList;
+        this.haldingAmountList = haldingAmountList;
+        this.documentaryAmountList = documentaryAmountList;
+        this.promotionAmountList = promotionAmountList;
+    }
+}

+ 45 - 0
src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportDto.java

@@ -0,0 +1,45 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:29
+ *  @Description: 收入报表统计  费用的记录表数据
+ */
+@Data
+@ApiModel("收入报表统计")
+public class RevenueReportDto implements Serializable {
+
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "手续费金额")
+    private BigDecimal  haldingAmount;
+
+    @ApiModelProperty(value = "非跟单金额")
+    private BigDecimal documentaryAmount;
+
+    @ApiModelProperty(value = "推广费金额")
+    private BigDecimal promotionAmount;
+
+
+    private String property;
+
+    public RevenueReportDto() {
+    }
+
+    public RevenueReportDto(String reportDate, BigDecimal haldingAmount, BigDecimal documentaryAmount, BigDecimal promotionAmount) {
+        this.reportDate = reportDate;
+        this.haldingAmount = haldingAmount;
+        this.documentaryAmount = documentaryAmount;
+        this.promotionAmount = promotionAmount;
+    }
+}

+ 34 - 0
src/main/java/com/ydtech/modules/admin/model/vo/ReportQueryVo.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.admin.model.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:20
+ *  @Description: 报表查询前台的分装
+ */
+@Data
+@ApiModel("报表查询前台查询实体")
+public class ReportQueryVo implements Serializable {
+
+
+    @ApiModelProperty("查询类型 1 年  2.月  3.日")
+    private String searchType;
+
+    @ApiModelProperty("年")
+    private String searchYear;
+
+    @ApiModelProperty("月")
+    private String searchMonth;
+
+    @ApiModelProperty("日")
+    private String searchDay;
+
+}

+ 38 - 0
src/main/java/com/ydtech/modules/admin/service/AppReportService.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.admin.service;
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportAllDto;
+import com.ydtech.modules.admin.model.dto.PremiumReportAllDto;
+import com.ydtech.modules.admin.model.dto.RevenueReportAllDto;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:24
+ *  @Description: app 相关报表统计
+ */
+public interface AppReportService {
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 15:58
+     *  @Description: 保费报表统计
+     */
+    HttpResult<PremiumReportAllDto> premiumReport(ReportQueryVo reportQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:03
+     *  @Description: 增援报表统计
+     */
+    HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(ReportQueryVo reportQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:04
+     *  @Description: 收入报表统计
+     */
+    HttpResult<RevenueReportAllDto> revenueReport(ReportQueryVo reportQueryVo);
+}

+ 305 - 0
src/main/java/com/ydtech/modules/admin/service/impl/AppReportServiceImpl.java

@@ -0,0 +1,305 @@
+package com.ydtech.modules.admin.service.impl;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.dao.SysUserAccountHistoryMapper;
+import com.ydtech.modules.admin.model.dto.*;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+import com.ydtech.modules.admin.service.AppReportService;
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
+import com.ydtech.modules.esm.dao.EsmUserReferrerMapper;
+import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:25
+ *  @Description:  报表统计页面
+ */
+@Service
+public class AppReportServiceImpl implements AppReportService {
+
+
+
+    @Autowired
+    private InsAreaCompanyMapper insAreaCompanyMapper;
+
+    @Autowired
+    private EsmUserReferrerMapper esmUserReferrerMapper;
+
+    @Autowired
+    private SysUserAccountHistoryMapper sysUserAccountHistoryMapper;
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description: 保费报表统计
+     */
+    @Override
+    public HttpResult<PremiumReportAllDto> premiumReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:07
+     *  @Description:  处理日期返回对应的数据
+     */
+    private static List<String> getDateStrings(ReportQueryVo reportQueryVo) {
+        //获取所有的月分
+        if("1".equals(reportQueryVo.getSearchType())){
+            return SliceUpDateUtil.sliceUpDateRange(SliceUpDateUtil.getFirstDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear())),
+                    SliceUpDateUtil.getLastDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear())), 2);
+        }
+        //获取所有的日
+        if("2".equals(reportQueryVo.getSearchType())){
+            int year = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[0]);
+            int month = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[1].replaceAll("^0+", ""));
+            return SliceUpDateUtil.sliceUpDateRange(SliceUpDateUtil.getFirstDayStringByMonth(year,month),
+                    SliceUpDateUtil.getLastDayStringByMonth(year,month), 3);
+        }
+        //获取所有的时
+        if("3".equals(reportQueryVo.getSearchType())){
+            return SliceUpDateUtil.sliceUpDateRange(reportQueryVo.getSearchDay()+" 00",
+                    reportQueryVo.getSearchDay()+" 23", 4);
+        }
+        return new ArrayList<String>();
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 15:05
+     *  @Description:  获取开始和结束时间
+     */
+    private static HashMap<String,String> getDateMap(ReportQueryVo reportQueryVo) {
+        HashMap<String,String> map=new HashMap<String,String>();
+        String beginTime="";
+        String endTime="";
+        //获取所有的月分
+        if("1".equals(reportQueryVo.getSearchType())){
+            beginTime = SliceUpDateUtil.getFirstDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear()))+" 00:00:00";
+            endTime = SliceUpDateUtil.getLastDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear()))+" 23:59:59";
+        }
+        //获取所有的日
+        if("2".equals(reportQueryVo.getSearchType())){
+            int year = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[0]);
+            int month = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[1].replaceAll("^0+", ""));
+            beginTime = SliceUpDateUtil.getFirstDayStringByMonth(year,month)+" 00:00:00";
+            endTime = SliceUpDateUtil.getLastDayStringByMonth(year,month)+" 23:59:59";
+        }
+        //获取所有的时
+        if("3".equals(reportQueryVo.getSearchType())){
+            beginTime = reportQueryVo.getSearchDay()+" 00:00:00";
+            endTime = reportQueryVo.getSearchDay()+" 23:59:59";
+        }
+        map.put("beginTime",beginTime);
+        map.put("endTime",endTime);
+        return map;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理保费的数据
+     */
+    private static PremiumReportAllDto getPremiumReportAllDto(List<PremiumReportDto> allList, List<String> dateStrs, String dateStr) {
+        List<PremiumReportDto> list =new ArrayList<>();
+        BigDecimal  jqPremium =BigDecimal.ZERO;
+        BigDecimal syPremium=BigDecimal.ZERO;
+        BigDecimal sumPremium=BigDecimal.ZERO;
+        List<BigDecimal> jqPremiumList =new ArrayList<>();
+        List<BigDecimal> syPremiumList =new ArrayList<>();
+        List<BigDecimal> sumPremiumList =new ArrayList<>();
+        LinkedHashMap<String,PremiumReportDto> map=new LinkedHashMap<String,PremiumReportDto>();
+        if(allList !=null && allList.size()>0){
+            for(PremiumReportDto premiumReportDto: allList){
+                map.put(premiumReportDto.getReportDate(),premiumReportDto);
+            }
+            for(String str: dateStrs){
+               if(map.get(str)==null){
+                   jqPremiumList.add(BigDecimal.ZERO);
+                   syPremiumList.add(BigDecimal.ZERO);
+                   sumPremiumList.add(BigDecimal.ZERO);
+                   list.add(new PremiumReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+               }else{
+                   jqPremium=jqPremium.add(map.get(str).getJqPremium());
+                   syPremium=syPremium.add(map.get(str).getSyPremium());
+                   sumPremium=sumPremium.add(map.get(str).getSumPremium());
+                   jqPremiumList.add(map.get(str).getJqPremium());
+                   syPremiumList.add(map.get(str).getSyPremium());
+                   sumPremiumList.add(map.get(str).getSumPremium());
+                   list.add(map.get(str));
+               }
+            }
+        }else {
+            for (String str : dateStrs) {
+                jqPremiumList.add(BigDecimal.ZERO);
+                syPremiumList.add(BigDecimal.ZERO);
+                sumPremiumList.add(BigDecimal.ZERO);
+                list.add(new PremiumReportDto(str, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO));
+            }
+        }
+        return new PremiumReportAllDto(dateStr,jqPremium,syPremium,sumPremium,dateStrs,jqPremiumList,syPremiumList,sumPremiumList);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理增员的数据
+     */
+    private static EmployeeIncreaseReportAllDto getEmployeeIncreaseReportAllDto(List<EmployeeIncreaseReportDto> allList, List<String> dateStrs, String dateStr) {
+        List<EmployeeIncreaseReportDto> list =new ArrayList<>();
+        LinkedHashMap<String,EmployeeIncreaseReportDto> map=new LinkedHashMap<String,EmployeeIncreaseReportDto>();
+        int  employeeIncreaseCount=0;
+        List<Integer> employeeIncreaseList =new ArrayList<>();
+        if(allList !=null && allList.size()>0){
+            for(EmployeeIncreaseReportDto employeeIncreaseReportDto: allList){
+                map.put(employeeIncreaseReportDto.getReportDate(),employeeIncreaseReportDto);
+            }
+            for(String str: dateStrs){
+                if(map.get(str)==null){
+                    employeeIncreaseList.add(0);
+                    list.add(new EmployeeIncreaseReportDto(str,0));
+                }else{
+                    employeeIncreaseCount+=(map.get(str).getEmployeeIncreaseCount());
+                    employeeIncreaseList.add(map.get(str).getEmployeeIncreaseCount());
+                    list.add(map.get(str));
+                }
+            }
+        }else{
+            for(String str: dateStrs){
+                employeeIncreaseList.add(0);
+                list.add(new EmployeeIncreaseReportDto(str,0));
+            }
+        }
+        return new EmployeeIncreaseReportAllDto(dateStr,employeeIncreaseCount,dateStrs,employeeIncreaseList);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理收入报表的数据
+     */
+    private static RevenueReportAllDto getRevenueReportAllDto(List<RevenueReportDto> allList, List<String> dateStrs,String dateStr) {
+        List<RevenueReportDto> list =new ArrayList<RevenueReportDto>();
+        BigDecimal  haldingAmount =BigDecimal.ZERO;
+        BigDecimal documentaryAmount=BigDecimal.ZERO;
+        BigDecimal promotionAmount=BigDecimal.ZERO;
+        List<BigDecimal> haldingAmountList =new ArrayList<>();
+        List<BigDecimal> documentaryAmountList =new ArrayList<>();
+        List<BigDecimal> promotionAmountList =new ArrayList<>();
+        LinkedHashMap<String,RevenueReportDto> map=new LinkedHashMap<String,RevenueReportDto>();
+        if(allList !=null && allList.size()>0){
+            for(RevenueReportDto revenueReportDto: allList){
+                map.put(revenueReportDto.getReportDate(),revenueReportDto);
+            }
+            for(String str: dateStrs){
+                if(map.get(str)==null){
+                    haldingAmountList.add(BigDecimal.ZERO);
+                    documentaryAmountList.add(BigDecimal.ZERO);
+                    promotionAmountList.add(BigDecimal.ZERO);
+                    list.add(new RevenueReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+                }else{
+                    haldingAmount=haldingAmount.add(map.get(str).getHaldingAmount());
+                    documentaryAmount=documentaryAmount.add(map.get(str).getDocumentaryAmount());
+                    promotionAmount=promotionAmount.add(map.get(str).getPromotionAmount());
+                    haldingAmountList.add(map.get(str).getHaldingAmount());
+                    documentaryAmountList.add(map.get(str).getDocumentaryAmount());
+                    promotionAmountList.add(map.get(str).getPromotionAmount());
+                    list.add(map.get(str));
+                }
+            }
+        }else {
+            for (String str : dateStrs) {
+                haldingAmountList.add(BigDecimal.ZERO);
+                documentaryAmountList.add(BigDecimal.ZERO);
+                promotionAmountList.add(BigDecimal.ZERO);
+                list.add(new RevenueReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+            }
+        }
+        return new RevenueReportAllDto(dateStr,haldingAmount,documentaryAmount,promotionAmount,dateStrs,haldingAmountList,documentaryAmountList,promotionAmountList);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description: 增援报表统计
+     */
+    @Override
+    public HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description:  收入报表统计
+     */
+    @Override
+    public HttpResult<RevenueReportAllDto> revenueReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+}

+ 105 - 0
src/main/java/com/ydtech/modules/admin/utils/SliceUpDateUtil.java

@@ -0,0 +1,105 @@
+package com.ydtech.modules.admin.utils;
+
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+public class SliceUpDateUtil {
+
+    /**
+     * 日期范围 - 切片
+     *
+     *
+     * @param startDate 起始日期
+     * @param endDate   结束日期
+     * @param type 切片类型 1年  2月  3日  4小时
+     * @return          切片日期
+     */
+    public static List<String> sliceUpDateRange(String startDate, String endDate , int type ) {
+        List<String> rs = new ArrayList<>();
+
+        try {
+            int dt = Calendar.DATE;
+            String pattern = "yyyy-MM-dd";
+            if (type==1) {
+                pattern = "yyyy";
+                dt = Calendar.YEAR;
+            } else if (type==2) {
+                pattern = "yyyy-MM";
+                dt = Calendar.MONTH;
+            } else if (type==3) {
+                pattern = "yyyy-MM-dd";
+                dt = Calendar.DATE;
+            }else if (type==4) {
+                pattern = "yyyy-MM-dd HH";
+                dt = Calendar.HOUR_OF_DAY;
+            }
+            SimpleDateFormat sd = new SimpleDateFormat(pattern);
+            Calendar sc = Calendar.getInstance();
+            Calendar ec = Calendar.getInstance();
+            sc.setTime(sd.parse(startDate));
+            ec.setTime(sd.parse(endDate));
+            while (sc.compareTo(ec) < 1) {
+                rs.add(sd.format(sc.getTime()));
+                sc.add(dt, 1);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return rs;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某年的第一天
+     */
+    public static String getFirstDayStringByYear(int year) {
+        LocalDate firstDayOfYear = LocalDate.of(year, 1, 1);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        String firstDayString = firstDayOfYear.format(formatter);
+        return firstDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某年的最后一天
+     */
+    public static String getLastDayStringByYear(int year) {
+        LocalDate lastDayOfYear = LocalDate.of(year, 12, 31);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        String lastDayString = lastDayOfYear.format(formatter);
+        return lastDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某月的第一天
+     */
+    public static String getFirstDayStringByMonth(int year,int month) {
+        LocalDate firstDayOfMonth = LocalDate.of(year, month, 1);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String firstDayString = firstDayOfMonth.format(formatter);
+        return firstDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某月的最后一天
+     */
+    public static String getLastDayStringByMonth(int year,int month) {
+        LocalDate firstDayOfMonth = LocalDate.of(year, month, 1);
+        LocalDate lastDayOfMonth = firstDayOfMonth.withDayOfMonth(firstDayOfMonth.lengthOfMonth());
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String lastDayString = lastDayOfMonth.format(formatter);
+        return lastDayString;
+    }
+}

+ 23 - 5
src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java

@@ -3,12 +3,11 @@ package com.ydtech.modules.esm.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserTeamDto;
 import com.ydtech.modules.admin.model.vo.AppCustomerManagementQueryVo;
 import com.ydtech.modules.admin.model.vo.SysReferrerVo;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
-import com.ydtech.modules.admin.model.vo.SysUserVO;
 import com.ydtech.modules.base.model.dto.PageDto;
 import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.esm.model.QueryChannel;
@@ -18,7 +17,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
-import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 
 
@@ -201,6 +200,25 @@ public interface EsmUserReferrerMapper extends BaseMapper<EsmUserReferrer> {
 
     List<SysUserTeamDto> getByTeam(@Param("managementQueryVo") AppCustomerManagementQueryVo managementQueryVo, @Param("userId") String userId, @Param("level") int level);
 
-
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:10
+     *  @Description: 查询年分数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:15
+     *  @Description: 查询月分数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:16
+     *  @Description: 查询天数数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportDay(HashMap<String,String> map);
 }

+ 22 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.PremiumReportDto;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -91,6 +92,27 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      *  @Description: 获取订单详情页面
      */
     SubOrder getSubOrderDetails(String subOrderId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportDay(HashMap<String,String> map);
 }
 
 

+ 73 - 0
src/main/resources/mapper/modules/admin/SysUserAccountHistoryMapper.xml

@@ -23,4 +23,77 @@
         from_bank_card,to_bank_card,user_id,
         create_time
     </sql>
+
+    <select id="revenueReportYear" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')) reportDate,
+                    property as property,
+                    sum(amount)  as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                GROUP BY
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
+    <select id="revenueReportMonth" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')) reportDate,
+                    property as property,
+                    sum(amount)  as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                GROUP BY
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
+    <select id="revenueReportDay" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )) reportDate,
+                    property as property,
+                    sum( amount ) as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                GROUP BY
+                    CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
 </mapper>

+ 37 - 0
src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml

@@ -137,5 +137,42 @@
         </if>
     </select>
 
+    <select id="employeeIncreaseReportYear" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0')) reportDate,
+            count(0) as employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+        GROUP BY  CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'))
+    </select>
+
+    <select id="employeeIncreaseReportMonth" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'),'-',LPAD(Day(us.create_time), 2, '0')) reportDate,
+            count(0) as employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+        GROUP BY  CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'),'-',LPAD(Day(us.create_time), 2, '0'))
+    </select>
+
+
+    <select id="employeeIncreaseReportDay" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR ( us.create_time ),'-',LPAD( MONTH ( us.create_time ), 2, '0' ),'-',LPAD( DAY ( us.create_time ), 2, '0' ),' ',LPAD( HOUR ( us.create_time ), 2, '0' ))
+                          reportDate,
+            count( 0 ) AS employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+        GROUP BY  CONCAT(YEAR ( us.create_time ),'-',LPAD( MONTH ( us.create_time ), 2, '0' ),'-',LPAD( DAY ( us.create_time ), 2, '0' ),' ',LPAD( HOUR ( us.create_time ), 2, '0' ))
+    </select>
 
 </mapper>

+ 41 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -586,4 +586,45 @@
         WHERE
             iac.id=#{subOrderId}
     </select>
+
+
+    <select id="premiumReportYear" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0')) reportDate,
+            sum(jqpremium) jqpremium,
+            sum(sypremium) sypremium,
+            sum(sumpremium) sumpremium
+        FROM
+            ins_area_company iac
+        WHERE
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+        GROUP BY CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'))
+    </select>
+
+    <select id="premiumReportMonth" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'),'-',LPAD(Day(iac.createtime), 2, '0')) reportDate,
+            sum(jqpremium) jqpremium,
+            sum(sypremium) sypremium,
+            sum(sumpremium) sumpremium
+        FROM
+            ins_area_company iac
+        WHERE
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+        GROUP BY  CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'),'-',LPAD(Day(iac.createtime), 2, '0'))
+    </select>
+
+    <select id="premiumReportDay" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR ( iac.createtime ),'-',LPAD( MONTH ( iac.createtime ), 2, '0' ),'-',LPAD( DAY ( iac.createtime ), 2, '0' ),' ',LPAD( HOUR ( iac.createtime ), 2, '0' ))
+                              reportDate,
+            sum( jqpremium ) jqpremium,
+            sum( sypremium ) sypremium,
+            sum( sumpremium ) sumpremium
+        FROM
+            ins_area_company iac
+        WHERE
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+        GROUP BY   CONCAT(YEAR ( iac.createtime ),'-',LPAD( MONTH ( iac.createtime ), 2, '0' ),'-',LPAD( DAY ( iac.createtime ), 2, '0' ),' ',LPAD( HOUR ( iac.createtime ), 2, '0' ))
+    </select>
 </mapper>