Merge branch 'div-1' into div
43个文件已添加
109个文件已修改
2个文件已删除
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.cache.ehcache.EhCacheCacheManager;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dto.system.ListConfig;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory.ConfigCategoryEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigCategoryService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigCategoryService configCategoryService;
|
| | | |
| | | |
| | | /**
|
| | | * 查询列表 - 新后台
|
| | | *
|
| | |
| | | ehCacheCacheManager.getCacheManager().clearAll();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(""));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 根据分类查询
|
| | | * @param callback
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getByCategory")
|
| | | public void getByCategory(String callback, String type, PrintWriter out) {
|
| | | try {
|
| | | ConfigCategoryEnum categoryEnum = configCategoryService.getCategoryEnum(type);
|
| | | if (categoryEnum == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本查询失败"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<ConfigCategory> list = new ArrayList<>();
|
| | | |
| | | List<ConfigCategory> listCategory = configCategoryService.listByType(categoryEnum);
|
| | | if (listCategory != null) {
|
| | | for (ConfigCategory category: listCategory) {
|
| | | Config config = configService.getConfigBykeyNoCache(category.getKeyEnum().getKey());
|
| | | if (config != null) {
|
| | | category.setConfig(config);
|
| | | list.add(category);
|
| | | }
|
| | | } |
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 保存信息
|
| | | * @param callback
|
| | | * @param listConfig
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveConfig")
|
| | | public void saveConfig(String callback, ListConfig listConfig, PrintWriter out) {
|
| | | try {
|
| | | if (listConfig == null || listConfig.getConfig() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未接收到保存的信息"));
|
| | | return;
|
| | | }
|
| | | |
| | | configService.update(listConfig.getConfig());
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("修改失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 查询品牌背景图片
|
| | | * @param callback
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBrandBgImg")
|
| | | public void getBrandBgImg(String callback, String type, PrintWriter out) {
|
| | | try {
|
| | | Config config = configService.getConfigBykeyNoCache(ConfigKeyEnum.brandBackgroundPicture.getKey());
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (config == null || StringUtil.isNullOrEmpty(config.getValue())) {
|
| | | data.put("pic", "");
|
| | | } else {
|
| | | data.put("pic", config.getValue());
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 修改品牌背景图片
|
| | | * @param callback
|
| | | * @param listConfig
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "changeBrandBgImg")
|
| | | public void changeBrandBgImg(String callback, HttpServletRequest request, Long id, PrintWriter out) {
|
| | | try {
|
| | | MultipartFile file = null;
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | file = fileRequest.getFile("file");
|
| | | } |
| | | |
| | | if (file == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传图片文件"));
|
| | | return;
|
| | | }
|
| | | |
| | | Config config = configService.getConfigBykeyNoCache(ConfigKeyEnum.brandBackgroundPicture.getKey());
|
| | | if (config == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("品牌对象不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | String oldpic = config.getValue();
|
| | | |
| | | |
| | | // 文件解析 |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath= FilePathEnum.brand.getPath() +UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | if (StringUtil.isNullOrEmpty(fileLink)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("文件上传失败"));
|
| | | return;
|
| | | }
|
| | | |
| | | config.setValue(fileLink);
|
| | | configService.update(config);
|
| | | |
| | | if(!Constant.IS_TEST) {
|
| | | if (oldpic != null && oldpic.trim().length() > 0) {
|
| | | COSManager.getInstance().deleteFile(oldpic);
|
| | | }
|
| | | }
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("修改失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderInfo; |
| | | import com.yeshi.fanli.entity.admin.count.CountOrderTrackRate; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountCouponService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountMomentsService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountOrderService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountUserService; |
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | |
| | | @Resource |
| | | private CommonOrderCountService commonOrderCountService; |
| | | |
| | | @Resource |
| | | private DailyCountCouponService dailyCountCouponService; |
| | | |
| | | @Resource |
| | | private DailyCountUserService dailyCountUserService; |
| | | |
| | | @Resource |
| | | private DailyCountOrderService dailyCountOrderService; |
| | | |
| | | @Resource |
| | | private DailyCountMomentsService dailyCountMomentsService; |
| | | |
| | | |
| | | private void verifyQueryData(String callback, Integer dateType, String year, String startTime, |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 统计订单佣金 |
| | | * @param callback |
| | | * @param channelArray |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderTypeNum") |
| | | public void getOrderTypeNum(String callback, String typeArray, Integer dateType, String year, |
| | | String startTime, String endTime, Integer countType, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | // 渠道 |
| | | List<Integer> typeList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typeList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (typeList != null && typeList.size() > 0) { |
| | | for (Integer type : typeList) { |
| | | List<CountOrderInfo> listData = userInfoCountService.countOrderType(type, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | |
| | | String name = ""; |
| | | if (type == 1) { |
| | | name = "自购订单"; |
| | | } else if (type == 2) { |
| | | name = "分享订单"; |
| | | } else if (type == 3) { |
| | | name = "邀请订单"; |
| | | } |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<CountOrderInfo> listData = userInfoCountService.countOrderType(null, beginDate, endDate); |
| | | List<Object> list = machineOrderResultMoney(dateList, dateType, listData); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 券相关图表数据 |
| | | * @param callback |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param type 查询类型 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getCouponCharts") |
| | | public void getCouponCharts(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | String typeArray, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | // 渠道 |
| | | List<String> typelList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typelList = gson.fromJson(typeArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | if (typelList != null && typelList.size() > 0) { |
| | | for (String type: typelList) { |
| | | List<DailyCountCoupon> listData = dailyCountCouponService.getDailyCountList(type, beginDate, endDate); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountCoupon(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", dailyCountCouponService.getTypeEnumDesc(type)); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<Object> machineDailyCountCoupon(List<String> dateList, Integer dateType, List<DailyCountCoupon> listData) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | for (DailyCountCoupon history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(result); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 用户相关图表数据 |
| | | * @param callback |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param type 查询类型 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getUserCharts") |
| | | public void getUserCharts(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | String typeArray, String channelArray, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<String> typelList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typelList = gson.fromJson(typeArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | if (typelList == null || typelList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递类型错误")); |
| | | return; |
| | | } |
| | | |
| | | // 渠道 |
| | | List<String> channelList = null; |
| | | if (channelArray != null && channelArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | if (channelList != null && channelList.size() > 0) { |
| | | String type = typelList.get(0); |
| | | for (String channel: channelList) { |
| | | List<DailyCountUser> listData = dailyCountUserService.getDailyCountList(type, beginDate, endDate, channel); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountUser(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", channel); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | for (String type: typelList) { |
| | | List<DailyCountUser> listData = dailyCountUserService.getDailyCountList(type, beginDate, endDate, null); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountUser(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", dailyCountUserService.getTypeEnumDesc(type)); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<Object> machineDailyCountUser(List<String> dateList, Integer dateType, List<DailyCountUser> listData) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | BigDecimal totalDay = new BigDecimal(0); |
| | | BigDecimal totalValid = new BigDecimal(0); |
| | | |
| | | for (DailyCountUser history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 判断是否计算比例 |
| | | if ((dateType == 2 || dateType == 3) && totalDay.compareTo(BigDecimal.valueOf(0)) > 0){ |
| | | result = MoneyBigDecimalUtil.div(totalValid, totalDay); |
| | | result = MoneyBigDecimalUtil.mul(result, BigDecimal.valueOf(100)); |
| | | } |
| | | } |
| | | list.add(result); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单相关图表数据 |
| | | * @param callback |
| | | * @param dateType |
| | | * @param year |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param type 查询类型 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderCharts") |
| | | public void getOrderCharts(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | String typeArray, String channelArray, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | // 渠道 |
| | | List<String> typelList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typelList = gson.fromJson(typeArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | if (typelList == null || typelList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递类型错误")); |
| | | return; |
| | | } |
| | | |
| | | // 渠道 |
| | | List<String> channelList = null; |
| | | if (channelArray != null && channelArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | if (channelList != null && channelList.size() > 0) { |
| | | String type = typelList.get(0); |
| | | for (String channel: channelList) { |
| | | List<DailyCountOrder> listData = dailyCountOrderService.getDailyCountList(type, beginDate, endDate, channel); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountOrder(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", channel); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | for (String type: typelList) { |
| | | List<DailyCountOrder> listData = dailyCountOrderService.getDailyCountList(type, beginDate, endDate, null); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountOrder(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", dailyCountOrderService.getTypeEnumDesc(type)); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<Object> machineDailyCountOrder(List<String> dateList, Integer dateType, List<DailyCountOrder> listData) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | BigDecimal totalDay = new BigDecimal(0); |
| | | BigDecimal totalValid = new BigDecimal(0); |
| | | |
| | | for (DailyCountOrder history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 判断是否计算比例 |
| | | if ((dateType == 2 || dateType == 3) && totalDay.compareTo(BigDecimal.valueOf(0)) > 0){ |
| | | result = MoneyBigDecimalUtil.div(totalValid, totalDay); |
| | | result = MoneyBigDecimalUtil.mul(result, BigDecimal.valueOf(100)); |
| | | } |
| | | } |
| | | list.add(result); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "getMomentsCharts") |
| | | public void getMomentsCharts(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | String typeArray, PrintWriter out) { |
| | | try { |
| | | // 数据验证处理 |
| | | verifyQueryData(callback, dateType, year, startTime, endTime, out); |
| | | |
| | | Date beginDate = getBeginDate(dateType, year, startTime); |
| | | Date endDate = getEndDate(dateType, year, endTime); |
| | | |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | // 渠道 |
| | | List<String> typelList = null; |
| | | if (typeArray != null && typeArray.trim().length() > 4) { |
| | | typelList = gson.fromJson(typeArray, new TypeToken<ArrayList<String>>() {}.getType()); |
| | | } |
| | | |
| | | if (typelList == null || typelList.size() == 0) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递类型错误")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | for (String type: typelList) { |
| | | List<DailyCountMoments> listData = dailyCountMomentsService.getDailyCountList(type, beginDate, endDate); |
| | | // 处理数据 |
| | | List<Object> list = machineDailyCountMoments(dateList, dateType, listData); |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", dailyCountMomentsService.getTypeEnumDesc(type)); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<Object> machineDailyCountMoments(List<String> dateList, Integer dateType, List<DailyCountMoments> listData) { |
| | | List<Object> list = new ArrayList<>(); |
| | | for (String date: dateList) { |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | for (DailyCountMoments history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(result); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils; |
| | | import com.yeshi.fanli.dto.ChartTDO; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.Extract; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.tag.PageEntity; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统计审核次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 审核状态:所有-3 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有3 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getAuditTotal") |
| | | public void getAuditTotal(String callback, String stateArray, 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; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | String substring = stateArray.substring(1, stateArray.length()-1); |
| | | List<Integer> channelList = null; |
| | | if (stateArray != null && stateArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (Integer state : channelList) { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, state); |
| | | String name = ""; |
| | | if (state == 1) { |
| | | name = "通过"; |
| | | } else if (state == 2) { |
| | | name = "驳回"; |
| | | } |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, null); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private List<Object> getAuditData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, |
| | | Integer state) throws Exception{ |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getAuditCount(beginDate, endDate, state); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory != null) { |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 统计提现申请总额 |
| | | * |
| | | * @param callback |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyMoney") |
| | | public void getExtractApplyMoney(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; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getApplyMoney(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | BigDecimal money = new BigDecimal("0"); |
| | | if (listHistory == null) { |
| | | list.add(money.toString()); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(money.toString()); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "金额"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统计提现申请总次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 所有-空值或者不传 待审核-0 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyNumber") |
| | | public void getExtractApplyNumber(String callback, Integer state, 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; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.geApplyNumber(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory == null) { |
| | | list.add(value + ""); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "数量"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载提现红包Openid |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | |
|
| | |
|
| | | /**
|
| | | * 计当天活跃用户中有多少个用户是90天前才活跃过,期间从未活跃的用户数量
|
| | | * 获取金币排行榜
|
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserActiveCharts")
|
| | | public void getUserActiveCharts(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;
|
| | | }
|
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | |
| | | Date beginDate = null;
|
| | | Date endDate = null;
|
| | | |
| | | if (dateType == 1) {
|
| | | beginDate = TimeUtil.parse(startTime);
|
| | | endDate = TimeUtil.parse(endTime);
|
| | | } else if (dateType == 2) {
|
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR);
|
| | | if (!StringUtil.isNullOrEmpty(year)) {
|
| | | currentYear = Integer.parseInt(year);
|
| | | }
|
| | | |
| | | calendar.clear();
|
| | | calendar.set(Calendar.YEAR, currentYear);
|
| | | beginDate =calendar.getTime();
|
| | | @RequestMapping(value = "getGoldCoinRecord")
|
| | | public void getGoldCoinRecord(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
|
| | | if (pageIndex == null)
|
| | | pageIndex = 1;
|
| | |
|
| | | calendar.clear();
|
| | | calendar.set(Calendar.YEAR, currentYear);
|
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) {
|
| | | beginDate = TimeUtil.parse("2018-01-01");
|
| | | endDate = new Date();
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | |
| | | List<Object> list = new ArrayList<>();
|
| | | List<UserActiveNumHistory> listHistory = userActiveLogService.query(beginDate, endDate);
|
| | | for (String date: dateList) {
|
| | | ChartTDO chartTDO = new ChartTDO();
|
| | | chartTDO.setShowDate(date);
|
| | | int value = 0;
|
| | | |
| | | if (listHistory != null) {
|
| | | for (UserActiveNumHistory history: listHistory) {
|
| | | if (dateType == 1) {
|
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime());
|
| | | if (gernalTime.equalsIgnoreCase(date)) {
|
| | | value += history.getNum();
|
| | | continue;
|
| | | }
|
| | | } else if (dateType == 2){
|
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay());
|
| | | if(gernalTime.startsWith("0")) {
|
| | | gernalTime = gernalTime.substring(1, 2);
|
| | | }
|
| | | if (gernalTime.equalsIgnoreCase(date)) {
|
| | | value += history.getNum();
|
| | | continue;
|
| | | }
|
| | | } else if (dateType == 3) {
|
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay());
|
| | | if (gernalTime.equalsIgnoreCase(date)) {
|
| | | value += history.getNum();
|
| | | continue;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | chartTDO.setShowValue(value + "");
|
| | | list.add(value + "");
|
| | | }
|
| | | |
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "数量");
|
| | | innerList.put("data", gson.toJson(list));
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | data.put("line_list", line_list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | if (pageSize == null)
|
| | | pageSize = 20;
|
| | | |
| | | List<IntegralDetail> list = integralDetailService.listQuery((pageIndex-1)* pageSize, pageSize, key);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关信息"));
|
| | | return;
|
| | | }
|
| | | |
| | | for (IntegralDetail integralDetail: list) {
|
| | | Long uid = integralDetail.getUid();
|
| | | UserInfo userInfo = userInfoService.getUserById(uid);
|
| | | if (userInfo != null) {
|
| | | integralDetail.setNickName(userInfo.getNickName());
|
| | | integralDetail.setPortrait(userInfo.getPortrait());
|
| | | }
|
| | | }
|
| | | |
| | | long count = integralDetailService.countQuery(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("list", gson.toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 用户账户明细
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getMoneyDetails")
|
| | | public void getMoneyDetails(String callback, Integer pageIndex, String key, Integer keyType, PrintWriter out) {
|
| | | if (pageIndex == null) {
|
| | | pageIndex = 1;
|
| | | }
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | try {
|
| | | List<UserMoneyDetail> list = userMoneyDetailService.listQuery(pageIndex, pageSize, key, keyType);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | for (UserMoneyDetail detail: list) {
|
| | | UserInfo userInfo = detail.getUserInfo();
|
| | | if (userInfo == null) {
|
| | | detail.setUserInfo(new UserInfo());
|
| | | continue;
|
| | | }
|
| | | |
| | | |
| | | UserInfo user = userInfoService.selectByPKey(userInfo.getId());
|
| | | if (user != null) {
|
| | | detail.setUserInfo(user);
|
| | | }
|
| | | }
|
| | |
|
| | | long count = userMoneyDetailService.countQuery(key, keyType);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new JsonSerializer<UserMoneyDetailTypeEnum>() {
|
| | | @Override
|
| | | public JsonElement serialize(UserMoneyDetailTypeEnum value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(value.getDesc());
|
| | | }
|
| | | }
|
| | | });
|
| | | Gson gson = gsonBuilder.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) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | 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.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVipConfigException;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/vipConfig")
|
| | | public class VIPConfigAdminController {
|
| | |
|
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | | * |
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, UserVipConfig record, PrintWriter out) {
|
| | | try {
|
| | | userVipConfigService.save(record);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserVipConfigException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /** |
| | | * 删除
|
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "delete")
|
| | | public void delete(String callback, String idArray, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | userVipConfigService.delete(list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除数据"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 查询
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | | |
| | | if (pageSize == null || pageSize < 1) |
| | | pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | List<UserVipConfig> list = userVipConfigService.query(pageIndex, pageSize, key);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | long count = userVipConfigService.count(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) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin.order;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | 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.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.job.order.taobao.UpdateOrderJob;
|
| | | import com.yeshi.fanli.job.order.taobao.UpdateTBRelationAndSpecialOrderJob;
|
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/jdOrder")
|
| | | public class JDOrderController {
|
| | |
|
| | | @Resource
|
| | | private JDOrderService jdOrderService;
|
| | |
|
| | |
|
| | | /**
|
| | | * 查询列表 - 新后台
|
| | | * |
| | | * @param callback
|
| | | * @param key
|
| | | * 查询词 名称
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, String key, Integer pageIndex, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 0) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<JDOrderItem> list = jdOrderService.listQuery((pageIndex-1)*pageSize,pageSize,key);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未找到相关信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = jdOrderService.countQuery(key);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "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();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin.order;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | 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.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/pddOrder")
|
| | | public class PDDOrderController {
|
| | |
|
| | | @Resource
|
| | | private PDDOrderService pddOrderService;
|
| | |
|
| | |
|
| | | /**
|
| | | * 查询列表 - 新后台
|
| | | * |
| | | * @param callback
|
| | | * @param key
|
| | | * 查询词 名称
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, String key, Integer pageIndex, PrintWriter out) {
|
| | | try {
|
| | | if (pageIndex == null || pageIndex < 0) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<PDDOrder> list = pddOrderService.listQuery((pageIndex-1)*pageSize,pageSize,key);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未找到相关信息"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = pddOrderService.countQuery(key);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "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();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | |
| | | |
| | | @Resource
|
| | | private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService;
|
| | |
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
| | | data.put("tearcherLink", tearcherLink);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // TODO 验证是否是导师
|
| | | |
| | | JSONObject inner = new JSONObject();
|
| | | inner.put("link", "https://www.baidu.com/");
|
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_vip.png");
|
| | | inner.put("title", "免费升级 享会员权益");
|
| | | inner.put("btnName", "升级会员");
|
| | | if (uid != null) {
|
| | | // 是否导师 TODO
|
| | | |
| | | if (userVIPInfoService.isVIP(uid)) {
|
| | | inner.put("link", "https://www.baidu.com/");
|
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_tearcher.png");
|
| | | inner.put("title", "拿五险与津贴 享导师权益");
|
| | | inner.put("btnName", "升级会员");
|
| | | } else {
|
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (userVIPPreInfo != null) {
|
| | | if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_1) {
|
| | | inner.put("btnName", "升级高级会员");
|
| | | } else if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_2) {
|
| | | inner.put("btnName", "升级超级会员");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | data.put("vip", inner);
|
| | | } |
| | |
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) && uid != null) {
|
| | | UserLevelUpgradedNotify notify = userLevelUpgradedNotifyService.getNeedNotifyByUid(uid);
|
| | |
| | | data.put("vipUpgradedNotify", notifyVO);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | // 获取升级时间
|
| | | private Date getUpgradedTime(Long uid, UserLevelEnum level) {
|
| | |
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | UserInviteLevelEnum level = null;
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | level = userInviteService.getUserInviteLevelNew(uid);
|
| | | } else {
|
| | | level = userInviteService.getUserInviteLevel(uid);
|
| | | }
|
| | | JSONObject inviteLevel = new JSONObject();
|
| | | UserInviteLevelEnum level = userInviteService.getUserInviteLevel(uid);
|
| | | inviteLevel.put("level", level.name());
|
| | | inviteLevel.put("link", level.getLink());
|
| | | data.put("inviteLevel", inviteLevel);
|
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountMomentsService; |
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService; |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | |
| | | |
| | | @Resource |
| | | private ShareGoodsService shareGoodsService; |
| | | |
| | | @Resource |
| | | private DailyCountMomentsService dailyCountMomentsService; |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | |
| | | private final static long TYPE_REXIAO = 1;// 热销 |
| | | private final static long TYPE_TUIJIAN = 2;// 推荐 |
| | |
| | | if (type == 3) { |
| | | shareCount++; |
| | | goodsEvaluateService.addShareNum(id); |
| | | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addShareClick(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (list.size() == 0) { |
| | |
| | | return; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e); |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("text", newText); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addCopyComment(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | | import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | | |
| | | @Resource
|
| | | private UserInviteService userInviteService;
|
| | | |
| | | @Resource
|
| | | private UserInviteValidRecordService userInviteValidRecordService;
|
| | |
|
| | |
|
| | |
|
| | |
| | | out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | getMyTeamNew(acceptData, page, uid, type, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = 0;
|
| | | List<ThreeSale> listTeam = null;
|
| | |
| | | UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(worker.getId(), uid);
|
| | | if (separate != null && separate.getEndTime() != null) {
|
| | | try {
|
| | | |
| | | |
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", "#888888");
|
| | | contentJson1.put("content", "将于");
|
| | |
| | | array.add(contentJson2);
|
| | | array.add(contentJson3);
|
| | | object.put("vipBreakTime",array);
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | |
| | | private void getMyTeamNew(AcceptData acceptData, long page, long uid, int type, PrintWriter out) {
|
| | | if (type != 1 && type != 2) {
|
| | | out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = 0;
|
| | | List<ThreeSale> listTeam = null;
|
| | | if (type == 1) {
|
| | | listTeam = threeSaleSerivce.listFirstTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | count = threeSaleSerivce.countFirstTeamByUndeleted(uid);
|
| | | } else if (type == 2) {
|
| | | listTeam = threeSaleSerivce.listSecondTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | count = threeSaleSerivce.countSecondTeamByUndeleted(uid);
|
| | | }
|
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | result.put("count", count);
|
| | | result.put("list", organizeTeamNew(count, listTeam, uid, type, true));
|
| | | |
| | | // 第一页判断是否激活 是否有队员
|
| | | if (type == 1 && page == 1) {
|
| | | boolean hasCode = false;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null) {
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
|
| | | hasCode = true;
|
| | | }
|
| | | result.put("hasCode", hasCode);
|
| | | result.put("hasTeam", count > 0 ? true : false);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | }
|
| | | |
| | | /**
|
| | | * 加工数据
|
| | | * @param count
|
| | | * @param list
|
| | | * @param uid
|
| | | * @param type 查询粉丝类型 1直接 2间接
|
| | | * @param wxtip 是需要微信提示
|
| | | * @return
|
| | | */
|
| | | private JSONArray organizeTeamNew(long count, List<ThreeSale> list, Long uid, int type, boolean wxtip) {
|
| | | JSONArray resultArray = new JSONArray();
|
| | | if (list == null || list.size() == 0) {
|
| | | return resultArray;
|
| | | }
|
| | |
|
| | | Date todayTime = new Date();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
|
| | |
|
| | | List<Long> listWid = new ArrayList<>();
|
| | | for (ThreeSale threeSale : list) {
|
| | | listWid.add(threeSale.getWorker().getId());
|
| | | }
|
| | | |
| | | // 查询有效粉丝id
|
| | | int validType = UserInviteValidRecord.TYPE_TWO;
|
| | | if (type == 1) {
|
| | | validType = UserInviteValidRecord.TYPE_ONE;
|
| | | }
|
| | | List<Long> listVid = userInviteValidRecordService.getValidWorkerIdsByUid(uid, listWid, validType);
|
| | | |
| | | for (ThreeSale threeSale : list) {
|
| | | UserInfo worker = threeSale.getWorker();
|
| | | Long workerId = worker.getId();
|
| | |
|
| | | // 邀请状态
|
| | | Boolean state = threeSale.getState();
|
| | | if (type == 2) {
|
| | | if (state && threeSale.getStateSuper()) {
|
| | | state = true;
|
| | | } else {
|
| | | state = false;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 邀请成功时间
|
| | | Long succeedTime = threeSale.getSucceedTime(); |
| | | if (succeedTime == null) {
|
| | | succeedTime = threeSale.getCreateTime();
|
| | | }
|
| | | |
| | | // 有效粉丝
|
| | | boolean validFans = false; |
| | | if (state && listVid != null && listVid.size() > 0 && listVid.contains(workerId)) {
|
| | | validFans = true;
|
| | | }
|
| | | |
| | | // 最近粉丝登录时间
|
| | | Date lastLoginTime = new Date(threeSale.getCreateTime());
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
|
| | | if (userInfoExtra != null && userInfoExtra.getActiveTime() != null) {
|
| | | lastLoginTime = userInfoExtra.getActiveTime();
|
| | | } |
| | | JSONObject loginJson = new JSONObject();
|
| | | if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
|
| | | loginJson.put("content", "最近登录 " + sdf.format(lastLoginTime)); // 本年
|
| | | } else {
|
| | | loginJson.put("content", "最近登录 " + format.format(lastLoginTime)); // 往年
|
| | | }
|
| | | loginJson.put("color", "#888888");
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | array.add(loginJson);
|
| | |
|
| | | // 查询粉丝等级
|
| | | UserInviteLevelEnum level = null;
|
| | | UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(workerId);
|
| | | if (vipLevel != null) {
|
| | | if (vipLevel.getLevel() == UserVIPLevel.LEVEL_3) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | } else if (vipLevel.getLevel() == UserVIPLevel.LEVEL_7) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | } else if (vipLevel.getLevel() == UserVIPLevel.LEVEL_10) {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | }
|
| | | }
|
| | | |
| | | if(level == null) {
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | level = UserInviteLevelEnum.noActive;
|
| | | } else {
|
| | | level = UserInviteLevelEnum.actived;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | JSONObject object = new JSONObject();
|
| | | object.put("workerId", workerId);
|
| | | object.put("nickName", worker.getNickName());
|
| | | object.put("portrait", worker.getPortrait());
|
| | | object.put("inviteId", threeSale.getId());
|
| | | object.put("inviteTime", format.format(new Date(succeedTime)) + " 加入");
|
| | | object.put("state", state? 1 : 2);
|
| | | object.put("recentMsg", array);
|
| | | object.put("level", level.name());
|
| | | object.put("validFans", validFans);
|
| | | |
| | | |
| | | // 判断是否存在脱离关系队员
|
| | | if (vipLevel != null && state) {
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(workerId, bossId);
|
| | | if (separate != null && separate.getEndTime() != null) {
|
| | | try {
|
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", "#888888");
|
| | | contentJson1.put("content", "将于");
|
| | |
|
| | | String dateDiff = DateUtil.dateDiff4(new Date(), separate.getEndTime());
|
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", "#F14242");
|
| | | contentJson2.put("content", dateDiff);
|
| | |
|
| | | JSONObject contentJson3 = new JSONObject();
|
| | | contentJson3.put("color", "#888888");
|
| | | contentJson3.put("content", "后脱离邀请关系");
|
| | | |
| | | JSONArray vipBreak = new JSONArray();
|
| | | vipBreak.add(contentJson1);
|
| | | vipBreak.add(contentJson2);
|
| | | vipBreak.add(contentJson3);
|
| | | object.put("vipBreakTime",vipBreak);
|
| | | |
| | | List<String> tips = new ArrayList<String>();
|
| | | tips.add("于"+ TimeUtil.formatDateDot(vipLevel.getSuccessTime()) + "升级为" + level.getName());
|
| | | if (type == 1) {
|
| | | tips.add("你需要在"+ dateDiff +"内升级为会员,否则按照邀请规则TA将与你脱离邀请关系。");
|
| | | tips.add("赶快加油升级为会员吧!");
|
| | | } else {
|
| | | tips.add("你需要辅助TA的邀请人"+ threeSale.getBoss().getNickName()+ "在"+dateDiff+"内升级为会员,否则这位间接粉丝" +worker.getNickName()+"将与你脱离邀请关系。");
|
| | | tips.add("赶快帮助TA升级为会员吧!");
|
| | | }
|
| | | object.put("vipBreakTip",tips);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) {
|
| | | // 一级队员 查询昵称备注
|
| | | String memoName = null;
|
| | | ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
|
| | | if (threeSaleExtraInfo != null) {
|
| | | if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
|
| | | memoName = threeSaleExtraInfo.getNickname();
|
| | | }
|
| | | }
|
| | | object.put("memoName", memoName);
|
| | | |
| | | // 添加微信信息
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
|
| | | object.put("weiXin", userInfoExtra.getWeiXin());
|
| | | object.put("weiXinState", 3);
|
| | | object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过板栗快省赚钱技巧。");
|
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | | object.put("weiXinTip", "点击提醒TA,系统会发送一封站内信,提醒其添加微信号。");
|
| | | } else {
|
| | | object.put("weiXinState", 2);
|
| | | object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | resultArray.add(object);
|
| | | }
|
| | | return resultArray;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 查看下级的直接粉丝
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid 当前UId
|
| | | * @param tid 下级UId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOthersTeam", method = RequestMethod.POST)
|
| | | public void getOthersTeam(AcceptData acceptData, long page, Long uid, Long tid, PrintWriter out) {
|
| | | if (tid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid, 1);
|
| | | long count = threeSaleSerivce.countFirstTeam(tid, 1);
|
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | result.put("count", count);
|
| | | result.put("list", organizeTeamNew(count, listTeam, tid, 1, false));
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 用户队员统计- IOS
|
| | | *
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | @RequestMapping(value = "remvoeBreak")
|
| | | public void remvoeBreak(String callback, AcceptData acceptData,Long inviteId, Long uid, Long tid, PrintWriter out) {
|
| | | if (uid == null || inviteId == null || tid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传输参数不完整"));
|
| | | return;
|
| | | }
|
| | | threeSaleSerivce.remvoeBreak(inviteId, uid, tid);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteService userInviteService;
|
| | | |
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | | |
| | | |
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | | *
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "该用户不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 省钱 -自购产生返利
|
| | |
|
| | | List<Integer> list = new ArrayList<Integer>();
|
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | |
|
| | | BigDecimal finishGoldCoin = integralDetailService.getCumulativeMoney(uid);
|
| | |
|
| | | // long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | // |
| | | long finishTeam = 0L;
|
| | | long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
|
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
|
| | | if (listThreeSale != null && listThreeSale.size() > 0) {
|
| | | for (ThreeSale three: listThreeSale) {
|
| | | UserInfo worker = three.getWorker();
|
| | | if (worker == null || worker.getId() == null) {
|
| | | continue;
|
| | | }
|
| | | // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
|
| | | long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
|
| | | if (countValid > 0) {
|
| | | finishTeam ++;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
|
| | | BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
|
| | |
|
| | | long limitTeam = 0;
|
| | |
|
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | | Date executeDate = null;
|
| | | try {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
|
| | | executeDate = format.parse(limtDate);
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null
|
| | | && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
|
| | | limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user")));
|
| | | } else {
|
| | | limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user")));
|
| | | }
|
| | | long limitHongBao = (Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy")));
|
| | | BigDecimal limitMoney = (new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
|
| | | BigDecimal limitgoldCoin = (new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
|
| | |
|
| | | if (finishGoldCoin.compareTo(limitgoldCoin) >= 0 && finishTeam >= limitTeam && finishHongBao >= limitHongBao
|
| | | && finishMoney.compareTo(limitMoney) >= 0) {// 条件符合
|
| | | ;
|
| | | } else {
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未达到开通条件")));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("未达到开通条件"));
|
| | | }
|
| | | return;
|
| | | }
|
| | | // 开通
|
| | | try {
|
| | | userVIPInfoService.applyVIP(uid);
|
| | | } catch (UserVIPInfoException e) {
|
| | |
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("申请成功,正在受理中")));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | out.print(JsonUtil.loadTrueResult("申请成功,正在受理中"));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 获取vip信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getVIPInfoV2")
|
| | | public void getVIPInfoV2(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 用户信息
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "该用户不存在"));
|
| | | return;
|
| | | }
|
| | | // 获取等级
|
| | | UserInviteLevelEnum level = userInviteService.getUserInviteLevelNew(uid);
|
| | | |
| | | // 达人
|
| | | long limitZiGou = 0;
|
| | | long limitShare = 0;
|
| | | long limitFirst = 0;
|
| | | long limitSecond = 0;
|
| | | if (level == UserInviteLevelEnum.actived || level == UserInviteLevelEnum.noActive) {
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_3_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_3_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_3_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_3_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vipPre1) {
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_7_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_7_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_7_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_7_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vipPre2 || level == UserInviteLevelEnum.vipApply) {
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_10_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vip || level == UserInviteLevelEnum.tearcherApply) {
|
| | | // TODO 比例
|
| | | |
| | | } else if (level == UserInviteLevelEnum.tearcher) {
|
| | | // TODO
|
| | | }
|
| | | |
| | | // 自购订单
|
| | | long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 分享订单
|
| | | long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | |
| | | |
| | | Date now = new Date();
|
| | | Date start = new Date(0);
|
| | | |
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | | |
| | | // 省钱: ---返利订单、奖励券提成
|
| | | List<UserMoneyDetailTypeEnum> typeFanli = new ArrayList<>();
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.fanli);
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.orderReward);
|
| | | BigDecimal saveMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeFanli, start, now).abs();
|
| | | |
| | | // 赚钱: 邀请订单、分享订单、补贴
|
| | | List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
|
| | | typeList.add(UserMoneyDetailTypeEnum.share);
|
| | | typeList.add(UserMoneyDetailTypeEnum.invite);
|
| | | typeList.add(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | typeList.add(UserMoneyDetailTypeEnum.systemEqualize);
|
| | | typeList.add(UserMoneyDetailTypeEnum.subsidy);
|
| | | BigDecimal earnMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, start, now).abs();
|
| | | if (level != UserInviteLevelEnum.vip) {
|
| | | BigDecimal rate = new BigDecimal("0.409");
|
| | | saveMoney = MoneyBigDecimalUtil.mul2(saveMoney, rate);
|
| | | earnMoney = MoneyBigDecimalUtil.mul2(earnMoney, rate);
|
| | | }
|
| | | |
| | | String school = "板栗学院";
|
| | | String platformSubsidy = "补贴返佣 ";
|
| | | String teamSubsidy = "会员专属";
|
| | | String teamReward = "超级会员专属";
|
| | | |
| | | // 达人版
|
| | | JSONObject jsonrRed1 = new JSONObject();
|
| | | jsonrRed1.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">52.5%</label>");
|
| | | jsonrRed1.put("school", school + "<label style=\"color:#E5005C;\">达人班</label>");
|
| | | jsonrRed1.put("teamSubsidy", teamSubsidy);
|
| | | jsonrRed1.put("teamReward", teamReward);
|
| | | |
| | | |
| | | JSONObject jsonrRed2 = new JSONObject();
|
| | | jsonrRed2.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">60%</label>");
|
| | | jsonrRed2.put("school", school + "<label style=\"color:#E5005C;\">普通班</label>");
|
| | | jsonrRed2.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">7.5%</label>");
|
| | | jsonrRed2.put("teamReward", teamReward);
|
| | | |
| | |
|
| | | JSONObject jsonrRed3 = new JSONObject();
|
| | | jsonrRed3.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">70%</label>");
|
| | | jsonrRed3.put("school", school + "<label style=\"color:#E5005C;\">高级班</label>");
|
| | | jsonrRed3.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">15%</label>");
|
| | | jsonrRed3.put("teamReward", teamReward);
|
| | | |
| | |
|
| | | JSONObject jsonrRed4 = new JSONObject();
|
| | | jsonrRed4.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">115%</label>");
|
| | | jsonrRed4.put("school", school + "<label style=\"color:#E5005C;\">超级班</label>");
|
| | | jsonrRed4.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">22.5%</label>");
|
| | | jsonrRed4.put("teamReward", teamReward + "最高<label style=\"color:#E5005C;\">40%</label>");
|
| | | |
| | | |
| | | JSONObject json = new JSONObject();
|
| | | json.put("level", level.name());
|
| | | json.put("nickName", userInfo.getNickName());
|
| | | json.put("portrait", userInfo.getPortrait());
|
| | | json.put("ruleLink", userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | json.put("saveMoney", saveMoney);
|
| | | json.put("earnMoney", earnMoney);
|
| | | |
| | | json.put("tearcherTip", "我是你的导师,为你在省赚过程中解难答疑,对你一对一辅导,倾听你的需求总结并反馈给板栗快省官方运营团队,快来添加我吧。");
|
| | | json.put("tearcherWX", userVipConfigService.getValueByKey("tearcher_weixin_num"));
|
| | | json.put("newerGongLue", configService.get(ConfigKeyEnum.newerGonglue.getKey()));
|
| | | |
| | | // 已完成
|
| | | json.put("doneZiGou", doneZiGou);
|
| | | json.put("doneShare", doneShare);
|
| | | json.put("doneFirst", doneFirst);
|
| | | json.put("doneSecond", doneSecond);
|
| | | |
| | | // 标准
|
| | | json.put("limitZiGou", limitZiGou);
|
| | | json.put("limitShare", limitShare);
|
| | | json.put("limitFirst", limitFirst);
|
| | | json.put("limitSecond", limitSecond);
|
| | | |
| | | // 已完成
|
| | | json.put("master", jsonrRed1);
|
| | | json.put("vip1", jsonrRed2);
|
| | | json.put("vip2", jsonrRed3);
|
| | | json.put("vip3", jsonrRed4);
|
| | | |
| | | // 人工客服链接
|
| | | json.put("csdLink", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json)));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(json));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.ESOrder;
|
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy;
|
| | | import com.yeshi.fanli.entity.order.OrderTeamReward;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.ESOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyServiceV2;
|
| | | import com.yeshi.fanli.service.inter.order.OrderTeamRewardService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | | import com.yeshi.fanli.vo.order.GoodsRebateVO;
|
| | | import com.yeshi.fanli.vo.order.OrderCountVO;
|
| | | import com.yeshi.fanli.vo.order.OrderRebateVO;
|
| | | import com.yeshi.fanli.vo.order.TeamBonusVO;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
|
| | |
| | | @Resource
|
| | | private ESOrderService esOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyServiceV2 inviteOrderSubsidyServiceV2;
|
| | |
|
| | | /**
|
| | | * 订单列表
|
| | |
| | | data.put("count", count);
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | data.put("helpUrl", configService.get(ConfigKeyEnum.orderListHelp.getKey()));
|
| | | data.put("bonusLink", configService.get(ConfigKeyEnum.orderBonusLink.getKey()));
|
| | | data.put("validMoney", "¥ " + validMoney);
|
| | | data.put("invalidMoney", "¥ " + invalidMoney);
|
| | | data.put("findOrderHelpUrl", orderFindUrl);
|
| | |
| | | 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());
|
| | | |
| | | // 团队奖励 TODO
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | BigDecimal teamSubsidy = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, dateType, null);
|
| | | if (teamSubsidy == null) {
|
| | | teamSubsidy = new BigDecimal(0);
|
| | | }
|
| | | |
| | | BigDecimal teamReward = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, dateType, null);
|
| | | if (teamReward == null) {
|
| | | teamReward = new BigDecimal(0);
|
| | | }
|
| | | |
| | | data.put("teamSubsidy", teamSubsidy.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("teamReward", teamReward.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("tutorSubsidy", "0.00");
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 团队收益统计 统计已到账未到账 : 累计只统计已到账
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param type 1-团队补贴 2-团队奖励 3-导师津贴
|
| | | */
|
| | | @RequestMapping(value = "getTeamBonus", method = RequestMethod.POST)
|
| | | public void getTeamBonus(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (type == null || type < 1 || type > 3) {
|
| | | type = 1;
|
| | | }
|
| | | |
| | | if (type == 1) {
|
| | | // 补贴
|
| | | sumTeamSubsidy(out, user);
|
| | | } else if (type == 2) {
|
| | | // 奖励
|
| | | sumTeamReward(out, user);
|
| | | } else {
|
| | | // 导师津贴
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("exist", false);
|
| | | data.put("link", configService.get(ConfigKeyEnum.tutorSubsidyLink.getKey()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计补贴
|
| | | * @param out
|
| | | * @param user
|
| | | */
|
| | | private void sumTeamSubsidy(PrintWriter out, UserInfo user) {
|
| | | Long uid = user.getId();
|
| | | // 是否VIP
|
| | | boolean vip = userVIPInfoService.isVIP(uid);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", configService.get(ConfigKeyEnum.orderTeamSubsidyLink.getKey()));
|
| | | if (!vip) {
|
| | | data.put("exist", false);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } |
| | | |
| | | data.put("exist", true);
|
| | | data.put("portrait", user.getPortrait());
|
| | | |
| | | // 今日统计
|
| | | BigDecimal todayDirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 1, InviteOrderSubsidy.LEVEL_ONE);
|
| | | if (todayDirect == null) {
|
| | | todayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal todayIndirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 1, InviteOrderSubsidy.LEVEL_TWO);
|
| | | if (todayIndirect == null) {
|
| | | todayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO today = new TeamBonusVO();
|
| | | today.setDirect(todayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setIndirect(todayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setTotal(MoneyBigDecimalUtil.add(todayDirect, todayIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 昨日统计
|
| | | BigDecimal yesterdayDirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 2, InviteOrderSubsidy.LEVEL_ONE);
|
| | | if (yesterdayDirect == null) {
|
| | | yesterdayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal yesterdayIndirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 2, InviteOrderSubsidy.LEVEL_TWO);
|
| | | if (yesterdayIndirect == null) {
|
| | | yesterdayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO yesterday = new TeamBonusVO();
|
| | | yesterday.setDirect(yesterdayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setIndirect(yesterdayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setTotal(MoneyBigDecimalUtil.add(yesterdayDirect, yesterdayIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 本月统计
|
| | | BigDecimal thisMonthDirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 3, InviteOrderSubsidy.LEVEL_ONE);
|
| | | if (thisMonthDirect == null) {
|
| | | thisMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal thisMonthIndirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 3, InviteOrderSubsidy.LEVEL_TWO);
|
| | | if (thisMonthIndirect == null) {
|
| | | thisMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO thisMonth = new TeamBonusVO();
|
| | | thisMonth.setDirect(thisMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setIndirect(thisMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setTotal(MoneyBigDecimalUtil.add(thisMonthDirect, thisMonthIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 本月统计
|
| | | BigDecimal lastMonthDirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 4, InviteOrderSubsidy.LEVEL_ONE);
|
| | | if (lastMonthDirect == null) {
|
| | | lastMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal lastMonthIndirect = inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid, 4, InviteOrderSubsidy.LEVEL_TWO);
|
| | | if (lastMonthIndirect == null) {
|
| | | lastMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO lastMonth = new TeamBonusVO();
|
| | | lastMonth.setDirect(lastMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setIndirect(lastMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setTotal(MoneyBigDecimalUtil.add(lastMonthDirect, lastMonthIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | BigDecimal direct = inviteOrderSubsidyServiceV2.sumRecievedMoneyByUid(uid, InviteOrderSubsidy.LEVEL_ONE);
|
| | | if (direct == null) {
|
| | | direct = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal indirect = inviteOrderSubsidyServiceV2.sumRecievedMoneyByUid(uid, InviteOrderSubsidy.LEVEL_TWO);
|
| | | if (indirect == null) {
|
| | | indirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal total = MoneyBigDecimalUtil.add(direct, indirect);
|
| | | |
| | | data.put("today", today);
|
| | | data.put("yesterday", yesterday);
|
| | | data.put("thisMonth", thisMonth);
|
| | | data.put("lastMonth", lastMonth);
|
| | | data.put("total", total.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("direct", direct.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("indirect", indirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | /**
|
| | | * 统计团队奖励
|
| | | * @param out
|
| | | * @param user
|
| | | */
|
| | | private void sumTeamReward(PrintWriter out, UserInfo user) {
|
| | | Long uid = user.getId();
|
| | | // 是否VIP
|
| | | boolean vip = userVIPInfoService.isVIP(uid);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", configService.get(ConfigKeyEnum.orderTeamRewardLink.getKey()));
|
| | | if (!vip) {
|
| | | data.put("exist", false);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } |
| | | |
| | | data.put("exist", true);
|
| | | data.put("portrait", user.getPortrait());
|
| | | |
| | | |
| | | // 今日统计
|
| | | BigDecimal todayDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 1, OrderTeamReward.LEVEL_ONE);
|
| | | if (todayDirect == null) {
|
| | | todayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal todayIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 1, OrderTeamReward.LEVEL_TWO);
|
| | | if (todayIndirect == null) {
|
| | | todayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO today = new TeamBonusVO();
|
| | | today.setDirect(todayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setIndirect(todayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | today.setTotal(MoneyBigDecimalUtil.add(todayDirect, todayIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 昨日统计
|
| | | BigDecimal yesterdayDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 2, OrderTeamReward.LEVEL_ONE);
|
| | | if (yesterdayDirect == null) {
|
| | | yesterdayDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal yesterdayIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 2, OrderTeamReward.LEVEL_TWO);
|
| | | if (yesterdayIndirect == null) {
|
| | | yesterdayIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO yesterday = new TeamBonusVO();
|
| | | yesterday.setDirect(yesterdayDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setIndirect(yesterdayIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | yesterday.setTotal(MoneyBigDecimalUtil.add(yesterdayDirect, yesterdayIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 本月统计
|
| | | BigDecimal thisMonthDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 3, OrderTeamReward.LEVEL_ONE);
|
| | | if (thisMonthDirect == null) {
|
| | | thisMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal thisMonthIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 3, OrderTeamReward.LEVEL_TWO);
|
| | | if (thisMonthIndirect == null) {
|
| | | thisMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO thisMonth = new TeamBonusVO();
|
| | | thisMonth.setDirect(thisMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setIndirect(thisMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | thisMonth.setTotal(MoneyBigDecimalUtil.add(thisMonthDirect, thisMonthIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | // 本月统计
|
| | | BigDecimal lastMonthDirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 4, OrderTeamReward.LEVEL_ONE);
|
| | | if (lastMonthDirect == null) {
|
| | | lastMonthDirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal lastMonthIndirect = orderTeamRewardService.sumValidMoneyByUidAndDate(uid, 4, OrderTeamReward.LEVEL_TWO);
|
| | | if (lastMonthIndirect == null) {
|
| | | lastMonthIndirect = new BigDecimal(0);
|
| | | }
|
| | | TeamBonusVO lastMonth = new TeamBonusVO();
|
| | | lastMonth.setDirect(lastMonthDirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setIndirect(lastMonthIndirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | lastMonth.setTotal(MoneyBigDecimalUtil.add(lastMonthDirect, lastMonthIndirect).setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | |
| | | |
| | | BigDecimal direct = orderTeamRewardService.sumRecievedMoneyByUid(uid, OrderTeamReward.LEVEL_ONE);
|
| | | if (direct == null) {
|
| | | direct = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal indirect = orderTeamRewardService.sumRecievedMoneyByUid(uid, OrderTeamReward.LEVEL_TWO);
|
| | | if (indirect == null) {
|
| | | indirect = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal total = MoneyBigDecimalUtil.add(direct, indirect);
|
| | | |
| | | data.put("today", today);
|
| | | data.put("yesterday", yesterday);
|
| | | data.put("thisMonth", thisMonth);
|
| | | data.put("lastMonth", lastMonth);
|
| | | data.put("total", total.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("direct", direct.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("indirect", indirect.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 返利说明
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @param sourceType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getReBateInfo")
|
| | | public void getReBateInfo(String callback, AcceptData acceptData, Long uid, String orderNo, Integer sourceType, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | GoodsRebateVO goodsVO = new GoodsRebateVO();
|
| | | goodsVO.setTitle("舒客舒克光感炫白牙片美白牙齿牙膜套装去黄牙清新口气");
|
| | | goodsVO.setPicture("https://img.alicdn.com/bao/uploaded/i4/355739614/O1CN01RB6Hlg2KtGMWR4mON_!!0-item_pic.jpg");
|
| | | goodsVO.setActualPay("¥60.00");
|
| | | goodsVO.setFanliRate("X20%");
|
| | | goodsVO.setFanliExpect("¥25.00");
|
| | | goodsVO.setCommision("10.00");
|
| | | goodsVO.setSubsidy("6.00");
|
| | | |
| | | GoodsRebateVO goodsVO2 = new GoodsRebateVO();
|
| | | goodsVO2.setTitle("馥佩美白柔肤水爽肤水补水保湿女化妆湿敷精华水男旗舰店官网正品");
|
| | | goodsVO2.setPicture("https://img.alicdn.com/bao/uploaded/i4/738252756/O1CN01MgFdXy1WEI8zmkyg7_!!0-item_pic.jpg");
|
| | | goodsVO2.setActualPay("¥62.00");
|
| | | goodsVO2.setFanliRate("X22%");
|
| | | goodsVO2.setFanliExpect("¥26.00");
|
| | | goodsVO2.setCommision("12.00");
|
| | | goodsVO2.setSubsidy("8.00");
|
| | | |
| | | List<GoodsRebateVO> listGoods= new ArrayList<>();
|
| | | listGoods.add(goodsVO);
|
| | | listGoods.add(goodsVO2);
|
| | | |
| | | OrderRebateVO orderRebateVO = new OrderRebateVO();
|
| | | orderRebateVO.setTotalFanLi("¥50.00");
|
| | | orderRebateVO.setUpperFanLi("¥60.00");
|
| | | orderRebateVO.setUserLevel(UserLevelEnum.daRen.name());
|
| | | orderRebateVO.setJumpLink("https://www.baidu.com/");
|
| | | orderRebateVO.setListGoods(listGoods);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", orderRebateVO);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | HttpServletRequest request,PrintWriter out) {
|
| | |
|
| | | String ocode = request.getSession().getAttribute(Constant.RANDKEY) + "";
|
| | | |
| | | request.getSession().removeAttribute(Constant.RANDKEY);
|
| | | |
| | | if (StringUtil.isNullOrEmpty(code) || !code.equalsIgnoreCase(ocode)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("验证码错误"));
|
| | | return;
|
| | | }
|
| | | request.getSession().removeAttribute(Constant.RANDKEY);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(username)||StringUtil.isNullOrEmpty(pwd)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户名或密码为空"));
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | @RequestMapping("loginExitJP")
|
| | | public void loginExitJP(String callback, HttpServletRequest request,PrintWriter out) {
|
| | | request.getSession().removeAttribute(Constant.SESSION_ADMIN);
|
| | | request.getSession().invalidate();
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult("退出成功"));
|
| | | return;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mongo.system; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.system.ConfigCategory; |
| | | import com.yeshi.fanli.entity.system.ConfigCategory.ConfigCategoryEnum; |
| | | |
| | | @Repository |
| | | public class ConfigCategoryDao extends MongodbBaseDao<ConfigCategory> { |
| | | |
| | | /** |
| | | * 查询 |
| | | * |
| | | * @param userEnum |
| | | * @return |
| | | */ |
| | | public List<ConfigCategory> listByType(ConfigCategoryEnum type) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(type)); |
| | | query.with(new Sort(Sort.Direction.ASC, "order")); |
| | | return mongoTemplate.find(query, ConfigCategory.class); |
| | | } |
| | | |
| | | } |
| | |
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | |
|
| | | public interface ExtractAuditRecordMapper {
|
| | |
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | int countAuditTotal(@Param("state")Integer state, @Param("preDay") String preDay);
|
| | | Long countAuditTotal(@Param("state")Integer state, @Param("preDay") String preDay);
|
| | |
|
| | | /**
|
| | | * 统计申请提的现总金额
|
| | |
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | int countApplyNumberByDay(@Param("preDay") String preDay);
|
| | | Long countApplyNumberByDay(@Param("preDay") String preDay);
|
| | |
|
| | | }
|
| | |
| | | @Param("payment") BigDecimal payment);
|
| | |
|
| | |
|
| | | Long countOrderByUidAndSettled(@Param("uid") Long uid, @Param("limitTime") long limitTime,
|
| | | @Param("payment") BigDecimal payment);
|
| | | |
| | |
|
| | | /**
|
| | | * 注:1笔且付款总金额不小于 payment 元(退款为失效
|
| | |
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Integer countOrderByTypeAndDate(@Param("orderType") Integer orderType, @Param("preDay") String preDay);
|
| | | Long countOrderByTypeAndDate(@Param("orderType") Integer orderType, @Param("preDay") String preDay);
|
| | |
|
| | |
|
| | | } |
| | |
| | | * @return
|
| | | */
|
| | | long countFirstTeam(@Param("uid") Long uid, @Param("state") Integer state);
|
| | | |
| | | |
| | | /**
|
| | | * 查询一级队员-未删除版
|
| | | * |
| | | * @param paramLong
|
| | | * @param paramInt
|
| | | * @param paramLong1
|
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listFirstTeamByUndeleted(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid);
|
| | |
|
| | | /**
|
| | | * 统计一级队员 -未删除版
|
| | | * |
| | | * @param uid
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | long countFirstTeamByUndeleted(@Param("uid") Long uid);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询二级队员
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listSecondTeamByUndeleted(@Param("start") long start, @Param("count") int count,
|
| | | @Param("uid") Long uid);
|
| | |
|
| | | /**
|
| | | * 统计二级队员
|
| | | * |
| | | * @param uid
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | long countSecondTeamByUndeleted(@Param("uid") Long uid);
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询二级队员
|
| | |
| | | */
|
| | | BigDecimal getCumulativeMoney(@Param("uid") Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计当日新增金币
|
| | | * @param uniqueKey
|
| | | * @return
|
| | | */
|
| | | Long countNewAddByDate(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 列表查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | List<IntegralDetail> listQuery(@Param("start")long start, @Param("count")int count, @Param("key")String key);
|
| | | |
| | | Long countQuery(@Param("key")String key);
|
| | | } |
| | |
| | | List<ChartTDO> countOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询所有订单
|
| | | * |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | List<JDOrderItem> listQuery(@Param("start") long start, @Param("count")int count, @Param("key")String key);
|
| | |
|
| | | Long countQuery(@Param("key")String key);
|
| | |
|
| | | } |
| | |
| | | UserMoneyDetail selectByTypeAndUidAndIdentifyCode(@Param("type") UserMoneyDetailTypeEnum type,
|
| | | @Param("uid") Long uid, @Param("sourceIdentifyId") Long sourceIdentifyId);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询明细
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | List<UserMoneyDetail> listQuery(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key,@Param("keyType") Integer keyType);
|
| | |
|
| | | Long countQuery(@Param("key") String key, @Param("keyType")Integer keyType);
|
| | | } |
| | |
| | | List<CountOrderDTO> countValidOrderByDay(@Param("preDay") String preDay); |
| | | |
| | | /** |
| | | * 查询当日下单用户 |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | List<Long> getUidByValidOrderByDay(@Param("preDay") String preDay); |
| | | |
| | | /** |
| | | * 通过多个uid 日期筛选 下单用户数量 |
| | | * @param preDay |
| | | * @param uid |
| | |
| | | * @return |
| | | */ |
| | | Integer countOderByUidAndLess10(@Param("uid") Long uid); |
| | | |
| | | |
| | | List<Long> getDownOrderUserByListUidAndDate(@Param("preDay") Date preDay,@Param("list") List<Long> list); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | long countSearchOrderByUid(@Param("uid") Long uid, @Param("list")List<ESOrder> list); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询最小结算时间 |
| | | * @return |
| | | */ |
| | | List<CommonOrder> getMinSettleTimeAndUid(); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
| | |
|
| | | InviteOrderSubsidy selectByPrimaryKeyForUpdate(Long id);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 统计用户已到账金额
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumRecievedMoneyByUid(@Param("uid") long uid, @Param("level") Integer level);
|
| | | |
| | | |
| | | /**
|
| | | * 统计用户有效金额
|
| | | * @param uid
|
| | | * @param day 1今日 2昨日 3本月 4上月
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumValidMoneyByUidAndDate(@Param("uid") long uid, @Param("day") Integer day, @Param("level") Integer level);
|
| | | |
| | | } |
| | |
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Integer countLostOrderNum(@Param("preDay") String preDay);
|
| | | Integer countLostOrderNum(@Param("preDay") String preDay, @Param("resultCode") int resultCode);
|
| | |
|
| | | /**
|
| | | * 统计申诉成功订单金额
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | * @throws
|
| | | */
|
| | | Long countCanSettleUid(Date time);
|
| | | |
| | | |
| | | /**
|
| | | * 统计用户已到账金额
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumRecievedMoneyByUid(@Param("uid") long uid, @Param("level") Integer level);
|
| | | |
| | | |
| | | /**
|
| | | * 统计用户有效金额
|
| | | * @param uid
|
| | | * @param day 1今日 2昨日 3本月 4上月
|
| | | * @return
|
| | | */
|
| | | BigDecimal sumValidMoneyByUidAndDate(@Param("uid") long uid, @Param("day") Integer day, @Param("level") Integer level);
|
| | | } |
| | |
| | | * @return
|
| | | */
|
| | | Long countByStatus(@Param("status") Integer status);
|
| | | |
| | | |
| | | /**
|
| | | * 查询所有订单
|
| | | * |
| | | * @param channel
|
| | | * @return
|
| | | */
|
| | | List<PDDOrder> listQuery(@Param("start") long start, @Param("count")int count, @Param("key")String key);
|
| | |
|
| | | Long countQuery(@Param("key")String key);
|
| | |
|
| | | } |
| | |
| | | */
|
| | | long count(@Param("key") String key, @Param("uid") Long uid, @Param("type") Integer type);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计每日新增红包
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Long countNumByDay(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 统计每日新增红包
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countMoneyByDay(@Param("preDay") String preDay);
|
| | | |
| | | } |
| | |
| | | */
|
| | | Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计每日新增红包
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | Long countNumByDay(@Param("preDay") String preDay);
|
| | | |
| | | /**
|
| | | * 统计每日新增红包
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countMoneyByDay(@Param("preDay") String preDay);
|
| | | |
| | | |
| | | } |
| | |
| | | * @param date
|
| | | * @return
|
| | | */
|
| | | int countActiveNumByDate(@Param("date") String date);
|
| | | Long countActiveNumByDate(@Param("preDay") String preDay);
|
| | |
|
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 根据渠道查询用户id |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<UserInfoRegister> listByDay(@Param("preDay")String preDay); |
| | | |
| | | |
| | | /** |
| | | * 统计渠道当日新增个数 |
| | | * @param channel |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | Integer countByChannelAndDay(@Param("channel")String channel, @Param("preDay")String preDay); |
| | | Long countByChannelAndDay(@Param("channel")String channel, @Param("preDay")String preDay); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum; |
| | | |
| | | public interface UserInviteValidNumMapper extends BaseMapper<UserInviteValidNum> { |
| | | |
| | | /** |
| | | * 更新直接粉丝数量 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | void addNumFirst(@Param("id")Long id, @Param("num") int num); |
| | | |
| | | /** |
| | | * 更新间接粉丝数量 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | void addNumSecond(@Param("id")Long id, @Param("num") int num); |
| | | |
| | | |
| | | /** |
| | | * 用于更新 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInviteValidNum selectForUpdate(Long id); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord; |
| | | |
| | | public interface UserInviteValidRecordMapper extends BaseMapper<UserInviteValidRecord> { |
| | | |
| | | /** |
| | | * 根据唯一值查询 |
| | | * @param uniqueKey |
| | | * @return |
| | | */ |
| | | UserInviteValidRecord selectByUniqueKey(@Param("uniqueKey")String uniqueKey); |
| | | |
| | | |
| | | /** |
| | | * 查询用户下的有效粉丝 |
| | | * @param uid |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<Long> getValidWorkerIdsByUid(@Param("uid")Long uid,@Param("list") List<Long> list,@Param("type")Integer type); |
| | | |
| | | } |
| | |
| | | List<ChartTDO> getFreeCouponMoneyToCharts(@Param("dateType") Integer dateType, @Param("year") String year,
|
| | | @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("couponType")String couponType);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计奖励券金额成功金额
|
| | | * @param type
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countRebateMoneyByDay(@Param("preDay") String preDay);
|
| | | |
| | | |
| | | /**
|
| | | * 统计免单金额成功金额
|
| | | * @param type
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countFreeMoneyByTypeAndDay(@Param("type") String type, @Param("preDay") String preDay);
|
| | | |
| | | |
| | | /**
|
| | | * 统计券每日新增数量
|
| | | * @param type
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | BigDecimal countCouponNumByDay(@Param("type") String type, @Param("preDay") String preDay);
|
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user.vip;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | |
|
| | | public interface UserVIPLevelMapper{
|
| | |
|
| | | |
| | | /**
|
| | | * 根据用户ID检索
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | UserVIPLevel getLevelByUid(@Param("uid") Long uid);
|
| | |
|
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon.DailyCountCouponEnum; |
| | | |
| | | @Repository |
| | | public class DailyCountCouponDao extends MongodbBaseDao<DailyCountCoupon> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public DailyCountCoupon getMaxDate(DailyCountCouponEnum couponEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(couponEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, DailyCountCoupon.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param userEnum |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DailyCountCoupon> query(DailyCountCouponEnum userEnum, Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | return mongoTemplate.find(query, DailyCountCoupon.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments.DailyCountMomentsEnum; |
| | | |
| | | @Repository |
| | | public class DailyCountMomentsDao extends MongodbBaseDao<DailyCountMoments> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public DailyCountMoments getMaxDate(DailyCountMomentsEnum couponEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(couponEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, DailyCountMoments.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param userEnum |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DailyCountMoments> query(DailyCountMomentsEnum userEnum, Date startTime, Date endTime) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | return mongoTemplate.find(query, DailyCountMoments.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder.DailyCountOrderEnum; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Repository |
| | | public class DailyCountOrderDao extends MongodbBaseDao<DailyCountOrder> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public DailyCountOrder getMaxDate(DailyCountOrderEnum couponEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(couponEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, DailyCountOrder.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param userEnum |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DailyCountOrder> query(DailyCountOrderEnum userEnum, Date startTime, Date endTime, String channel) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (!StringUtil.isNullOrEmpty(channel)) { |
| | | query.addCriteria(Criteria.where("channel").is(channel)); |
| | | } |
| | | return mongoTemplate.find(query, DailyCountOrder.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.count; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser; |
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser.DailyCountUserEnum; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | @Repository |
| | | public class DailyCountUserDao extends MongodbBaseDao<DailyCountUser> { |
| | | |
| | | /** |
| | | * 查询统计最大的一天 |
| | | * |
| | | * @return |
| | | */ |
| | | public DailyCountUser getMaxDate(DailyCountUserEnum couponEnum) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("type").is(couponEnum.name())); |
| | | query.with(new Sort(Sort.Direction.DESC, "day")).limit(1); |
| | | return mongoTemplate.findOne(query, DailyCountUser.class); |
| | | } |
| | | |
| | | /** |
| | | * 查询视图 |
| | | * |
| | | * @param userEnum |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DailyCountUser> query(DailyCountUserEnum userEnum, Date startTime, Date endTime, String channel) { |
| | | Query query = new Query(); |
| | | Criteria ca = new Criteria(); |
| | | ca.andOperator(Criteria.where("type").is(userEnum.name()),Criteria.where("day").gte(startTime), Criteria.where("day").lte(endTime)); |
| | | query.addCriteria(ca); |
| | | if (!StringUtil.isNullOrEmpty(channel)) { |
| | | query.addCriteria(Criteria.where("channel").is(channel)); |
| | | } |
| | | return mongoTemplate.find(query, DailyCountUser.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.system; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.entity.common.Config; |
| | | |
| | | public class ListConfig { |
| | | private List<Config> config; |
| | | |
| | | public List<Config> getConfig() { |
| | | return config; |
| | | } |
| | | |
| | | public void setConfig(List<Config> config) { |
| | | this.config = config; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.fanli.dto.user;
|
| | |
|
| | | public enum UserInviteLevelEnum {
|
| | | noActive("未激活", ""), actived("已经激活", ""), vipApply("超级会员申请中", ""), vip("超级会员", ""), tearcherApply("导师申请中",
|
| | | ""), tearcher("导师", "");
|
| | | noActive("未激活", ""),
|
| | | actived("已经激活", ""),
|
| | | vipApply("超级会员申请中", ""),
|
| | | vipPre1("普通会员", ""), |
| | | vipPre2("高级会员", ""), |
| | | vip("超级会员", ""), |
| | | tearcherApply("导师申请中",""),
|
| | | tearcher("导师", "");
|
| | | private String name;
|
| | | private String link;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | |
|
| | | public class UserVIPLevel {
|
| | | |
| | | public static int LEVEL_3 = 3;// 超级会员第一阶段 -普通会员
|
| | | public static int LEVEL_7 = 7;// 超级会员第二阶段 -高级会员
|
| | | public static int LEVEL_10 = 7;// 超级会员 |
| | | |
| | | private Integer level;
|
| | | private Date successTime;
|
| | | private UserInviteLevelEnum LevelEnum;
|
| | | |
| | | public Integer getLevel() {
|
| | | return level;
|
| | | }
|
| | |
|
| | | public void setLevel(Integer level) {
|
| | | this.level = level;
|
| | | }
|
| | |
|
| | | public Date getSuccessTime() {
|
| | | return successTime;
|
| | | }
|
| | |
|
| | | public void setSuccessTime(Date successTime) {
|
| | | this.successTime = successTime;
|
| | | }
|
| | |
|
| | | public UserInviteLevelEnum getLevelEnum() {
|
| | | return LevelEnum;
|
| | | }
|
| | |
|
| | | public void setLevelEnum(UserInviteLevelEnum levelEnum) {
|
| | | LevelEnum = levelEnum;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 渠道订单统计 |
| | | * 券相关统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | |
| | | extractAuditNumber("提现审核次数"), |
| | | todayOrder("当日订单的用户数量"), |
| | | weekOrder("7天内订单用户数量"), |
| | | weekThreeOrder("7天内订单用户数量"),; |
| | | weekThreeOrder("7天内订单用户数量"), |
| | | integral("金币数量"); |
| | | |
| | | private final String desc; |
| | | |
| | |
| | | // 渠道 |
| | | @Field("channel") |
| | | private String channel; |
| | | |
| | | // 更新日期 |
| | | @Field("updateDate") |
| | | private Date updateDate; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getUpdateDate() { |
| | | return updateDate; |
| | | } |
| | | |
| | | public void setUpdateDate(Date updateDate) { |
| | | this.updateDate = updateDate; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 每日券统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "daily_count_coupon") |
| | | public class DailyCountCoupon { |
| | | |
| | | public enum DailyCountCouponEnum { |
| | | freeCouponNum("免单券统计数量"), |
| | | freeCouponMoney("免单券统计金额"), |
| | | freeCouponBuyNum("自购免单券统计数量"), |
| | | freeCouponBuyMoney("自购免单券统计金额"), |
| | | welfareFreeCouponNum("福利免单统计数量"), |
| | | welfareFreeCouponMoney("福利免单统计金额"), |
| | | freeCouponGiveNum("赠送免单券统计数量"), |
| | | rebateCouponNum("返利奖励券统计数量"), |
| | | rebateCouponMoney("返利奖励券统计金额"); |
| | | |
| | | private final String desc; |
| | | |
| | | private DailyCountCouponEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期:年月日 |
| | | @Field("day") |
| | | private Date day; |
| | | // 总数 |
| | | @Field("total") |
| | | private BigDecimal total; |
| | | // 类型 |
| | | @Field("type") |
| | | private DailyCountCouponEnum type; |
| | | // 更新日期 |
| | | @Field("updateDate") |
| | | private Date updateDate; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public BigDecimal getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(BigDecimal total) { |
| | | this.total = total; |
| | | } |
| | | |
| | | public DailyCountCouponEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(DailyCountCouponEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getUpdateDate() { |
| | | return updateDate; |
| | | } |
| | | |
| | | public void setUpdateDate(Date updateDate) { |
| | | this.updateDate = updateDate; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 每日统计发圈数量 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "daily_count_moments") |
| | | public class DailyCountMoments { |
| | | |
| | | public enum DailyCountMomentsEnum { |
| | | shareClick("分享点击次数"), copyComment("复制评论次数"); |
| | | |
| | | private final String desc; |
| | | |
| | | private DailyCountMomentsEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期:年月日 |
| | | @Field("day") |
| | | private Date day; |
| | | // 总数 -每日结果数据 |
| | | @Field("total") |
| | | private BigDecimal total; |
| | | // 类型 |
| | | @Field("type") |
| | | private DailyCountMomentsEnum type; |
| | | // 更新日期 |
| | | @Field("updateDate") |
| | | private Date updateDate; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public BigDecimal getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(BigDecimal total) { |
| | | this.total = total; |
| | | } |
| | | |
| | | public DailyCountMomentsEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(DailyCountMomentsEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getUpdateDate() { |
| | | return updateDate; |
| | | } |
| | | |
| | | public void setUpdateDate(Date updateDate) { |
| | | this.updateDate = updateDate; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 每日订单统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "daily_count_order") |
| | | public class DailyCountOrder { |
| | | |
| | | public enum DailyCountOrderEnum { |
| | | fanliOrderNum("返利订单数量"), |
| | | shareOrderNum("分享订单数量"), |
| | | inviteOrderNum("邀请订单数量"), |
| | | |
| | | channelOrderNum24H("渠道订单统计数量24小时内"), |
| | | channelOrderNum("渠道订单统计数量"), |
| | | channelOrderMoney("渠道订单统计金额"), |
| | | |
| | | weiQuanOrderNum("售后订单统计数量"), |
| | | weiQuanOrderMoney("售后订单统计金额"), |
| | | |
| | | tbOrderTrackRate("淘宝订单根据率"), |
| | | jdOrderTrackRate("京东订单根据率"), |
| | | pddOrderTrackRate("拼多多订单根据率"), |
| | | |
| | | lastOrderUntreatedNum("订单找回未处理统计数量"), |
| | | lastOrderSucceedNum("订单找回成功统计数量"), |
| | | lastOrderFailNum("订单找回失败统计数量"), |
| | | lastOrderSucceedMoney("订单找回成功统计金额"); |
| | | |
| | | private final String desc; |
| | | |
| | | private DailyCountOrderEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期:年月日 |
| | | @Field("day") |
| | | private Date day; |
| | | // 总数 |
| | | @Field("total") |
| | | private BigDecimal total; |
| | | // 类型 |
| | | @Field("type") |
| | | private DailyCountOrderEnum type; |
| | | // 渠道 |
| | | @Field("channel") |
| | | private String channel; |
| | | // 更新日期 |
| | | @Field("updateDate") |
| | | private Date updateDate; |
| | | |
| | | // 计算比例 |
| | | @Field("rate") |
| | | private boolean rate; |
| | | // 当日总数 -计算比例 |
| | | @Field("totalDay") |
| | | private BigDecimal totalDay; |
| | | // 当日有效总数 -计算比例 |
| | | @Field("totalValid") |
| | | private BigDecimal totalValid; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public BigDecimal getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(BigDecimal total) { |
| | | this.total = total; |
| | | } |
| | | |
| | | public DailyCountOrderEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(DailyCountOrderEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getUpdateDate() { |
| | | return updateDate; |
| | | } |
| | | |
| | | public void setUpdateDate(Date updateDate) { |
| | | this.updateDate = updateDate; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public boolean isRate() { |
| | | return rate; |
| | | } |
| | | |
| | | public void setRate(boolean rate) { |
| | | this.rate = rate; |
| | | } |
| | | |
| | | public BigDecimal getTotalDay() { |
| | | return totalDay; |
| | | } |
| | | |
| | | public void setTotalDay(BigDecimal totalDay) { |
| | | this.totalDay = totalDay; |
| | | } |
| | | |
| | | public BigDecimal getTotalValid() { |
| | | return totalValid; |
| | | } |
| | | |
| | | public void setTotalValid(BigDecimal totalValid) { |
| | | this.totalValid = totalValid; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.admin.count; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 每日用户统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "daily_count_user") |
| | | public class DailyCountUser { |
| | | |
| | | public enum DailyCountUserEnum { |
| | | newUserChannel("新增用户分渠道"), |
| | | newUserDownOrderDay("转化率-当日下单"), |
| | | newUserDownOrderWeek("转化率-当周下单"), |
| | | newUserDownOrderWeek3("转化率-当周下3单"), |
| | | activeAgain90("90天再次活跃"), |
| | | integralNum("用户金币数量"), |
| | | newUserTljNum("新人红包数量总计"), |
| | | newUserTljMoney("新人红包金额总计"), |
| | | redpackNum("奖励红包总计"), |
| | | redpackMoney("奖励红包总计"), |
| | | extractApplyNumber("提现申请次数"), |
| | | extractApplyMoney("提现申请金额"), |
| | | extractAuditPass("提现审核通过"), |
| | | extractAuditReject("提现审核驳回"); |
| | | |
| | | private final String desc; |
| | | |
| | | private DailyCountUserEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 日期:年月日 |
| | | @Field("day") |
| | | private Date day; |
| | | // 总数 -每日结果数据 |
| | | @Field("total") |
| | | private BigDecimal total; |
| | | // 类型 |
| | | @Field("type") |
| | | private DailyCountUserEnum type; |
| | | // 渠道 |
| | | @Field("channel") |
| | | private String channel; |
| | | // 更新日期 |
| | | @Field("updateDate") |
| | | private Date updateDate; |
| | | |
| | | // 计算比例 |
| | | @Field("rate") |
| | | private boolean rate; |
| | | // 当日总数 -计算比例 |
| | | @Field("totalDay") |
| | | private BigDecimal totalDay; |
| | | // 当日有效总数 -计算比例 |
| | | @Field("totalValid") |
| | | private BigDecimal totalValid; |
| | | |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public BigDecimal getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(BigDecimal total) { |
| | | this.total = total; |
| | | } |
| | | |
| | | public DailyCountUserEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(DailyCountUserEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Date getUpdateDate() { |
| | | return updateDate; |
| | | } |
| | | |
| | | public void setUpdateDate(Date updateDate) { |
| | | this.updateDate = updateDate; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public BigDecimal getTotalDay() { |
| | | return totalDay; |
| | | } |
| | | |
| | | public void setTotalDay(BigDecimal totalDay) { |
| | | this.totalDay = totalDay; |
| | | } |
| | | |
| | | public BigDecimal getTotalValid() { |
| | | return totalValid; |
| | | } |
| | | |
| | | public void setTotalValid(BigDecimal totalValid) { |
| | | this.totalValid = totalValid; |
| | | } |
| | | |
| | | public boolean isRate() { |
| | | return rate; |
| | | } |
| | | |
| | | public void setRate(boolean rate) { |
| | | this.rate = rate; |
| | | } |
| | | } |
| | |
| | | @Table(name = "yeshi_ec_threeSale")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_threeSale")
|
| | | public class ThreeSale {
|
| | |
|
| | | public static int EXPIRE_NORMAL = 0;// 正常状态
|
| | | public static int EXPIRE_OUTOFDATE = 1;// 邀请关系脱离
|
| | |
|
| | | // 邀请状态
|
| | | public static int STATE_SUCCESS = 1;// 成功
|
| | | public static int STATE_NOT_SUCCESS = 0;// 尚未成功
|
| | |
|
| | | // 脱离状态
|
| | | public static int EXPIRE_NORMAL = 0;// 正常状态
|
| | | public static int EXPIRE_BREAK = 1;// 邀请关系脱离
|
| | | public static int EXPIRE_BREAK_VIP = 2; // vip脱离关系
|
| | | public static int EXPIRE_BREAK_VIP_DEL3 = 3; // 直接脱离关系删除
|
| | | public static int EXPIRE_BREAK_VIP_DEL4 = 4; // 间接脱离关系删除
|
| | | public static int EXPIRE_BREAK_VIP_DEL34 = 34; // 直接、间接脱离关系删除
|
| | |
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | |
| | |
|
| | | @Transient
|
| | | private ThreeSaleExtraInfo threeSaleExtraInfo;
|
| | |
|
| | | // 上上级关系状态
|
| | | @Transient
|
| | | private Boolean stateSuper;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.threeSaleExtraInfo = threeSaleExtraInfo;
|
| | | }
|
| | |
|
| | | public Boolean getStateSuper() {
|
| | | return stateSuper;
|
| | | }
|
| | |
|
| | | public void setStateSuper(Boolean stateSuper) {
|
| | | this.stateSuper = stateSuper;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | |
|
| | | /**
|
| | | * 首次注册信息
|
| | | *
|
| | |
| | | private Long id;
|
| | | // 渠道
|
| | | @Column(name = "regt_channel")
|
| | | private ChannelEnum channel;
|
| | | private String channel;
|
| | | // ip : 端口
|
| | | @Column(name = "regt_ip")
|
| | | private String ip;
|
| | |
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public ChannelEnum getChannel() {
|
| | | public String getChannel() {
|
| | | return channel;
|
| | | }
|
| | |
|
| | | public void setChannel(ChannelEnum channel) {
|
| | | public void setChannel(String channel) {
|
| | | this.channel = channel;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 有效粉丝数量
|
| | | */
|
| | | @Table("yeshi_ec_user_invite_valid_num")
|
| | | public class UserInviteValidNum {
|
| | |
|
| | | @Column(name = "utv_uid")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "utv_num_first")
|
| | | private Integer numFirst;
|
| | |
|
| | | @Column(name = "utv_num_second")
|
| | | private Integer numSecond;
|
| | |
|
| | | @Column(name = "utv_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Integer getNumFirst() {
|
| | | return numFirst;
|
| | | }
|
| | |
|
| | | public void setNumFirst(Integer numFirst) {
|
| | | this.numFirst = numFirst;
|
| | | }
|
| | |
|
| | | public Integer getNumSecond() {
|
| | | return numSecond;
|
| | | }
|
| | |
|
| | | public void setNumSecond(Integer numSecond) {
|
| | | this.numSecond = numSecond;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 有效粉丝记录表
|
| | | */
|
| | | @Table("yeshi_ec_user_invite_valid_record")
|
| | | public class UserInviteValidRecord {
|
| | | public static int TYPE_ONE = 1;// 直接粉丝
|
| | | public static int TYPE_TWO = 2;// 间接粉丝
|
| | |
|
| | | @Column(name = "tvr_id")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "tvr_uid")
|
| | | private Long uid;// 用户id
|
| | |
|
| | | @Column(name = "tvr_worker_id")
|
| | | private Long workerId; // 粉丝id
|
| | |
|
| | | @Column(name = "tvr_type")
|
| | | private Integer type;
|
| | |
|
| | | // 唯一值:( uid#workerId#type)
|
| | | @Column(name = "tvr_unique_key")
|
| | | private String uniqueKey;
|
| | | |
| | | @Column(name = "tvr_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Long getWorkerId() {
|
| | | return workerId;
|
| | | }
|
| | |
|
| | | public void setWorkerId(Long workerId) {
|
| | | this.workerId = workerId;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public String getUniqueKey() {
|
| | | return uniqueKey;
|
| | | }
|
| | |
|
| | | public void setUniqueKey(String uniqueKey) {
|
| | | this.uniqueKey = uniqueKey;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | @Column(name = "td_create_time")
|
| | | private Date createTime;
|
| | |
|
| | |
|
| | | private String nickName;// 昵称
|
| | | private String portrait;// 头像
|
| | | |
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | public void setUniqueKey(String uniqueKey) {
|
| | | this.uniqueKey = uniqueKey;
|
| | | }
|
| | |
|
| | | public String getNickName() {
|
| | | return nickName;
|
| | | }
|
| | |
|
| | | public void setNickName(String nickName) {
|
| | | this.nickName = nickName;
|
| | | }
|
| | |
|
| | | public String getPortrait() {
|
| | | return portrait;
|
| | | }
|
| | |
|
| | | public void setPortrait(String portrait) {
|
| | | this.portrait = portrait;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public String getVlaue() { |
| | | return vlaue; |
| | | } |
| | | |
| | | /** |
| | | * 获取枚举类型 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public static ChannelEnum getTypeEnum(String type) { |
| | | if (ChannelEnum.unknown.name().equals(type)) |
| | | return ChannelEnum.unknown; |
| | | |
| | | if (ChannelEnum.p360.name().equals(type)) |
| | | return ChannelEnum.p360; |
| | | |
| | | if (ChannelEnum.appstore.name().equals(type)) |
| | | return ChannelEnum.appstore; |
| | | |
| | | if (ChannelEnum.douyin.name().equals(type)) |
| | | return ChannelEnum.douyin; |
| | | |
| | | if (ChannelEnum.guanwang.name().equals(type)) |
| | | return ChannelEnum.guanwang; |
| | | |
| | | if (ChannelEnum.lenovo.name().equals(type)) |
| | | return ChannelEnum.lenovo; |
| | | |
| | | if (ChannelEnum.meizu.name().equals(type)) |
| | | return ChannelEnum.meizu; |
| | | |
| | | if (ChannelEnum.oppo.name().equals(type)) |
| | | return ChannelEnum.oppo; |
| | | |
| | | if (ChannelEnum.pp.name().equals(type)) |
| | | return ChannelEnum.pp; |
| | | |
| | | if (ChannelEnum.qq.name().equals(type)) |
| | | return ChannelEnum.qq; |
| | | |
| | | if (ChannelEnum.sougou.name().equals(type)) |
| | | return ChannelEnum.sougou; |
| | | |
| | | if (ChannelEnum.vivo.name().equals(type)) |
| | | return ChannelEnum.vivo; |
| | | |
| | | if (ChannelEnum.xiaomi.name().equals(type)) |
| | | return ChannelEnum.xiaomi; |
| | | |
| | | if (ChannelEnum.yaoqing.name().equals(type)) |
| | | return ChannelEnum.yaoqing; |
| | | |
| | | if (ChannelEnum.yingyin.name().equals(type)) |
| | | return ChannelEnum.yingyin; |
| | | |
| | | if (ChannelEnum.huawei.name().equals(type)) |
| | | return ChannelEnum.huawei; |
| | | |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.system; |
| | | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | import com.yeshi.fanli.entity.common.Config; |
| | | |
| | | /** |
| | | * 设置分类 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Document(collection = "config_category") |
| | | public class ConfigCategory { |
| | | |
| | | public enum ConfigCategoryEnum { |
| | | versionDiff("标签栏引导提示"), |
| | | msgNotify("大图通知"), |
| | | tbGoods("淘宝商品"), |
| | | jdGoods("京东商品"), |
| | | pddGoods("拼多多商品"), |
| | | goldCoin("金币设置"), |
| | | freeCoupon("免单券设置"), |
| | | rebateCoupon("返利奖励券设置"), |
| | | pageText("页面文本设置"), |
| | | protocol("协议相关"), |
| | | rule("规则相关"), |
| | | helpStrategy("帮助攻略相关"), |
| | | orderCart("订单购物车相关"), |
| | | maskControl("遮罩控制"), |
| | | guanXuan("官宣任务"), |
| | | specialHelper("小助手"), |
| | | extract("提现相关"); |
| | | |
| | | private final String desc; |
| | | |
| | | private ConfigCategoryEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | @Field("_id") |
| | | private String id; |
| | | // 类型 |
| | | @Field("type") |
| | | private ConfigCategoryEnum type; |
| | | // 关键词枚举 |
| | | @Field("KeyEnum") |
| | | private ConfigKeyEnum KeyEnum; |
| | | // 类型 |
| | | @Field("order") |
| | | private int order; |
| | | |
| | | // 编辑方式: 1 、普通文本 2、多行文本 3、单选框 |
| | | @Field("editMode") |
| | | private int editMode; |
| | | |
| | | private Config config; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public ConfigCategoryEnum getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(ConfigCategoryEnum type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public ConfigKeyEnum getKeyEnum() { |
| | | return KeyEnum; |
| | | } |
| | | |
| | | public void setKeyEnum(ConfigKeyEnum keyEnum) { |
| | | KeyEnum = keyEnum; |
| | | } |
| | | |
| | | public int getOrder() { |
| | | return order; |
| | | } |
| | | |
| | | public void setOrder(int order) { |
| | | this.order = order; |
| | | } |
| | | |
| | | public int getEditMode() { |
| | | return editMode; |
| | | } |
| | | |
| | | public void setEditMode(int editMode) { |
| | | this.editMode = editMode; |
| | | } |
| | | |
| | | public Config getConfig() { |
| | | return config; |
| | | } |
| | | |
| | | public void setConfig(Config config) { |
| | | this.config = config; |
| | | } |
| | | |
| | | } |
| | |
| | | taobaoOrderParseJS("taobao_order_parse_js", "淘宝订单解析脚本"), |
| | | autoFindTaobaoOrder("auto_find_taobao_order", "是否开启淘宝自动找单"), |
| | | orderListHelp("order_list_help", "订单列表帮助链接"), |
| | | orderBonusLink("order_bonus_link", "奖金跳转订单筛选列表帮助链接"), |
| | | lostOrderHelpWhat("lost_order_help_what", "订单找回-订单找回是什么"), |
| | | lostOrderHelpReason("lost_order_help_reason", "订单找回-找回失败原因"), |
| | | orderFindNotifyUrl("order_find_notify_url", "订单列表-订单找回帮助链接"), |
| | |
| | | evaluateEmojis("evaluate_emojis", "发圈评论Emojis"), |
| | | evaluateText("evaluate_text", "发圈评论文本"), |
| | | |
| | | |
| | | shareOrderRebateDescLink("share_order_rebate_desc_link", "分享订单返利计算说明链接"), |
| | | orderRebateDescLink("order_rebate_desc_link", "订单返利计算说明链接"), |
| | | orderTeamSubsidyLink("order_team_subsidy_link", "订单补贴帮助链接"), |
| | | orderTeamRewardLink("order_team_reward_link", "订单奖励帮助链接"), |
| | | tutorSubsidyLink("tutor_subsidy_link", "导师津贴帮助链接"), |
| | | ; |
| | | |
| | | private final String key; |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Component
|
| | | public class UpdateThreeSaleJob {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteSeparateService userInviteSeparateService;
|
| | |
| | | if (list == null || list.size() == 0)
|
| | | break;
|
| | |
|
| | | for (UserInviteSeparate separate: list) {
|
| | | for (UserInviteSeparate record: list) {
|
| | | try {
|
| | | userVIPInfoService.inviteSeparate(separate.getWorkerId(), separate.getBossId());
|
| | | userInviteSeparateService.inviteSeparate(record);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | |
|
| | |
|
| | |
|
| | | <select id="countAuditTotal" resultType="Integer">
|
| | | SELECT IFNULL(COUNT(tr.id),0) FROM `yeshi_ec_extract_audit_record` tr
|
| | | <select id="countAuditTotal" resultType="Long">
|
| | | SELECT COUNT(tr.id) FROM `yeshi_ec_extract_audit_record` tr
|
| | | LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
|
| | | WHERE t.`state` = #{state} AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | |
| | | WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | |
|
| | | <select id="countApplyNumberByDay" resultType="Integer">
|
| | | SELECT IFNULL(COUNT(t.id),0) FROM `yeshi_ec_extract` t
|
| | | <select id="countApplyNumberByDay" resultType="Long">
|
| | | SELECT COUNT(t.id) FROM `yeshi_ec_extract` t
|
| | | WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay}
|
| | | </select>
|
| | |
|
| | |
| | | <result column="createTime" property="createTime" jdbcType="BIGINT" />
|
| | | <result column="updateTime" property="updateTime" jdbcType="BIGINT" />
|
| | | <result column="expire" property="expire" jdbcType="INTEGER" />
|
| | | <result column="stateSuper" property="stateSuper" jdbcType="BOOLEAN" />
|
| | |
|
| | |
|
| | | <association property="boss" column="boss_id"
|
| | | select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPrimaryKey" />
|
| | |
| | | </update>
|
| | |
|
| | | <update id="inviteSeparate">
|
| | | update yeshi_ec_threeSale t set t.state = 0,t.expire = 1,
|
| | | update yeshi_ec_threeSale t set t.state = 0,t.expire = 2,
|
| | | t.updateTime = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]>
|
| | | where t.worker_id=#{workerId} AND t.boss_id = #{bossId}
|
| | | </update>
|
| | |
| | | </if>
|
| | | )A
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listFirstTeamByUndeleted" resultMap="AllResultMap">
|
| | | SELECT * FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN `yeshi_ec_threesale_extra_info` ff ON (ts.`boss_id` = ff.`tf_boss_id` AND ts.`worker_id`=ff.`tf_worker_id`)
|
| | | WHERE ts.`boss_id` = #{uid} AND (ts.`expire` = 0 OR ts.`expire` = 2 OR ts.`expire` = 4)
|
| | | ORDER BY ts.state DESC, ts.createTime DESC
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | |
|
| | | <select id="countFirstTeamByUndeleted" resultType="java.lang.Long">
|
| | | SELECT IFNULL(count(ts.id),0) FROM `yeshi_ec_threesale` ts
|
| | | WHERE ts.`boss_id` = #{uid} AND (ts.`expire` = 0 OR ts.`expire` = 2 OR ts.`expire` = 4)
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listSecondTeamByUndeleted" resultMap="AllResultMap">
|
| | | SELECT yet.*,stateSuper FROM (
|
| | | SELECT DISTINCT(ts.`id`) AS id, tf.state AS stateSuper FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
|
| | | WHERE tf.`boss_id` = #{uid} AND (tf.`expire` = 0 OR tf.`expire` = 2))A
|
| | | LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id
|
| | | WHERE yet.`expire` = 0 OR yet.`expire` = 2 OR yet.`expire` = 3
|
| | | ORDER BY yet.state DESC, yet.createTime DESC
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | |
|
| | | <select id="countSecondTeamByUndeleted" resultType="java.lang.Long">
|
| | | SELECT COUNT(DISTINCT yet.id) FROM (SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
|
| | | WHERE tf.`boss_id` = #{uid} AND (tf.`expire` = 0 OR tf.`expire` = 2))A
|
| | | LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id
|
| | | WHERE yet.`expire` = 0 OR yet.`expire` = 2 OR yet.`expire` = 3
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | | <select id="getMyBoss" resultMap="AllResultMap">
|
| | | select
|
| | |
| | |
|
| | |
|
| | | <select id="counOrderByUidAndOrderType" resultType="Long">
|
| | | SELECT COUNT(co.`co_id`) FROM yeshi_ec_hongbao_v2 v2
|
| | | LEFT JOIN yeshi_ec_hongbao_order h ON v2.`hb_id` = h.`ho_hongbao_id`
|
| | | LEFT JOIN yeshi_ec_common_order co ON h.`ho_order_id` = co.`co_id`
|
| | | WHERE v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3 |
| | | AND co.`co_payment` >= #{payment} AND v2.`hb_type` = #{type}
|
| | | SELECT COUNT(0) FROM (SELECT co.`co_order_no` FROM yeshi_ec_hongbao_v2 v2
|
| | | LEFT JOIN yeshi_ec_hongbao_order h ON v2.`hb_id` = h.`ho_hongbao_id`
|
| | | LEFT JOIN yeshi_ec_common_order co ON h.`ho_order_id` = co.`co_id`
|
| | | WHERE v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3 AND co.`co_payment` >= #{payment} AND v2.`hb_type` = #{type}
|
| | | GROUP BY co.`co_order_no`,co.`co_source_type`)A
|
| | | </select>
|
| | |
|
| | | |
| | | <select id="countOrderByUidAndSettled" resultType="Long">
|
| | | SELECT COUNT(0) FROM (SELECT co.`co_order_no` FROM yeshi_ec_hongbao_v2 v2
|
| | | LEFT JOIN yeshi_ec_hongbao_order h ON v2.`hb_id` = h.`ho_hongbao_id`
|
| | | LEFT JOIN yeshi_ec_common_order co ON h.`ho_order_id` = co.`co_id`
|
| | | WHERE v2.`hb_uid` = #{uid} AND co.`co_settle_time` IS NOT NULL AND co.`co_payment` >= #{payment} |
| | | AND (v2.`hb_type` = 1 OR v2.`hb_type` = 20)
|
| | | GROUP BY co.`co_order_no`,co.`co_source_type`)A
|
| | | </select>
|
| | |
|
| | | <select id="getRewardMoneyByDate" resultType="BigDecimal">
|
| | | SELECT (COALESCE(SUM(v2.`hb_money`),0)- COALESCE(SUM(d.`wr_money`),0))AS totalmoney FROM (
|
| | |
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countOrderByTypeAndDate" resultType="Integer">
|
| | | SELECT COUNT(co.`co_id`) FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | <select id="countOrderByTypeAndDate" resultType="Long">
|
| | | SELECT COUNT(1) FROM (SELECT ho.* FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE 1=1
|
| | | <if test="orderType == 1"> <!-- 自购订单 -->
|
| | | AND (v2.hb_type =1 or v2.hb_type =2)
|
| | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
|
| | | WHERE hb.hb_id IS NOT NULL AND (co.`co_state`=1 OR co.`co_state`=2)
|
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y-%m-%d') = #{preDay}
|
| | | GROUP BY co.`co_order_no`, co.`co_source_type`
|
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)A
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | WHERE d.`td_uid` = #{uid} AND d.`td_money` > 0;
|
| | | </select>
|
| | |
|
| | | |
| | | <select id="countNewAddByDate" resultType = "Long">
|
| | | SELECT SUM(d.`td_money`) FROM `yeshi_ec_integral_detail` d
|
| | | WHERE d.`td_money` > 0 AND TO_DAYS(d.`td_create_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | SELECT * FROM `yeshi_ec_integral_detail` d
|
| | | <if test="key != null and key != ''">WHERE d.`td_uid` LIKE '%${key}%'</if>
|
| | | ORDER BY d.`td_id` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType = "Long">
|
| | | SELECT COUNT(d.`td_id`) FROM `yeshi_ec_integral_detail` d |
| | | <if test="key != null and key != ''">WHERE d.`td_uid` LIKE '%${key}%'</if>
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | ORDER BY jo_order_time
|
| | | </select>
|
| | |
|
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_jd_order_item f
|
| | | <if test="key != null and key !='' ">
|
| | | WHERE f.`joi_order_id` LIKE '${key}%'
|
| | | </if>
|
| | | ORDER BY f.`joi_id` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType="Long">
|
| | | SELECT COUNT(f.`joi_id`) FROM yeshi_ec_jd_order_item f
|
| | | <if test="key != null and key !='' ">
|
| | | WHERE f.`joi_order_id` LIKE '${key}%'
|
| | | </if>
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | from yeshi_ec_user_money_detail where umd_uid=#{uid} and
|
| | | umd_type=#{type} and umd_source_identify_id=#{sourceIdentifyId}
|
| | | </select>
|
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_user_money_detail |
| | | <if test="key != null and key !=''">
|
| | | <if test="keyType == 1"> where umd_uid = #{key}</if>
|
| | | <if test="keyType == 2"> where umd_uid like '${key}%'</if>
|
| | | </if>
|
| | | order by umd_id DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType ="Long">
|
| | | select count(umd_id) from yeshi_ec_user_money_detail |
| | | <if test="key != null and key !=''">
|
| | | <if test="keyType == 1"> where umd_uid = #{key}</if>
|
| | | <if test="keyType == 2"> where umd_uid like '${key}%'</if>
|
| | | </if>
|
| | | </select>
|
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | |
| | | <select id="countValidOrderByDay" resultMap="CountOrderMap"> |
| | | SELECT co_uid AS uid ,totalOrder FROM ( |
| | | SELECT COUNT(d.`co_id`) AS totalOrder,d.`co_uid` FROM `yeshi_ec_common_order` d |
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = '2019-11-11' AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = #{preDay} |
| | | AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A |
| | | GROUP BY co_uid |
| | | </select> |
| | | |
| | | |
| | | <select id="getUidByValidOrderByDay" resultType="Long"> |
| | | SELECT DISTINCT d.`co_uid` FROM `yeshi_ec_common_order` d |
| | | WHERE TO_DAYS(co_third_create_time) = TO_DAYS(#{preDay}) AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type` |
| | | </select> |
| | | |
| | | |
| | | <select id="countDownOrderUserByUidAndDate" resultType="Integer"> |
| | | SELECT COUNT(DISTINCT d.`co_uid`) FROM `yeshi_ec_common_order` d |
| | |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="getDownOrderUserByListUidAndDate" resultType="Long"> |
| | | SELECT d.`co_uid` FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_third_create_time`<![CDATA[<=]]> #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | <foreach collection="list" item="uid" open="AND (" separator="OR" close=")" > |
| | | d.`co_uid` = #{uid} |
| | | </foreach> |
| | | GROUP BY d.`co_order_no`,d.`co_source_type` |
| | | </select> |
| | | |
| | | <select id="countCommissionByDay" resultMap="CountOrderMap"> |
| | | SELECT co_uid AS uid ,commission FROM ( |
| | | SELECT SUM(IFNULL(d.`co_eIncome`,d.`co_estimate`)) AS commission,d.`co_uid` FROM `yeshi_ec_common_order` d |
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = '2019-11-11' AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | WHERE DATE_FORMAT(d.`co_third_create_time`,'%Y-%m-%d') = #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | GROUP BY d.`co_order_no`,d.`co_source_type`)A |
| | | GROUP BY co_uid |
| | | </select> |
| | |
| | | |
| | | <select id="countCommissionByDate" resultType="BigDecimal"> |
| | | SELECT SUM(IFNULL(d.`co_eIncome`,d.`co_estimate`)) FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_third_create_time`= #{preDay} AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | WHERE TO_DAYS(d.`co_third_create_time`)= TO_DAYS#{preDay}) AND (d.`co_state`=1 OR d.`co_state`=2) |
| | | </select> |
| | | |
| | | <select id="countOderByUidAndLess10" resultType="Integer"> |
| | |
| | | </foreach> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | | |
| | | <select id="getMinSettleTimeAndUid" resultMap="BaseResultMap"> |
| | | SELECT d.`co_uid`,MAX(d.`co_settle_time`) AS co_settle_time FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_settle_time` IS NOT NULL AND d.`co_payment` > 1 |
| | | GROUP BY d.`co_uid` |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="countByOrderNoAndType" resultType="java.lang.Long">SELECT count(*) |
| | | FROM yeshi_ec_invite_order_subsidy WHERE os_order_no = #{orderNo} AND |
| | | os_source_type = #{type}</select> |
| | | |
| | | |
| | | <select id="sumValidMoneyByUidAndDate" resultType="BigDecimal"> |
| | | SELECT SUM(d.`os_money`) FROM yeshi_ec_invite_order_subsidy d |
| | | WHERE d.`os_uid` = #{uid} AND (d.`os_state` = 1 OR d.`os_state` = 3) |
| | | <if test="level != null"> |
| | | AND d.os_level = #{level} |
| | | </if> |
| | | <if test="day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(d.`os_valid_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(d.`os_valid_time`) = 1 |
| | | </if> |
| | | <if test="day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(d.`os_valid_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`os_valid_time`, '%Y%m')) = 1 |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="sumRecievedMoneyByUid" resultType="BigDecimal"> |
| | | SELECT SUM(d.`os_money`) FROM yeshi_ec_invite_order_subsidy d |
| | | WHERE d.`os_uid` = #{uid} AND d.`os_state` = 3 |
| | | <if test="level != null"> |
| | | AND d.os_level = #{level} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="countLostOrderNum" resultType="Integer">
|
| | | SELECT COUNT(1) FROM (SELECT COUNT(t.`id`) FROM `yeshi_ec_lost_order` t
|
| | | WHERE FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') = #{preDay}
|
| | | AND t.result_code = #{resultCode}
|
| | | GROUP BY t.`orderId`,t.`orderType`)A
|
| | | </select>
|
| | |
|
| | |
| | | <select id="countCanSettleUid" resultType="java.lang.Long" |
| | | parameterType="java.util.Date">SELECT COUNT(*) FROM ( SELECT t.otr_uid FROM |
| | | yeshi_ec_order_team_reward t WHERE t.otr_state=1 AND |
| | | #{0}>t.otr_pre_get_time GROUP BY t.otr_uid) a</select> |
| | | #{0}>t.otr_pre_get_time GROUP BY t.otr_uid) a |
| | | </select> |
| | | |
| | | <select id="sumValidMoneyByUidAndDate" resultType="BigDecimal"> |
| | | SELECT SUM(d.`otr_money`) FROM yeshi_ec_order_team_reward d |
| | | WHERE d.`otr_uid` = #{uid} AND (d.`otr_state` = 1 OR d.`otr_state` = 3) |
| | | <if test="level != null"> |
| | | AND d.otr_level = #{level} |
| | | </if> |
| | | <if test="day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(d.`otr_valid_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(d.`otr_valid_time`) = 1 |
| | | </if> |
| | | <if test="day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(d.`otr_valid_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(d.`otr_valid_time`, '%Y%m')) = 1 |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="sumRecievedMoneyByUid" resultType="BigDecimal"> |
| | | SELECT SUM(d.`otr_money`) FROM yeshi_ec_order_team_reward d |
| | | WHERE d.`otr_uid` = #{uid} AND d.`otr_state` = 3 |
| | | <if test="level != null"> |
| | | AND d.otr_level = #{level} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | </if>
|
| | | </select>
|
| | |
|
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_pdd_order f
|
| | | <if test="key != null and key !='' ">
|
| | | WHERE f.`po_order_id` LIKE '${key}%'
|
| | | </if>
|
| | | ORDER BY f.`po_id` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType="Long">
|
| | | SELECT COUNT(f.`po_id`) FROM yeshi_ec_pdd_order f
|
| | | <if test="key != null and key !='' ">
|
| | | WHERE f.`po_order_id` LIKE '${key}%'
|
| | | </if>
|
| | | </select>
|
| | |
|
| | |
|
| | | </mapper>
|
| | |
| | | AND t.`rpd_type` = 'deduct'
|
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="countNumByDay" resultType="Long">
|
| | | SELECT COUNT(d.`rpd_id`) FROM `yeshi_ec_red_pack_detail` d
|
| | | WHERE d.`rpd_money` > 0 AND d.`rpd_type` NOT IN ('refund','giveOthersFail','shopOrderDrawBack','redExchangeReject')
|
| | | AND TO_DAYS( d.`rpd_create_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countMoneyByDay" resultType="BigDecimal">
|
| | | SELECT SUM(d.`rpd_money`) FROM `yeshi_ec_red_pack_detail` d
|
| | | WHERE d.`rpd_money` > 0 AND d.`rpd_type` NOT IN ('refund','giveOthersFail','shopOrderDrawBack','redExchangeReject')
|
| | | AND TO_DAYS( d.`rpd_create_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | </mapper>
|
| | |
| | | SELECT count(utd_id) FROM yeshi_ec_user_taolijin_detail
|
| | | WHERE utd_uid=#{uid} and `utd_create_time`<![CDATA[<=]]>#{date}
|
| | | </select>
|
| | | |
| | | <select id="countNumByDay" resultType="Long">
|
| | | SELECT COUNT(d.`utd_id`) FROM `yeshi_ec_user_taolijin_detail` d
|
| | | WHERE d.`utd_type` = 'add' AND TO_DAYS(d.`utd_create_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | <select id="countMoneyByDay" resultType="BigDecimal">
|
| | | SELECT SUM(d.`utd_money`) FROM `yeshi_ec_user_taolijin_detail` d
|
| | | WHERE d.`utd_type` = 'add' AND TO_DAYS(d.`utd_create_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | | </mapper>
|
| | |
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countActiveNumByDate" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(COUNT(dd.`uie_uid`),0) |
| | | FROM (SELECT t.`uie_uid`, MAX(d.`lua_createtime`) AS lastDate FROM `yeshi_ec_user_info_extra` t |
| | | LEFT JOIN `yeshi_ec_log_user_active` d ON t.`uie_uid` = d.`lua_uid`
|
| | | WHERE TO_DAYS(t.`uie_active_time`) = TO_DAYS('${date}') |
| | | AND TO_DAYS(d.`lua_createtime`) <![CDATA[<]]> TO_DAYS('${date}')
|
| | | GROUP BY d.`lua_uid`)dd |
| | | WHERE dd.lastDate <![CDATA[<]]> DATE_SUB('${date}', INTERVAL 90 DAY)
|
| | | <select id="countActiveNumByDate" resultType="Long">
|
| | | SELECT COUNT(BB.lua_uid) FROM (SELECT d.`lua_uid` FROM yeshi_ec_log_user_active d
|
| | | WHERE TO_DAYS(d.`lua_createtime`) = TO_DAYS(#{preDay})
|
| | | GROUP BY d.`lua_uid`) A |
| | | LEFT JOIN (SELECT lua_uid FROM (SELECT d.`lua_uid`,MAX(d.`lua_createtime`) AS maxTime FROM yeshi_ec_log_user_active d
|
| | | WHERE TO_DAYS(d.`lua_createtime`) <![CDATA[<]]> TO_DAYS(#{preDay}) |
| | | GROUP BY d.`lua_uid`) B WHERE B.`maxTime` <![CDATA[<]]> DATE_SUB(#{preDay}, INTERVAL 90 DAY))BB ON A.lua_uid = BB.lua_uid
|
| | | WHERE BB.lua_uid IS NOT NULL
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserInfoRegisterMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoRegister"> |
| | | <id column="regt_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="regt_channel" property="channel" typeHandler="com.yeshi.fanli.util.mybatishandler.ChannelEnumHandler"/> |
| | | <result column="regt_channel" property="channel" jdbcType="VARCHAR"/> |
| | | <result column="regt_ip" property="ip" jdbcType="VARCHAR"/> |
| | | <result column="regt_device" property="device" jdbcType="VARCHAR"/> |
| | | <result column="regt_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | |
| | | |
| | | <select id="listUidByChannelAndDay" resultType="Long"> |
| | | SELECT regt_id FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay}) |
| | | </select> |
| | | |
| | | <select id="listByChannelAndDay" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay}) |
| | | </select> |
| | | |
| | | |
| | | <select id="countByChannelAndDay" resultMap="BaseResultMap"> |
| | | <select id="countByChannelAndDay" resultType="Long"> |
| | | SELECT COUNT(regt_id) FROM yeshi_ec_user_info_register |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = #{preDay} |
| | | WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay}) |
| | | </select> |
| | | |
| | | |
| | | <select id="listByDay" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register |
| | | WHERE TO_DAYS(regt_create_time) = TO_DAYS(#{preDay}) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | |
|
| | | <update id="updateStateByWorkerIdAndBossId">
|
| | | UPDATE yeshi_ec_user_invite_separate SET uis_state = #{state}
|
| | | WHERE uis_worker_id = #{workerId} AND uis_boss_id = #{bossId}
|
| | | WHERE uis_worker_id = #{workerId} AND uis_boss_id = #{bossId} AND uis_state = 0
|
| | | </update>
|
| | |
|
| | | <select id="selectByWorkerIdAndBossId" resultMap="BaseResultMap">
|
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.UserInviteValidNumMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInviteValidNum"> |
| | | <id column="utv_uid" property="id" jdbcType="BIGINT"/> |
| | | <result column="utv_num_first" property="numFirst" jdbcType="INTEGER"/> |
| | | <result column="utv_num_second" property="numSecond" jdbcType="INTEGER"/> |
| | | <result column="utv_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">utv_uid,utv_num_first,utv_num_second,utv_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_invite_valid_num where utv_uid = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_invite_valid_num where utv_uid = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidNum" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_num (utv_uid,utv_num_first,utv_num_second,utv_update_time) values (#{id,jdbcType=BIGINT},#{numFirst,jdbcType=INTEGER},#{numSecond,jdbcType=INTEGER},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidNum" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_num |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">utv_uid,</if> |
| | | <if test="numFirst != null">utv_num_first,</if> |
| | | <if test="numSecond != null">utv_num_second,</if> |
| | | <if test="updateTime != null">utv_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="numFirst != null">#{numFirst,jdbcType=INTEGER},</if> |
| | | <if test="numSecond != null">#{numSecond,jdbcType=INTEGER},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidNum">update yeshi_ec_user_invite_valid_num set utv_num_first = #{numFirst,jdbcType=INTEGER},utv_num_second = #{numSecond,jdbcType=INTEGER},utv_update_time = #{updateTime,jdbcType=TIMESTAMP} where utv_uid = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidNum">update yeshi_ec_user_invite_valid_num |
| | | <set> |
| | | <if test="numFirst != null">utv_num_first=#{numFirst,jdbcType=INTEGER},</if> |
| | | <if test="numSecond != null">utv_num_second=#{numSecond,jdbcType=INTEGER},</if> |
| | | <if test="updateTime != null">utv_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where utv_uid = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="addNumFirst"> |
| | | UPDATE yeshi_ec_user_invite_valid_num SET utv_num_first = utv_num_first + #{num,jdbcType=INTEGER},utv_update_time = NOW() |
| | | WHERE utv_uid = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="addNumSecond"> |
| | | UPDATE yeshi_ec_user_invite_valid_num SET utv_num_second = utv_num_second + #{num,jdbcType=INTEGER},utv_update_time = NOW() |
| | | WHERE utv_uid = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="selectForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select * from yeshi_ec_user_invite_valid_num where utv_uid = #{id,jdbcType=BIGINT} FOR UPDATE |
| | | </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.UserInviteValidRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord"> |
| | | <id column="tvr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="tvr_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="tvr_worker_id" property="workerId" jdbcType="BIGINT"/> |
| | | <result column="tvr_type" property="type" jdbcType="INTEGER"/> |
| | | <result column="tvr_unique_key" property="uniqueKey" jdbcType="VARCHAR"/> |
| | | <result column="tvr_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tvr_id,tvr_uid,tvr_worker_id,tvr_type,tvr_unique_key,tvr_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_invite_valid_record where tvr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_invite_valid_record where tvr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_record (tvr_id,tvr_uid,tvr_worker_id,tvr_type,tvr_unique_key,tvr_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{workerId,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{uniqueKey,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tvr_id,</if> |
| | | <if test="uid != null">tvr_uid,</if> |
| | | <if test="workerId != null">tvr_worker_id,</if> |
| | | <if test="type != null">tvr_type,</if> |
| | | <if test="uniqueKey != null">tvr_unique_key,</if> |
| | | <if test="createTime != null">tvr_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="workerId != null">#{workerId,jdbcType=BIGINT},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="uniqueKey != null">#{uniqueKey,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord">update yeshi_ec_user_invite_valid_record set tvr_uid = #{uid,jdbcType=BIGINT},tvr_worker_id = #{workerId,jdbcType=BIGINT},tvr_type = #{type,jdbcType=INTEGER},tvr_unique_key = #{uniqueKey,jdbcType=VARCHAR},tvr_create_time = #{createTime,jdbcType=TIMESTAMP} where tvr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord">update yeshi_ec_user_invite_valid_record |
| | | <set> |
| | | <if test="uid != null">tvr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="workerId != null">tvr_worker_id=#{workerId,jdbcType=BIGINT},</if> |
| | | <if test="type != null">tvr_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="uniqueKey != null">tvr_unique_key=#{uniqueKey,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">tvr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where tvr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="selectByUniqueKey" resultMap="BaseResultMap"> |
| | | select * from yeshi_ec_user_invite_valid_record |
| | | where tvr_unique_key = #{uniqueKey,jdbcType=VARCHAR} |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="getValidWorkerIdsByUid" resultType="Long"> |
| | | select DISTINCT tvr_worker_id from yeshi_ec_user_invite_valid_record |
| | | where tvr_uid = #{uid} and tvr_type = #{type} |
| | | and tvr_worker_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </if>
|
| | | ORDER BY v2.`hb_get_time`
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countFreeMoneyByTypeAndDay" resultType="BigDecimal">
|
| | | SELECT SUM(v2.`hb_money`) 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` = #{type} |
| | | AND TO_DAYS(v2.`hb_get_time`) = TO_DAYS(#{preDay})
|
| | | </select>
|
| | | |
| | | <select id="countRebateMoneyByDay" resultType="BigDecimal">
|
| | | SELECT SUM(v2.`hb_money`) FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_type`= 10 AND TO_DAYS(v2.`hb_get_time`) = TO_DAYS(#{preDay}) |
| | | </select>
|
| | | |
| | | <select id="countCouponNumByDay" resultType="BigDecimal">
|
| | | SELECT COUNT(c.`usc_id`) FROM yeshi_ec_user_system_coupon c |
| | | LEFT JOIN yeshi_ec_system_coupon p ON p.`sc_id`= c.`usc_coupon_id`
|
| | | WHERE p.`sc_type` = #{type} AND TO_DAYS(c.`usc_create_time`) = TO_DAYS(#{preDay})
|
| | | </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.vip.UserVIPLevelMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.dto.vip.UserVIPLevel"> |
| | | <id column="level" property="level" jdbcType="INTEGER" /> |
| | | <result column="success_time" property="successTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | |
| | | <select id="getLevelByUid" resultMap="BaseResultMap"> |
| | | SELECT IFNULL(A.grade,B.vpi_process) AS 'level',IF(A.grade IS NULL,B.vpi_create_time,A.uvi_success_time) AS 'success_time' |
| | | FROM (SELECT p.`vpi_process`,p.`vpi_uid`,p.`vpi_create_time` FROM `yeshi_ec_user_vip_pre_info` p |
| | | WHERE p.`vpi_uid` = #{uid} ORDER BY p.`vpi_process` DESC LIMIT 1)B |
| | | LEFT JOIN (SELECT 10 AS grade,d.`uvi_uid`,d.`uvi_success_time` FROM `yeshi_ec_user_vip_info` d |
| | | WHERE d.`uvi_uid` = #{uid} AND d.`uvi_state` = 2 LIMIT 1)A ON A.uvi_uid = B.vpi_uid |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.config;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mongo.system.ConfigCategoryDao;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory.ConfigCategoryEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigCategoryService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class ConfigCategoryServiceImpl implements ConfigCategoryService {
|
| | |
|
| | | @Resource
|
| | | private ConfigCategoryDao configCategoryDao;
|
| | |
|
| | | @Override
|
| | | public void addConfigCategory(ConfigCategory configCategory) {
|
| | | if (configCategory == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | ConfigCategoryEnum type = configCategory.getType();
|
| | | ConfigKeyEnum keyEnum = configCategory.getKeyEnum();
|
| | | if (type == null || keyEnum == null) {
|
| | | return; |
| | | }
|
| | | |
| | | // 默认文本编辑
|
| | | if (configCategory.getEditMode() == 0) {
|
| | | configCategory.setEditMode(1);
|
| | | }
|
| | | |
| | | configCategory.setId(StringUtil.Md5(type.name() +"#space#" + keyEnum.name()));
|
| | | configCategoryDao.save(configCategory);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<ConfigCategory> listByType(ConfigCategoryEnum type) {
|
| | | return configCategoryDao.listByType(type);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public ConfigCategoryEnum getCategoryEnum(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | | |
| | | ConfigCategoryEnum[] array = ConfigCategoryEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private ConfigMapper configMapper;
|
| | | |
| | |
|
| | | @Cacheable(value = "config")
|
| | | public List<Config> getAllList() {
|
| | |
| | | @Transactional
|
| | | public void update(List<Config> list) {
|
| | | for (Config config : list) {
|
| | | if (config.getValue() == null) {
|
| | | config.setValue("");
|
| | | }
|
| | | config.setCreatetime(new Date().getTime() + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | |
| | |
|
| | | @CacheEvict(value = "config", allEntries = true)
|
| | | public void update(Config config) {
|
| | | if (config.getValue() == null)
|
| | | config.setValue("");
|
| | | |
| | | config.setCreatetime(new Date().getTime() + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | |
| | | config.setCreatetime(currentTime + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Config getConfigBykeyNoCache(String key) {
|
| | | List<Config> list = configMapper.listByKey(key, null, null);
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | return list.get(0);
|
| | | }
|
| | | }
|
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> getUidByValidOrderByDay(String preDay) { |
| | | return commonOrderCountMapper.getUidByValidOrderByDay(preDay); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer countDownOrderUserByUidAndDate(Date preDay, List<Long> list) { |
| | | return commonOrderCountMapper.countDownOrderUserByUidAndDate(preDay, list); |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> getDownOrderUserByListUidAndDate(Date preDay, List<Long> list) { |
| | | return commonOrderCountMapper.getDownOrderUserByListUidAndDate(preDay, list); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CountOrderDTO> countCommissionByDay(String preDay) { |
| | |
| | | return result_list; |
| | | } |
| | | |
| | | @Override |
| | | public Long countOrderBySourceTypeAndDay(int source, String preDay) { |
| | | return commonOrderCountMapper.countOrderBySourceTypeAndDay(preDay, source); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.count.DailyCountCouponDao;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon.DailyCountCouponEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.count.DailyCountCouponService;
|
| | | import com.yeshi.fanli.service.inter.count.UserSystemCouponCountService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class DailyCountCouponServiceImpl implements DailyCountCouponService {
|
| | |
|
| | | @Resource
|
| | | private DailyCountCouponDao dailyCountCouponDao;
|
| | | |
| | | @Resource
|
| | | private UserSystemCouponCountService userSystemCouponCountService;
|
| | |
|
| | | @Override
|
| | | public List<DailyCountCoupon> getDailyCountList(String type, Date startTime, Date endTime) throws Exception {
|
| | | // 查询类型
|
| | | DailyCountCouponEnum typeEnum = getTypeEnum(type);
|
| | | if (typeEnum == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | // 初始化数据
|
| | | initData(typeEnum);
|
| | |
|
| | | return dailyCountCouponDao.query(typeEnum, startTime, endTime);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | private DailyCountCouponEnum getTypeEnum(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | | |
| | | DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取枚举类型
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public String getTypeEnumDesc(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return "";
|
| | | }
|
| | | |
| | | DailyCountCouponEnum[] array = DailyCountCouponEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i].getDesc();
|
| | | }
|
| | | }
|
| | |
|
| | | return "";
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 初始数据
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void initData(DailyCountCouponEnum typeEnum) throws Exception {
|
| | | Date lastDate = null;
|
| | | DailyCountCoupon lastRecord = dailyCountCouponDao.getMaxDate(typeEnum);
|
| | | if (lastRecord != null) {
|
| | | lastDate = lastRecord.getUpdateDate();
|
| | | } else {
|
| | | lastDate = TimeUtil.parse("2019-03-04");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDate, today);
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | // 计算日期
|
| | | String preDay = DateUtil.plusDay(i, lastDate);
|
| | | // 统计数据
|
| | | BigDecimal total = getCountByType(preDay, typeEnum);
|
| | |
|
| | | // 保存信息
|
| | | DailyCountCoupon obj = new DailyCountCoupon();
|
| | | obj.setTotal(total);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountCouponDao.save(obj);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 数据统计
|
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @return
|
| | | */
|
| | | private BigDecimal getCountByType(String preDay, DailyCountCouponEnum typeEnum) {
|
| | | BigDecimal total = null;
|
| | | if (DailyCountCouponEnum.freeCouponNum == typeEnum) {
|
| | | total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCoupon, preDay);
|
| | | } else if (DailyCountCouponEnum.freeCouponMoney == typeEnum) {
|
| | | total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCoupon, preDay);
|
| | | } else if (DailyCountCouponEnum.freeCouponBuyNum == typeEnum) {
|
| | | total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponBuy, preDay);
|
| | | } else if (DailyCountCouponEnum.freeCouponBuyMoney == typeEnum) {
|
| | | total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.freeCouponBuy, preDay);
|
| | | } else if (DailyCountCouponEnum.welfareFreeCouponNum == typeEnum) {
|
| | | total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.welfareFreeCoupon, preDay);
|
| | | } else if (DailyCountCouponEnum.welfareFreeCouponMoney == typeEnum) {
|
| | | total = userSystemCouponCountService.countFreeMoneyByTypeAndDay(CouponTypeEnum.welfareFreeCoupon, preDay);
|
| | | } else if (DailyCountCouponEnum.freeCouponGiveNum == typeEnum) {
|
| | | total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.freeCouponGive, preDay);
|
| | | } else if (DailyCountCouponEnum.rebateCouponNum == typeEnum) {
|
| | | total = userSystemCouponCountService.countCouponNumByDay(CouponTypeEnum.rebatePercentCoupon, preDay);
|
| | | } else if (DailyCountCouponEnum.rebateCouponMoney == typeEnum) {
|
| | | total = userSystemCouponCountService.countRebateMoneyByDay(preDay);
|
| | | }
|
| | |
|
| | | if (total == null) {
|
| | | total = new BigDecimal(0);
|
| | | }
|
| | | return total;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.count.DailyCountMomentsDao;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments.DailyCountMomentsEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.count.DailyCountMomentsService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class DailyCountMomentsServiceImpl implements DailyCountMomentsService {
|
| | |
|
| | | @Resource
|
| | | private DailyCountMomentsDao dailyCountMomentsDao;
|
| | |
|
| | | @Override
|
| | | public List<DailyCountMoments> getDailyCountList(String type, Date startTime, Date endTime) throws Exception {
|
| | | // 查询类型
|
| | | DailyCountMomentsEnum typeEnum = getTypeEnum(type);
|
| | | if (typeEnum == null) {
|
| | | return null;
|
| | | }
|
| | | return dailyCountMomentsDao.query(typeEnum, startTime, endTime);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | private DailyCountMomentsEnum getTypeEnum(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | DailyCountMomentsEnum[] array = DailyCountMomentsEnum.values();
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public String getTypeEnumDesc(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return "";
|
| | | }
|
| | |
|
| | | DailyCountMomentsEnum[] array = DailyCountMomentsEnum.values();
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i].getDesc();
|
| | | }
|
| | | }
|
| | | return "";
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | |
| | | /**
|
| | | * 添加分享次数统计
|
| | | */
|
| | | @Override
|
| | | public void addShareClick() {
|
| | | try {
|
| | | BigDecimal num = new BigDecimal(1);
|
| | | // 当日日期
|
| | | String toDay = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | |
|
| | | String id = StringUtil.Md5(toDay + DailyCountMomentsEnum.shareClick.name());
|
| | |
|
| | | DailyCountMoments moments = dailyCountMomentsDao.get(id);
|
| | | if (moments != null) {
|
| | | moments.setTotal(MoneyBigDecimalUtil.add(moments.getTotal(), num));
|
| | | moments.setUpdateDate(new Date());
|
| | | dailyCountMomentsDao.save(moments);
|
| | | } else {
|
| | | moments = new DailyCountMoments();
|
| | | moments.setId(id);
|
| | | moments.setTotal(num);
|
| | | moments.setType(DailyCountMomentsEnum.shareClick);
|
| | | moments.setUpdateDate(new Date());
|
| | | moments.setDay(TimeUtil.parse(toDay));
|
| | | dailyCountMomentsDao.save(moments);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 添加复制评论统计
|
| | | */
|
| | | @Override
|
| | | public void addCopyComment() {
|
| | | try {
|
| | | BigDecimal num = new BigDecimal(1);
|
| | | // 当日日期
|
| | | String toDay = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | |
|
| | | String id = StringUtil.Md5(toDay + DailyCountMomentsEnum.copyComment.name());
|
| | |
|
| | | DailyCountMoments moments = dailyCountMomentsDao.get(id);
|
| | | if (moments != null) {
|
| | | moments.setTotal(MoneyBigDecimalUtil.add(moments.getTotal(), num));
|
| | | moments.setUpdateDate(new Date());
|
| | | dailyCountMomentsDao.save(moments);
|
| | | } else {
|
| | | moments = new DailyCountMoments();
|
| | | moments.setId(id);
|
| | | moments.setTotal(num);
|
| | | moments.setType(DailyCountMomentsEnum.copyComment);
|
| | | moments.setUpdateDate(new Date());
|
| | | moments.setDay(TimeUtil.parse(toDay));
|
| | | dailyCountMomentsDao.save(moments);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.count.DailyCountOrderDao;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder.DailyCountOrderEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | | import com.yeshi.fanli.service.inter.count.DailyCountOrderService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.UserOrderWeiQuanRecordService;
|
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class DailyCountOrderServiceImpl implements DailyCountOrderService {
|
| | |
|
| | | @Resource
|
| | | private DailyCountOrderDao dailyCountOrderDao;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | |
|
| | | @Resource
|
| | | private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private JDOrderService jdOrderService;
|
| | |
|
| | | @Resource
|
| | | private PDDOrderService pddOrderService;
|
| | |
|
| | | @Resource
|
| | | private LostOrderService lostOrderService;
|
| | |
|
| | | @Override
|
| | | public List<DailyCountOrder> getDailyCountList(String type, Date startTime, Date endTime, String channel)
|
| | | throws Exception {
|
| | | // 查询类型
|
| | | DailyCountOrderEnum typeEnum = getTypeEnum(type);
|
| | | if (typeEnum == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | // 初始化数据
|
| | | initData(typeEnum);
|
| | |
|
| | | return dailyCountOrderDao.query(typeEnum, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | private DailyCountOrderEnum getTypeEnum(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | DailyCountOrderEnum[] array = DailyCountOrderEnum.values();
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public String getTypeEnumDesc(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return "";
|
| | | }
|
| | |
|
| | | DailyCountOrderEnum[] array = DailyCountOrderEnum.values();
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i].getDesc();
|
| | | }
|
| | | }
|
| | |
|
| | | return "";
|
| | | }
|
| | |
|
| | | /**
|
| | | * 初始数据
|
| | | * |
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void initData(DailyCountOrderEnum typeEnum) throws Exception {
|
| | | Date lastDate = null;
|
| | | DailyCountOrder lastRecord = dailyCountOrderDao.getMaxDate(typeEnum);
|
| | | if (lastRecord != null) {
|
| | | lastDate = lastRecord.getUpdateDate();
|
| | | } else {
|
| | | lastDate = TimeUtil.parse("2018-01-20");
|
| | | }
|
| | |
|
| | | long min = DateUtil.dateDiffMin(lastDate, new Date());
|
| | | if (min <= 10) { // 10分钟以内不统计
|
| | | return;
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDate, today);
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | // 计算日期
|
| | | String preDay = DateUtil.plusDay(i, lastDate);
|
| | | // 统计数据
|
| | | if (DailyCountOrderEnum.fanliOrderNum == typeEnum) {
|
| | | addOrderNumCount(preDay, typeEnum, 1);
|
| | | } else if (DailyCountOrderEnum.shareOrderNum == typeEnum) {
|
| | | addOrderNumCount(preDay, typeEnum, 2);
|
| | | } else if (DailyCountOrderEnum.inviteOrderNum == typeEnum) {
|
| | | addOrderNumCount(preDay, typeEnum, 3);
|
| | | } else if (DailyCountOrderEnum.channelOrderNum24H == typeEnum) {
|
| | | addChannelOrderNum24H(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.channelOrderNum == typeEnum) {
|
| | | addChannelOrderNum(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.channelOrderMoney == typeEnum) {
|
| | | addChannelOrderMoney(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.weiQuanOrderNum == typeEnum) {
|
| | | addWeiQuanOrderNum(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.weiQuanOrderMoney == typeEnum) {
|
| | | addWeiQuanOrderMoney(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.tbOrderTrackRate == typeEnum) {
|
| | | addTBOrderTrackRate(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.jdOrderTrackRate == typeEnum) {
|
| | | addJDOrderTrackRate(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.pddOrderTrackRate == typeEnum) {
|
| | | addPDDOrderTrackRate(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.lastOrderUntreatedNum == typeEnum) {
|
| | | addLastOrderUntreatedNum(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.lastOrderSucceedNum == typeEnum) {
|
| | | addLastOrderSucceedNum(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.lastOrderFailNum == typeEnum) {
|
| | | addLastOrderFailNum(preDay, typeEnum);
|
| | | } else if (DailyCountOrderEnum.lastOrderSucceedMoney == typeEnum) {
|
| | | addLastOrderSucceedMoney(preDay, typeEnum);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计订单数量
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @param orderType
|
| | | * @throws Exception
|
| | | */
|
| | | private void addOrderNumCount(String preDay, DailyCountOrderEnum typeEnum, int orderType) throws Exception {
|
| | | Long count = hongBaoV2CountService.countOrderByTypeAndDate(orderType, preDay);
|
| | | if (count == null)
|
| | | count = 0L;
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计各个渠道订单数据
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addChannelOrderNum(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | List<UserInfoRegister> listRegister = null;
|
| | | // 统计当日订单
|
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countValidOrderByDay(preDay);
|
| | |
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO : listOrder) {
|
| | | listUid.add(countOrderDTO.getUid());
|
| | | }
|
| | | listRegister = userInfoRegisterService.listByMultipleUids(listUid);
|
| | | }
|
| | |
|
| | | // 统计各个渠道
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | long count = 0;
|
| | | String channelVlaue = channels[i].getVlaue();
|
| | | if (listOrder != null && listOrder.size() > 0 && listRegister != null && listRegister.size() > 0) {
|
| | | for (CountOrderDTO dto : listOrder) {
|
| | | Long orderUid = dto.getUid();
|
| | | if (orderUid == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | for (UserInfoRegister register : listRegister) {
|
| | | Long uid = register.getId();
|
| | | String vlaue = register.getChannel();
|
| | | // 渠道 、用户id匹配
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == orderUid.longValue()) {
|
| | | count++;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计新人24H内下单数量
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addChannelOrderNum24H(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | int count = 0;
|
| | |
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (list != null && list.size() > 0) {
|
| | | for (UserInfoRegister user : list) {
|
| | | Date limitDay = DateUtil.plusDayDate(1, user.getCreateTime());
|
| | | Integer total = commonOrderCountService.countOderByUidAndDate(limitDay, user.getId());
|
| | | if (total != null)
|
| | | count += total;
|
| | | }
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计渠道金额
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addChannelOrderMoney(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | List<UserInfoRegister> listRegister = null;
|
| | | // 查询订单佣金
|
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countCommissionByDay(preDay);
|
| | |
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO : listOrder) {
|
| | | listUid.add(countOrderDTO.getUid());
|
| | | }
|
| | | listRegister = userInfoRegisterService.listByMultipleUids(listUid);
|
| | | }
|
| | |
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | String channelVlaue = channels[i].getVlaue();
|
| | |
|
| | | if (listOrder != null && listOrder.size() > 0 && listRegister != null && listRegister.size() > 0) {
|
| | | for (CountOrderDTO dto : listOrder) {
|
| | | Long orderUid = dto.getUid();
|
| | | BigDecimal commission = dto.getCommission();
|
| | | if (commission == null || orderUid == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | for (UserInfoRegister register : listRegister) {
|
| | | Long uid = register.getId();
|
| | | String vlaue = register.getChannel();
|
| | | // 渠道 、用户id匹配
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == orderUid.longValue()) {
|
| | | money = MoneyBigDecimalUtil.add(money, commission);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(money);
|
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计维权订单数量
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addWeiQuanOrderNum(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | Integer count = userOrderWeiQuanRecordService.countWeiQaunOrderNumberByDate(preDay);
|
| | | if (count == null)
|
| | | count = 0;
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询维权金额
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addWeiQuanOrderMoney(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | BigDecimal money = userOrderWeiQuanRecordService.countWeiQaunOrderMoneyByDate(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(money);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 淘宝订单跟踪率
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addTBOrderTrackRate(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | // 统计跟踪到数据
|
| | | Long count = commonOrderCountService.countOrderBySourceTypeAndDay(Constant.SOURCE_TYPE_TAOBAO, preDay);
|
| | |
|
| | | Long total = taoBaoOrderService.countOrderByDay(preDay);
|
| | |
|
| | | // 计算比例
|
| | | BigDecimal rate = new BigDecimal(0);
|
| | | if (total != null && total > 0 && count != null && count > 0) {
|
| | | rate = MoneyBigDecimalUtil.div(BigDecimal.valueOf(count), BigDecimal.valueOf(total));
|
| | | rate = MoneyBigDecimalUtil.mul(rate, BigDecimal.valueOf(100));
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setRate(true);
|
| | | obj.setTotalDay(BigDecimal.valueOf(total));
|
| | | obj.setTotalValid(BigDecimal.valueOf(count));
|
| | | obj.setTotal(rate);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 京东订单跟踪率
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addJDOrderTrackRate(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | // 统计跟踪到数据
|
| | | Long count = commonOrderCountService.countOrderBySourceTypeAndDay(Constant.SOURCE_TYPE_JD, preDay);
|
| | |
|
| | | Long total = jdOrderService.countOrderByDay(preDay);
|
| | |
|
| | | // 计算比例
|
| | | BigDecimal rate = new BigDecimal(0);
|
| | | if (total != null && total > 0 && count != null && count > 0) {
|
| | | rate = MoneyBigDecimalUtil.div(BigDecimal.valueOf(count), BigDecimal.valueOf(total));
|
| | | rate = MoneyBigDecimalUtil.mul(rate, BigDecimal.valueOf(100));
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setRate(true);
|
| | | obj.setTotalDay(BigDecimal.valueOf(total));
|
| | | obj.setTotalValid(BigDecimal.valueOf(count));
|
| | | obj.setTotal(rate);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 拼多多订单跟踪率
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addPDDOrderTrackRate(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | // 统计跟踪到数据
|
| | | Long count = commonOrderCountService.countOrderBySourceTypeAndDay(Constant.SOURCE_TYPE_PDD, preDay);
|
| | |
|
| | | Long total = pddOrderService.countOrderByDay(preDay);
|
| | | // 计算比例
|
| | | BigDecimal rate = new BigDecimal(0);
|
| | | if (total != null && total > 0 && count != null && count > 0) {
|
| | | rate = MoneyBigDecimalUtil.div(BigDecimal.valueOf(count), BigDecimal.valueOf(total));
|
| | | rate = MoneyBigDecimalUtil.mul(rate, BigDecimal.valueOf(100));
|
| | | }
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setRate(true);
|
| | | obj.setTotalDay(BigDecimal.valueOf(total));
|
| | | obj.setTotalValid(BigDecimal.valueOf(count));
|
| | | obj.setTotal(rate);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计申诉订单未处理数量
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addLastOrderUntreatedNum(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | Integer num = lostOrderService.countLostOrderNum(preDay, LostOrder.RESULT_CODE_VERFING);
|
| | | if (num == null)
|
| | | num = 0;
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(num));
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计申诉订单 处理失败
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addLastOrderFailNum(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | Integer num = lostOrderService.countLostOrderNum(preDay, LostOrder.RESULT_CODE_FAIL);
|
| | | if (num == null)
|
| | | num = 0;
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(num));
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计申诉订单 处理成功
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addLastOrderSucceedNum(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | Integer num = lostOrderService.countLostOrderNum(preDay, LostOrder.RESULT_CODE_SUCCESS);
|
| | | if (num == null)
|
| | | num = 0;
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(num));
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单找回成功统计金额
|
| | | * |
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addLastOrderSucceedMoney(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | BigDecimal money = lostOrderService.countAppealMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal("0");
|
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(money);
|
| | | obj.setType(typeEnum);
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.count.DailyCountUserDao;
|
| | | import com.yeshi.fanli.dto.order.CountOrderDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser;
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser.DailyCountUserEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | | import com.yeshi.fanli.service.inter.count.DailyCountUserService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class DailyCountUserServiceImpl implements DailyCountUserService {
|
| | |
|
| | | @Resource
|
| | | private DailyCountUserDao dailyCountUserDao;
|
| | | |
| | | @Resource
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | | |
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | | |
| | | @Resource
|
| | | private RedPackDetailService redPackDetailService;
|
| | | |
| | | @Resource
|
| | | private UserTaoLiJinDetailService userTaoLiJinDetailService;
|
| | | |
| | | @Resource
|
| | | private ExtractAuditRecordService extractAuditRecordService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<DailyCountUser> getDailyCountList(String type, Date startTime, Date endTime, String channel) throws Exception {
|
| | | // 查询类型
|
| | | DailyCountUserEnum typeEnum = getTypeEnum(type);
|
| | | if (typeEnum == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | // 初始化数据
|
| | | initData(typeEnum);
|
| | |
|
| | | return dailyCountUserDao.query(typeEnum, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | private DailyCountUserEnum getTypeEnum(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | | |
| | | DailyCountUserEnum[] array = DailyCountUserEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取枚举类型
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public String getTypeEnumDesc(String name) {
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return "";
|
| | | }
|
| | | |
| | | DailyCountUserEnum[] array = DailyCountUserEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i].getDesc();
|
| | | }
|
| | | }
|
| | |
|
| | | return "";
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 初始数据
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void initData(DailyCountUserEnum typeEnum) throws Exception {
|
| | | Date lastDate = null;
|
| | | DailyCountUser lastRecord = dailyCountUserDao.getMaxDate(typeEnum);
|
| | | if (lastRecord != null) {
|
| | | lastDate = lastRecord.getUpdateDate();
|
| | | } else {
|
| | | lastDate = TimeUtil.parse("2017-05-06");
|
| | | }
|
| | | long min = DateUtil.dateDiffMin(lastDate, new Date());
|
| | | if (min <= 10) { // 10分钟以内不统计
|
| | | return;
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDate, today);
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | // 计算日期
|
| | | String preDay = DateUtil.plusDay(i, lastDate);
|
| | | // 统计数据
|
| | | if (DailyCountUserEnum.newUserChannel == typeEnum) {
|
| | | addNewUserChannel(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.newUserDownOrderDay == typeEnum) {
|
| | | addNewUserDownOrderDay(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.newUserDownOrderWeek == typeEnum) {
|
| | | addNewUserDownOrderWeek(preDay);
|
| | | } else if (DailyCountUserEnum.newUserDownOrderWeek3 == typeEnum) {
|
| | | addNewUserDownOrderWeek(preDay);
|
| | | } else if (DailyCountUserEnum.activeAgain90 == typeEnum) {
|
| | | addActiveAgain90(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.integralNum == typeEnum) {
|
| | | addIntegralNum(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.newUserTljNum == typeEnum) {
|
| | | addNewUserTljNum(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.newUserTljMoney == typeEnum) {
|
| | | addNewUserTljMoney(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.redpackNum == typeEnum) {
|
| | | addRedpackNum(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.redpackMoney == typeEnum) {
|
| | | addRedpackMoney(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.extractApplyNumber == typeEnum) {
|
| | | addExtractApplyNumber(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.extractApplyMoney == typeEnum) {
|
| | | addExtractApplyMoney(preDay, typeEnum);
|
| | | } else if (DailyCountUserEnum.extractAuditPass == typeEnum) {
|
| | | addExtractAuditNum(preDay, Extract.STATE_PASS, typeEnum);
|
| | | } else if (DailyCountUserEnum.extractAuditReject == typeEnum) {
|
| | | addExtractAuditNum(preDay, Extract.STATE_REJECT, typeEnum);
|
| | | } |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 统计各个渠道新增用户数量
|
| | | * @param preDay
|
| | | */
|
| | | private void addNewUserChannel(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | Long count = userInfoRegisterService.countByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | DailyCountUser obj = new DailyCountUser();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 统计各个渠道每日下单转化率
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addNewUserDownOrderDay(String preDay, DailyCountUserEnum typeEnum) throws Exception {
|
| | | // 统计当日有效订单
|
| | | List<Long> listOrder = commonOrderCountService.getUidByValidOrderByDay(preDay);
|
| | | |
| | | // 查询当日新注册用户
|
| | | List<UserInfoRegister> listRegister = userInfoRegisterService.listByDay(preDay);
|
| | | |
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | long totalDay = 0;
|
| | | long totalValid = 0;
|
| | | String channelName = channels[i].getVlaue();
|
| | | |
| | | if (listOrder != null && listOrder.size() > 0 && listRegister != null && listRegister.size() > 0) {
|
| | | for (UserInfoRegister register: listRegister) {
|
| | | String channel = register.getChannel();
|
| | | if (channelName.equalsIgnoreCase(channel)) {
|
| | | totalDay ++ ;
|
| | | }
|
| | | |
| | | Long id = register.getId();
|
| | | // 判断当前用户是否今日下单
|
| | | for (Long uid: listOrder) {
|
| | | if (uid.longValue() == id.longValue()) {
|
| | | totalValid ++;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | // 计算比例: 下单用户数/新增用户数
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | if (totalDay > 0 && totalValid > 0) {
|
| | | total = MoneyBigDecimalUtil.div(BigDecimal.valueOf(totalValid),BigDecimal.valueOf(totalDay));
|
| | | total = MoneyBigDecimalUtil.mul(total, BigDecimal.valueOf(100));
|
| | | } |
| | | |
| | | DailyCountUser obj = new DailyCountUser();
|
| | | obj.setTotal(total);
|
| | | obj.setRate(true);
|
| | | obj.setTotalDay(BigDecimal.valueOf(totalDay));
|
| | | obj.setTotalValid(BigDecimal.valueOf(totalValid));
|
| | | |
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计当周下单数据
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addNewUserDownOrderWeek(String preDay) throws Exception {
|
| | | // 加上6天 -注册一周内数据
|
| | | Date startDay = new Date(TimeUtil.convertDateToTemp2(preDay + " 23:59:59"));
|
| | | Date limitDay = DateUtil.plusDayDate(6, startDay);
|
| | | |
| | | // 渠道数据
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | long totalUser = 0;
|
| | | long totalWeek = 0;
|
| | | long totalWeek3 = 0;
|
| | | |
| | | List<Long> listUid = new ArrayList<Long>();
|
| | | |
| | | // 查询今日新增用户
|
| | | List<UserInfoRegister> list = userInfoRegisterService.listByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | |
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | System.out.println("***********************" +list.size()); |
| | | totalUser = list.size();
|
| | | for (UserInfoRegister user : list) {
|
| | | listUid.add(user.getId());
|
| | | }
|
| | | }
|
| | | |
| | | if (listUid.size() > 0) {
|
| | | List<Long> listUidDown = commonOrderCountService.getDownOrderUserByListUidAndDate(limitDay, listUid);
|
| | | if (listUidDown != null && listUidDown.size() > 0) {
|
| | | System.out.println("***********************" +listUidDown.size()); |
| | | for (Long uid: listUid) {
|
| | | int total = 0;
|
| | | for (Long id: listUidDown) {
|
| | | if (uid.longValue() == id.longValue()) {
|
| | | total ++;
|
| | | }
|
| | | }
|
| | | |
| | | if (total > 0) {
|
| | | System.out.println("-----------------------------------------------------");
|
| | | totalWeek ++;
|
| | | System.out.println(totalWeek);
|
| | | System.out.println("-----------------------------------------------------");
|
| | | }
|
| | | |
| | | if (total >= 3) {
|
| | | System.out.println("-----------------------------------------------------");
|
| | | totalWeek3 ++;
|
| | | System.out.println(totalWeek3);
|
| | | System.out.println("-----------------------------------------------------");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 计算比例:当周 下单用户数/新增用户数
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | if (totalUser > 0 && totalWeek > 0) {
|
| | | total = MoneyBigDecimalUtil.div(BigDecimal.valueOf(totalWeek),BigDecimal.valueOf(totalUser));
|
| | | total = MoneyBigDecimalUtil.mul(total, BigDecimal.valueOf(100));
|
| | | } |
| | | DailyCountUser obj = new DailyCountUser();
|
| | | obj.setRate(true);
|
| | | obj.setTotalDay(BigDecimal.valueOf(totalUser));
|
| | | obj.setTotalValid(BigDecimal.valueOf(totalWeek));
|
| | | obj.setTotal(total);
|
| | | obj.setType(DailyCountUserEnum.newUserDownOrderWeek);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | | obj.setDay(TimeUtil.parse(preDay));
|
| | | obj.setId(StringUtil.Md5(preDay + channels[i].name() + DailyCountUserEnum.newUserDownOrderWeek.name()));
|
| | | dailyCountUserDao.save(obj);
|
| | | |
| | | |
| | | // 计算比例: 下3单用户数/新增用户数
|
| | | BigDecimal total3 = new BigDecimal(0);
|
| | | if (totalUser > 0 && totalWeek3 > 0) {
|
| | | total3 = MoneyBigDecimalUtil.div(BigDecimal.valueOf(totalWeek3),BigDecimal.valueOf(totalUser));
|
| | | total3 = MoneyBigDecimalUtil.mul(total3, BigDecimal.valueOf(100));
|
| | | } |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setRate(true);
|
| | | obj3.setTotalDay(BigDecimal.valueOf(totalUser));
|
| | | obj3.setTotalValid(BigDecimal.valueOf(totalWeek3));
|
| | | obj3.setTotal(total3);
|
| | | obj3.setType(DailyCountUserEnum.newUserDownOrderWeek3);
|
| | | obj3.setChannel(channels[i].name());
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + channels[i].name() + DailyCountUserEnum.newUserDownOrderWeek3.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 统计90天内再次活跃
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addActiveAgain90(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | long count = userActiveLogService.count90DaysLaterActiveNum(preDay);
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(BigDecimal.valueOf(count));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 金币新增数量
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addIntegralNum(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | Long count = integralDetailService.countNewAddByDate(preDay);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(BigDecimal.valueOf(count));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | /**
|
| | | * 红包新增数量
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addRedpackNum(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | Long total = redPackDetailService.countNumByDay(preDay);
|
| | | if (total == null) {
|
| | | total = 0L;
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(new BigDecimal(total));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 红包新增金额
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addRedpackMoney(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | BigDecimal total = redPackDetailService.countMoneyByDay(preDay);
|
| | | if (total == null) {
|
| | | total = new BigDecimal(0);
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(total);
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 红包新增数量
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addNewUserTljNum(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | Long total = userTaoLiJinDetailService.countNumByDay(preDay);
|
| | | if (total == null) {
|
| | | total = 0L;
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(new BigDecimal(total));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 红包新增金额
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addNewUserTljMoney(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | BigDecimal total = userTaoLiJinDetailService.countMoneyByDay(preDay);
|
| | | if (total == null) {
|
| | | total = new BigDecimal(0);
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(total);
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 提现申请数量
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addExtractApplyNumber(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | Long total = extractAuditRecordService.countApplyNumberByDay(preDay);
|
| | | if (total == null) {
|
| | | total = 0L;
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(new BigDecimal(total));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 提现申请金额
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addExtractApplyMoney(String preDay, DailyCountUserEnum typeEnum) throws Exception{
|
| | | BigDecimal total = extractAuditRecordService.countApplyMoneyByDay(preDay);
|
| | | if (total == null) {
|
| | | total = new BigDecimal(0);
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(total);
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | /**
|
| | | * 提现审核数量
|
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | | private void addExtractAuditNum(String preDay, int state, DailyCountUserEnum typeEnum) throws Exception{
|
| | | Long total = extractAuditRecordService.countAuditNumberByDay(state, preDay);
|
| | | if (total == null) {
|
| | | total = 0L;
|
| | | }
|
| | | |
| | | DailyCountUser obj3 = new DailyCountUser();
|
| | | obj3.setTotal(new BigDecimal(total));
|
| | | obj3.setType(typeEnum);
|
| | | obj3.setUpdateDate(new Date());
|
| | | obj3.setDay(TimeUtil.parse(preDay));
|
| | | obj3.setId(StringUtil.Md5(preDay + state + typeEnum.name()));
|
| | | dailyCountUserDao.save(obj3);
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public Integer countOrderByTypeAndDate(Integer orderType, String preDay) {
|
| | | public Long countOrderByTypeAndDate(Integer orderType, String preDay) {
|
| | | return hongBaoV2CountMapper.countOrderByTypeAndDate(orderType, preDay);
|
| | | }
|
| | |
|
| | |
| | | return count;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countOrderByUidAndSettled(Long uid, Long time, BigDecimal payment) {
|
| | | Long count = hongBaoV2CountMapper.countOrderByUidAndSettled(uid, time, payment);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long counOrderByUidAndOrderType(Long uid, BigDecimal payment,int type) {
|
| | |
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | |
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public long countNewUser(Integer isToday, Integer isMonth) {
|
| | | return userInfoMapper.countNewUser(isToday, isMonth);
|
| | |
| | | @Override
|
| | | public List<CountUserInfo> getNewUserData(Date startTime, Date endTime, String channel) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initChannelUserCount();
|
| | |
|
| | | return countUserInfoDao.query(CountUserEnum.newUser, startTime, endTime, channel);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public void initChannelUserCount() {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.newUser);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | try {
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-05-14");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | // 统计今日之前的
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordCount(String preDay) throws Exception {
|
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | Integer count = userInfoRegisterService.countByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (count == null) {
|
| | | count = 0;
|
| | | }
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setChannel(channels[i].name());
|
| | | record.setId(StringUtil.Md5(preDay + channels[i].name() + CountUserEnum.newUser.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.newUser);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | String vlaue = listRegister.get(m).getChannel();
|
| | |
|
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | |
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | String vlaue = listRegister.get(m).getChannel();
|
| | |
|
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | |
| | |
|
| | | @Override
|
| | | public List<CountOrderInfo> counOrderLastNum(Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderLastNum();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.lastNum, startTime, endTime);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderLastNum() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.lastNum);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2019-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderLastNum(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderLastNum(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderLastNum(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderLastNum(String preDay) throws Exception {
|
| | | Integer num = lostOrderService.countLostOrderNum(preDay);
|
| | | if (num == null)
|
| | | num = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(num);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.lastNum.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.lastNum.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountOrderInfo> counOrderLastMoney(Date startTime, Date endTime) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<CountOrderInfo> countOrderType(Integer state, Date startTime, Date endTime) {
|
| | | // 重新查询统计今日以及空缺
|
| | | initOrderTypeCount();
|
| | |
|
| | | return countOrderInfoDao.query(CountOrderEnum.orderType, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | private void initOrderTypeCount() {
|
| | | try {
|
| | | CountOrderInfo lastRecord = countOrderInfoDao.getMaxDate(CountOrderEnum.orderType);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | |
|
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2018-01-01");
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++) {
|
| | | addRecordOrderTypeCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | } else {
|
| | | // 重新统计昨日
|
| | | addRecordOrderTypeCount(DateUtil.reduceDay2(1, lastDay));
|
| | | // 重新统计今日
|
| | | addRecordOrderTypeCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | private void addRecordOrderTypeCount(String preDay) throws Exception {
|
| | | for (int i = 1; i < 4; i++) {
|
| | | Integer count = hongBaoV2CountService.countOrderByTypeAndDate(i, preDay);
|
| | | if (count == null)
|
| | | count = 0;
|
| | | CountOrderInfo record = new CountOrderInfo();
|
| | | record.setNum(count);
|
| | | record.setState(i);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountOrderEnum.orderType.name());
|
| | | record.setId(StringUtil.Md5(preDay + CountOrderEnum.orderType.name()));
|
| | | countOrderInfoDao.save(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> countUserDownOrderByChannelAndToday(String channel, Date startTime, Date endTime) {
|
| | |
| | | for (int m = 0; m <listRegister.size(); m ++) {
|
| | | boolean reduce = false;
|
| | | Long uid = listRegister.get(m).getId();
|
| | | String vlaue = listRegister.get(m).getChannel().getVlaue();
|
| | | String vlaue = listRegister.get(m).getChannel();
|
| | |
|
| | | for (int n = 0; n <listOrder.size(); n ++) {
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == listOrder.get(n).getUid()) {
|
| | |
| | | return userSystemCouponCountMapper.getFreeCouponMoneyToCharts(dateType, year, startTime, endTime, couponType);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public BigDecimal countRebateMoneyByDay(String preDay){
|
| | | return userSystemCouponCountMapper.countRebateMoneyByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public BigDecimal countFreeMoneyByTypeAndDay(CouponTypeEnum typeEnum, String preDay){
|
| | | return userSystemCouponCountMapper.countFreeMoneyByTypeAndDay(typeEnum.name(), preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public BigDecimal countCouponNumByDay(CouponTypeEnum typeEnum, String preDay){
|
| | | return userSystemCouponCountMapper.countCouponNumByDay(typeEnum.name(), preDay);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | } |
| | | |
| | | String picUrl = goodsDetailVO.getPicUrl(); |
| | | |
| | | if (fileRequest != null) { |
| | | MultipartFile file = fileRequest.getFile("file" + i); |
| | | if (file != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 数据对比 删除图片 |
| | | if (oldGoodsList != null && oldGoodsList.size() > 0) { |
| | |
| | | totalImg++; |
| | | } |
| | | |
| | | |
| | | // 清理老图片 |
| | | if (listOld != null && listOld.size() > 0) { |
| | | for (int j = 0; j < listOld.size(); j++) { |
| | | boolean del = true; |
| | |
| | | e.printStackTrace(); |
| | | continue; |
| | | } |
| | | |
| | | // 按照发布显示时间段起始时间为准。 |
| | | goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); |
| | | |
| | | |
| | | // 按照发布显示时间段起始时间为准。 |
| | | goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); |
| | |
| | | return userMoneyDetailMapper.selectByTypeAndUidAndIdentifyCode(type, uid, sourceIdentifyId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<UserMoneyDetail> listQuery(int page, int pageSize, String key, Integer keyType) {
|
| | | return userMoneyDetailMapper.listQuery((page - 1) * pageSize, pageSize, key, keyType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery(String key, Integer keyType) {
|
| | | Long count = userMoneyDetailMapper.countQuery(key, keyType);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper;
|
| | | import com.yeshi.fanli.dao.user.count.CountUserInfoDao;
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.dto.money.ExtractOrderStatisticDTO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo.CountUserEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
|
| | |
| | | return extractAuditRecordMapper.getbyExtractId(extractId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> getAuditCount(Date startTime, Date endTime, Integer state) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initAuditCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractAuditNumber, startTime, endTime, state);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | @Override
|
| | | public void initAuditCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractAuditNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordAuditCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordAuditCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | private void addRecordAuditCount(String preDay) throws Exception{
|
| | | for (int i = 1; i < 3; i++) {
|
| | | int count = extractAuditRecordMapper.countAuditTotal(i, preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setState(i);
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractAuditNumber.name())+ "-" + i);
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractAuditNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | | } |
| | |
|
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> getApplyMoney(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyMoneyCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyMoney, startTime, endTime);
|
| | | public Long countAuditNumberByDay(int state, String preDay) {
|
| | | return extractAuditRecordMapper.countAuditTotal(state, preDay);
|
| | | }
|
| | |
|
| | | // 初始化统计
|
| | | |
| | | @Override
|
| | | public void initApplyMoneyCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyMoney);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordApplyMoneyCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordApplyMoneyCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | public BigDecimal countApplyMoneyByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | }
|
| | |
|
| | | private void addRecordApplyMoneyCount(String preDay) throws Exception{
|
| | | BigDecimal money = extractAuditRecordMapper.countApplyExtractMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setMoney(money);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyMoney.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyMoney);
|
| | | countUserInfoDao.save(record);
|
| | | } |
| | |
|
| | | @Override
|
| | | public List<CountUserInfo> geApplyNumber(Date startTime, Date endTime) throws Exception {
|
| | | // 重新查询统计今日以及空缺
|
| | | initApplyNumberCount();
|
| | | |
| | | return countUserInfoDao.query(CountUserEnum.extractApplyNumber, startTime, endTime);
|
| | | }
|
| | |
|
| | | |
| | | // 初始化统计
|
| | | @Override
|
| | | public void initApplyNumberCount() {
|
| | | try {
|
| | | CountUserInfo lastRecord = countUserInfoDao.getMaxDate(CountUserEnum.extractApplyNumber);
|
| | | Date lastDay = null;
|
| | | if (lastRecord != null && lastRecord.getDay() != null) {
|
| | | lastDay = lastRecord.getDay();
|
| | | }
|
| | | |
| | | if (lastDay == null) {
|
| | | lastDay = TimeUtil.parse("2017-07-19");
|
| | | }
|
| | | |
| | | Date today = new Date();
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 0; i <= betweenDays; i++ ) {
|
| | | addRecordCount(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addRecordCount(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | public Long countApplyNumberByDay(String preDay) {
|
| | | return extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | }
|
| | |
|
| | | private void addRecordCount(String preDay) throws Exception{
|
| | | int count = extractAuditRecordMapper.countApplyNumberByDay(preDay);
|
| | | CountUserInfo record = new CountUserInfo();
|
| | | record.setNum(count);
|
| | | record.setId(StringUtil.Md5(preDay + CountUserEnum.extractApplyNumber.name()));
|
| | | record.setDay(TimeUtil.parse(preDay));
|
| | | record.setType(CountUserEnum.extractApplyNumber);
|
| | | countUserInfoDao.save(record);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService; |
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserInviteService userInviteService; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | for (CommonOrderVO order : listOrder) { |
| | | |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc(levelName); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | BigDecimal totalPay = new BigDecimal(0); |
| | | BigDecimal totalActual = new BigDecimal(0); |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement); |
| | | |
| | | // 商品价格 |
| | | BigDecimal actualPrice = commonGoodsVO.getActualPrice(); |
| | | if (actualPrice != null) { |
| | | Integer totalCount = commonOrder.getTotalCount(); |
| | | totalActual = MoneyBigDecimalUtil.add(totalActual, |
| | | MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice)); |
| | | } |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime)); |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | |
| | | // 2.1分享订单和返利订单实付金额大于或者小于券后价的时候,订单页面 只显示3天 下单时间开始 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | | && DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime |
| | | && totalPay.compareTo(totalActual) != 0) { |
| | | order.setFanliDesc("由实付金额*返利比计算而来"); |
| | | order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey())); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | |
| | | return commonOrderMapper.countSearchOrderByUid(uid, list); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getMinSettleTimeAndUid() { |
| | | return commonOrderMapper.getMinSettleTimeAndUid(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) |
| | | throws Exception { |
| | |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) |
| | | needSelectVIPUidList.add(Long.parseLong(order.getUserId())); |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc(levelName); |
| | | } |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc("订单来源:" + levelName); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | } |
| | | |
| | |
| | | // 2019.8.1开始返回维权信息 |
| | | Date august = TimeUtil.parse("2019-08-01"); |
| | | |
| | | // 当前用户是否VIP |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 当前用户是否可以使用奖励券 |
| | | boolean isvip = userInviteService.verifyVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | BigDecimal totalPay = new BigDecimal(0); |
| | | BigDecimal totalActual = new BigDecimal(0); |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | |
| | | if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) { |
| | | CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO(); |
| | | PropertyUtils.copyProperties(commonGoodsVO, goods); |
| | | commonGoodsVO.setGoodsType(sourceType); |
| | | if (commonGoodsVO.getGoodsType() == null) { |
| | | commonGoodsVO.setGoodsType(sourceType); |
| | | } |
| | | |
| | | // 淘宝商品图片处理 |
| | | String picture = commonGoodsVO.getPicture(); |
| | |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement); |
| | | |
| | | // 商品价格 |
| | | BigDecimal actualPrice = commonGoodsVO.getActualPrice(); |
| | | if (actualPrice != null) { |
| | | Integer totalCount = commonOrder.getTotalCount(); |
| | | totalActual = MoneyBigDecimalUtil.add(totalActual, |
| | | MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice)); |
| | | } |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | |
| | | } |
| | | |
| | | // 订单类型为空时 已商品类为准 |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType == null) { |
| | | String shopType = commonGoodsVO.getShopType(); |
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(1); |
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(2); |
| | | } |
| | | String shopType = commonGoodsVO.getShopType(); |
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(1); |
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(2); |
| | | } |
| | | |
| | | Integer goodsType = commonGoodsVO.getGoodsType(); |
| | | if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) { |
| | | order.setOrderType(Constant.SOURCE_TYPE_ELME); // 饿了么订单 |
| | | } |
| | | |
| | | order.getListOrderGoods().add(commonGoodsVO); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 订单类型 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType == null) { |
| | | order.setOrderType(1); |
| | | } |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | order.setOrderType(3); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | if (thirdCreateTime != null) { |
| | |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | } |
| | | |
| | | // 2.1分享订单和返利订单实付金额大于或者小于券后价的时候,订单页面 只显示3天 下单时间开始 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType |
| | | && DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime |
| | | && totalPay.compareTo(totalActual) != 0) { |
| | | order.setFanliDesc("由实付金额*返利比计算而来"); |
| | | order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey())); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | | } |
| | | |
| | | // 订单类型 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType == null) |
| | | order.setOrderType(1); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | order.setOrderType(3); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | /* 订单状态 转换处理 */ |
| | | String orderStateContent = ""; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 2.1显示返利说明连接> |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (CommonOrder.STATE_SX != orderState && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | BigDecimal hongBao = order.getHongBao(); |
| | | if (hongBao == null) { |
| | | hongBao = new BigDecimal(0); |
| | |
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper |
| | | .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); |
| | | |
| | | boolean isPart = false;// 默认失效 |
| | | BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); |
| | | if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) { |
| | | orderStateContent = "售后成功"; |
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { |
| | | // 奖励订单、免单 使用记录 |
| | | if (sourceType == null) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, isvip); |
| | | } |
| | | } |
| | | |
| | |
| | | inviteOrderSubsidyMapper.updateByPrimaryKeySelective(orderSubsidy);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public BigDecimal sumRecievedMoneyByUid(long uid, Integer level) {
|
| | | return inviteOrderSubsidyMapper.sumRecievedMoneyByUid(uid, level);
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal sumValidMoneyByUidAndDate(long uid, Integer day, Integer level) {
|
| | | return inviteOrderSubsidyMapper.sumValidMoneyByUidAndDate(uid, day, level);
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Integer countLostOrderNum(String preDay) {
|
| | | return lostOrderMapper.countLostOrderNum(preDay);
|
| | | public Integer countLostOrderNum(String preDay, int resultCode) {
|
| | | return lostOrderMapper.countLostOrderNum(preDay, resultCode);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | public long countCanSettleUid(Date time) {
|
| | | return orderTeamRewardMapper.countCanSettleUid(time);
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal sumRecievedMoneyByUid(long uid, Integer level) {
|
| | | return orderTeamRewardMapper.sumRecievedMoneyByUid(uid, level);
|
| | | }
|
| | | |
| | | @Override
|
| | | public BigDecimal sumValidMoneyByUidAndDate(long uid, Integer day, Integer level) {
|
| | | return orderTeamRewardMapper.sumValidMoneyByUidAndDate(uid, day, level);
|
| | | }
|
| | | }
|
| | |
| | | return order;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countOrderByDay(String preDay) {
|
| | | return jdOrderItemMapper.countOrderByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<JDOrderItem> listQuery(long start, int count, String key) {
|
| | | return jdOrderItemMapper.listQuery(start, count, key);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countQuery(String key) {
|
| | | Long count = jdOrderItemMapper.countQuery(key);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | }
|
| | |
| | | return pddOrderMapper.listByStatus(status, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Long countOrderByDay(String preDay) {
|
| | | return pddOrderMapper.countOrderByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<PDDOrder> listQuery(long start, int count, String key) {
|
| | | return pddOrderMapper.listQuery(start, count, key);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countQuery(String key) {
|
| | | Long count = pddOrderMapper.countQuery(key);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | | return taoBaoOrderMapper.listByStateAndCreateTime(state, minCreateTime.getTime(), maxCreateTime.getTime());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countOrderByDay(String preDay) {
|
| | | return taoBaoOrderMapper.countOrderByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | | if (StringUtil.isNullOrEmpty(record.getKey()))
|
| | | throw new RedPackConfigException(1, "标识不能为空");
|
| | |
|
| | | String remark = record.getRemark();
|
| | | if ("null".equalsIgnoreCase(remark)) {
|
| | | record.setRemark("");
|
| | | }
|
| | | |
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setCreateTime(new Date());
|
| | |
| | | public long count(String key,Long uid, Integer type){
|
| | | return redPackDetailMapper.count(key, uid, type);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Long countNumByDay(String preDay) {
|
| | | return redPackDetailMapper.countNumByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public BigDecimal countMoneyByDay(String preDay) {
|
| | | return redPackDetailMapper.countMoneyByDay(preDay);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinDetailMapper;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | userTaoLiJinDetailMapper.insertSelective(detail);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Long countNumByDay(String preDay) {
|
| | | return userTaoLiJinDetailMapper.countNumByDay(preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countMoneyByDay(String preDay) {
|
| | | return userTaoLiJinDetailMapper.countMoneyByDay(preDay);
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.text.ParseException;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserActiveLogMapper;
|
| | | import com.yeshi.fanli.dao.user.UserActiveNumHistoryDao;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | |
|
| | | @Service
|
| | | public class UserActiveLogServiceImpl implements UserActiveLogService {
|
| | |
| | | private UserActiveLogMapper userActiveLogMapper;
|
| | |
|
| | | @Resource
|
| | | private UserActiveNumHistoryDao userActiveNumHistoryDao;
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | | |
| | |
|
| | | @Override
|
| | | public void addUserActiveLog(UserActiveLog userActiveLog) {
|
| | |
| | | return;
|
| | | if (userActiveLog.getUid() == null || userActiveLog.getUid() == 0)
|
| | | return;
|
| | | |
| | | UserActiveLog latestLog = getUserLatestActiveInfo(userActiveLog.getUid());
|
| | | if (latestLog == null) {
|
| | | try { // 保存注册信息
|
| | | UserInfoRegister register = new UserInfoRegister();
|
| | | register.setId(userActiveLog.getUid());
|
| | | register.setIp(userActiveLog.getIp());
|
| | | register.setChannel(userActiveLog.getChannel());
|
| | | register.setDevice(userActiveLog.getDevice());
|
| | | userInfoRegisterService.addRegisterInfo(register);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 间隔5分钟以上再记录
|
| | | if (latestLog == null || System.currentTimeMillis() - latestLog.getCreateTime().getTime() > 1000 * 60 * 5L) {
|
| | | userActiveLog.setCreateTime(new Date());
|
| | |
| | | return userActiveLogMapper.selectFirstActiveInfo(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<UserActiveNumHistory> query(Date startTime, Date endTime){
|
| | | // 重新查询统计今日以及空缺
|
| | | initUserActiveNumCount();
|
| | | |
| | | return userActiveNumHistoryDao.query(startTime, endTime);
|
| | | }
|
| | | |
| | | |
| | | // 初始化统计
|
| | | private void initUserActiveNumCount() {
|
| | | UserActiveNumHistory history = userActiveNumHistoryDao.getMaxDate();
|
| | | Date lastDay = null;
|
| | | if (history != null && history.getDay() != null)
|
| | | lastDay = history.getDay();
|
| | | |
| | | Date today = new Date();
|
| | | try {
|
| | | if (lastDay == null)
|
| | | lastDay = TimeUtil.parse("2018-09-01");
|
| | | int betweenDays = DateUtil.daysBetween2(lastDay, today);
|
| | | |
| | | // 统计今日之前的
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 1; i <= betweenDays; i++ ) {
|
| | | addUserActiveNumHistory(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | | addUserActiveNumHistory(TimeUtil.getGernalTime(today.getTime()));
|
| | | } catch (Exception e) {
|
| | | // |
| | | public long count90DaysLaterActiveNum(String preDay){
|
| | | Long count = userActiveLogMapper.countActiveNumByDate(preDay);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | |
| | | /*
|
| | | * 统计当天活跃用户中有多少个用户是90天前才活跃过,期间从未活跃的用户数量。
|
| | | */
|
| | | @Override
|
| | | public void addUserActiveNumHistory(String date){
|
| | | int num = userActiveLogMapper.countActiveNumByDate(date);
|
| | | |
| | | UserActiveNumHistory history = new UserActiveNumHistory();
|
| | | history.setId(date);
|
| | | history.setNum(num);
|
| | | try {
|
| | | history.setDay(TimeUtil.parse(date));
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | userActiveNumHistoryDao.save(history);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoRegisterMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class UserInfoRegisterServiceImpl implements UserInfoRegisterService {
|
| | |
|
| | | @Resource
|
| | | private UserInfoRegisterMapper userInfoRegisterMapper;
|
| | | |
| | | |
| | | @Override
|
| | | public void addRegisterInfo(UserInfoRegister record) {
|
| | | if (record == null || record.getId() == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfoRegister info = userInfoRegisterMapper.selectByPrimaryKey(record.getId());
|
| | | if (info != null) |
| | | return;
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getChannel())) {
|
| | | record.setChannel(ChannelEnum.unknown.getVlaue());
|
| | | }
|
| | | |
| | | record.setCreateTime(new Date());
|
| | | userInfoRegisterMapper.insertSelective(record);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<UserInfoRegister> listByMultipleUids(List<Long> list) {
|
| | |
| | | return userInfoRegisterMapper.listByMultipleUidAndDay(list, preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserInfoRegister> listByDay(String preDay) {
|
| | | return userInfoRegisterMapper.listByDay(preDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserInfoRegister> listByChannelAndDay(String channel, String preDay) {
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public Integer countByChannelAndDay(String channel, String preDay) {
|
| | | public Long countByChannelAndDay(String channel, String preDay) {
|
| | | return userInfoRegisterMapper.countByChannelAndDay(channel, preDay);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | |
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | private UserInviteService userInviteService;
|
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | |
| | | jumpBtn.put("params", jumpLink);
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web"));
|
| | | } else if (CouponTypeEnum.rebatePercentCoupon == type) {
|
| | | if (userVIPInfoService.isVIP(uid)) { // 会员只可赠送
|
| | | if (userInviteService.verifyVIP(uid)) { // 会员只可赠送
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_ONLY);
|
| | | } else {// 可使用 可赠送
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
|
| | |
| | | return integralDetailMapper.getCumulativeMoney(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Long countNewAddByDate(String preDay) {
|
| | | return integralDetailMapper.countNewAddByDate(preDay);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<IntegralDetail> listQuery(long start, int count, String key) {
|
| | | return integralDetailMapper.listQuery(start, count, key);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countQuery(String key) {
|
| | | Long count = integralDetailMapper.countQuery(key);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | return count;
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
|
| | |
| | | List<ThreeSale> list = listByWorkerId(worker.getId());
|
| | | if (list != null && list.size() > 0) {
|
| | | for (ThreeSale ts : list) {
|
| | | if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {
|
| | | if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_BREAK) {
|
| | | outOfDateCount++;
|
| | | }
|
| | | }
|
| | |
| | | if (list != null)
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (list.get(i).getState() != null && list.get(i).getState() == false
|
| | | && list.get(i).getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {// 过期的
|
| | | && list.get(i).getExpire() == ThreeSale.EXPIRE_BREAK) {// 过期的
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeamByUndeleted(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listFirstTeamByUndeleted(start, count, uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countFirstTeamByUndeleted(Long uid) {
|
| | | return threeSaleMapper.countFirstTeamByUndeleted(uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<ThreeSale> listSecondTeamByUndeleted(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listSecondTeamByUndeleted(start, count, uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countSecondTeamByUndeleted(Long uid) {
|
| | | return threeSaleMapper.countSecondTeamByUndeleted(uid);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid, state);
|
| | | }
|
| | |
| | |
|
| | | return deepList;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void remvoeBreak(Long id, Long uid, Long tid) {
|
| | | ThreeSale threeSale = threeSaleMapper.selectByPrimaryKey(id);
|
| | | if (threeSale == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | Long workerId = threeSale.getWorker().getId();
|
| | | if (tid.longValue() != workerId.longValue()) {
|
| | | return;
|
| | | }
|
| | | |
| | | Integer expire = threeSale.getExpire();
|
| | | if (expire == ThreeSale.EXPIRE_NORMAL) {
|
| | | return;
|
| | | }
|
| | | |
| | | int upExpire = expire;
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | if (bossId.longValue() == uid.longValue()) { // 直接粉丝
|
| | | if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL4) {
|
| | | upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | } else {
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL3;
|
| | | }
|
| | | } else { // 间接粉丝
|
| | | if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL3) {
|
| | | upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
|
| | | } else {
|
| | | upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL4;
|
| | | }
|
| | | }
|
| | | |
| | | ThreeSale update = new ThreeSale();
|
| | | update.setId(id);
|
| | | update.setExpire(upExpire);
|
| | | update.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user.invite;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteSeparateMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class UserInviteSeparateServiceImpl implements UserInviteSeparateService {
|
| | |
| | | @Resource
|
| | | private UserInviteSeparateMapper userInviteSeparateMapper;
|
| | |
|
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void insertSelective(UserInviteSeparate record) {
|
| | | userInviteSeparateMapper.insertSelective(record);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addPreSeparateRecord(Long workerId, Long bossId) {
|
| | | // 更新之前状态失效
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_INVALID);
|
| | | |
| | | // 限制天数
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | | |
| | | // 保存记录
|
| | | UserInviteSeparate inviteSeparate = new UserInviteSeparate();
|
| | | inviteSeparate.setBossId(bossId);
|
| | | inviteSeparate.setWorkerId(workerId);
|
| | | inviteSeparate.setState(UserInviteSeparate.STATE_INIT);
|
| | | inviteSeparate.setEndTime(DateUtil.plusDayDate(limitDays, new Date()));
|
| | | inviteSeparate.setCreateTime(new Date());
|
| | | inviteSeparate.setUpdateTime(new Date());
|
| | | userInviteSeparateMapper.insertSelective(inviteSeparate);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | return userInviteSeparateMapper.getHandleOverdue(start, count);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSeparate(UserInviteSeparate record) {
|
| | | if (record == null)
|
| | | return;
|
| | |
|
| | | Long workerId = record.getWorkerId();
|
| | | Long bossId = record.getBossId();
|
| | | |
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(workerId);
|
| | | if (threeSale == null) {
|
| | | // 成功脱离 不发消息
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_SUCCESS);
|
| | | return;
|
| | | } |
| | | |
| | | boolean separate = false;
|
| | | UserVIPPreInfo info = userVIPPreInfoService.getVipByProcess(bossId, UserVIPPreInfo.PROCESS_1);
|
| | | if (info == null) {
|
| | | separate = true;
|
| | | } else if (info.getCreateTime().getTime() >= record.getEndTime().getTime()) {
|
| | | separate = true; |
| | | }
|
| | | |
| | |
|
| | | if (!separate) { |
| | | // 未脱离
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_INVALID);
|
| | | } else { |
| | | // 脱离关系
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_SUCCESS);
|
| | |
|
| | | // 脱离邀请关系
|
| | | threeSaleSerivce.inviteSeparate(workerId, bossId);
|
| | |
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | | |
| | | // 消息 TODO
|
| | | UserInfo userInfo = userInfoService.selectByPKey(workerId);
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + workerId + "于"+ TimeUtil.formatDateDot(record.getCreateTime()) + "成功升级成为会员 ");
|
| | | msgboss.setContent2("很遗憾,你未能在" + limitDays + "天升级为会员 ");
|
| | | msgboss.setContent3("已与其脱离邀请关系");
|
| | | userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPLevelMapper;
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | | |
| | | @Resource
|
| | | private UserVIPLevelMapper userVIPLevelMapper;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public UserInviteLevelEnum getUserInviteLevel(Long uid) {
|
| | |
| | | if (info.getState() == UserVIPInfo.STATE_VERIFING)
|
| | | return UserInviteLevelEnum.vipApply;
|
| | |
|
| | | |
| | | // TODO 没有判断导师
|
| | |
|
| | | return UserInviteLevelEnum.vip;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserInviteLevelEnum getUserInviteLevelNew(Long uid) {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | return UserInviteLevelEnum.noActive;
|
| | | }
|
| | | |
| | | UserVIPInfo info = userVIPInfoService.selectByUid(uid);
|
| | | if (info == null) {
|
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (userVIPPreInfo != null) {
|
| | | if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_1) {
|
| | | return UserInviteLevelEnum.vipPre1;
|
| | | } else if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_2) {
|
| | | return UserInviteLevelEnum.vipPre2;
|
| | | }
|
| | | }
|
| | | } else if (info.getState() == UserVIPInfo.STATE_VERIFING) {
|
| | | return UserInviteLevelEnum.vipApply;
|
| | | } else if (info.getState() == UserVIPInfo.STATE_SUCCESS) {
|
| | | return UserInviteLevelEnum.vip;
|
| | | }
|
| | | |
| | | // TODO 没有判断导师
|
| | | |
| | | return UserInviteLevelEnum.actived;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public boolean verifyVIP(Long uid) {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | return false;
|
| | | }
|
| | | |
| | | UserVIPInfo info = userVIPInfoService.selectByUid(uid);
|
| | | if (info != null && info.getState() == UserVIPInfo.STATE_SUCCESS) {
|
| | | return true;
|
| | | }
|
| | | |
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (userVIPPreInfo != null) {
|
| | | return true;
|
| | | }
|
| | | |
| | | return false;
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public UserVIPLevel getVIPLevelByUid(Long uid) {
|
| | | return userVIPLevelMapper.getLevelByUid(uid);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.invite;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteValidNumMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteValidRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class UserInviteValidNumServiceImpl implements UserInviteValidNumService {
|
| | | @Resource
|
| | | private UserInviteValidNumMapper userInviteValidNumMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInviteValidRecordMapper userInviteValidRecordMapper;
|
| | | |
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | |
| | | @Override
|
| | | public UserInviteValidNum selectByPrimaryKey(Long id) {
|
| | | return userInviteValidNumMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 直接粉丝 +1
|
| | | * @param uid
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void addNumFirst(Long uid) {
|
| | | UserInviteValidNum inviteValid = userInviteValidNumMapper.selectForUpdate(uid);
|
| | | if (inviteValid != null) {
|
| | | userInviteValidNumMapper.addNumFirst(uid, 1);
|
| | | } else {
|
| | | inviteValid = new UserInviteValidNum();
|
| | | inviteValid.setId(uid);
|
| | | inviteValid.setNumFirst(1);
|
| | | inviteValid.setNumSecond(0);
|
| | | inviteValid.setUpdateTime(new Date());
|
| | | userInviteValidNumMapper.insertSelective(inviteValid);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 间接粉丝 +1
|
| | | * @param uid
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void addNumSecond(Long uid) {
|
| | | UserInviteValidNum inviteValid = userInviteValidNumMapper.selectForUpdate(uid);
|
| | | if (inviteValid != null) {
|
| | | userInviteValidNumMapper.addNumSecond(uid, 1);
|
| | | } else {
|
| | | inviteValid = new UserInviteValidNum();
|
| | | inviteValid.setId(uid);
|
| | | inviteValid.setNumFirst(0);
|
| | | inviteValid.setNumSecond(1);
|
| | | inviteValid.setUpdateTime(new Date());
|
| | | userInviteValidNumMapper.insertSelective(inviteValid);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addValidTeamNum(Long uid, BigDecimal payment, Date payDate) {
|
| | | if (uid == null || payment == null || payDate == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | // 付款金额小于1
|
| | | if (payment.compareTo(Constant.VIP_ORDER_PAY) < 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 是否上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 队员关系有效时间
|
| | | Long succeedTime = threeSale.getSucceedTime();
|
| | | if (succeedTime == null) {
|
| | | succeedTime = threeSale.getCreateTime();
|
| | | }
|
| | | |
| | | // 下单时间在生产关系之前
|
| | | if (payDate.getTime() <= succeedTime.longValue()) {
|
| | | return;
|
| | | }
|
| | | |
| | | Long bossId = threeSale.getBoss().getId();
|
| | | String uniqueKey = StringUtil.Md5(bossId + "#" + uid + "#" + UserInviteValidRecord.TYPE_ONE);
|
| | | UserInviteValidRecord record = userInviteValidRecordMapper.selectByUniqueKey(uniqueKey);
|
| | | if (record == null) {
|
| | | record = new UserInviteValidRecord();
|
| | | record.setUid(bossId);
|
| | | record.setWorkerId(uid);
|
| | | record.setType(UserInviteValidRecord.TYPE_ONE);
|
| | | record.setUniqueKey(uniqueKey);
|
| | | record.setCreateTime(new Date());
|
| | | userInviteValidRecordMapper.insertSelective(record);
|
| | | |
| | | // 更新上级的直接粉丝数量
|
| | | addNumFirst(bossId);
|
| | | }
|
| | | |
| | | // 是否上上级
|
| | | ThreeSale threeSaleSuper = threeSaleSerivce.getMyBoss(bossId);
|
| | | if (threeSaleSuper == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 间接关系
|
| | | Long bossIdSuper = threeSaleSuper.getBoss().getId();
|
| | | String uniqueKeySuper = StringUtil.Md5(bossIdSuper + "#" + uid + "#" + UserInviteValidRecord.TYPE_TWO);
|
| | | UserInviteValidRecord recordSuper = userInviteValidRecordMapper.selectByUniqueKey(uniqueKeySuper);
|
| | | if (recordSuper == null) {
|
| | | recordSuper = new UserInviteValidRecord();
|
| | | recordSuper.setUid(bossIdSuper);
|
| | | recordSuper.setWorkerId(uid);
|
| | | recordSuper.setType(UserInviteValidRecord.TYPE_TWO);
|
| | | recordSuper.setUniqueKey(uniqueKeySuper);
|
| | | recordSuper.setCreateTime(new Date());
|
| | | userInviteValidRecordMapper.insertSelective(recordSuper);
|
| | | |
| | | // 更新上上级的间接粉丝数量
|
| | | addNumSecond(bossIdSuper);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.invite;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteValidRecordMapper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService;
|
| | |
|
| | | @Service
|
| | | public class UserInviteValidRecordServiceImpl implements UserInviteValidRecordService {
|
| | |
|
| | | @Resource
|
| | | private UserInviteValidRecordMapper userInviteValidRecordMapper;
|
| | | |
| | | @Override
|
| | | public List<Long> getValidWorkerIdsByUid(Long uid, List<Long> list,Integer type){
|
| | | return userInviteValidRecordMapper.getValidWorkerIdsByUid(uid, list, type);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class UserVIPInfoServiceImpl implements UserVIPInfoService {
|
| | |
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | userVIPInfoMapper.insert(info);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userVIPInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | |
|
| | | if (!verifyConform(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userVIPInfo.getId());
|
| | | info.setSuccessTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_SUCCESS);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | |
|
| | | // 下级的超级会员 不脱离
|
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | |
|
| | | // 额外信息
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | |
|
| | | // 添加金币
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Constant.VIP_COLDCOIN_NUM);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | | userInfoExtraService.addGoldCoinByUid(uid, Constant.VIP_COLDCOIN_NUM);
|
| | |
|
| | | try {
|
| | | // 奖励券
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | | for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | |
|
| | | // 赠送免单券
|
| | | for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | |
|
| | | // 消息
|
| | | MsgOtherVIPDTO msgOther = new MsgOtherVIPDTO();
|
| | | msgOther.setContent1("恭喜你,已成为超级会员");
|
| | | msgOther.setContent2("满足升级条件");
|
| | | msgOther.setContent3(TimeUtil.formatDateDot(new Date()));
|
| | | userOtherMsgNotificationService.passVIPApplyMsg(uid, "返利奖励券和、赠送免单券和金币请到我的-福利中心中查看", msgOther);
|
| | |
|
| | | // 通知上级
|
| | | callBoss(uid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 通知上级脱离关系
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | @Transactional
|
| | | private void callBoss(Long uid) {
|
| | | // 是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | // 上级是否为会员
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserVIPInfo bossVIP = userVIPInfoMapper.selectByPrimaryKeyForUpdate(bossId);
|
| | | if (bossVIP != null && bossVIP.getState() != null && bossVIP.getState() == UserVIPInfo.STATE_SUCCESS)
|
| | | return;
|
| | |
|
| | | // 之前插入记录失效
|
| | | userInviteSeparateService.updateStateByWorkerIdAndBossId(uid, bossId, UserInviteSeparate.STATE_INVALID);
|
| | |
|
| | | // 限制时间
|
| | | int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
|
| | | UserInviteSeparate inviteSeparate = new UserInviteSeparate();
|
| | | inviteSeparate.setBossId(bossId);
|
| | | inviteSeparate.setWorkerId(uid);
|
| | | inviteSeparate.setState(UserInviteSeparate.STATE_INIT);
|
| | | inviteSeparate.setEndTime(DateUtil.plusDayDate(limitDays, new Date()));
|
| | | inviteSeparate.setCreateTime(new Date());
|
| | | inviteSeparate.setUpdateTime(new Date());
|
| | | userInviteSeparateService.insertSelective(inviteSeparate);
|
| | |
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | // 消息
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + " " + uid);
|
| | | msgboss.setContent2("于" + TimeUtil.formatDateDot(new Date()) + "成功升级成为超级会员");
|
| | | msgboss.setContent3("今日起" + limitDays + "天内,你未能成为超级会员将会与其脱离邀请关系 ");
|
| | | userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setState(UserVIPInfo.STATE_INVALID);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | |
|
| | | // 消息
|
| | | MsgOtherVIPDTO msgOther = new MsgOtherVIPDTO();
|
| | | msgOther.setContent1("很抱歉,未通过超级会员申请");
|
| | | msgOther.setContent2("未满足超级会员升级条件或疑似出现违规 ");
|
| | | userOtherMsgNotificationService.rejectVIPApply(uid, "如有疑问请联系我的-人工客服", msgOther);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserVIPInfo();
|
| | | userInfo.setId(uid);
|
| | | addUserVIPInfo(userInfo);
|
| | | }
|
| | |
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_INVALID)
|
| | | throw new UserVIPInfoException(2, "已经申请过");
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setApplyTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isVIP(Long uid) {
|
| | |
| | | return map;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean verifyConform(Long uid) {
|
| | | if (uid == null || uid <= 0)
|
| | | return false;
|
| | |
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra == null)
|
| | | return false;
|
| | |
|
| | | // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | | // long teamNum =
|
| | | // hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | long teamNum = 0L;
|
| | | long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
|
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
|
| | | if (listThreeSale != null && listThreeSale.size() > 0) {
|
| | | for (ThreeSale three : listThreeSale) {
|
| | | UserInfo worker = three.getWorker();
|
| | | if (worker == null || worker.getId() == null) {
|
| | | continue;
|
| | | }
|
| | | // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
|
| | | long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(),
|
| | | three.getSucceedTime(), payMoney);
|
| | | if (countValid > 0) {
|
| | | teamNum++;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | | Date executeDate = null;
|
| | | try {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
|
| | | executeDate = format.parse(limtDate);
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (executeDate == null)
|
| | | return false;
|
| | |
|
| | | if (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime()) {
|
| | | long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user"));
|
| | | if (teamNum < limitNum)
|
| | | return false;
|
| | | } else {
|
| | | long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user"));
|
| | | if (teamNum < limitNum)
|
| | | return false;
|
| | | }
|
| | |
|
| | | // 2、累计自购返利≥100 元(从注册板栗快省起);
|
| | | BigDecimal fanMoney = new BigDecimal(userVipConfigService.getValueByKey("require_fan_money"));
|
| | | BigDecimal purchase = hongBaoV2CountService.getRewardMoneyBySelf(uid);
|
| | | if (purchase.compareTo(fanMoney) < 0)
|
| | | return false;
|
| | |
|
| | | // 3、累计金币≥10000 枚(从注册板栗快省起);
|
| | | BigDecimal goldCoin = integralDetailService.getCumulativeMoney(uid);
|
| | | BigDecimal limitGoldCoin = new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin"));
|
| | | if (goldCoin.compareTo(limitGoldCoin) < 0)
|
| | | return false;
|
| | |
|
| | | // 4、使用红包≥1 次
|
| | | List<Integer> list = new ArrayList<Integer>();
|
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | long useHongBao = banLiShopOrderService.countByUidAndState(uid, list);
|
| | | long limitHongBao = Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy"));
|
| | | if (useHongBao < limitHongBao)
|
| | | return false;
|
| | |
|
| | | // 符合条件
|
| | | return true;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserVIPInfo> listQuery(int page, int count, String key, Integer state) {
|
| | |
| | | return userVIPInfoMapper.countQuery(key, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSeparate(Long workerId, Long bossId) {
|
| | | if (workerId == null || bossId == null)
|
| | | return;
|
| | |
|
| | | // 查询记录
|
| | | UserInviteSeparate userInviteSeparate = userInviteSeparateService.selectByWorkerIdAndBossId(workerId, bossId);
|
| | | if (userInviteSeparate == null)
|
| | | return;
|
| | |
|
| | | // 是否存在邀请关系
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(workerId);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | Long bossIdExist = threeSale.getBoss().getId();
|
| | | if (bossIdExist == null || bossId.longValue() != bossIdExist.longValue())
|
| | | return;
|
| | |
|
| | | // 上级会员情况
|
| | | boolean separate = false;
|
| | | UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKey(bossId);
|
| | | if (userVIPInfo != null && userVIPInfo.getState() != null
|
| | | && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) {
|
| | | if (userInviteSeparate.getEndTime().getTime() < userVIPInfo.getSuccessTime().getTime()) {
|
| | | separate = true; // 结束时间已经超过
|
| | | }
|
| | | } else {
|
| | | separate = true; // 上级非会员
|
| | | }
|
| | |
|
| | | if (!separate) {
|
| | | // 未脱离
|
| | | userInviteSeparateService.updateStateByWorkerIdAndBossId(workerId, bossId,
|
| | | UserInviteSeparate.STATE_INVALID);
|
| | | } else {
|
| | | // 脱离关系
|
| | | userInviteSeparateService.updateStateByWorkerIdAndBossId(workerId, bossId,
|
| | | UserInviteSeparate.STATE_SUCCESS);
|
| | |
|
| | | // 脱离邀请关系
|
| | | threeSaleSerivce.inviteSeparate(workerId, bossId);
|
| | |
|
| | | int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
|
| | | // 消息
|
| | | UserInfo userInfo = userInfoService.selectByPKey(workerId);
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + workerId + "于"
|
| | | + TimeUtil.formatDateDot(userInviteSeparate.getCreateTime()) + "成功升级成为超级会员 ");
|
| | | msgboss.setContent2("很遗憾,你未能在" + limitDays + "天升级为超级会员 ");
|
| | | msgboss.setContent3("已与其脱离邀请关系");
|
| | | userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void applyVIPNew(Long uid) throws UserVIPInfoException {
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException {
|
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | throw new UserVIPInfoException(1, "请先升级为高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVipNew(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | | if (!verifyVip(uid))
|
| | | throw new UserVIPInfoException(1, "不满足升级条件");
|
| | |
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void passVIPApplyNew(Long uid) throws UserVIPInfoException {
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userVIPInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | |
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | }
|
| | |
|
| | | if (!verifyVipNew(uid))
|
| | | if (!verifyVip(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | |
|
| | | // 额外信息
|
| | |
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | |
|
| | | // 添加金币
|
| | | userInfoExtraService.addGoldCoinByUid(uid, Constant.VIP_COLDCOIN_NUM);
|
| | | // 添加金币明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Constant.VIP_COLDCOIN_NUM);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | |
|
| | | try {
|
| | | // 奖励券
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | | for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | |
|
| | | // 赠送免单券
|
| | | for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | String giveCoupon = userVipConfigService.getValueByKey("vip_pre_10_gift_givefree_coupon");
|
| | | if (!StringUtil.isNullOrEmpty(giveCoupon)) {
|
| | | int num = Integer.parseInt(giveCoupon);
|
| | | for (int i = 0; i < num; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | |
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("已将你的账户由高级会员升级为超级会员");
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | private boolean verifyVipNew(Long uid) {
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | private boolean verifyVip(Long uid) {
|
| | | // 自购订单
|
| | | long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | // 分享订单
|
| | | long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | |
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | |
|
| | | if (countZiGou >= Constant.VIP_PROCESS_3_ZIGOU || countShare >= Constant.VIP_PROCESS_3_SHARE
|
| | | || (firstTeam >= Constant.VIP_PROCESS_3_TEAM && secondTeam >= Constant.VIP_PROCESS_3_TEAM_SECOND)) {
|
| | | long limitZiGou = 0;
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | |
| | | long limitShare = 0;
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_10_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | |
| | | long limitFirst = 0;
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | |
| | | long limitSecond = 0;
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | |
| | | if (doneZiGou >= limitZiGou || doneShare >= limitShare || (doneFirst >= limitFirst && doneSecond >= limitSecond)) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException {
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPPreInfoMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | | |
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserInviteSeparateService userInviteSeparateService;
|
| | | |
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | Collections.sort(infoList, cm);
|
| | | return infoList.get(0);
|
| | | }
|
| | | |
| | | @Override
|
| | | public UserVIPPreInfo getVipByProcess(Long uid, int process){
|
| | | return userVIPPreInfoMapper.selectByUidAndProcess(uid, process);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public UserVIPPreInfo getProcessInfo(Long uid, Date time) {
|
| | |
| | | if (oldInfo != null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | |
| | | // 自购订单
|
| | | long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | // 分享订单
|
| | | long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | |
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | |
|
| | | // 一阶段
|
| | | boolean process1 = oneProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | boolean process1 = oneProcess(uid, doneZiGou, doneShare, doneFirst, doneSecond);
|
| | | if (!process1) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 二阶段
|
| | | twoProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | twoProcess(uid, doneZiGou, doneShare, doneFirst, doneSecond);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | * @param firstTeam
|
| | | * @param secondTeam
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private boolean oneProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | boolean process = false;
|
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU) {
|
| | | |
| | | long limitZiGou = 0;
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_3_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | |
| | | long limitShare = 0;
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_3_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | |
| | | long limitFirst = 0;
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_3_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | |
| | | long limitSecond = 0;
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_3_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | |
| | | if (countZiGou >= limitZiGou) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 " + Constant.VIP_PROCESS_1_ZIGOU + "笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_1_SHARE) {
|
| | | msg = "恭喜你!返利订单达到 " + limitZiGou + "笔";
|
| | | } else if (countShare >= limitShare) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 " + Constant.VIP_PROCESS_1_SHARE + "笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND) {
|
| | | msg = "恭喜你!分享订单达到 " + limitShare + "笔";
|
| | | } else if (firstTeam >= limitFirst && secondTeam >= limitSecond) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到" + Constant.VIP_PROCESS_1_TEAM + "人,间接粉丝达到 " + Constant.VIP_PROCESS_1_TEAM_SECOND + "人";
|
| | | msg = "直接粉丝达到" + limitFirst + "人,间接粉丝达到 " + limitSecond + "人";
|
| | | }
|
| | |
|
| | | if (process) {
|
| | |
| | | msgDto.setStatus("系统已将你的账户由快省达人升级为普通会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部普通会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
|
| | | |
| | | |
| | | // 赠送金币
|
| | | String goldcoin = userVipConfigService.getValueByKey("vip_pre_3_gift_goldcoin");
|
| | | if (!StringUtil.isNullOrEmpty(goldcoin)) {
|
| | | // 添加金币明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Integer.parseInt(goldcoin));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-3-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | // 添加金币
|
| | | userInfoExtraService.addGoldCoinByUid(uid, Integer.parseInt(goldcoin));
|
| | | |
| | | //TODO 消息
|
| | | }
|
| | | |
| | | // 是否存在下级脱离期限 -更新不脱离
|
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | | |
| | | // 上级脱离关系
|
| | | remindBoss(uid);
|
| | | |
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return process;
|
| | | }
|
| | |
|
| | | |
| | | private void remindBoss(Long uid) {
|
| | | // 是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | |
| | | Long bossId = threeSale.getBoss().getId();
|
| | | // 验证上级是否已是会员
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(bossId, UserVIPPreInfo.PROCESS_1);
|
| | | if (oldInfo != null) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 添加脱离关系倒计时
|
| | | userInviteSeparateService.addPreSeparateRecord(uid, bossId);
|
| | | |
| | | // TODO 消息
|
| | | |
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 二阶段
|
| | | *
|
| | |
| | | * @param firstTeam
|
| | | * @param secondTeam
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private boolean twoProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | boolean process = false;
|
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU) {
|
| | | |
| | | long limitZiGou = 0;
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_7_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | |
| | | long limitShare = 0;
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_7_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | |
| | | long limitFirst = 0;
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_7_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | |
| | | long limitSecond = 0;
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_7_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | |
| | | if (countZiGou >= limitZiGou) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 " + Constant.VIP_PROCESS_2_ZIGOU + "笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_2_SHARE) {
|
| | | msg = "恭喜你!返利订单达到 " + limitZiGou + "笔";
|
| | | } else if (countShare >= limitShare) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 " + Constant.VIP_PROCESS_2_SHARE + "笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND) {
|
| | | msg = "恭喜你!分享订单达到 " + limitShare + "笔";
|
| | | } else if (firstTeam >= limitFirst && secondTeam >= limitSecond) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到" + Constant.VIP_PROCESS_2_TEAM + "人,间接粉丝达到 " + Constant.VIP_PROCESS_2_TEAM_SECOND + "人";
|
| | | msg = "直接粉丝达到" + limitFirst + "人,间接粉丝达到 " + limitSecond + "人";
|
| | | }
|
| | |
|
| | | if (process) {
|
| | |
| | | msgDto.setStatus("系统已将你的账户由普通会员升级为高级会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部高级会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | |
| | | // 赠送奖励券
|
| | | String rewardCoupon = userVipConfigService.getValueByKey("vip_pre_7_gift_reward_coupon");
|
| | | if (!StringUtil.isNullOrEmpty(rewardCoupon)) {
|
| | | int num = Integer.parseInt(rewardCoupon);
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | | for (int i = 0; i < num; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | | }
|
| | | |
| | | // TODO 发券消息
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | | return process;
|
| | |
| | | if (StringUtil.isNullOrEmpty(record.getKey()))
|
| | | throw new UserVipConfigException(1, "标识不能为空");
|
| | |
|
| | | |
| | | String remark = record.getRemark();
|
| | | if ("null".equalsIgnoreCase(remark)) {
|
| | | record.setRemark("");
|
| | | }
|
| | | |
| | | |
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setStartTime(new Date());
|
| | | record.setCreateTime(new Date());
|
| | | userVipConfigMapper.insert(record);
|
| | | } else {
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.config;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory.ConfigCategoryEnum;
|
| | |
|
| | | public interface ConfigCategoryService {
|
| | |
|
| | | /**
|
| | | * 添加分类信息
|
| | | * @param configCategory
|
| | | */
|
| | | public void addConfigCategory(ConfigCategory configCategory);
|
| | |
|
| | | /**
|
| | | * 根据分类查询key值
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public List<ConfigCategory> listByType(ConfigCategoryEnum type);
|
| | |
|
| | | /**
|
| | | * 获取类型枚举
|
| | | * @param name
|
| | | * @return
|
| | | */
|
| | | public ConfigCategoryEnum getCategoryEnum(String name);
|
| | |
|
| | | |
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public String getSearchDiscoveryKeys();
|
| | |
|
| | | /**
|
| | | * 根据key查询 无缓存
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public Config getConfigBykeyNoCache(String key);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountCoupon;
|
| | |
|
| | | public interface DailyCountCouponService {
|
| | |
|
| | | /**
|
| | | * 查询各类型统计
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<DailyCountCoupon> getDailyCountList(String type, Date startTime, Date endTime) throws Exception;
|
| | |
|
| | | /**
|
| | | * 获取枚举类型说明
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public String getTypeEnumDesc(String type);
|
| | | |
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountMoments;
|
| | |
|
| | | public interface DailyCountMomentsService {
|
| | |
|
| | | /**
|
| | | * 查询统计
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param channel
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<DailyCountMoments> getDailyCountList(String type, Date startTime, Date endTime) throws Exception;
|
| | |
|
| | | /**
|
| | | * 获取类型说明
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public String getTypeEnumDesc(String type);
|
| | |
|
| | | |
| | | /**
|
| | | * 添加分享次数
|
| | | */
|
| | | public void addShareClick();
|
| | |
|
| | | /**
|
| | | * 添加复制评论
|
| | | */
|
| | | public void addCopyComment();
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountOrder;
|
| | |
|
| | | public interface DailyCountOrderService {
|
| | |
|
| | | /**
|
| | | * 查询统计
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param channel
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<DailyCountOrder> getDailyCountList(String type, Date startTime, Date endTime, String channel) throws Exception;
|
| | |
|
| | | /**
|
| | | * 获取类型说明
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public String getTypeEnumDesc(String type);
|
| | |
|
| | | |
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.count.DailyCountUser;
|
| | |
|
| | | public interface DailyCountUserService {
|
| | |
|
| | | /**
|
| | | * 查询统计
|
| | | * @param type
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param channel
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<DailyCountUser> getDailyCountList(String type, Date startTime, Date endTime, String channel) throws Exception;
|
| | |
|
| | | /**
|
| | | * 获取类型说明
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public String getTypeEnumDesc(String type);
|
| | |
|
| | | |
| | |
|
| | | |
| | | }
|
| | |
| | | Integer moneyState, String startTime, String endTime, List<Integer> listSource);
|
| | |
|
| | |
|
| | | public Integer countOrderByTypeAndDate(Integer orderType, String preDay);
|
| | | public Long countOrderByTypeAndDate(Integer orderType, String preDay);
|
| | |
|
| | | /**
|
| | | * 统计订单数量
|
| | |
| | | * @param type 订单类型
|
| | | * @return
|
| | | */
|
| | | public long counOrderByUidAndOrderType(Long uid, BigDecimal payment, int type); |
| | | public long counOrderByUidAndOrderType(Long uid, BigDecimal payment, int type);
|
| | |
|
| | | /**
|
| | | * 统计已结算
|
| | | * @param uid
|
| | | * @param time
|
| | | * @param payment
|
| | | * @return
|
| | | */
|
| | | public long countOrderByUidAndSettled(Long uid, Long time, BigDecimal payment); |
| | |
|
| | | }
|
| | |
| | |
|
| | | public List<CountUserInfo> getNewUserData(Date startTime, Date endTime, String channel);
|
| | |
|
| | | public void initChannelUserCount();
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public List<CountOrderInfo> countHongBaoByChannel(String channel, Date startTime, Date endTime);
|
| | |
|
| | | /**
|
| | | * 统计订单数量-根据类型
|
| | | * @param channel
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> countOrderType(Integer state, Date startTime, Date endTime);
|
| | |
|
| | |
|
| | | /**
|
| | | * 统计维权订单数量
|
| | |
| | | * @return
|
| | | */
|
| | | public List<CountOrderInfo> counOrderTotalNum(Date startTime, Date endTime);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.vo.user.SystemCouponVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
|
| | |
|
| | |
| | | */
|
| | | public List<ChartTDO> getFreeCouponMoneyToCharts(Integer dateType, String year, String startTime,
|
| | | String endTime, String couponType);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据券类型 统计免单金额
|
| | | * @param typeEnum
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countFreeMoneyByTypeAndDay(CouponTypeEnum typeEnum, String preDay);
|
| | |
|
| | | /**
|
| | | * 统计奖励券成功金额
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countRebateMoneyByDay(String preDay);
|
| | |
|
| | | /**
|
| | | * 每日新增券数量
|
| | | * @param typeEnum
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countCouponNumByDay(CouponTypeEnum typeEnum, String preDay);
|
| | |
|
| | | }
|
| | |
| | | public UserMoneyDetail selectByTypeAndUidAndIdentifyCode(UserMoneyDetailTypeEnum type, Long uid,
|
| | | Long sourceIdentifyId);
|
| | |
|
| | | /**
|
| | | * 查询明细统计
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public List<UserMoneyDetail> listQuery(int page, int pageSize, String key, Integer keyType);
|
| | |
|
| | | public long countQuery(String key, Integer keyType);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.money.extract;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.ChartTDO;
|
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | |
|
| | | public interface ExtractAuditRecordService {
|
| | |
| | | public List<ExtractAuditRecord> getbyExtractId(Long extractId);
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 统计申请提的现总金额
|
| | | * @param state
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public List<CountUserInfo> getApplyMoney(Date startTime, Date endTime) throws Exception;
|
| | | |
| | | public void initApplyMoneyCount();
|
| | | |
| | | /**
|
| | | * 统计申请提的现总次数
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | List<CountUserInfo> geApplyNumber(Date startTime, Date endTime) throws Exception;
|
| | | public Long countApplyNumberByDay(String preDay);
|
| | |
|
| | | public void initApplyNumberCount();
|
| | | public BigDecimal countApplyMoneyByDay(String preDay);
|
| | |
|
| | | public void initAuditCount();
|
| | | public Long countAuditNumberByDay(int state, String preDay);
|
| | |
|
| | | public List<CountUserInfo> getAuditCount(Date startTime, Date endTime, Integer state) throws Exception;
|
| | |
|
| | |
|
| | |
|
| | | |
| | |
|
| | | }
|
| | |
| | | */ |
| | | public List<ChartTDO> getTrackAccuracyRate(Integer dateType, String year, String startTime, String endTime, |
| | | int sourceType) throws Exception; |
| | | |
| | | |
| | | public Long countOrderBySourceTypeAndDay(int source, String preDay); |
| | | |
| | | |
| | | public List<Long> getDownOrderUserByListUidAndDate(Date preDay, List<Long> list); |
| | | |
| | | /** |
| | | * 查询当日下单用户 |
| | | * @param preDay |
| | | * @return |
| | | */ |
| | | public List<Long> getUidByValidOrderByDay(String preDay); |
| | | } |
| | |
| | | */ |
| | | public Date getThirdCreateTime(String orderId,int sourceType); |
| | | |
| | | |
| | | public List<CommonOrder> getMinSettleTimeAndUid(); |
| | | |
| | | } |
| | |
| | | * @param money
|
| | | */
|
| | | public void settleById(Long id, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 统计已到账金额
|
| | | * @param uid
|
| | | * @param level
|
| | | * @return
|
| | | */
|
| | | public BigDecimal sumRecievedMoneyByUid(long uid, Integer level);
|
| | |
|
| | | /**
|
| | | * 统计有效金额
|
| | | * @param uid
|
| | | * @param day
|
| | | * @param level
|
| | | * @return
|
| | | */
|
| | | public BigDecimal sumValidMoneyByUidAndDate(long uid, Integer day, Integer level);
|
| | | }
|
| | |
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countLostOrderNum(String preDay);
|
| | | public Integer countLostOrderNum(String preDay, int resultCode);
|
| | |
|
| | | /**
|
| | | * 统计申诉找回佣金
|
| | |
| | | * @throws
|
| | | */
|
| | | public long countCanSettleUid(Date time);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计用户有效金额
|
| | | * @param uid
|
| | | * @param day 1今日 2昨日 3本月 4上月
|
| | | * @param level
|
| | | * @return
|
| | | */
|
| | | public BigDecimal sumValidMoneyByUidAndDate(long uid, Integer day, Integer level);
|
| | | |
| | | /**
|
| | | * 统计用户已到账金额
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal sumRecievedMoneyByUid(long uid, Integer level);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.order.jd;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.exception.jd.JDOrderException;
|
| | |
|
| | | public interface JDOrderService {
|
| | |
| | | */
|
| | | public JDOrder selectDetailByOrderId(Long orderId);
|
| | |
|
| | | |
| | | |
| | | public Long countOrderByDay(String preDay);
|
| | |
|
| | | /**
|
| | | * 查询订单
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public List<JDOrderItem> listQuery(long start, int count, String key);
|
| | |
|
| | | public long countQuery(String key);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<PDDOrder> listByStatus(Integer status, int page, int pageSize);
|
| | |
|
| | | |
| | | public Long countOrderByDay(String preDay);
|
| | |
|
| | | |
| | | public List<PDDOrder> listQuery(long start, int count, String key);
|
| | |
|
| | | public long countQuery(String key);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<TaoBaoOrder> listByStateAndCreateTime(String state, Date minCreateTime, Date maxCreateTime);
|
| | |
|
| | | public Long countOrderByDay(String preDay);
|
| | | }
|
| | |
| | |
|
| | | public long count(String key, Long uid, Integer type);
|
| | |
|
| | | public BigDecimal countMoneyByDay(String preDay);
|
| | | |
| | | |
| | | public Long countNumByDay(String preDay);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public Long countDetail(long uid);
|
| | |
|
| | | public Long countNumByDay(String preDay);
|
| | |
|
| | | public BigDecimal countMoneyByDay(String preDay);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
|
| | |
|
| | | /**
|
| | | * 用户活跃日志服务
|
| | |
| | | */
|
| | | public UserActiveLog getFirstActiveInfo(Long uid);
|
| | |
|
| | |
|
| | | /**
|
| | | * |
| | | * @param dateType
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * 统计90后再次活跃用户
|
| | | * @param date
|
| | | * @return
|
| | | */
|
| | | public List<UserActiveNumHistory> query(Date startTime, Date endTime);
|
| | |
|
| | | public void addUserActiveNumHistory(String date);
|
| | | public long count90DaysLaterActiveNum(String date);
|
| | | }
|
| | |
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Integer countByChannelAndDay(String channel, String preDay);
|
| | | public Long countByChannelAndDay(String channel, String preDay);
|
| | |
|
| | | /**
|
| | | * 添加注册信息
|
| | | * @param record
|
| | | */
|
| | | public void addRegisterInfo(UserInfoRegister record);
|
| | |
|
| | | public List<UserInfoRegister> listByDay(String preDay);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<UserInviteSeparate> getHandleOverdue(int start, int count);
|
| | |
|
| | |
|
| | | public void addPreSeparateRecord(Long workerId, Long bossId);
|
| | |
|
| | | /**
|
| | | * 脱离邀请关系
|
| | | * @param record
|
| | | */
|
| | | public void inviteSeparate(UserInviteSeparate record);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public BigDecimal getCumulativeMoney(Long uid);
|
| | |
|
| | | /**
|
| | | * 统计当日新增
|
| | | * @param preDay
|
| | | * @return
|
| | | */
|
| | | public Long countNewAddByDate(String preDay);
|
| | |
|
| | | /**
|
| | | * 列表查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public List<IntegralDetail> listQuery(long start, int count, String key);
|
| | |
|
| | | |
| | | public long countQuery(String key);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid,int deep);
|
| | |
|
| | | /**
|
| | | * 查询未删除版-粉丝一级
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<ThreeSale> listFirstTeamByUndeleted(long start, int count, Long uid);
|
| | |
|
| | | /**
|
| | | * 统计粉丝一级
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countFirstTeamByUndeleted(Long uid);
|
| | |
|
| | | /**
|
| | | * 查询未删除版-粉丝二级
|
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<ThreeSale> listSecondTeamByUndeleted(long start, int count, Long uid);
|
| | |
|
| | | /**
|
| | | * 统计粉丝二级
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countSecondTeamByUndeleted(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 删除脱离队员
|
| | | * @param id
|
| | | * @param uid
|
| | | * @param tid
|
| | | */
|
| | | public void remvoeBreak(Long id, Long uid, Long tid);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user.invite;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.dto.vip.UserVIPLevel;
|
| | |
|
| | | public interface UserInviteService {
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | public UserInviteLevelEnum getUserInviteLevel(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 获取邀请等级 2.1
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserInviteLevelEnum getUserInviteLevelNew(Long uid);
|
| | |
|
| | |
|
| | | public boolean verifyVIP(Long uid);
|
| | |
|
| | |
|
| | | /**
|
| | | * 查询会员当前VIP等级
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserVIPLevel getVIPLevelByUid(Long uid);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.invite;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | |
|
| | | public interface UserInviteValidNumService {
|
| | |
|
| | | /**
|
| | | * 有效粉丝增加
|
| | | * @param uid 粉丝id
|
| | | * @param payment 付款金额
|
| | | * @param payDate 付款时间
|
| | | */
|
| | | public void addValidTeamNum(Long uid, BigDecimal payment, Date payDate);
|
| | |
|
| | | /**
|
| | | * 查询粉丝数量
|
| | | * @param id 用户id
|
| | | * @return
|
| | | */
|
| | | public UserInviteValidNum selectByPrimaryKey(Long id);
|
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.invite;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | public interface UserInviteValidRecordService {
|
| | |
|
| | | /**
|
| | | * 查询有效粉丝的粉丝id
|
| | | * @param uid
|
| | | * @param list
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public List<Long> getValidWorkerIdsByUid(Long uid, List<Long> list, Integer type);
|
| | |
|
| | |
|
| | | |
| | | }
|
| | |
| | | */
|
| | | public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 申请VIP
|
| | | * |
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 通过vip申请
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 拒绝申请
|
| | | * |
| | | * @param uid
|
| | | * @param reason
|
| | | */
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 是否为VIP
|
| | |
| | | */
|
| | | public Map<Long,Boolean> listByUids(List<Long> uid);
|
| | |
|
| | | /**
|
| | | * 验证是否满足会员条件
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public boolean verifyConform(Long uid);
|
| | |
|
| | | /**
|
| | | * 待审核列表
|
| | |
| | |
|
| | | public long countQuery(String key, Integer state);
|
| | |
|
| | | /**
|
| | | * 超级会员与上级关系脱离
|
| | | * @param workerId
|
| | | * @param bossId
|
| | | */
|
| | | public void inviteSeparate(Long workerId, Long bossId);
|
| | |
|
| | | /**
|
| | | * 超级会员申请通过
|
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void passVIPApplyNew(Long uid) throws UserVIPInfoException;
|
| | | public void passVIPApply(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 超级会员未通过
|
| | |
| | | * @param reason
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException;
|
| | | public void rejectVIPApply(Long uid, String reason) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 超级会员申请
|
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void applyVIPNew(Long uid) throws UserVIPInfoException;
|
| | | public void applyVIP(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid,int process);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询进度根据不同阶段
|
| | | * @param uid
|
| | | * @param process
|
| | | * @return
|
| | | * @throws UserVIPPreInfoException
|
| | | */
|
| | | public UserVIPPreInfo getVipByProcess(Long uid, int process);
|
| | |
|
| | | }
|
| | |
| | | // 新人定义: 自完成注册起10天内;
|
| | | public static final int TLJ_NEW_USER_DEFINE = 10;
|
| | |
|
| | | // vip奖励券券5张
|
| | | public static final int VIP_COUPON_REWARD_NUM = 15;
|
| | | // vip赠送免单券5张
|
| | | public static final int VIP_COUPON_GIVEFREE_NUM = 5;
|
| | | // vip赠送金币
|
| | | public static final int VIP_COLDCOIN_NUM = 1800;
|
| | | // 订单实付款
|
| | | public static final BigDecimal VIP_ORDER_PAY = new BigDecimal("1");
|
| | |
|
| | | // vip-一阶段分享订单数据
|
| | | public static final int VIP_PROCESS_1_ZIGOU = 60;
|
| | | public static final int VIP_PROCESS_1_SHARE = 120;
|
| | | public static final int VIP_PROCESS_1_TEAM = 8;
|
| | | public static final int VIP_PROCESS_1_TEAM_SECOND = 16;
|
| | | |
| | | // vip-二阶段分享订单数据
|
| | | public static final int VIP_PROCESS_2_ZIGOU = 120;
|
| | | public static final int VIP_PROCESS_2_SHARE = 240;
|
| | | public static final int VIP_PROCESS_2_TEAM = 16;
|
| | | public static final int VIP_PROCESS_2_TEAM_SECOND = 32;
|
| | | |
| | | |
| | | // vip-三阶段分享订单数据
|
| | | public static final int VIP_PROCESS_3_ZIGOU = 240;
|
| | | public static final int VIP_PROCESS_3_SHARE = 480;
|
| | | public static final int VIP_PROCESS_3_TEAM = 32;
|
| | | public static final int VIP_PROCESS_3_TEAM_SECOND = 64;
|
| | | |
| | | |
| | | // 订单列表显> 时间 TODO
|
| | | public static final String ORDER_SHOW_BRACE_TIME = "2019-12-14";
|
| | |
|
| | |
|
| | | // 奖励券倒计时 - 天数
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | |
|
| | | /**
|
| | | * 有效队员
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component |
| | | public class InviteValidTeamMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | |
| | | LogHelper.mqInfo("consumer-InviteValidTeamMessageListener", message.getMsgID(), message.getTopic(),
|
| | | message.getTag(), new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | |
|
| | | // 订单到账相关
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderConfirm.name())) {
|
| | | OrderConfirmMQMsg dto = new Gson().fromJson(new String(message.getBody()),OrderConfirmMQMsg.class);
|
| | | if (dto != null) {
|
| | | userInviteValidNumService.addValidTeamNum(dto.getSourceUid(), dto.getSettleMent(), dto.getPlaceOrderTime());
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.user;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.ChannelEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class ChannelEnumUtil {
|
| | | |
| | | public static ChannelEnum getChannelEnum(String channel) {
|
| | | if (StringUtil.isNullOrEmpty(channel)) {
|
| | | return ChannelEnum.unknown;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.p360.getVlaue())) {
|
| | | return ChannelEnum.p360;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.appstore.getVlaue())) {
|
| | | return ChannelEnum.appstore;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.douyin.getVlaue())) {
|
| | | return ChannelEnum.douyin;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.guanwang.getVlaue())) {
|
| | | return ChannelEnum.guanwang;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.lenovo.getVlaue())) {
|
| | | return ChannelEnum.lenovo;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.meizu.getVlaue())) {
|
| | | return ChannelEnum.meizu;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.oppo.getVlaue())) {
|
| | | return ChannelEnum.oppo;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.pp.getVlaue())) {
|
| | | return ChannelEnum.pp;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.qq.getVlaue())) {
|
| | | return ChannelEnum.qq;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.sougou.getVlaue())) {
|
| | | return ChannelEnum.sougou;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.vivo.getVlaue())) {
|
| | | return ChannelEnum.vivo;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.xiaomi.getVlaue())) {
|
| | | return ChannelEnum.xiaomi;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.yaoqing.getVlaue())) {
|
| | | return ChannelEnum.yaoqing;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.yingyin.getVlaue())) {
|
| | | return ChannelEnum.yingyin;
|
| | | }
|
| | | |
| | | if (channel.equalsIgnoreCase(ChannelEnum.huawei.getVlaue())) {
|
| | | return ChannelEnum.huawei;
|
| | | }
|
| | | |
| | | return ChannelEnum.unknown;
|
| | | }
|
| | | }
|
| | |
| | | private String vipOrderDesc;// 超级订单描述(2.1之后废弃)
|
| | |
|
| | | @Expose
|
| | | private String fanliDesc;// 返利说明
|
| | | @Expose
|
| | | private String fanliDescLink;// 返利说明链接
|
| | | private String rebateLink;// 返利说明链接
|
| | |
|
| | | @Expose
|
| | | private String orderDesc;// 订单描述
|
| | |
| | | this.subsidyList = subsidyList;
|
| | | }
|
| | |
|
| | | public String getFanliDesc() {
|
| | | return fanliDesc;
|
| | | }
|
| | |
|
| | | public void setFanliDesc(String fanliDesc) {
|
| | | this.fanliDesc = fanliDesc;
|
| | | }
|
| | |
|
| | | public String getFanliDescLink() {
|
| | | return fanliDescLink;
|
| | | }
|
| | |
|
| | | public void setFanliDescLink(String fanliDescLink) {
|
| | | this.fanliDescLink = fanliDescLink;
|
| | | }
|
| | |
|
| | | public String getOrderDesc() {
|
| | | return orderDesc;
|
| | | }
|
| | |
| | | public void setOrderDesc(String orderDesc) {
|
| | | this.orderDesc = orderDesc;
|
| | | }
|
| | |
|
| | | public String getRebateLink() {
|
| | | return rebateLink;
|
| | | }
|
| | |
|
| | | public void setRebateLink(String rebateLink) {
|
| | | this.rebateLink = rebateLink;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | public class GoodsRebateVO {
|
| | | private String title; // 商品标题
|
| | | private String picture; // 商品图片
|
| | | private String actualPay; // 实付款
|
| | | private String fanliRate; // 返利比例
|
| | | private String fanliExpect; // 预估返利
|
| | | private String commision; // 返利比或者佣金
|
| | | private String subsidy; // 补贴
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public String getActualPay() {
|
| | | return actualPay;
|
| | | }
|
| | |
|
| | | public void setActualPay(String actualPay) {
|
| | | this.actualPay = actualPay;
|
| | | }
|
| | |
|
| | | public String getFanliExpect() {
|
| | | return fanliExpect;
|
| | | }
|
| | |
|
| | | public void setFanliExpect(String fanliExpect) {
|
| | | this.fanliExpect = fanliExpect;
|
| | | }
|
| | |
|
| | | public String getCommision() {
|
| | | return commision;
|
| | | }
|
| | |
|
| | | public void setCommision(String commision) {
|
| | | this.commision = commision;
|
| | | }
|
| | |
|
| | | public String getSubsidy() {
|
| | | return subsidy;
|
| | | }
|
| | |
|
| | | public void setSubsidy(String subsidy) {
|
| | | this.subsidy = subsidy;
|
| | | }
|
| | |
|
| | | public String getFanliRate() {
|
| | | return fanliRate;
|
| | | }
|
| | |
|
| | | public void setFanliRate(String fanliRate) {
|
| | | this.fanliRate = fanliRate;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | public class OrderRebateVO {
|
| | | private String totalFanLi; // 预估总返利
|
| | | private String upperFanLi; // 升级返利
|
| | | private String userLevel; // 用户等级
|
| | | private String jumpLink; // 跳转链接
|
| | |
|
| | | private List<GoodsRebateVO> listGoods;
|
| | |
|
| | | public String getTotalFanLi() {
|
| | | return totalFanLi;
|
| | | }
|
| | |
|
| | | public void setTotalFanLi(String totalFanLi) {
|
| | | this.totalFanLi = totalFanLi;
|
| | | }
|
| | |
|
| | | public String getUpperFanLi() {
|
| | | return upperFanLi;
|
| | | }
|
| | |
|
| | | public void setUpperFanLi(String upperFanLi) {
|
| | | this.upperFanLi = upperFanLi;
|
| | | }
|
| | |
|
| | | public String getUserLevel() {
|
| | | return userLevel;
|
| | | }
|
| | |
|
| | | public void setUserLevel(String userLevel) {
|
| | | this.userLevel = userLevel;
|
| | | }
|
| | |
|
| | | public List<GoodsRebateVO> getListGoods() {
|
| | | return listGoods;
|
| | | }
|
| | |
|
| | | public void setListGoods(List<GoodsRebateVO> listGoods) {
|
| | | this.listGoods = listGoods;
|
| | | }
|
| | |
|
| | | public String getJumpLink() {
|
| | | return jumpLink;
|
| | | }
|
| | |
|
| | | public void setJumpLink(String jumpLink) {
|
| | | this.jumpLink = jumpLink;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | public class TeamBonusVO {
|
| | | private String total; // 总计
|
| | | private String direct; // 直接
|
| | | private String indirect; // 间接
|
| | |
|
| | | public TeamBonusVO() {
|
| | | }
|
| | | |
| | | |
| | | public TeamBonusVO(String direct, String indirect, String total) {
|
| | | this.direct = direct;
|
| | | this.indirect = indirect;
|
| | | this.total = total;
|
| | | }
|
| | | |
| | | |
| | | public String getTotal() {
|
| | | return total;
|
| | | }
|
| | |
|
| | | public void setTotal(String total) {
|
| | | this.total = total;
|
| | | }
|
| | |
|
| | | public String getDirect() {
|
| | | return direct;
|
| | | }
|
| | |
|
| | | public void setDirect(String direct) {
|
| | | this.direct = direct;
|
| | | }
|
| | |
|
| | | public String getIndirect() {
|
| | | return indirect;
|
| | | }
|
| | |
|
| | | public void setIndirect(String indirect) {
|
| | | this.indirect = indirect;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package org.fanli.config;
|
| | |
|
| | | import org.junit.Test;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory;
|
| | | import com.yeshi.fanli.entity.system.ConfigCategory.ConfigCategoryEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigCategoryService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | |
|
| | | public class Test_ConfigCategoryService {
|
| | | |
| | | @Test
|
| | | public void addConfigCategory() {
|
| | | ConfigCategoryService service = BeanUtil.getBean(ConfigCategoryService.class);
|
| | | |
| | | ConfigCategory c1 = new ConfigCategory();
|
| | | c1.setKeyEnum(ConfigKeyEnum.msgConfigGuanxuan);
|
| | | c1.setType(ConfigCategoryEnum.helpStrategy);
|
| | | c1.setOrder(1);
|
| | | c1.setEditMode(2);
|
| | | service.addConfigCategory(c1);
|
| | | |
| | | ConfigCategory c2 = new ConfigCategory();
|
| | | c2.setKeyEnum(ConfigKeyEnum.msgConfigZhushou);
|
| | | c2.setType(ConfigCategoryEnum.specialHelper);
|
| | | c2.setOrder(1);
|
| | | c2.setEditMode(2);
|
| | | service.addConfigCategory(c2);
|
| | | |
| | | |
| | | /*ConfigCategory c3 = new ConfigCategory();
|
| | | c3.setKeyEnum(ConfigKeyEnum.orderTeamSubsidyLink);
|
| | | c3.setType(ConfigCategoryEnum.helpStrategy);
|
| | | c3.setOrder(22);
|
| | | c3.setEditMode(1);
|
| | | service.addConfigCategory(c3);
|
| | | |
| | | |
| | | ConfigCategory c4 = new ConfigCategory();
|
| | | c4.setKeyEnum(ConfigKeyEnum.orderTeamRewardLink);
|
| | | c4.setType(ConfigCategoryEnum.helpStrategy);
|
| | | c4.setOrder(23);
|
| | | c4.setEditMode(1);
|
| | | service.addConfigCategory(c4);
|
| | | |
| | | ConfigCategory c5 = new ConfigCategory();
|
| | | c5.setKeyEnum(ConfigKeyEnum.tutorSubsidyLink);
|
| | | c5.setType(ConfigCategoryEnum.helpStrategy);
|
| | | c5.setOrder(24);
|
| | | c5.setEditMode(1);
|
| | | service.addConfigCategory(c5);
|
| | | |
| | | |
| | | ConfigCategory c6 = new ConfigCategory();
|
| | | c6.setKeyEnum(ConfigKeyEnum.adminMinSameGoodsOrderCount);
|
| | | c6.setType(ConfigCategoryEnum.extract);
|
| | | c6.setOrder(6);
|
| | | service.addConfigCategory(c6);*/
|
| | | |
| | | }
|
| | | }
|
| | |
| | | return datatime;
|
| | | }
|
| | |
|
| | | |
| | | public static long dateDiffMin(Date startTime, Date endTime) throws Exception {
|
| | | long nm = 1000 * 60;// 一分钟的毫秒数
|
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
|
| | |
|
| | | // 获得两个时间的毫秒时间差异
|
| | | long diff = endTime.getTime() - startTime.getTime();
|
| | | long day = diff / nd;// 计算差多少天
|
| | | long hour = diff % nd / nh;// 计算差多少小时
|
| | | long min = diff % nd % nh / nm + day * 24 * 60 + hour * 60;// 计算差多少分钟
|
| | | return min;
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 通过时间秒毫秒数判断两个时间的间隔
|
| | | *
|