| | |
| | | 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;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<Config> list = new ArrayList<>();
|
| | | 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) {
|
| | | list.add(config);
|
| | | category.setConfig(config);
|
| | | list.add(category);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
| | | 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()); |
| | |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | 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)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | 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); |
| | |
| | | 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()); |
| | |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | 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)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | 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); |
| | | } |
| | |
| | | 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.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;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 用户账户明细
|
| | | * |
| | | * @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("操作异常"));
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
| | | 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
|
| | | *
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 获取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;
|
| | | String school = "板栗学院";
|
| | | String platformSubsidy = "补贴返佣 ";
|
| | | String teamSubsidy = "会员专属";
|
| | | String teamReward = "超级会员专属";
|
| | | if (level == UserInviteLevelEnum.actived || level == UserInviteLevelEnum.noActive) {
|
| | | // TODO 比例
|
| | | school += "达人班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">52.5%</label>";
|
| | | |
| | | |
| | | 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) {
|
| | | |
| | | // TODO 比例
|
| | | school += "普通班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">60%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">7.5%</label>";
|
| | | |
| | | |
| | | 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) {
|
| | | school += "高级班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">70%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">15%</label>";
|
| | | |
| | | 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 比例
|
| | | school += "超级班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">115%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">22.5%</label>";
|
| | | teamReward = "超级会员专属最高<label style=\"color:#E5005C;\">40%</label>";
|
| | | |
| | | } 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);
|
| | | }
|
| | | |
| | | |
| | | 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("tearcherTip", "导师按钮:弹框内容");
|
| | | json.put("saveMoney", saveMoney);
|
| | | json.put("earnMoney", earnMoney);
|
| | | |
| | | // 已完成
|
| | | 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("platformSubsidy", platformSubsidy);
|
| | | json.put("school", school);
|
| | | json.put("teamSubsidy", teamSubsidy);
|
| | | json.put("teamReward", teamReward);
|
| | |
|
| | | // 人工客服链接
|
| | | 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.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;
|
| | |
| | | @Resource
|
| | | private ESOrderService esOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderTeamRewardService orderTeamRewardService;
|
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyServiceV2 inviteOrderSubsidyServiceV2;
|
| | |
|
| | | /**
|
| | | * 订单列表
|
| | |
| | |
|
| | | // 团队奖励 TODO
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | data.put("teamSubsidy", "999.66");
|
| | | data.put("teamReward", "777.66");
|
| | | data.put("tutorSubsidy", "888.66");
|
| | | 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-导师津贴
|
| | |
| | | type = 1;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("link", "https://www.baidu.com/");
|
| | | String total = "";
|
| | | if (type == 1) {
|
| | | total = "111.3";
|
| | | // 补贴
|
| | | sumTeamSubsidy(out, user);
|
| | | } else if (type == 2) {
|
| | | total = "222.3";
|
| | | } else if (type == 3) {
|
| | | total = "333.3";
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(total)) {
|
| | | data.put("exist", false);
|
| | | // 奖励
|
| | | sumTeamReward(out, user);
|
| | | } else {
|
| | | data.put("exist", true);
|
| | | data.put("portrait", user.getPortrait());
|
| | | |
| | | TeamBonusVO today = new TeamBonusVO("1.3", "2.3" ,"3.6");
|
| | | TeamBonusVO yesterday = new TeamBonusVO("1.3", "2.3" ,"3.6");
|
| | | TeamBonusVO thisMonth = new TeamBonusVO("1.3", "2.3" ,"3.6");
|
| | | TeamBonusVO lastMonth = new TeamBonusVO("1.3", "2.3" ,"3.6");
|
| | | data.put("total", total);
|
| | | data.put("direct", "655.36");
|
| | | data.put("indirect", "236.58");
|
| | | data.put("today", today);
|
| | | data.put("yesterday", yesterday);
|
| | | data.put("thisMonth", thisMonth);
|
| | | data.put("lastMonth", lastMonth);
|
| | | // 导师津贴
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("exist", false);
|
| | | data.put("link", configService.get(ConfigKeyEnum.tutorSubsidyLink.getKey()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | 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));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 返利说明
|
| | |
| | | |
| | | 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; |
| | |
| | | @Repository |
| | | public class ConfigCategoryDao extends MongodbBaseDao<ConfigCategory> { |
| | | |
| | | |
| | | /** |
| | | * 查询 |
| | | * |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | @Param("payment") BigDecimal payment);
|
| | |
|
| | |
|
| | | Long countOrderByUidAndSettled(@Param("uid") Long uid, @Param("limitTime") long limitTime,
|
| | | @Param("payment") BigDecimal payment);
|
| | | |
| | |
|
| | | /**
|
| | | * 注:1笔且付款总金额不小于 payment 元(退款为失效
|
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | 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);
|
| | | |
| | | } |
| | |
| | | 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);
|
| | | } |
| | |
| | | * @param date
|
| | | * @return
|
| | | */
|
| | | Long 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 |
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 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); |
| | | } |
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; |
| | | } |
| | | } |
| | |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | /** |
| | | * 每日订单统计 |
| | | * 每日订单统计 |
| | | * |
| | | * @author Administrator |
| | | * |
| | |
| | | |
| | | public enum DailyCountOrderEnum { |
| | | fanliOrderNum("返利订单数量"), |
| | | shareOrderNum("分享订单数量"), |
| | | shareOrderNum("分享订单数量"), |
| | | inviteOrderNum("邀请订单数量"), |
| | | |
| | | channelOrderNum24H("渠道订单统计数量24小时内"), |
| | | channelOrderNum("渠道订单统计数量"), |
| | | |
| | | channelOrderNum24H("渠道订单统计数量24小时内"), |
| | | channelOrderNum("渠道订单统计数量"), |
| | | channelOrderMoney("渠道订单统计金额"), |
| | | |
| | | weiQuanOrderNum("售后订单统计数量"), |
| | | |
| | | weiQuanOrderNum("售后订单统计数量"), |
| | | weiQuanOrderMoney("售后订单统计金额"), |
| | | |
| | | |
| | | tbOrderTrackRate("淘宝订单根据率"), |
| | | jdOrderTrackRate("京东订单根据率"), |
| | | jdOrderTrackRate("京东订单根据率"), |
| | | pddOrderTrackRate("拼多多订单根据率"), |
| | | |
| | | lastOrderUntreatedNum("订单找回未处理统计数量"), |
| | | lastOrderSucceedNum("订单找回成功统计数量"), |
| | | |
| | | lastOrderUntreatedNum("订单找回未处理统计数量"), |
| | | lastOrderSucceedNum("订单找回成功统计数量"), |
| | | lastOrderFailNum("订单找回失败统计数量"), |
| | | lastOrderSucceedMoney("订单找回成功统计金额"); |
| | | |
| | | private final String desc; |
| | | |
| | | |
| | | private DailyCountOrderEnum(String desc) { |
| | | this.desc = desc; |
| | | } |
| | |
| | | // 更新日期 |
| | | @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 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; |
| | | } |
| | | |
| | | } |
| | |
| | | // 日期:年月日 |
| | | @Field("day") |
| | | private Date day; |
| | | // 总数 |
| | | // 总数 -每日结果数据 |
| | | @Field("total") |
| | | private BigDecimal total; |
| | | // 类型 |
| | |
| | | // 更新日期 |
| | | @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; |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.springframework.data.mongodb.core.mapping.Field; |
| | | |
| | | import com.yeshi.fanli.entity.common.Config; |
| | | |
| | | /** |
| | | * 设置分类 |
| | | * |
| | |
| | | |
| | | public enum ConfigCategoryEnum { |
| | | versionDiff("标签栏引导提示"), |
| | | msgNotify("大图通知"), |
| | | tbGoods("淘宝商品"), |
| | | msgNotify("大图通知"), |
| | | tbGoods("淘宝商品"), |
| | | jdGoods("京东商品"), |
| | | pddGoods("拼多多商品"), |
| | | goldCoin("金币设置"), |
| | | freeCoupon("免单券设置"), |
| | | rebateCoupon("返利奖励券设置"), |
| | | rebateCoupon("返利奖励券设置"), |
| | | pageText("页面文本设置"), |
| | | protocol("协议相关"), |
| | | rule("规则相关"), |
| | | helpStrategy("帮助攻略相关"), |
| | | orderCart("订单购物车相关"), |
| | | orderCart("订单购物车相关"), |
| | | maskControl("遮罩控制"), |
| | | guanXuan("官宣任务"), |
| | | specialHelper("小助手"), |
| | | extract("提现相关"); |
| | | |
| | | private final String desc; |
| | |
| | | // 类型 |
| | | @Field("order") |
| | | private int order; |
| | | |
| | | // 编辑方式: 1 、普通文本 2、多行文本 3、单选框 |
| | | @Field("editMode") |
| | | private int editMode; |
| | | |
| | | private Config config; |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | evaluateEmojis("evaluate_emojis", "发圈评论Emojis"), |
| | | evaluateText("evaluate_text", "发圈评论文本"), |
| | | |
| | | |
| | | orderRebateDescLink("order_rebate_desc_link", "订单返利计算说明链接"), |
| | | orderTeamSubsidyLink("order_team_subsidy_link", "订单补贴帮助链接"), |
| | | orderTeamRewardLink("order_team_reward_link", "订单奖励帮助链接"), |
| | | tutorSubsidyLink("tutor_subsidy_link", "导师津贴帮助链接"), |
| | | ; |
| | | |
| | | private final String key; |
| | |
| | |
|
| | |
|
| | | <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 (
|
| | |
| | | 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>
|
| | |
| | | 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 |
| | | 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> |
| | | </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 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"> |
| | |
| | | <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="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> |
| | |
| | |
|
| | |
|
| | | <select id="countActiveNumByDate" resultType="Long">
|
| | | SELECT COUNT(dd.`uie_uid`) 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 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> |
| | | |
| | | |
| | | <select id="listByDay" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_info_register |
| | | WHERE TO_DAYS(regt_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.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> |
| | | |
| | | </mapper> |
| | |
| | | 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);
|
| | | }
|
| | |
| | |
|
| | | @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);
|
| | | }
|
| | |
| | | } |
| | | |
| | | @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 commonOrderCountMapper.countCommissionByDay(preDay); |
| | | } |
| | |
| | |
|
| | | @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 {
|
| | | public List<DailyCountOrder> getDailyCountList(String type, Date startTime, Date endTime, String channel)
|
| | | throws Exception {
|
| | | // 查询类型
|
| | | DailyCountOrderEnum typeEnum = getTypeEnum(type);
|
| | | if (typeEnum == null) {
|
| | |
| | |
|
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | |
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | DailyCountOrderEnum[] array = DailyCountOrderEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i];
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取枚举类型
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | |
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | return "";
|
| | | }
|
| | | |
| | |
|
| | | DailyCountOrderEnum[] array = DailyCountOrderEnum.values();
|
| | | for (int i = 0; i < array.length; i ++) {
|
| | | for (int i = 0; i < array.length; i++) {
|
| | | if (array[i].name().equals(name)) {
|
| | | return array[i].getDesc();
|
| | | }
|
| | |
| | | return "";
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 初始数据
|
| | | * |
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | |
| | | if (lastRecord != null) {
|
| | | lastDate = lastRecord.getUpdateDate();
|
| | | } else {
|
| | | lastDate = TimeUtil.parse("2017-05-06");
|
| | | lastDate = TimeUtil.parse("2018-01-20");
|
| | | }
|
| | |
|
| | | long min = DateUtil.dateDiffMin(lastDate, new Date());
|
| | | if (min <= 10) { // 10分钟以内不统计
|
| | | return;
|
| | | }
|
| | |
|
| | | Date today = new Date();
|
| | |
| | |
|
| | | /**
|
| | | * 统计订单数量
|
| | | * |
| | | * @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);
|
| | | 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<UserInfoRegister> listRegister = null;
|
| | | // 统计当日订单
|
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countValidOrderByDay(preDay);
|
| | | |
| | |
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | List<Long> listUid = new ArrayList<>();
|
| | | for (CountOrderDTO countOrderDTO: listOrder) {
|
| | | 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) {
|
| | | for (CountOrderDTO dto : listOrder) {
|
| | | Long orderUid = dto.getUid();
|
| | | if (orderUid == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | for (UserInfoRegister register: listRegister) {
|
| | |
|
| | | for (UserInfoRegister register : listRegister) {
|
| | | Long uid = register.getId();
|
| | | String vlaue =register.getChannel().getVlaue();
|
| | | String vlaue = register.getChannel();
|
| | | // 渠道 、用户id匹配
|
| | | if (channelVlaue.equalsIgnoreCase(vlaue) && uid.longValue() == orderUid.longValue()) {
|
| | | count ++;
|
| | | count++;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | |
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 统计新人24H内下单数量
|
| | | * |
| | | * @param preDay
|
| | | * @param 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) {
|
| | |
| | | count += total;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | |
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 统计渠道金额
|
| | | * |
| | | * @param preDay
|
| | | * @param typeEnum
|
| | | * @throws Exception
|
| | | */
|
| | | private void addChannelOrderMoney(String preDay, DailyCountOrderEnum typeEnum) throws Exception {
|
| | | List<UserInfoRegister> listRegister = null;
|
| | | 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) {
|
| | | 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) {
|
| | | for (CountOrderDTO dto : listOrder) {
|
| | | Long orderUid = dto.getUid();
|
| | | BigDecimal commission = dto.getCommission();
|
| | | if (commission != null || orderUid == null) {
|
| | | if (commission == null || orderUid == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | for (UserInfoRegister register: listRegister) {
|
| | |
|
| | | for (UserInfoRegister register : listRegister) {
|
| | | Long uid = register.getId();
|
| | | String vlaue =register.getChannel().getVlaue();
|
| | | 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);
|
| | |
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 统计维权订单数量
|
| | | * |
| | | * @param preDay
|
| | | * @param 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.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询维权金额
|
| | | * |
| | | * @param preDay
|
| | | * @param 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.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.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.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.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.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.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());
|
| | |
| | |
|
| | | /**
|
| | | * 统计申诉订单未处理数量
|
| | | * |
| | | * @param preDay
|
| | | * @param 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.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计申诉订单 处理失败
|
| | | * |
| | | * @param preDay
|
| | | * @param 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.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计申诉订单 处理成功
|
| | | * |
| | | * @param preDay
|
| | | * @param 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.setId(StringUtil.Md5(preDay + typeEnum.name()));
|
| | | dailyCountOrderDao.save(obj);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 订单找回成功统计金额
|
| | | * |
| | | * @param preDay
|
| | | * @throws Exception
|
| | | */
|
| | |
| | | BigDecimal money = lostOrderService.countAppealMoney(preDay);
|
| | | if (money == null)
|
| | | money = new BigDecimal("0");
|
| | | |
| | |
|
| | | DailyCountOrder obj = new DailyCountOrder();
|
| | | obj.setTotal(money);
|
| | | obj.setType(typeEnum);
|
| | |
| | | package com.yeshi.fanli.service.impl.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | } 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++) {
|
| | |
| | | ChannelEnum[] channels = ChannelEnum.values();
|
| | | for (int i = 0; i < channels.length; i++) {
|
| | | Long count = userInfoRegisterService.countByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | if (count != null) {
|
| | | total = new BigDecimal(total.toString());
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | | DailyCountUser obj = new DailyCountUser();
|
| | | obj.setTotal(total);
|
| | | obj.setTotal(BigDecimal.valueOf(count));
|
| | | obj.setType(typeEnum);
|
| | | obj.setChannel(channels[i].name());
|
| | | obj.setUpdateDate(new Date());
|
| | |
| | | */
|
| | | private void addNewUserDownOrderDay(String preDay, DailyCountUserEnum typeEnum) throws Exception {
|
| | | // 统计当日有效订单
|
| | | List<CountOrderDTO> listOrder = commonOrderCountService.countValidOrderByDay(preDay);
|
| | | 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();
|
| | |
|
| | | long totalUser = 0;
|
| | | long totalUserDown = 0;
|
| | | if (listOrder != null && listOrder.size() > 0) {
|
| | | // 查询该渠道当日注册用户
|
| | | List<UserInfoRegister> listRegister = userInfoRegisterService.listByChannelAndDay(channels[i].getVlaue(), preDay);
|
| | | if (listRegister != null && listRegister.size() > 0) {
|
| | | totalUser = listRegister.size();
|
| | | if (listOrder != null && listOrder.size() > 0 && listRegister != null && listRegister.size() > 0) {
|
| | | for (UserInfoRegister register: listRegister) {
|
| | | String channel = register.getChannel();
|
| | | if (channelName.equalsIgnoreCase(channel)) {
|
| | | totalDay ++ ;
|
| | | }
|
| | |
|
| | | // 循环统计是否存在用户下单
|
| | | for (UserInfoRegister userInfoRegister: listRegister) {
|
| | | Long id = userInfoRegister.getId();
|
| | | for (CountOrderDTO dto: listOrder) {
|
| | | if (dto.getUid() != null && dto.getUid().longValue() == id.longValue()) {
|
| | | totalUserDown ++;
|
| | | break;
|
| | | }
|
| | | Long id = register.getId();
|
| | | // 判断当前用户是否今日下单
|
| | | for (Long uid: listOrder) {
|
| | | if (uid.longValue() == id.longValue()) {
|
| | | totalValid ++;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | // 计算比例: 下单用户数/新增用户数
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | if (totalUser > 0 && totalUserDown > 0) {
|
| | | total = MoneyBigDecimalUtil.div(BigDecimal.valueOf(totalUserDown),BigDecimal.valueOf(totalUser));
|
| | | 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());
|
| | |
| | | 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) {
|
| | | Integer total = commonOrderCountService.countOderByUidAndDate(limitDay, user.getId());
|
| | | if (total != null && total > 0) {
|
| | | totalWeek ++;
|
| | | 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);
|
| | |
| | | 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());
|
| | |
| | | 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());
|
| | |
| | | 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) {
|
| | |
| | | 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()) {
|
| | |
| | | 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 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;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | } |
| | | |
| | | // 2.1显示返利说明连接> |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 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); |
| | |
| | | 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);
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
| | | 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());
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoRegisterService;
|
| | | import com.yeshi.fanli.util.user.ChannelEnumUtil;
|
| | |
|
| | | @Service
|
| | | public class UserActiveLogServiceImpl implements UserActiveLogService {
|
| | |
| | | UserInfoRegister register = new UserInfoRegister();
|
| | | register.setId(userActiveLog.getUid());
|
| | | register.setIp(userActiveLog.getIp());
|
| | | register.setChannel(ChannelEnumUtil.getChannelEnum(userActiveLog.getChannel()));
|
| | | register.setChannel(userActiveLog.getChannel());
|
| | | register.setDevice(userActiveLog.getDevice());
|
| | | userInfoRegisterService.addRegisterInfo(register);
|
| | | } catch (Exception e) {
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public long count90DaysLaterActiveNum(String date){
|
| | | Long count = userActiveLogMapper.countActiveNumByDate(date);
|
| | | public long count90DaysLaterActiveNum(String preDay){
|
| | | Long count = userActiveLogMapper.countActiveNumByDate(preDay);
|
| | | if (count == null) {
|
| | | count = 0L;
|
| | | }
|
| | |
| | |
|
| | | 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 {
|
| | |
| | | if (info != null)
|
| | | return;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(record.getChannel())) {
|
| | | record.setChannel(ChannelEnum.unknown.getVlaue());
|
| | | }
|
| | | |
| | | record.setCreateTime(new Date());
|
| | | userInfoRegisterMapper.insertSelective(record);
|
| | | }
|
| | |
| | | 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) {
|
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 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
|
| | | */
|
| | | private void addNumFirst(Long uid) {
|
| | | UserInviteValidNum inviteValid = userInviteValidNumMapper.selectForUpdate(uid);
|
| | | if (inviteValid != null) {
|
| | | userInviteValidNumMapper.addNumFirst(uid, 1);
|
| | | } else {
|
| | | inviteValid = new UserInviteValidNum();
|
| | | inviteValid.setNumFirst(1);
|
| | | inviteValid.setNumSecond(0);
|
| | | inviteValid.setUpdateTime(new Date());
|
| | | userInviteValidNumMapper.insertSelective(inviteValid);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 间接粉丝 +1
|
| | | * @param uid
|
| | | */
|
| | | private void addNumSecond(Long uid) {
|
| | | UserInviteValidNum inviteValid = userInviteValidNumMapper.selectForUpdate(uid);
|
| | | if (inviteValid != null) {
|
| | | userInviteValidNumMapper.addNumSecond(uid, 1);
|
| | | } else {
|
| | | inviteValid = new UserInviteValidNum();
|
| | | inviteValid.setNumFirst(0);
|
| | | inviteValid.setNumSecond(1);
|
| | | inviteValid.setUpdateTime(new Date());
|
| | | userInviteValidNumMapper.insertSelective(inviteValid);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | 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 + "#" + bossId + "#" + UserInviteValidRecord.TYPE_TWO);
|
| | | UserInviteValidRecord recordSuper = userInviteValidRecordMapper.selectByUniqueKey(uniqueKeySuper);
|
| | | if (recordSuper == null) {
|
| | | recordSuper = new UserInviteValidRecord();
|
| | | recordSuper.setUid(bossIdSuper);
|
| | | recordSuper.setWorkerId(bossId);
|
| | | recordSuper.setType(UserInviteValidRecord.TYPE_TWO);
|
| | | recordSuper.setUniqueKey(uniqueKeySuper);
|
| | | recordSuper.setCreateTime(new Date());
|
| | | userInviteValidRecordMapper.insertSelective(recordSuper);
|
| | | |
| | | // 更新上上级的间接粉丝数量
|
| | | addNumSecond(bossIdSuper);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | |
| | | 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.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | |
| | | userInviteSeparateService.updateStateByWorkerIdAndBossId(uid, bossId, UserInviteSeparate.STATE_INVALID);
|
| | |
|
| | | // 限制时间
|
| | | int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | | UserInviteSeparate inviteSeparate = new UserInviteSeparate();
|
| | | inviteSeparate.setBossId(bossId);
|
| | | inviteSeparate.setWorkerId(uid);
|
| | |
| | | // 脱离邀请关系
|
| | | threeSaleSerivce.inviteSeparate(workerId, bossId);
|
| | |
|
| | | int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey()));
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | | // 消息
|
| | | UserInfo userInfo = userInfoService.selectByPKey(workerId);
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | |
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | |
|
| | | 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 (countZiGou >= limitZiGou || countShare >= limitShare || (firstTeam >= limitFirst && secondTeam >= limitSecond)) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | 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.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | | |
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | 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) {
|
| | |
| | | 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) {
|
| | |
| | | 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 {
|
| | |
| | | * @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 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);
|
| | |
|
| | | }
|
| | |
| | | |
| | | |
| | | 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); |
| | | } |
| | |
| | | * @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);
|
| | | }
|
| | |
| | | * @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);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void addRegisterInfo(UserInfoRegister record);
|
| | |
|
| | | public List<UserInfoRegister> listByDay(String preDay);
|
| | |
|
| | | }
|
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);
|
| | |
|
| | | |
| | | }
|
| | |
| | | // 订单实付款
|
| | | 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;
|
| | | |
| | | // // 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";
|
| | |
| | | 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;
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 通过时间秒毫秒数判断两个时间的间隔
|
| | | *
|