Subversion Repositories SmartDukaan

Rev

Rev 28153 | Rev 28967 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28153 Rev 28541
Line 1... Line 1...
1
package com.spice.profitmandi.dao.model;
1
package com.spice.profitmandi.dao.model;
2
 
2
 
3
import java.time.LocalDateTime;
3
import java.time.LocalDateTime;
4
import java.util.List;
4
import java.util.List;
5
 
5
 
-
 
6
import org.apache.commons.lang3.StringUtils;
-
 
7
 
6
import com.spice.profitmandi.dao.enumuration.catalog.AchievementType;
8
import com.spice.profitmandi.dao.enumuration.catalog.AchievementType;
7
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
9
import com.spice.profitmandi.dao.enumuration.catalog.OfferSchemeType;
8
import com.spice.profitmandi.service.offers.ItemCriteria;
10
import com.spice.profitmandi.service.offers.ItemCriteria;
9
import com.spice.profitmandi.service.offers.PartnerCriteria;
11
import com.spice.profitmandi.service.offers.PartnerCriteria;
10
 
12
 
Line 36... Line 38...
36
	public void setEligibleSale(int eligibleSale) {
38
	public void setEligibleSale(int eligibleSale) {
37
		this.eligibleSale = eligibleSale;
39
		this.eligibleSale = eligibleSale;
38
	}
40
	}
39
 
41
 
40
	public String getDashboardHtml() {
42
	public String getDashboardHtml() {
41
		String s= null;
-
 
42
		if(this.getTargetType().equals(AchievementType.VALUE)) {
-
 
43
			
-
 
44
		} else {
-
 
45
			
-
 
46
		}
-
 
47
		StringBuffer sb = new StringBuffer();
43
		StringBuffer sb = new StringBuffer();
48
		if(this.getNextTargetSlab() != null) {
44
		if(this.getSchemeType().equals(OfferSchemeType.SELLIN)) {
-
 
45
			sb.append("On purchase of");
-
 
46
			if(this.getTargetType().equals(AchievementType.QUANTITY)) {
-
 
47
				TargetSlab targetSlab = this.getTargetSlabs().get(0);
-
 
48
				sb.append(" " + targetSlab.getOnwardsAmount());
49
			if(this.getCurrentTargetSlab()!=null) {
49
				if(this.getTargetSlabs().size()==1) {
-
 
50
					sb.append(" or more pcs, Get");
-
 
51
					if (StringUtils.isNotBlank(targetSlab.getTargetDescription())) {
-
 
52
						sb.append(" "+ targetSlab.getTargetDescription());
-
 
53
					}
-
 
54
				} else {
50
				sb.append("Contgratulations for achieving ").append(this.getCurrentTarget()).append(". ");
55
					sb.append(" but less than ").append(this.getTargetSlabs().get(1).getOnwardsAmount() + "pcs, Get");
-
 
56
					if (StringUtils.isNotBlank(targetSlab.getTargetDescription())) {
-
 
57
						sb.append(" "+ targetSlab.getTargetDescription());
-
 
58
					}
-
 
59
				}
51
			}
60
			}
-
 
61
		} else {
-
 
62
			if(this.getNextTargetSlab() != null) {
-
 
63
				if(this.getCurrentTargetSlab()!=null) {
-
 
64
					sb.append("Contgratulations for achieving ").append(this.getCurrentTarget()).append(". ");
-
 
65
				}
52
			sb.append("Sell ");
66
				sb.append("Sell ");
53
			if(this.getTargetType().equals(AchievementType.VALUE)) {
67
				if(this.getTargetType().equals(AchievementType.VALUE)) {
54
				sb.append("stock worth Rs.<span class=\"currency\">")
68
					sb.append("stock worth Rs.<span class=\"currency\">")
55
				.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
69
					.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
56
				.append("</span> to earn ").append(this.getNextTargetSlab().getTargetDescription());
70
					.append("</span> to earn ").append(this.getNextTargetSlab().getTargetDescription());
57
			} else {
71
				} else {
58
					sb.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
72
					sb.append(this.getNextTargetSlab().getRemainingAmount(this.eligibleSale))
59
					.append(" more unit(s) to earn ")
73
					.append(" more unit(s) to earn ")
60
					.append(this.getNextTargetSlab().getTargetDescription()).append(" per unit");
74
					.append(this.getNextTargetSlab().getTargetDescription()).append(" per unit");
61
			}
75
				}
62
		} else {
-
 
63
			sb.append("Congratulations for achieving the highest slab of ");
-
 
64
			if(this.getTargetType().equals(AchievementType.VALUE)) {
-
 
65
				sb.append("Rs.<span class=\"currency\">")
-
 
66
				.append(this.getCurrentTargetSlab().getOnwardsAmount())
-
 
67
				.append("</span>");
-
 
68
			} else {
76
			} else {
-
 
77
				sb.append("Congratulations for achieving the highest slab of ");
-
 
78
				if(this.getTargetType().equals(AchievementType.VALUE)) {
-
 
79
					sb.append("Rs.<span class=\"currency\">")
-
 
80
					.append(this.getCurrentTargetSlab().getOnwardsAmount())
-
 
81
					.append("</span>");
-
 
82
				} else {
69
				sb.append(this.getCurrentTargetSlab().getOnwardsAmount()).append(" units")
83
					sb.append(this.getCurrentTargetSlab().getOnwardsAmount()).append(" units")
70
				.append(", you are eligible for ").append(this.getCurrentTargetSlab().getTargetDescription());
84
					.append(", you are eligible for ").append(this.getCurrentTargetSlab().getTargetDescription());
-
 
85
					
71
				
86
				}
-
 
87
				sb.append(", keep it up!!");
72
			}
88
			}
73
			sb.append(", keep it up!!");
-
 
74
		}
89
		}
75
		return sb.toString();
90
		return sb.toString();
76
	}
91
	}
77
	
92
	
78
	
93