New file |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | 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.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.vo.user.SystemCouponVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/userCoupon")
|
| | | public class UserSystemCouponAdminController {
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponCountService userSystemCouponCountService;
|
| | |
|
| | | /**
|
| | | * 用户奖励券列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param keyType 1-用户id、 2来源
|
| | | * @param state
|
| | | * @param percent
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listRebateCoupon")
|
| | | public void listRebateCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, Integer percent, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountService
|
| | | .listRebateCoupon((pageIndex - 1) * pageSize, pageSize, key, keyType, state, percent);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countRebateCoupon(key, keyType, state, percent);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSystemRebateCoupon")
|
| | | public void listSystemRebateCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<SystemCouponVO> list = userSystemCouponCountService
|
| | | .listSystemCouponByRebate((pageIndex - 1) * pageSize, pageSize, key, sort);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countSystemCouponRebate(key);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSystemFreeCoupon")
|
| | | public void listSystemFreeCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer sort,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<SystemCouponVO> list = userSystemCouponCountService.listSystemCouponByFree((pageIndex - 1) * pageSize,
|
| | | pageSize, key, sort);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countSystemCouponFree(key);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户奖励券列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param keyType 1-用户id、 2来源
|
| | | * @param state
|
| | | * @param percent
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listFreeCoupon")
|
| | | public void listFreeCoupon(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, Integer activated, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountService.listFreeCoupon((pageIndex - 1) * pageSize,
|
| | | pageSize, key, keyType, state, activated);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countFreeCoupon(key, keyType, state, activated);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户奖励券列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param keyType 1-用户id、 2来源
|
| | | * @param state
|
| | | * @param percent
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listFreeCouponRecord")
|
| | | public void listFreeCouponRecord(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType,
|
| | | Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountService
|
| | | .listFreeCouponRecord((pageIndex - 1) * pageSize, pageSize, key, keyType, state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = userSystemCouponCountService.countFreeCouponRecord(key, keyType, state);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 奖励券数量曲线图
|
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRebateCouponUsedNumCharts")
|
| | | public void getRebateCouponUsedNumCharts(String callback, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out){
|
| | | try {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | JSONObject data = getChartsData(dateType, year, startTime, endTime, 1, null);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 奖励券数量曲线图
|
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRebateCouponMoneyCharts")
|
| | | public void getRebateCouponMoneyCharts(String callback, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out){
|
| | | try {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | JSONObject data = getChartsData(dateType, year, startTime, endTime, 2, null);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 奖励券数量曲线图
|
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getFreeCouponMoneyCharts")
|
| | | public void getFreeCouponMoneyCharts(String callback, Integer dateType, String year, String startTime,
|
| | | String endTime, Integer coupon, PrintWriter out){
|
| | | try {
|
| | | |
| | | if (coupon == null || (coupon != 1 && coupon != 2)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("券类型不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | |
| | | String couponType = null;
|
| | | if (coupon == 1) {
|
| | | couponType = "freeCoupon";
|
| | | } else if (coupon == 2){
|
| | | couponType = "welfareFreeCoupon";
|
| | | }
|
| | | |
| | | |
| | | JSONObject data = getChartsData(dateType, year, startTime, endTime, 3, couponType);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | public JSONObject getChartsData(Integer dateType, String year, String startTime,
|
| | | String endTime, int source, String couponType) throws Exception {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null;
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | List<Map<String, Object>> list = null;
|
| | | if (source == 1) {
|
| | | // 奖励券数量
|
| | | innerList.put("name", "数量");
|
| | | list = userSystemCouponCountService.getRebateCouponUsedNumToCharts(dateType, year,
|
| | | startTime, endTime);
|
| | | } else if (source == 2) {
|
| | | // 奖励券金额
|
| | | innerList.put("name", "金额");
|
| | | list = userSystemCouponCountService.getRebateCouponMoneyToCharts(dateType, year,
|
| | | startTime, endTime);
|
| | | } else if (source == 3) {
|
| | | // 奖励券金额
|
| | | innerList.put("name", "金额");
|
| | | list = userSystemCouponCountService.getFreeCouponMoneyToCharts(dateType, year,
|
| | | startTime, endTime, couponType);
|
| | | }
|
| | | |
| | | |
| | | Object objectDate = null;
|
| | | |
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | |
|
| | | data.put("line_list", line_list);
|
| | | return data;
|
| | | }
|
| | | }
|
| | |
| | | |
| | | List<HongBaoV2VO> listShareAndInviteMoney(@Param("start") long start, @Param("count") int count, |
| | | @Param("date") String date); |
| | | |
| | | |
| | | /** |
| | | * 统计奖励券总金额 |
| | | * @return |
| | | */ |
| | | BigDecimal countRebateCouponMoney(); |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | */ |
| | | long countValidOrder(@Param("uid")Long uid); |
| | | |
| | | /** |
| | | * 根据订单号 查询金额 |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | BigDecimal getMoneyByOrderNo(@Param("orderNo")String orderNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.vo.user.SystemCouponVO; |
| | | import com.yeshi.fanli.vo.user.UserSystemCouponCountVO; |
| | | |
| | | public interface UserSystemCouponCountMapper { |
| | | |
| | | /** |
| | | * 奖励券统计 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param keyType |
| | | * @param state |
| | | * @param percent |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponCountVO> listRebateCoupon(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state, @Param("percent") Integer percent); |
| | | |
| | | Long countRebateCoupon(@Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state, @Param("percent") Integer percent); |
| | | |
| | | |
| | | /** |
| | | * 系统奖励券统计 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param keyType |
| | | * @param state |
| | | * @param percent |
| | | * @return |
| | | */ |
| | | List<SystemCouponVO> listSystemCouponByRebate(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("sort") Integer sort); |
| | | |
| | | Long countSystemCouponRebate(@Param("key") String key); |
| | | |
| | | /** |
| | | * 统计奖励金额 |
| | | * @return |
| | | */ |
| | | BigDecimal countRebateMoneyByCouponId(@Param("couponId") Long couponId); |
| | | |
| | | |
| | | /** |
| | | * 系统奖励券统计 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param keyType |
| | | * @param state |
| | | * @param percent |
| | | * @return |
| | | */ |
| | | List<SystemCouponVO> listSystemCouponByFree(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("sort") Integer sort); |
| | | |
| | | Long countSystemCouponFree(@Param("key") String key); |
| | | |
| | | /** |
| | | * 统计免单金额 |
| | | * @return |
| | | */ |
| | | BigDecimal countFreeMoneyByCouponId(@Param("couponId") Long couponId); |
| | | |
| | | |
| | | /** |
| | | * 免单券 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param keyType |
| | | * @param state |
| | | * @param percent |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponCountVO> listFreeCoupon(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state, @Param("activated") Integer activated); |
| | | |
| | | Long countFreeCoupon(@Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state, @Param("activated") Integer activated); |
| | | |
| | | |
| | | /** |
| | | * 免单券使用记录 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param keyType |
| | | * @param state |
| | | * @param percent |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponCountVO> listFreeCouponRecord(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state); |
| | | |
| | | Long countFreeCouponRecord(@Param("key") String key, @Param("keyType") Integer keyType, |
| | | @Param("state") Integer state); |
| | | |
| | | /** |
| | | * 奖励券使用数量曲线图 |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getRebateCouponUsedNumToCharts(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | /** |
| | | * 奖励券使用成功金额曲线图 |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getRebateCouponMoneyToCharts(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | /** |
| | | * 奖励券使用成功金额曲线图 |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getFreeCouponMoneyToCharts(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("couponType")String couponType); |
| | | |
| | | } |
| | |
| | | totalMoney DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countRebateCouponMoney" resultType="java.math.BigDecimal"> |
| | | SELECT IFNULL(SUM(h.`hb_money`),0) FROM `yeshi_ec_hongbao_v2` h |
| | | where h.`hb_type` = 10 |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | WHERE hb.hb_id IS NOT NULL AND <![CDATA[co.`co_state` <> 4]]> |
| | | </select> |
| | | |
| | | <select id="getMoneyByOrderNo" resultType="java.math.BigDecimal"> |
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_common_order co |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id=ho.`ho_hongbao_id` |
| | | WHERE co.`co_order_no` = #{orderNo} |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponCountMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.vo.user.UserSystemCouponCountVO"> |
| | | <id column="usc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="usc_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="usc_source" property="source" jdbcType="VARCHAR"/> |
| | | <result column="usc_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="usc_state_activate" property="stateActivated" jdbcType="INTEGER"/> |
| | | <result column="usc_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_use_time" property="useTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="usc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="systemCoupon" column="ucr_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.SystemCouponMapper.BaseResultMap"/> |
| | | |
| | | <association property="userSystemCouponRecord" column="usc_coupon_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.user.UserSystemCouponRecordMapper.BaseResultMap"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap id="BaseResultSystemMap" type="com.yeshi.fanli.vo.user.SystemCouponVO"> |
| | | <id column="sc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="sc_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="sc_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="sc_picture_invalid" property="pictureInvalid" jdbcType="VARCHAR"/> |
| | | <result column="sc_effect" property="effect" jdbcType="VARCHAR"/> |
| | | |
| | | <result column="sc_type" property="type" |
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.CouponTypeEnumHandler" /> |
| | | |
| | | <result column="sc_percent" property="percent" jdbcType="DECIMAL"/> |
| | | <result column="sc_amount" property="amount" jdbcType="VARCHAR"/> |
| | | <result column="sc_expiry_day" property="expiryDay" jdbcType="INTEGER"/> |
| | | <result column="sc_rule" property="rule" jdbcType="VARCHAR"/> |
| | | <result column="sc_remark" property="remark" jdbcType="VARCHAR"/> |
| | | <result column="sc_receive_count" property="receiveCount" jdbcType="INTEGER"/> |
| | | <result column="sc_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="sc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="sc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="notUse" property="notUse" jdbcType="BIGINT"/> |
| | | <result column="used" property="used" jdbcType="BIGINT"/> |
| | | <result column="overdue" property="overdue" jdbcType="BIGINT"/> |
| | | <result column="total" property="total" jdbcType="BIGINT"/> |
| | | <result column="activateNum" property="activateNum" jdbcType="BIGINT"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="listRebateCoupon" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | LEFT JOIN `yeshi_ec_user_system_coupon_record` d ON d.`ucr_user_coupon_id` = uc.`usc_id` |
| | | WHERE p.`sc_type` = 'rebatePercentCoupon' |
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | | |
| | | <if test="percent != null"> |
| | | AND p.`sc_percent` = #{percent} |
| | | </if> |
| | | |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_source` like '%${key}%' |
| | | </if> |
| | | </if> |
| | | ORDER BY uc.`usc_create_time` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countRebateCoupon" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE p.`sc_type` = 'rebatePercentCoupon' |
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | | <if test="percent != null"> |
| | | AND p.`sc_percent` = #{percent} |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_source` like '%${key}%' |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="listSystemCouponByRebate" resultMap="BaseResultSystemMap"> |
| | | SELECT * FROM yeshi_ec_system_coupon p |
| | | LEFT JOIN |
| | | (SELECT SUM(A.notUse)AS notUse, SUM(A.used)AS used, SUM(A.overdue)AS overdue,COUNT(*)AS total,usc_coupon_id |
| | | FROM (SELECT IF(cp.`usc_state`=1,1,0)AS notUse,IF(cp.`usc_state`=3,1,0)AS used,IF(cp.`usc_state`=4,1,0)AS overdue,cp.`usc_coupon_id` |
| | | FROM `yeshi_ec_user_system_coupon` cp |
| | | )A |
| | | GROUP BY A.usc_coupon_id)B ON p.`sc_id` = B.usc_coupon_id |
| | | WHERE p.`sc_type` = 'rebatePercentCoupon' |
| | | <if test="key != null and key != '' "> |
| | | AND p.`sc_percent` = #{key} |
| | | </if> |
| | | ORDER BY |
| | | <if test="sort == null">p.`sc_percent`</if> |
| | | <if test="sort == 1">B.notUse</if> |
| | | <if test="sort == 2">B.notUse DESC</if> |
| | | <if test="sort == 3">B.used</if> |
| | | <if test="sort == 4">B.used DESC</if> |
| | | <if test="sort == 5">B.total</if> |
| | | <if test="sort == 6">B.total DESC</if> |
| | | |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countSystemCouponRebate" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(p.sc_id),0) FROM `yeshi_ec_system_coupon` p |
| | | WHERE p.`sc_type` = 'rebatePercentCoupon' |
| | | <if test="key != null and key != '' "> |
| | | AND p.`sc_percent` = #{key} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countRebateMoneyByCouponId" resultType="java.math.BigDecimal"> |
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_user_system_coupon c |
| | | LEFT JOIN `yeshi_ec_user_system_coupon_record` pr ON c.`usc_id` = pr.`ucr_user_coupon_id` |
| | | LEFT JOIN `yeshi_ec_order` o ON o.`orderid` = pr.`ucr_order_no` |
| | | LEFT JOIN `yeshi_ec_order_hongbaov2_map` map ON map.`ohm_order_id` = o.`id` |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON v2.`hb_id`= map.`ohm_hongbao_id` |
| | | WHERE v2.`hb_id` IS NOT NULL AND c.`usc_coupon_id` = #{couponId} |
| | | </select> |
| | | |
| | | <select id="listSystemCouponByFree" resultMap="BaseResultSystemMap"> |
| | | SELECT * FROM yeshi_ec_system_coupon p |
| | | LEFT JOIN |
| | | (SELECT SUM(A.notUse)AS notUse, SUM(A.used)AS used, SUM(A.overdue)AS overdue,COUNT(*)AS total, SUM(A.activateNum)AS activateNum,usc_coupon_id |
| | | FROM (SELECT IF(cp.`usc_state`=1,1,0)AS notUse,IF(cp.`usc_state`=3,1,0)AS used, |
| | | IF(cp.`usc_state`=4,1,0)AS overdue,IF(cp.`usc_state_activate`=1,1,0)AS activateNum,cp.`usc_coupon_id` |
| | | FROM `yeshi_ec_user_system_coupon` cp |
| | | )A |
| | | GROUP BY A.usc_coupon_id)B ON p.`sc_id` = B.usc_coupon_id |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | ORDER BY |
| | | <if test="sort == null">p.sc_id</if> |
| | | <if test="sort == 1">B.notUse</if> |
| | | <if test="sort == 2">B.notUse DESC</if> |
| | | <if test="sort == 3">B.used</if> |
| | | <if test="sort == 4">B.used DESC</if> |
| | | <if test="sort == 5">B.total</if> |
| | | <if test="sort == 6">B.total DESC</if> |
| | | |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countSystemCouponFree" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(p.sc_id),0) FROM `yeshi_ec_system_coupon` p |
| | | WHERE p.`sc_type` = 'rebatePercentCoupon' |
| | | </select> |
| | | |
| | | <select id="countFreeMoneyByCouponId" resultType="java.math.BigDecimal"> |
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_user_system_coupon c |
| | | LEFT JOIN `yeshi_ec_user_system_coupon_record` pr ON c.`usc_id` = pr.`ucr_user_coupon_id` |
| | | LEFT JOIN `yeshi_ec_common_order` co ON pr.`ucr_order_no` = co.`co_order_no` |
| | | LEFT JOIN `yeshi_ec_hongbao_order` ho ON ho.`ho_order_id` = co.`co_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON ho.`ho_hongbao_id` = v2.`hb_id` |
| | | WHERE pr.`ucr_state` = 3 AND c.`usc_coupon_id` = #{couponId} |
| | | </select> |
| | | |
| | | <select id="listFreeCoupon" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | LEFT JOIN (SELECT * FROM `yeshi_ec_user_system_coupon_record` d WHERE d.`ucr_state` = 2 or d.`ucr_state` = 3 )A ON A.`ucr_user_coupon_id` = uc.`usc_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | | <if test="activated != null"> |
| | | AND uc.`usc_state_activate` = #{activated} |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_source` like '%${key}%' |
| | | </if> |
| | | </if> |
| | | ORDER BY uc.`usc_create_time` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countFreeCoupon" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon') |
| | | <if test="state != null"> |
| | | AND uc.usc_state = #{state} |
| | | </if> |
| | | <if test="activated != null"> |
| | | AND uc.`usc_state_activate` = #{activated} |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_source` like '%${key}%' |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listFreeCouponRecord" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_user_system_coupon_record` d |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON d.`ucr_user_coupon_id` = uc.`usc_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' OR p.`sc_type` = 'welfareFreeCoupon') |
| | | <if test="state != null"> |
| | | AND d.`ucr_state` = #{state} |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_id` = #{key} |
| | | </if> |
| | | </if> |
| | | ORDER BY d.`ucr_create_time` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countFreeCouponRecord" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(d.`ucr_id`),0) FROM `yeshi_ec_user_system_coupon_record` d |
| | | LEFT JOIN `yeshi_ec_user_system_coupon` uc ON d.`ucr_user_coupon_id` = uc.`usc_id` |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= uc.`usc_coupon_id` |
| | | WHERE (p.`sc_type` = 'freeCoupon' or p.`sc_type` = 'welfareFreeCoupon') |
| | | <if test="state != null"> |
| | | AND d.`ucr_state` = #{state} |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1"> |
| | | AND uc.`usc_uid` = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND uc.`usc_id` = #{key} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getRebateCouponUsedNumToCharts" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(COUNT(c.`usc_id`),0) AS showValue, |
| | | <if test="dateType == 1"> |
| | | DATE_FORMAT(c.`usc_use_time`,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | DATE_FORMAT(c.`usc_use_time`,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | DATE_FORMAT(c.`usc_use_time`,'%Y') AS 'showDate' |
| | | </if> |
| | | FROM yeshi_ec_user_system_coupon c |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= c.`usc_coupon_id` |
| | | WHERE c.`usc_state` = 3 AND p.`sc_type` = 'rebatePercentCoupon' |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND DATE_FORMAT(c.`usc_use_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND DATE_FORMAT(c.`usc_use_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | </if> |
| | | <if test="year != null and year != '' "> |
| | | AND DATE_FORMAT(c.`usc_use_time`,'%Y') = '${year}' |
| | | </if> |
| | | |
| | | <if test="dateType == 1"> |
| | | GROUP BY DATE_FORMAT(c.`usc_use_time`,'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | GROUP BY DATE_FORMAT(c.`usc_use_time`,'%Y-%m') |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | GROUP BY DATE_FORMAT(c.`usc_use_time`,'%Y') |
| | | </if> |
| | | ORDER BY c.`usc_use_time` |
| | | </select> |
| | | |
| | | |
| | | <select id="getRebateCouponMoneyToCharts" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(SUM(c.`hb_money`),0) AS showValue, |
| | | <if test="dateType == 1"> |
| | | DATE_FORMAT(c.`hb_get_time`,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | DATE_FORMAT(c.`hb_get_time`,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | DATE_FORMAT(c.`hb_get_time`,'%Y') AS 'showDate' |
| | | </if> |
| | | FROM yeshi_ec_hongbao_v2 c |
| | | WHERE c.`hb_type`= 10 |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND DATE_FORMAT(c.`hb_get_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND DATE_FORMAT(c.`hb_get_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | </if> |
| | | <if test="year != null and year != '' "> |
| | | AND DATE_FORMAT(c.`hb_get_time`,'%Y') = '${year}' |
| | | </if> |
| | | |
| | | <if test="dateType == 1"> |
| | | GROUP BY DATE_FORMAT(c.`hb_get_time`,'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | GROUP BY DATE_FORMAT(c.`hb_get_time`,'%Y-%m') |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | GROUP BY DATE_FORMAT(c.`hb_get_time`,'%Y') |
| | | </if> |
| | | ORDER BY c.`hb_get_time` |
| | | </select> |
| | | |
| | | <select id="getFreeCouponMoneyToCharts" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(SUM(v2.`hb_money`),0) AS showValue, |
| | | <if test="dateType == 1"> |
| | | DATE_FORMAT(v2.`hb_get_time`,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | DATE_FORMAT(v2.`hb_get_time`,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | DATE_FORMAT(v2.`hb_get_time`,'%Y') AS 'showDate' |
| | | </if> |
| | | FROM yeshi_ec_user_system_coupon c |
| | | LEFT JOIN yeshi_ec_system_coupon sp ON sp.`sc_id` = c.`usc_coupon_id` |
| | | LEFT JOIN `yeshi_ec_user_system_coupon_record` pr ON c.`usc_id` = pr.`ucr_user_coupon_id` |
| | | LEFT JOIN `yeshi_ec_common_order` co ON pr.`ucr_order_no` = co.`co_order_no` |
| | | LEFT JOIN `yeshi_ec_hongbao_order` ho ON ho.`ho_order_id` = co.`co_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON ho.`ho_hongbao_id` = v2.`hb_id` |
| | | WHERE pr.`ucr_state` = 3 AND sp.`sc_type` = #{couponType} |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND DATE_FORMAT(v2.`hb_get_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND DATE_FORMAT(v2.`hb_get_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | </if> |
| | | <if test="year != null and year != '' "> |
| | | AND DATE_FORMAT(v2.`hb_get_time`,'%Y') = '${year}' |
| | | </if> |
| | | |
| | | <if test="dateType == 1"> |
| | | GROUP BY DATE_FORMAT(v2.`hb_get_time`,'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateType == 2"> |
| | | GROUP BY DATE_FORMAT(v2.`hb_get_time`,'%Y-%m') |
| | | </if> |
| | | <if test="dateType == 3"> |
| | | GROUP BY DATE_FORMAT(v2.`hb_get_time`,'%Y') |
| | | </if> |
| | | ORDER BY v2.`hb_get_time` |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.DecimalFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | |
| | | return countOrderNumberBySettleTime(uid, 2, 4); // 根据
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getMoneyByOrderNo(String orderNo) {
|
| | | return commonOrderCountMapper.getMoneyByOrderNo(orderNo);
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | | long count = hongBaoV2CountMapper.countNumberByUid(uid);
|
| | | return (int) count;
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal countRebateCouponMoney() {
|
| | | return hongBaoV2CountMapper.countRebateCouponMoney();
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponCountMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.vo.user.SystemCouponVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
|
| | |
|
| | | @Service
|
| | | public class UserSystemCouponCountServiceImpl implements UserSystemCouponCountService {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponCountMapper userSystemCouponCountMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource
|
| | | private OrderHongBaoMapService orderHongBaoMapService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | | /**
|
| | | * 奖励券统计
|
| | | */
|
| | | @Override
|
| | | public List<UserSystemCouponCountVO> listRebateCoupon(long start,int count, String key, Integer keyType,
|
| | | Integer state, Integer percent){
|
| | | |
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listRebateCoupon(start, count, key,
|
| | | keyType, state, percent);
|
| | | |
| | | if (list == null ) {
|
| | | list = new ArrayList<UserSystemCouponCountVO>();
|
| | | }
|
| | | |
| | | for (UserSystemCouponCountVO userSystemCouponVO: list) {
|
| | | // 用户信息
|
| | | Long uid = userSystemCouponVO.getUid();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserInfo();
|
| | | userInfo.setId(uid);
|
| | | }
|
| | | userSystemCouponVO.setUserInfo(userInfo);
|
| | | |
| | | UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
|
| | | if (couponRecord != null) {
|
| | | String orderNo = couponRecord.getOrderNo();
|
| | | // 获取奖励金额
|
| | | BigDecimal royaltyMoney = orderHongBaoMapService.getCouponHongbaoByOrderNo(orderNo, uid);
|
| | | if (royaltyMoney == null) {
|
| | | royaltyMoney = new BigDecimal(0);
|
| | | }
|
| | | userSystemCouponVO.setRoyaltyMoney(royaltyMoney);
|
| | | |
| | | BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
|
| | | if (orderMoney == null) {
|
| | | orderMoney = new BigDecimal(0);
|
| | | }
|
| | | userSystemCouponVO.setOrderMoney(orderMoney);
|
| | | |
| | | }
|
| | | }
|
| | | |
| | | return list;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countRebateCoupon(String key, Integer keyType, Integer state, Integer percent){
|
| | | return userSystemCouponCountMapper.countRebateCoupon(key, keyType, state, percent);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 系统奖励券统计
|
| | | */
|
| | | @Override
|
| | | public List<SystemCouponVO> listSystemCouponByRebate(long start,int count, String key, Integer sort){
|
| | | |
| | | List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByRebate(start, count, key, sort);
|
| | | |
| | | if (list == null ) {
|
| | | list = new ArrayList<SystemCouponVO>();
|
| | | }
|
| | | |
| | | for (SystemCouponVO systemCouponVO: list) {
|
| | | |
| | | BigDecimal money = userSystemCouponCountMapper.countRebateMoneyByCouponId(systemCouponVO.getId());
|
| | | if (money == null) {
|
| | | money = new BigDecimal(0);
|
| | | }
|
| | | systemCouponVO.setMoney(money);
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countSystemCouponRebate(String key){
|
| | | return userSystemCouponCountMapper.countSystemCouponRebate(key);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 系统免单券统计
|
| | | */
|
| | | @Override
|
| | | public List<SystemCouponVO> listSystemCouponByFree(long start,int count, String key, Integer sort){
|
| | | |
| | | List<SystemCouponVO> list = userSystemCouponCountMapper.listSystemCouponByFree(start, count, key, sort);
|
| | | |
| | | if (list == null ) {
|
| | | list = new ArrayList<SystemCouponVO>();
|
| | | }
|
| | | |
| | | for (SystemCouponVO systemCouponVO: list) {
|
| | | |
| | | BigDecimal money = userSystemCouponCountMapper.countFreeMoneyByCouponId(systemCouponVO.getId());
|
| | | if (money == null) {
|
| | | money = new BigDecimal(0);
|
| | | }
|
| | | systemCouponVO.setMoney(money);
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countSystemCouponFree(String key){
|
| | | return userSystemCouponCountMapper.countSystemCouponFree(key);
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<UserSystemCouponCountVO> listFreeCoupon(long start,int count, String key, Integer keyType,
|
| | | Integer state, Integer activated){
|
| | | |
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listFreeCoupon(start, count, key,
|
| | | keyType, state, activated);
|
| | | |
| | | if (list == null ) {
|
| | | list = new ArrayList<UserSystemCouponCountVO>();
|
| | | }
|
| | | |
| | | for (UserSystemCouponCountVO userSystemCouponVO: list) {
|
| | | // 用户信息
|
| | | Long uid = userSystemCouponVO.getUid();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserInfo();
|
| | | userInfo.setId(uid);
|
| | | }
|
| | | userSystemCouponVO.setUserInfo(userInfo);
|
| | | |
| | | UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
|
| | | if (couponRecord != null) {
|
| | | String orderNo = couponRecord.getOrderNo();
|
| | | BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
|
| | | if (orderMoney == null) {
|
| | | orderMoney = new BigDecimal(0);
|
| | | }
|
| | | userSystemCouponVO.setOrderMoney(orderMoney);
|
| | | |
| | | }
|
| | | }
|
| | | |
| | | return list;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public long countFreeCoupon(String key, Integer keyType, Integer state,Integer activated){
|
| | | return userSystemCouponCountMapper.countFreeCoupon(key, keyType, state, activated);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<UserSystemCouponCountVO> listFreeCouponRecord(long start,int count, String key, Integer keyType,
|
| | | Integer state){
|
| | | |
| | | List<UserSystemCouponCountVO> list = userSystemCouponCountMapper.listFreeCouponRecord(start, count, key,
|
| | | keyType, state);
|
| | | |
| | | if (list == null ) {
|
| | | list = new ArrayList<UserSystemCouponCountVO>();
|
| | | }
|
| | | |
| | | for (UserSystemCouponCountVO userSystemCouponVO: list) {
|
| | | // 用户信息
|
| | | Long uid = userSystemCouponVO.getUid();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserInfo();
|
| | | userInfo.setId(uid);
|
| | | }
|
| | | userSystemCouponVO.setUserInfo(userInfo);
|
| | | |
| | | UserSystemCouponRecord couponRecord = userSystemCouponVO.getUserSystemCouponRecord();
|
| | | if (couponRecord != null) {
|
| | | String orderNo = couponRecord.getOrderNo();
|
| | | BigDecimal orderMoney = commonOrderCountService.getMoneyByOrderNo(orderNo);
|
| | | if (orderMoney == null) {
|
| | | orderMoney = new BigDecimal(0);
|
| | | }
|
| | | userSystemCouponVO.setOrderMoney(orderMoney);
|
| | | |
| | | }
|
| | | }
|
| | | |
| | | return list;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public long countFreeCouponRecord(String key, Integer keyType, Integer state){
|
| | | return userSystemCouponCountMapper.countFreeCouponRecord(key, keyType, state);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<Map<String, Object>> getRebateCouponUsedNumToCharts(Integer dateType, String year, |
| | | String startTime, String endTime){
|
| | | return userSystemCouponCountMapper.getRebateCouponUsedNumToCharts(dateType, year, startTime, endTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<Map<String, Object>> getRebateCouponMoneyToCharts(Integer dateType, String year, |
| | | String startTime, String endTime){
|
| | | return userSystemCouponCountMapper.getRebateCouponMoneyToCharts(dateType, year, startTime, endTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<Map<String, Object>> getFreeCouponMoneyToCharts(Integer dateType, String year, String startTime, |
| | | String endTime, String couponType){
|
| | | return userSystemCouponCountMapper.getFreeCouponMoneyToCharts(dateType, year, startTime, endTime, couponType);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | */
|
| | | public List<HongBaoV2VO> listShareAndInviteMoney(long start, int count, String date);
|
| | |
|
| | | /**
|
| | | * 奖励券金额
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countRebateCouponMoney();
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.vo.user.SystemCouponVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
|
| | |
|
| | | public interface UserSystemCouponCountService {
|
| | |
|
| | | /**
|
| | | * 奖励券统计
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param keyType
|
| | | * @param state
|
| | | * @param percent
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponCountVO> listRebateCoupon(long start, int count, String key, Integer keyType, Integer state,
|
| | | Integer percent);
|
| | |
|
| | | public long countRebateCoupon(String key, Integer keyType, Integer state, Integer percent);
|
| | |
|
| | | /**
|
| | | * 免单券
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param keyType
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponCountVO> listFreeCoupon(long start, int count, String key, Integer keyType, Integer state, Integer activated);
|
| | |
|
| | | public long countFreeCoupon(String key, Integer keyType, Integer state, Integer activated);
|
| | |
|
| | | /**
|
| | | * 免单券使用记录
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param keyType
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponCountVO> listFreeCouponRecord(long start, int count, String key, Integer keyType,
|
| | | Integer state);
|
| | |
|
| | | public long countFreeCouponRecord(String key, Integer keyType, Integer state);
|
| | |
|
| | | /**
|
| | | * 系统奖励券金额统计
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param sort
|
| | | * @return
|
| | | */
|
| | | public List<SystemCouponVO> listSystemCouponByRebate(long start, int count, String key, Integer sort);
|
| | |
|
| | | public long countSystemCouponRebate(String key);
|
| | |
|
| | | /**
|
| | | * 免单券统计
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @param sort
|
| | | * @return
|
| | | */
|
| | | public List<SystemCouponVO> listSystemCouponByFree(long start, int count, String key, Integer sort);
|
| | |
|
| | | public long countSystemCouponFree(String key);
|
| | |
|
| | | /**
|
| | | * 曲线图-奖励券使用数量
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<Map<String, Object>> getRebateCouponUsedNumToCharts(Integer dateType, String year, String startTime,
|
| | | String endTime);
|
| | |
|
| | | /**
|
| | | * 奖励券使用成功金额曲线图
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<Map<String, Object>> getRebateCouponMoneyToCharts(Integer dateType, String year, String startTime,
|
| | | String endTime);
|
| | |
|
| | | /**
|
| | | * 统计免单券金额
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param couponType
|
| | | * @return
|
| | | */
|
| | | public List<Map<String, Object>> getFreeCouponMoneyToCharts(Integer dateType, String year, String startTime,
|
| | | String endTime, String couponType);
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | */
|
| | | public Map<String, Object> lastMonthSettleOrderNumber(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据订单号 统计奖励券加成金额
|
| | | * @param orderNo
|
| | | * @return
|
| | | */
|
| | | BigDecimal getMoneyByOrderNo(String orderNo);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | |
|
| | | public class UserSystemCouponCountVO extends UserSystemCoupon implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | private UserInfo userInfo;
|
| | | |
| | | private UserSystemCouponRecord userSystemCouponRecord;
|
| | | |
| | | private BigDecimal orderMoney;
|
| | | |
| | | private BigDecimal royaltyMoney;
|
| | | |
| | | |
| | |
|
| | | public UserInfo getUserInfo() {
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | public void setUserInfo(UserInfo userInfo) {
|
| | | this.userInfo = userInfo;
|
| | | }
|
| | |
|
| | | public UserSystemCouponRecord getUserSystemCouponRecord() {
|
| | | return userSystemCouponRecord;
|
| | | }
|
| | |
|
| | | public void setUserSystemCouponRecord(UserSystemCouponRecord userSystemCouponRecord) {
|
| | | this.userSystemCouponRecord = userSystemCouponRecord;
|
| | | }
|
| | |
|
| | | public BigDecimal getOrderMoney() {
|
| | | return orderMoney;
|
| | | }
|
| | |
|
| | | public void setOrderMoney(BigDecimal orderMoney) {
|
| | | this.orderMoney = orderMoney;
|
| | | }
|
| | |
|
| | | public BigDecimal getRoyaltyMoney() {
|
| | | return royaltyMoney;
|
| | | }
|
| | |
|
| | | public void setRoyaltyMoney(BigDecimal royaltyMoney) {
|
| | | this.royaltyMoney = royaltyMoney;
|
| | | }
|
| | |
|
| | | }
|