Commit e3dacb2f by jianan

导出运营报表2-经纪人日程管理,销售目标,活动量

parent c5ce9fa2
......@@ -911,7 +911,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
payIds[i] = withdraws.get(i).getPayId();
}
List<FortunePayToOrderInfo> fortunePayToOrderInfos = agmsFortuneDalService.fortunePayToOrder(payIds);
createCSV(fortunePayToOrderInfos, response);
createCSV(fortunePayToOrderInfos, response, requestVO);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
......@@ -1287,9 +1287,14 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
}
}
private void createCSV(List<FortunePayToOrderInfo> fortunePayToOrderInfos, HttpServletResponse response) {
private void createCSV(List<FortunePayToOrderInfo> fortunePayToOrderInfos, HttpServletResponse response, ExportFortunePayRequestVO requestVO) {
String charset = "UTF-8"; // 读取字符编码
String[] columnName = new String[]{"序号", "预计发佣年月", "所属渠道", "经纪人", "佣金", "应发佣金", "首年销售佣金(fyc)", "保单号", "保费", "佣金率", "发佣状态", "佣金类型", "手机号", "职级", "分公司", "营业部", "体系", "购买方案"};
// 如果是渠道到处报表,用不同的表头
if (requestVO.getChannelId() != null) {
columnName = new String[]{"序号", "发佣年月", "所属渠道", "经纪人", "佣金", "应发佣金", "首年销售佣金(fyc)", "保单号", "保费", "佣金率", "发佣状态", "佣金类型", "手机号", "职级", "分公司", "营业部", "体系", "购买方案"};
}
String tableName = "YD_Export_Fortune_Pay";
String CSV_COLUMN_SEPARATOR = ",";//CSV文件列分隔符
String CSV_ROW_SEPARATOR = "\r\n";//CSV文件行分隔符
......
......@@ -151,10 +151,10 @@
<when test="type != null and date != null">
AND t.statistic_time_unit = #{type,jdbcType=BIGINT}
<if test="type == 1">
AND year(t.created_at) = year(#{date,jdbcType=VARCHAR})
AND year(t.created_at) = year(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'))
</if>
<if test="type == 3">
AND DATE_FORMAT(t.created_at, '%Y%m') = DATE_FORMAT(#{date,jdbcType=VARCHAR}, '%Y%m')
AND DATE_FORMAT(t.created_at, '%Y-%m') = DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
</if>
</when>
<when test="type != null and date == null">
......@@ -162,7 +162,8 @@
</when>
<otherwise>
<if test="date != null">
AND date_format(t.created_at, '%Y-%m-%d') &gt;= #{date,jdbcType=VARCHAR} AND date_format(t.created_at, '%Y-%m-%d') &lt;= #{date,jdbcType=VARCHAR}
AND date_format(t.created_at, '%Y-%m') &gt;= DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
AND date_format(t.created_at, '%Y-%m') &lt;= DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
</if>
</otherwise>
</choose>
......@@ -188,10 +189,10 @@
<when test="type != null and date != null">
AND t.statistic_time_unit = #{type,jdbcType=BIGINT}
<if test="type == 1">
AND year(t.created_at) = year(#{date,jdbcType=VARCHAR})
AND year(t.created_at) = year(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'))
</if>
<if test="type == 3">
AND DATE_FORMAT(t.created_at, '%Y%m') = DATE_FORMAT(#{date,jdbcType=VARCHAR}, '%Y%m')
AND DATE_FORMAT(t.created_at, '%Y-%m') = DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
</if>
</when>
<when test="type != null and date == null">
......@@ -199,7 +200,8 @@
</when>
<otherwise>
<if test="date != null">
AND date_format(t.created_at, '%Y-%m-%d') &gt;= #{date,jdbcType=VARCHAR} AND date_format(t.created_at, '%Y-%m-%d') &lt;= #{date,jdbcType=VARCHAR}
AND date_format(t.created_at, '%Y-%m') &gt;= DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
AND date_format(t.created_at, '%Y-%m') &lt;= DATE_FORMAT(str_to_date(#{date,jdbcType=VARCHAR}, '%Y-%m'), '%Y-%m')
</if>
</otherwise>
</choose>
......@@ -226,10 +228,10 @@
WHERE t.practitioner_id = p.id AND o.id = t.md_drop_option_id
AND (o.drop_master_id IN(14,16) OR o.id IN(226,227,229))
<if test="startDate != null">
AND t.track_time &gt;= DATE #{startDate,jdbcType=VARCHAR}
AND date_format(t.track_time, '%Y-%m-%d') &gt;= #{startDate,jdbcType=VARCHAR}
</if>
<if test="endDate != null">
AND t.track_time &lt;= DATE #{endDate,jdbcType=VARCHAR}
AND date_format(t.track_time, '%Y-%m-%d') &lt;= #{endDate,jdbcType=VARCHAR}
</if>
<if test="practitionerId != null">
AND t.practitioner_id = #{practitionerId,jdbcType=BIGINT}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment