show mine recent 1 month goals

This commit is contained in:
东皇 2017-11-10 14:38:49 +08:00
parent 6a1a1f3a95
commit 140e56f253

View File

@ -6,12 +6,13 @@ import javax.validation.Valid;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import me.chyxion.tigon.model.ListResult;
import me.chyxion.tigon.mybatis.Search;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import me.chyxion.tigon.model.ViewModel;
import me.chyxion.tigon.model.ListResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Controller;
import com.pudonghot.ambition.crm.model.WeekGoal;
import com.pudonghot.ambition.crm.util.AmDateUtil;
@ -60,10 +61,6 @@ public class WeekGoalController
public ViewModel<WeekGoal> update(
@Valid WeekGoalFormForUpdate form) {
return ((WeekGoalService) queryService).update(form);
// final Date now = new Date();
// Map<String, Object> mapRtn = new HashMap<>();
// mapRtn.put("data", ((WeekGoalService) queryService).yearSum(getUserId(), AmDateUtil.getYear(now), now));
// return mapRtn;
}
private Search filters(final Search search, final String strFilters) {
@ -116,11 +113,12 @@ public class WeekGoalController
* @return search
*/
private Search thisMonth(final Search search) {
final Date now = new Date() ;
final int thisMonth = AmDateUtil.getMonth(now);
return search.lte(WeekGoal.DATE_START, now)
.and(new Search(WeekGoal.MONTH_END, thisMonth)
.or(WeekGoal.MONTH_END, thisMonth));
final Date now = new Date();
final Date lastMonth = DateUtils.addMonths(now, -1);
// final int thisMonth = AmDateUtil.getMonth(now);
return search.gt(WeekGoal.DATE_END, lastMonth).lte(WeekGoal.DATE_START, now);
// .and(new Search(WeekGoal.MONTH_END, thisMonth)
// .or(WeekGoal.MONTH_END, thisMonth));
}
private ListResult<ViewModel<WeekGoal>> addYearSum(