Sfoglia il codice sorgente

--add isSignIn();update signIn();

zzy.zhiyuan.foxmail 8 anni fa
parent
commit
6d519cb394

+ 41 - 6
src/main/java/com/ekexiu/portal/service/GrowthLogService.java

86
		return this.growthLogDao.queryLastSignIn(con, professorId, "5");
86
		return this.growthLogDao.queryLastSignIn(con, professorId, "5");
87
	}
87
	}
88
	
88
	
89
	@Get
90
	@Path("/isSignIn")
91
	public boolean isSignIn(@JdbcConn Connection con,String professorId)throws SQLException{
92
		GrowthLog growthLog = this.growthLogDao.queryLastSignIn(con, professorId, "5");
93
		if(growthLog != null){
94
			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
95
			String date = sdf.format(new Date());
96
			if(date.equals(growthLog.getCreateTime().substring(0, 8))){
97
				return false;
98
			}else{
99
				return true;
100
			}
101
		}else{
102
			return true;
103
		}
104
	}
105
	
89
	@Get
106
	@Get
90
	@Path("/queryByPro")
107
	@Path("/queryByPro")
91
	public List<GrowthLog> queryByPro(@JdbcConn Connection con,String professorId,@DefaultValue("com.ekexiu.portal.service.GrowthLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("20") int rows)throws SQLException{
108
	public List<GrowthLog> queryByPro(@JdbcConn Connection con,String professorId,@DefaultValue("com.ekexiu.portal.service.GrowthLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("20") int rows)throws SQLException{
94
	
111
	
95
	@Get
112
	@Get
96
	@Path("/queryInvite")
113
	@Path("/queryInvite")
97
	public List<InviteUserScore> queryInvite(@JdbcConn Connection con,String professorId,@DefaultValue("com.ekexiu.portal.service.GrowthLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("20") int rows)throws SQLException{
98
		return this.growthLogDao.queryInvite(con, professorId, createTime, rows);
114
	public List<InviteUserScore> queryInvite(@JdbcConn Connection con,String professorId,@DefaultValue("20") int rows,@DefaultValue("0") int offset)throws SQLException{
115
		return this.growthLogDao.queryInvite(con, professorId, rows, offset);
99
	}
116
	}
100
	
117
	
101
	@Get
118
	@Get
225
	 */
242
	 */
226
	@Post
243
	@Post
227
	@Path("/signIn")
244
	@Path("/signIn")
228
	public void signIn(@JdbcConn(true) Connection con,String professorId)throws SQLException, JfwBaseException{
245
	public Map<String, Integer> signIn(@JdbcConn(true) Connection con,String professorId)throws SQLException, JfwBaseException{
229
		//获取当天日期(年月日)
246
		//获取当天日期(年月日)
230
		String today = this.getDate() + "%";
247
		String today = this.getDate() + "%";
231
		//获取前一天日期(年月日)
248
		//获取前一天日期(年月日)
239
		growthLog.setId(StringUtil.buildUUID());
256
		growthLog.setId(StringUtil.buildUUID());
240
		growthLog.setProfessorId(professorId);
257
		growthLog.setProfessorId(professorId);
241
		growthLog.setOperate("5");
258
		growthLog.setOperate("5");
259
		int todayScore;
260
		int lastDayScore;
242
		if(lastLog == null){
261
		if(lastLog == null){
243
			growthLog.setSignInDays(1);
262
			growthLog.setSignInDays(1);
244
			growthLog.setScore(this.rule.getSignInOneDay());
263
			growthLog.setScore(this.rule.getSignInOneDay());
264
			todayScore = this.rule.getSignInOneDay();
265
			lastDayScore = this.rule.getSignInTwoDays();
245
		}else{
266
		}else{
246
			int days = lastLog.getSignInDays();
267
			int days = lastLog.getSignInDays();
247
			growthLog.setSignInDays(days+1);
268
			growthLog.setSignInDays(days+1);
248
			if(days > 5){
249
				growthLog.setScore(this.rule.getSignInSixDays());
250
			}else if(5 == days){
269
			if(days > 4){
251
				growthLog.setScore(this.rule.getSignInSixDays());
270
				growthLog.setScore(this.rule.getSignInSixDays());
271
				todayScore = this.rule.getSignInSixDays();
272
				lastDayScore = this.rule.getSignInSixDays();
252
			}else if(4 == days){
273
			}else if(4 == days){
253
				growthLog.setScore(this.rule.getSignInFiveDays());
274
				growthLog.setScore(this.rule.getSignInFiveDays());
275
				todayScore = this.rule.getSignInFiveDays();
276
				lastDayScore = this.rule.getSignInSixDays();
254
			}else if(3 == days){
277
			}else if(3 == days){
255
				growthLog.setScore(this.rule.getSignInFourDays());
278
				growthLog.setScore(this.rule.getSignInFourDays());
279
				todayScore = this.rule.getSignInFourDays();
280
				lastDayScore = this.rule.getSignInFiveDays();
256
			}else if(2 == days){
281
			}else if(2 == days){
257
				growthLog.setScore(this.rule.getSignInThreeDays());
282
				growthLog.setScore(this.rule.getSignInThreeDays());
283
				todayScore = this.rule.getSignInThreeDays();
284
				lastDayScore = this.rule.getSignInFourDays();
258
			}else if(1 == days){
285
			}else if(1 == days){
259
				growthLog.setScore(this.rule.getSignInTwoDays());
286
				growthLog.setScore(this.rule.getSignInTwoDays());
287
				todayScore = this.rule.getSignInTwoDays();
288
				lastDayScore = this.rule.getSignInThreeDays();
260
			}else{
289
			}else{
261
				growthLog.setScore(this.rule.getSignInOneDay());
290
				growthLog.setScore(this.rule.getSignInOneDay());
291
				todayScore = this.rule.getSignInOneDay();
292
				lastDayScore = this.rule.getSignInTwoDays();
262
			}
293
			}
263
		}
294
		}
264
		this.growthLogDao.insert(con, growthLog);
295
		this.growthLogDao.insert(con, growthLog);
265
		this.professorDao.updateScoreValue(con, professorId, growthLog.getScore());
296
		this.professorDao.updateScoreValue(con, professorId, growthLog.getScore());
266
		this.professorDao.updateGrowthValue(con, professorId, growthLog.getScore());
297
		this.professorDao.updateGrowthValue(con, professorId, growthLog.getScore());
298
		Map<String, Integer> map = new HashMap<String, Integer>();
299
		map.put("todayScore", todayScore);
300
		map.put("lastDayScore", lastDayScore);
301
		return map;
267
	}
302
	}
268
	
303
	
269
	/**
304
	/**