保存进度!
This commit is contained in:
		@@ -12,8 +12,13 @@ package com.cpic.xim.mybatis.mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardProject;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardGainer;
 | 
			
		||||
 | 
			
		||||
public interface RewardsMapper 
 | 
			
		||||
{
 | 
			
		||||
    public ArrayList<RewardProject> queryRewardProjects();
 | 
			
		||||
 | 
			
		||||
    public ArrayList<RewardGainer> queryRewardGainers();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,156 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-09-07 15:18:46
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/RewardGainer.java
 | 
			
		||||
 * @Description: 获奖人对象
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.mybatis.pojo;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class RewardGainer
 | 
			
		||||
{
 | 
			
		||||
    public RewardGainer() {}
 | 
			
		||||
 | 
			
		||||
    public RewardGainer( String acquiredDate, String callerName, String callerCode,
 | 
			
		||||
            String rewardProjectCode, String rewardProjectName)
 | 
			
		||||
    {
 | 
			
		||||
        this.acquiredDate = acquiredDate;
 | 
			
		||||
        this.callerName = callerName;
 | 
			
		||||
        this.callerCode = callerCode;
 | 
			
		||||
        this.rewardProjectCode = rewardProjectCode;
 | 
			
		||||
        this.rewardProjectName = rewardProjectName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString()
 | 
			
		||||
    {
 | 
			
		||||
        return "RewardGainer [acquiredDate=" + acquiredDate + ", callerName=" + callerName
 | 
			
		||||
                + ", callerCode=" + callerCode + ", rewardProjectCode=" + rewardProjectCode
 | 
			
		||||
                + ", rewardProjectName=" + rewardProjectName + "]";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int hashCode()
 | 
			
		||||
    {
 | 
			
		||||
        final int prime = 31;
 | 
			
		||||
        int result = 1;
 | 
			
		||||
        result = prime * result + ((acquiredDate == null) ? 0 : acquiredDate.hashCode());
 | 
			
		||||
        result = prime * result + ((callerName == null) ? 0 : callerName.hashCode());
 | 
			
		||||
        result = prime * result + ((callerCode == null) ? 0 : callerCode.hashCode());
 | 
			
		||||
        result = prime * result + ((rewardProjectCode == null) ? 0 : rewardProjectCode.hashCode());
 | 
			
		||||
        result = prime * result + ((rewardProjectName == null) ? 0 : rewardProjectName.hashCode());
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean equals( Object obj )
 | 
			
		||||
    {
 | 
			
		||||
        if ( this == obj )
 | 
			
		||||
            return true;
 | 
			
		||||
        if ( obj == null )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( getClass() != obj.getClass() )
 | 
			
		||||
            return false;
 | 
			
		||||
        RewardGainer other = (RewardGainer) obj;
 | 
			
		||||
        if ( acquiredDate == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.acquiredDate != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !acquiredDate.equals( other.acquiredDate ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( callerName == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.callerName != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !callerName.equals( other.callerName ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( callerCode == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.callerCode != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !callerCode.equals( other.callerCode ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( rewardProjectCode == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.rewardProjectCode != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !rewardProjectCode.equals( other.rewardProjectCode ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( rewardProjectName == null )
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.rewardProjectName != null )
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !rewardProjectName.equals( other.rewardProjectName ) )
 | 
			
		||||
            return false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getAcquiredDate()
 | 
			
		||||
    {
 | 
			
		||||
        return acquiredDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAcquiredDate( String acquiredDate )
 | 
			
		||||
    {
 | 
			
		||||
        this.acquiredDate = acquiredDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCallerName()
 | 
			
		||||
    {
 | 
			
		||||
        return callerName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCallerName( String callerName )
 | 
			
		||||
    {
 | 
			
		||||
        this.callerName = callerName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCallerCode()
 | 
			
		||||
    {
 | 
			
		||||
        return callerCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCallerCode( String callerCode )
 | 
			
		||||
    {
 | 
			
		||||
        this.callerCode = callerCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getRewardProjectCode()
 | 
			
		||||
    {
 | 
			
		||||
        return rewardProjectCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRewardProjectCode( String rewardProjectCode )
 | 
			
		||||
    {
 | 
			
		||||
        this.rewardProjectCode = rewardProjectCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getRewardProjectName()
 | 
			
		||||
    {
 | 
			
		||||
        return rewardProjectName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRewardProjectName( String rewardProjectName )
 | 
			
		||||
    {
 | 
			
		||||
        this.rewardProjectName = rewardProjectName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "acquiredDate" )
 | 
			
		||||
    private String acquiredDate;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "callerName" )
 | 
			
		||||
    private String callerName;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "callerCode" )
 | 
			
		||||
    private String callerCode;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "rewardProjectCode" )
 | 
			
		||||
    private String rewardProjectCode;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "rewardProjectName" )
 | 
			
		||||
    private String rewardProjectName;
 | 
			
		||||
}
 | 
			
		||||
@@ -11,14 +11,14 @@ package com.cpic.xim.web.controllers;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class QueryResult {
 | 
			
		||||
public class QueryResponse {
 | 
			
		||||
 | 
			
		||||
    public QueryResult(boolean success, String message) {
 | 
			
		||||
    public QueryResponse(boolean success, String message) {
 | 
			
		||||
        this.success = success;
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public QueryResult() {
 | 
			
		||||
    public QueryResponse() {
 | 
			
		||||
        this.success = false;
 | 
			
		||||
        this.message = "";
 | 
			
		||||
    }
 | 
			
		||||
@@ -53,7 +53,7 @@ public class QueryResult {
 | 
			
		||||
        if (this == obj) return true;
 | 
			
		||||
        if (obj == null) return false;
 | 
			
		||||
        if (getClass() != obj.getClass()) return false;
 | 
			
		||||
        QueryResult other = (QueryResult) obj;
 | 
			
		||||
        QueryResponse other = (QueryResponse) obj;
 | 
			
		||||
        if (success != other.success) return false;
 | 
			
		||||
        if (message == null) {
 | 
			
		||||
            if (other.message != null) return false;
 | 
			
		||||
@@ -9,10 +9,10 @@
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.account;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class TeleSalerQueryResult extends QueryResult
 | 
			
		||||
public class TeleSalerQueryResult extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public TeleSalerQueryResult()
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,10 @@ package com.cpic.xim.web.controllers.archievement.RankingList;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import com.cpic.xim.utils.ranking.CallerRankingItem;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class RankingListResponse extends QueryResult
 | 
			
		||||
public class RankingListResponse extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
    public RankingListResponse()
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,11 +10,11 @@
 | 
			
		||||
package com.cpic.xim.web.controllers.archievement.caller;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public class CallerArchievementQueryResult extends QueryResult
 | 
			
		||||
public class CallerArchievementQueryResult extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * 
 | 
			
		||||
 
 | 
			
		||||
@@ -14,14 +14,14 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 查询部门业绩返回结果。
 | 
			
		||||
 * MensualArchievementList 每月业绩,要保证数据是按照月份排序。
 | 
			
		||||
 */
 | 
			
		||||
public class DepartmentArchievementQueryResult extends QueryResult
 | 
			
		||||
public class DepartmentArchievementQueryResult extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
    public DepartmentArchievementQueryResult()
 | 
			
		||||
    {
 | 
			
		||||
@@ -46,7 +46,8 @@ public class DepartmentArchievementQueryResult extends QueryResult
 | 
			
		||||
        return mensualArchievementList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMensualArchievementList( ArrayList<MensualArchievementItem> mensualArchievementList )
 | 
			
		||||
    public void setMensualArchievementList(
 | 
			
		||||
            ArrayList<MensualArchievementItem> mensualArchievementList )
 | 
			
		||||
    {
 | 
			
		||||
        this.mensualArchievementList = mensualArchievementList;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -63,4 +63,6 @@ public class RewardController
 | 
			
		||||
 | 
			
		||||
        return response;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-09-07 17:16:12
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/rewards/RewardGainersResponse.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.web.controllers.rewards;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardGainer;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public class RewardGainersResponse extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
    public RewardGainersResponse( boolean success, String message,
 | 
			
		||||
            ArrayList<RewardGainer> gainerList)
 | 
			
		||||
    {
 | 
			
		||||
        super( success, message );
 | 
			
		||||
 | 
			
		||||
        this.gainerList = gainerList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public RewardGainersResponse()
 | 
			
		||||
    {
 | 
			
		||||
        super();
 | 
			
		||||
 | 
			
		||||
        this.gainerList = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ArrayList<RewardGainer> getGainerList()
 | 
			
		||||
    {
 | 
			
		||||
        return gainerList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setGainerList( ArrayList<RewardGainer> gainerList )
 | 
			
		||||
    {
 | 
			
		||||
        this.gainerList = gainerList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "gainerList" )
 | 
			
		||||
    private ArrayList<RewardGainer> gainerList;
 | 
			
		||||
}
 | 
			
		||||
@@ -10,11 +10,11 @@
 | 
			
		||||
package com.cpic.xim.web.controllers.rewards;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardProject;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResult;
 | 
			
		||||
import com.cpic.xim.web.controllers.QueryResponse;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public class RewardProjectsResponse extends QueryResult
 | 
			
		||||
public class RewardProjectsResponse extends QueryResponse
 | 
			
		||||
{
 | 
			
		||||
    public RewardProjectsResponse( boolean success, String message,
 | 
			
		||||
            ArrayList<RewardProject> rewardList)
 | 
			
		||||
 
 | 
			
		||||
@@ -8,4 +8,22 @@
 | 
			
		||||
        <id property="rewardCode" column="reward_index" />
 | 
			
		||||
        <result property="rewardName" column="reward_name" javaType="String"/>
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <select id="queryRewardGainers" resultMap="RewardGainerMapper">
 | 
			
		||||
        SELECT hjr.award_date award_date,
 | 
			
		||||
               hjr.gainer_name gainer_name,
 | 
			
		||||
               hjr.gainer_code gainer_code,
 | 
			
		||||
               xm.reward_name reward_name,
 | 
			
		||||
               xm.reward_index
 | 
			
		||||
          FROM reward_gainers  hjr,
 | 
			
		||||
               reward_projects xm
 | 
			
		||||
         WHERE hjr.reward_index = xm.reward_index
 | 
			
		||||
    </select>
 | 
			
		||||
    <resultMap id="RewardGainerMapper" type="com.cpic.xim.mybatis.pojo.RewardGainer">
 | 
			
		||||
        <result column="gainer_name" property="callerName" />
 | 
			
		||||
        <result column="gainer_code" property="callerCode" />
 | 
			
		||||
        <result column="award_date" property="acquiredDate" />
 | 
			
		||||
        <result column="reward_name" property="rewardProjectName" />
 | 
			
		||||
        <result column="reward_index" property="rewardProjectCode" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
 | 
			
		||||
import com.cpic.xim.mybatis.mapper.ArchievementMapper;
 | 
			
		||||
import com.cpic.xim.mybatis.mapper.RewardsMapper;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.MensualArchievementItem;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardGainer;
 | 
			
		||||
import com.cpic.xim.mybatis.pojo.RewardProject;
 | 
			
		||||
import com.cpic.xim.mybatis.utils.MybatisUtils;
 | 
			
		||||
import com.cpic.xim.utils.ranking.CallerRankingList;
 | 
			
		||||
@@ -127,12 +128,34 @@ public class DesktopArchievementTest
 | 
			
		||||
            ArrayList<RewardProject> rewards = mapper.queryRewardProjects();
 | 
			
		||||
 | 
			
		||||
            System.out.println( rewards );
 | 
			
		||||
            assert( rewards.isEmpty() == false );
 | 
			
		||||
            
 | 
			
		||||
            assert (rewards.isEmpty() == false);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException error )
 | 
			
		||||
        {
 | 
			
		||||
            assert( false );
 | 
			
		||||
            assert (false);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testQueryGainers()
 | 
			
		||||
    {
 | 
			
		||||
        SqlSession session = null;
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            session = MybatisUtils.getSqlSession();
 | 
			
		||||
            RewardsMapper mapper = session.getMapper( RewardsMapper.class );
 | 
			
		||||
 | 
			
		||||
            ArrayList<RewardGainer> gainers = mapper.queryRewardGainers();
 | 
			
		||||
 | 
			
		||||
            System.out.println( gainers );
 | 
			
		||||
            
 | 
			
		||||
            assert( gainers != null );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( IOException error )
 | 
			
		||||
        {
 | 
			
		||||
            assert (false);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user