package com.yeshi.fanli.controller.wxmp.v1;
|
|
import java.io.PrintWriter;
|
import java.math.BigDecimal;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.yeshi.utils.JsonUtil;
|
|
import com.yeshi.fanli.entity.accept.AcceptData;
|
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
import com.yeshi.fanli.vo.user.UserSettingsVO;
|
|
import net.sf.json.JSONObject;
|
|
@Controller("WXMPOrderController")
|
@RequestMapping("/wxmp/api/v1/order")
|
public class OrderController {
|
|
@Resource
|
private SystemClientParamsService systemClientParamsService;
|
|
@Resource
|
private UserCustomSettingsService userCustomSettingsService;
|
|
@Resource
|
private HongBaoV2CountService hongBaoV2CountService;
|
|
/**
|
* 统计奖金
|
*
|
* @param acceptData
|
* @param uid
|
* @param dateType
|
* 1-今日 2-昨天 3-本月 4-上个月
|
* @param out
|
*/
|
@RequestMapping(value = "getBonusCount", method = RequestMethod.POST)
|
public void getBonusCount(AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
|
if (uid == null) {
|
out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
return;
|
}
|
|
boolean show = false;
|
UserSettingsVO settings = null;
|
try {
|
settings = userCustomSettingsService.getMySettings(uid);
|
} catch (Exception e) {
|
}
|
|
// 验证是否显示模块
|
if (settings != null && settings.getNoBonusCount() != null) {
|
if (settings.getNoBonusCount() == 1) {
|
show = false;
|
} else if (settings.getNoBonusCount() == 0) {
|
show = true;
|
}
|
} else {
|
show = hongBaoV2CountService.getHongBaoCount(uid, null) > 0;
|
}
|
|
BigDecimal selfMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 1);
|
BigDecimal shareMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 2);
|
BigDecimal inviteMoney = hongBaoV2CountService.getRewardMoneyToCount(uid, dateType, 3);
|
|
JSONObject data = new JSONObject();
|
data.put("show", show);
|
data.put("selfMoney", selfMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
data.put("shareMoney", shareMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
out.print(JsonUtil.loadTrueResult(data));
|
}
|
}
|