15 changed files with 417 additions and 20 deletions
			
			
		@ -0,0 +1,45 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dao.stats; | 
				
			|||
 | 
				
			|||
import com.epmet.dto.stats.form.GmUploadDataFormDTO; | 
				
			|||
import org.apache.ibatis.annotations.Mapper; | 
				
			|||
import org.apache.ibatis.annotations.Param; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Author sun | 
				
			|||
 * @Description  数据统计服务 | 
				
			|||
 */ | 
				
			|||
@Mapper | 
				
			|||
public interface DataStatsDao { | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Description 数据上报--网格员数据分析上报--按客户Id和dateId删除历史数据 | 
				
			|||
     * @author sun | 
				
			|||
     */ | 
				
			|||
    int delGmUploadData(String customerId, String dateId); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Description 数据上报--网格员数据分析上报--批量新增或修改数据 | 
				
			|||
     * @author sun | 
				
			|||
     */ | 
				
			|||
    int saveOrUpGmUploadData(@Param("list") List<GmUploadDataFormDTO.DataList> list); | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,101 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			|||
 | 
				
			|||
<mapper namespace="com.epmet.dao.stats.DataStatsDao"> | 
				
			|||
 | 
				
			|||
    <delete id="delGmUploadData"> | 
				
			|||
        DELETE | 
				
			|||
        FROM | 
				
			|||
            fact_grid_member_statistics_daily | 
				
			|||
        WHERE | 
				
			|||
            customer_id = #{customerId} | 
				
			|||
        AND date_id = #{dateId} | 
				
			|||
        LIMIT 1000 | 
				
			|||
    </delete> | 
				
			|||
 | 
				
			|||
    <insert id="saveOrUpGmUploadData"> | 
				
			|||
        INSERT INTO fact_grid_member_statistics_daily | 
				
			|||
        ( | 
				
			|||
            id, | 
				
			|||
            date_id, | 
				
			|||
            month_id, | 
				
			|||
            year_id, | 
				
			|||
            customer_id, | 
				
			|||
            agency_id, | 
				
			|||
            grid_id, | 
				
			|||
            pid, | 
				
			|||
            pids, | 
				
			|||
            staff_id, | 
				
			|||
            staff_name, | 
				
			|||
            project_count, | 
				
			|||
            issue_to_project_count, | 
				
			|||
            closed_issue_count, | 
				
			|||
            project_response_count, | 
				
			|||
            project_transfer_count, | 
				
			|||
            project_closed_count, | 
				
			|||
            project_incr, | 
				
			|||
            issue_to_project_incr, | 
				
			|||
            closed_issue_incr, | 
				
			|||
            project_response_incr, | 
				
			|||
            project_transfer_incr, | 
				
			|||
            project_closed_incr, | 
				
			|||
            del_flag, | 
				
			|||
            revision, | 
				
			|||
            created_by, | 
				
			|||
            created_time, | 
				
			|||
            updated_by, | 
				
			|||
            updated_time | 
				
			|||
        ) | 
				
			|||
        VALUES | 
				
			|||
        <foreach collection="list" item="i" separator=","> | 
				
			|||
        ( | 
				
			|||
            REPLACE(UUID(), '-', ''), | 
				
			|||
            #{i.dateId}, | 
				
			|||
            #{i.monthId}, | 
				
			|||
            #{i.yearId}, | 
				
			|||
            #{i.customerId}, | 
				
			|||
            #{i.agencyId}, | 
				
			|||
            #{i.gridId}, | 
				
			|||
            #{i.pid}, | 
				
			|||
            #{i.pids}, | 
				
			|||
            #{i.staffId}, | 
				
			|||
            #{i.staffName}, | 
				
			|||
            #{i.projectCount}, | 
				
			|||
            #{i.issueToProjectCount}, | 
				
			|||
            #{i.closedIssueCount}, | 
				
			|||
            #{i.projectResponseCount}, | 
				
			|||
            #{i.projectTransferCount}, | 
				
			|||
            #{i.projectClosedCount}, | 
				
			|||
            #{i.projectIncr}, | 
				
			|||
            #{i.issueToProjectIncr}, | 
				
			|||
            #{i.closedIssueIncr}, | 
				
			|||
            #{i.projectResponseIncr}, | 
				
			|||
            #{i.projectTransferIncr}, | 
				
			|||
            #{i.projectClosedIncr}, | 
				
			|||
            0, | 
				
			|||
            0, | 
				
			|||
            'BASE_REPORT', | 
				
			|||
            NOW(), | 
				
			|||
            'BASE_REPORT', | 
				
			|||
            NOW() | 
				
			|||
        ) | 
				
			|||
        </foreach> | 
				
			|||
        ON DUPLICATE KEY | 
				
			|||
        UPDATE | 
				
			|||
            project_count = values(project_count), | 
				
			|||
            issue_to_project_count = values(issue_to_project_count), | 
				
			|||
            closed_issue_count = values(closed_issue_count), | 
				
			|||
            project_response_count = values(project_response_count), | 
				
			|||
            project_transfer_count = values(project_transfer_count), | 
				
			|||
            project_closed_count = values(project_closed_count), | 
				
			|||
            project_incr = values(project_incr), | 
				
			|||
            issue_to_project_incr = values(issue_to_project_incr), | 
				
			|||
            closed_issue_incr = values(closed_issue_incr), | 
				
			|||
            project_response_incr = values(project_response_incr), | 
				
			|||
            project_transfer_incr = values(project_transfer_incr), | 
				
			|||
            project_closed_incr = values(project_closed_incr), | 
				
			|||
            updated_by = 'BASE_REPORT', | 
				
			|||
            updated_time = NOW() | 
				
			|||
    </insert> | 
				
			|||
 | 
				
			|||
</mapper> | 
				
			|||
					Loading…
					
					
				
		Reference in new issue