| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listRebateCoupon")
|
| | | public void listRebateCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, Integer percent, PrintWriter out) {
|
| | | public void listRebateCoupon(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, Integer percent, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSystemRebateCoupon")
|
| | | public void listSystemRebateCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | public void listSystemRebateCoupon(AdminAcceptData acceptData,String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSystemFreeCoupon")
|
| | | public void listSystemFreeCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | public void listSystemFreeCoupon(AdminAcceptData acceptData,String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listFreeCoupon")
|
| | | public void listFreeCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | public void listFreeCoupon(AdminAcceptData acceptData,String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, Integer activated, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listFreeCouponRecord")
|
| | | public void listFreeCouponRecord(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | public void listFreeCouponRecord(AdminAcceptData acceptData,String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listGiveCoupon")
|
| | | public void listGiveCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer type,
|
| | | public void listGiveCoupon(AdminAcceptData acceptData,String callback, Integer pageIndex, Integer pageSize, String key, Integer type,
|
| | | Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 券统计
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "statisticsCoupon")
|
| | | public void statisticsCoupon(AdminAcceptData acceptData,String callback, Long uid, PrintWriter out) {
|
| | | try {
|
| | | List<String> listSource = new ArrayList<>();
|
| | | listSource.add(UserSystemCoupon.SOURCE_EXCHANGE);
|
| | | |
| | | // 免单券
|
| | | List<String> listFree = new ArrayList<>();
|
| | | listFree.add(CouponTypeEnum.freeCoupon.name());
|
| | | listFree.add(CouponTypeEnum.welfareFreeCoupon.name());
|
| | | listFree.add(CouponTypeEnum.freeCouponBuy.name());
|
| | | listFree.add(CouponTypeEnum.freeCouponGive.name());
|
| | | // 累计-金币兑换
|
| | | long freeTotal = userSystemCouponCountService.countCouponNum(uid, null, null, listFree,listSource);
|
| | | // 使用中
|
| | | long freeUseIn = userSystemCouponCountService.countCouponNum(uid, UserSystemCoupon.STATE_IN_USE, null, listFree, null);
|
| | | // 剩余
|
| | | long freeUseCan = userSystemCouponCountService.countCouponNum(uid, UserSystemCoupon.STATE_CAN_USE, null, listFree, null);
|
| | | long freeUseActive = userSystemCouponCountService.countCouponNum(uid, 0, 0, listFree, null);
|
| | | |
| | | // 奖励券
|
| | | listFree.clear();
|
| | | listFree.add(CouponTypeEnum.rebatePercentCoupon.name());
|
| | | // 累计-金币兑换
|
| | | long rebateTotal = userSystemCouponCountService.countCouponNum(uid, null, null, listFree, listSource);
|
| | | // 使用中
|
| | | long rebateUseIn = userSystemCouponCountService.countCouponNum(uid, UserSystemCoupon.STATE_IN_USE, null, listFree, null);
|
| | | // 剩余
|
| | | long rebateUseCan = userSystemCouponCountService.countCouponNum(uid, UserSystemCoupon.STATE_CAN_USE, null, listFree, null);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("freeTotal", freeTotal);
|
| | | data.put("freeUseIn", freeUseIn);
|
| | | data.put("freeLeft", freeUseCan + freeUseActive);
|
| | | data.put("rebateTotal", rebateTotal);
|
| | | data.put("rebateUseIn", rebateUseIn);
|
| | | data.put("rebateLeft", rebateUseCan);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|