| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.dto.money.AccountDetails;
|
| | | import com.yeshi.fanli.entity.admin.UserInfoAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.ScanHistory;
|
| | | import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.PidOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | import com.yeshi.fanli.util.HongBaoUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | private PidOrderService pidOrderService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private BindingAccountService bindingAccountService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private UserRankService userRankService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @RequestMapping(value = "getUserList", method = RequestMethod.POST)
|
| | | public void getUserList(int pageIndex, String key, PrintWriter out) {
|
| | |
| | | long loseUser = userInfoCountService.countLoseUser(180);
|
| | | // 累计有购买用户数
|
| | | long orderUser = userInfoCountService.countHasOrderUser();
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | // 总数-普通用户
|
| | | long countNormal = 0;
|
| | | // 总数-铜用户
|
| | |
| | | long countSilver = 0;
|
| | | // 总数-金用户
|
| | | long countGold = 0;
|
| | | |
| | |
|
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank != null && listRank.size() > 0) {
|
| | | for (UserRank userRank: listRank) {
|
| | | for (UserRank userRank : listRank) {
|
| | | Long id = userRank.getId();
|
| | | String name = userRank.getName();
|
| | | if ("青铜".equals(name)) {
|
| | | continue; |
| | | } |
| | | |
| | | continue;
|
| | | }
|
| | |
|
| | | long count = userInfoExtraService.countByRankId(id);
|
| | | if ("白银".equals(name)) {
|
| | | countCuprum = count;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 普通用户计算
|
| | | countNormal = totalUser - (countCuprum + countSilver + countGold);
|
| | | |
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("totalUser", totalUser);
|
| | | data.put("loseUser", loseUser);
|
| | |
| | | * data.put("countTotalMoney", countTotalMoney);
|
| | | * data.put("countCanAssets", countCanAssets);
|
| | | */
|
| | |
|
| | | |
| | |
|
| | | // 今日新增用户数量
|
| | | long todayUser = userInfoCountService.countNewUser(1, null);
|
| | |
| | |
|
| | | try {
|
| | |
|
| | | List<AccountDetails> detailsList = accountDetailsService.findAccountDetailsList(uid, pageIndex);
|
| | | if (detailsList == null || detailsList.size() == 0) {
|
| | | List<UserMoneyDetail> userMoneyDetailsList = userMoneyDetailService.listByUidWithState(uid, pageIndex,
|
| | | pageSize);
|
| | | if (userMoneyDetailsList == null || userMoneyDetailsList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | int count = accountDetailsService.getCount(uid);
|
| | | List<AccountDetails> detailList = new ArrayList<>();
|
| | | for (UserMoneyDetail detail : userMoneyDetailsList)
|
| | | detailList.add(AccountDetailsFactory.create(detail));
|
| | |
|
| | | long count = userMoneyDetailService.countByUidWithState(uid);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", GsonUtil.toJsonExpose(detailsList));
|
| | | data.put("result_list", GsonUtil.toJsonExpose(detailList));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareGoodsActivityOrderService shareGoodsActivityOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
| | | return;
|
| | | }
|
| | | System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | // 淘特价
|
| | | if (system.getId() == 7) {
|
| | | system = systemService.getSystem("ANDROID", Constant.systemCommonConfig.getAndroidPackageName());
|
| | | }
|
| | |
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | // 用户已经登录
|
| | | if (!StringUtil.isNullOrEmpty(uid) && Long.parseLong(uid) > 0) {
|
| | | TBPid tbPid = null;
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_ANDROID);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | }
|
| | |
|
| | | } else {
|
| | | tbPid = tbPidService.getTBPid(Long.parseLong(uid), PidUser.TYPE_FANLI_IOS);
|
| | | if (tbPid != null) {
|
| | | String siteId = tbPid.getPid().split("_")[2];
|
| | | String adzoneId = tbPid.getPid().split("_")[3];
|
| | | TaoBaoUnionConfig config = taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | clientTBPid = new ClientTBPid(config.getAppKey(), tbPid.getPid(), siteId, adzoneId);
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android"))
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | else
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | // 获取会员推广位或者默认推广位
|
| | |
|
| | | TaoBaoGoodsBrief simpleGoods = null;
|
| | | try {
|
| | | simpleGoods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
|
| | | } catch (NumberFormatException e2) {
|
| | | e2.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | |
|
| | | if (simpleGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 获取淘客参数
|
| | | ClientTBPid clientTBPid = null;
|
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
|
| | | String pid = Constant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | | clientTBPid = new ClientTBPid(Constant.TAOBAO_AUTH_APPKEY, Constant.TAOBAO_AUTH_APPSECRET,
|
| | | pid.split("_")[2], pid.split("_")[3]);
|
| | | } else {
|
| | | if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | } else {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | }
|
| | | }
|
| | | |
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | |
| | | listswiper = swiperPictureService.getByBannerCard(swiperCard);
|
| | |
|
| | | if (listswiper == null) {
|
| | | listswiper = new ArrayList<SwiperPicture>();
|
| | | listswiper = new ArrayList<SwiperPicture>();
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | // 其他专题
|
| | | specialList.add(special);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | |
| | |
|
| | | root.put("banner", JsonUtil.getApiCommonGson().toJson(listswiper));
|
| | | root.put("honest", JsonUtil.getApiCommonGson().toJson(honestList));
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(specialList));
|
| | | root.put("miaoSha", msJSON);
|
| | | |
| | |
|
| | | // 增加邀请有奖
|
| | | JSONObject invite = new JSONObject();
|
| | |
| | | * @param acceptData
|
| | | * @param id
|
| | | * @param uid
|
| | | * @param pageSource 页面来源
|
| | | * @param pageSource
|
| | | * 页面来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getgoodsinfo", method = RequestMethod.POST)
|
| | |
| | |
|
| | | // 领券人列表
|
| | | List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
|
| | | |
| | |
|
| | | String hongBao = null;
|
| | | |
| | |
|
| | | // 获取券信息
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
|
| | | JSONObject couponInfo = new JSONObject();
|
| | | couponInfo.put("couponPrice", quanPrice.toString());
|
| | | |
| | |
|
| | | if (from != null && from.equals("miandan")) {
|
| | | // 免单商品
|
| | | hongBao = "¥" + quanPrice.toString();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 服务端转链
|
| | | if (convertInServer && !StringUtil.isNullOrEmpty(tb.getCouponLink())) {
|
| | | couponInfo.put("couponUrl", tb.getCouponLink());
|
| | |
| | | listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 红包
|
| | | if (hongBao == null) {
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | hongBao = TaoBaoUtil.getGoodsHongBaoInfo(tb, proportion);
|
| | | }
|
| | | goods.put("hongBao", hongBao);
|
| | | |
| | |
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | |
|
| | | String jumpUrl = "https://item.taobao.com/item.htm?id=" + tb.getAuctionId();
|
| | |
| | | data.put("couponUsers", listCouponUser);
|
| | | data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id);
|
| | |
|
| | | |
| | | // 取消分享活动
|
| | | // if (!StringUtil.isNullOrEmpty(uid)
|
| | | // && shareGoodsActivityOrderService.countShareGoodsActivityOrder(Long.parseLong(uid)) > 0) {
|
| | | // } else if(!"miandan".equals(from)) {
|
| | | // // 非免单商品
|
| | | // JSONObject shareActivity = new JSONObject();
|
| | | // shareActivity.put("moneyDesc", "春节狂欢奖金:¥" + TaoBaoUtil.getGoodsHongBaoMoney(tb,
|
| | | // new BigDecimal(hongBaoManageService.get("share_activity_proportion"))));
|
| | | // shareActivity.put("ruleDescPicture", "http://img.flqapp.com/resource/share_activity_img.png");
|
| | | // |
| | | // data.put("shareActivity", shareActivity);
|
| | | // } |
| | | |
| | | // 取消分享活动
|
| | | // if (!StringUtil.isNullOrEmpty(uid)
|
| | | // &&
|
| | | // shareGoodsActivityOrderService.countShareGoodsActivityOrder(Long.parseLong(uid))
|
| | | // > 0) {
|
| | | // } else if(!"miandan".equals(from)) {
|
| | | // // 非免单商品
|
| | | // JSONObject shareActivity = new JSONObject();
|
| | | // shareActivity.put("moneyDesc", "春节狂欢奖金:¥" +
|
| | | // TaoBaoUtil.getGoodsHongBaoMoney(tb,
|
| | | // new
|
| | | // BigDecimal(hongBaoManageService.get("share_activity_proportion"))));
|
| | | // shareActivity.put("ruleDescPicture",
|
| | | // "http://img.flqapp.com/resource/share_activity_img.png");
|
| | | //
|
| | | // data.put("shareActivity", shareActivity);
|
| | | // }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final String tempUid = uid;
|
| | |
| | | JSONObject root = new JSONObject();
|
| | | root.put("special", JsonUtil.getApiCommonGson().toJson(listSpecial));
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.dto.money.AccountDetails;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | |
| | | }
|
| | |
|
| | | data.put("moduleState", mySettings);
|
| | | |
| | |
|
| | | int welfareCenterNews = 0;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(user.getId());
|
| | | if (userInfoExtra != null && userInfoExtra.getCouponNews() != null) {
|
| | | welfareCenterNews = userInfoExtra.getCouponNews();
|
| | | }
|
| | | data.put("welfareCenterNews", welfareCenterNews);
|
| | | |
| | | |
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | final UserInfo uuser = user;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | |
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.money;
|
| | |
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Transient;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
|
| | | public class AccountDetails {
|
| | |
|
| | | public AccountDetails(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public AccountDetails() {
|
| | | }
|
| | |
|
| | | private Long id;
|
| | |
|
| | | private UserInfo userInfo;
|
| | |
|
| | | private Integer type;
|
| | |
|
| | | @Expose
|
| | | private String money;
|
| | |
|
| | | @Expose
|
| | | private String title;
|
| | |
|
| | | private Extract extract;
|
| | |
|
| | | @Expose
|
| | | private String createTime;
|
| | |
|
| | | private Integer state;
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserInfo getUserInfo() {
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | public void setUserInfo(UserInfo userInfo) {
|
| | | this.userInfo = userInfo;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public String getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(String money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public Extract getExtract() {
|
| | | return extract;
|
| | | }
|
| | |
|
| | | public void setExtract(Extract extract) {
|
| | | this.extract = extract;
|
| | | }
|
| | |
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | } |
| | |
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | |
|
| | | /**
|
| | |
| | | @Column(name = "ahm_hongbao_id")
|
| | | private HongBao hongBao;
|
| | | @Column(name = "ahm_account_details_id")
|
| | | private AccountDetails accountDetails;
|
| | | private UserMoneyDetail userMoneyDetail;
|
| | | @Column(name = "ahm_createtime")
|
| | | private Date createTime;
|
| | | @Column(name = "ahm_updatetime")
|
| | |
| | | this.hongBao = hongBao;
|
| | | }
|
| | |
|
| | | public AccountDetails getAccountDetails() {
|
| | | return accountDetails;
|
| | | }
|
| | |
|
| | | public void setAccountDetails(AccountDetails accountDetails) {
|
| | | this.accountDetails = accountDetails;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public UserMoneyDetail getUserMoneyDetail() {
|
| | | return userMoneyDetail;
|
| | | }
|
| | |
|
| | | public void setUserMoneyDetail(UserMoneyDetail userMoneyDetail) {
|
| | | this.userMoneyDetail = userMoneyDetail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Table("yeshi_ec_user_money_detail")
|
| | | public class UserMoneyDetail {
|
| | |
|
| | | public UserMoneyDetail(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | | public UserMoneyDetail() {
|
| | | }
|
| | |
|
| | | public enum UserMoneyDetailTypeEnum {
|
| | | share("分享奖金", "http://img.flqapp.com/resource/money_detail/icon_share.png", ""), invite("邀请奖金", "http://img.flqapp.com/resource/money_detail/icon_invite.png", ""), inviteAndShare("奖金收入", "http://img.flqapp.com/resource/money_detail/icon_share.png", ""), fanli("返利到账", "http://img.flqapp.com/resource/money_detail/icon_fanli.png",
|
| | | ""), fanliWeiQuan("返利扣除", "http://img.flqapp.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), inviteWeiQuan("邀请奖金扣除", "http://img.flqapp.com/resource/money_detail/icon_invite.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), shareWeiQuan("分享奖金扣除", "http://img.flqapp.com/resource/money_detail/icon_share.png",
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.TaoBaoOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.DataMonitorService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBao110Util;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | |
|
| | |
| | | <id column="ahm_hongbao_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="accountDetails" column="ahm_account_details_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.AccountDetails"> |
| | | <association property="userMoneyDetail" column="ahm_account_details_id" |
| | | javaType="com.yeshi.fanli.entity.money.UserMoneyDetail"> |
| | | <id column="ahm_account_details_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | |
| | | yeshi_ec_account_details_hongbao_map |
| | | (ahm_id,ahm_hongbao_id,ahm_account_details_id,ahm_createtime,ahm_updatetime) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{accountDetails.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{userMoneyDetail.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap" |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ahm_id,</if> |
| | | <if test="hongBao != null">ahm_hongbao_id,</if> |
| | | <if test="accountDetails != null">ahm_account_details_id,</if> |
| | | <if test="userMoneyDetail != null">ahm_account_details_id,</if> |
| | | <if test="createTime != null">ahm_createtime,</if> |
| | | <if test="updateTime != null">ahm_updatetime,</if> |
| | | </trim> |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if> |
| | | <if test="accountDetails != null">#{accountDetails.id,jdbcType=BIGINT},</if> |
| | | <if test="userMoneyDetail != null">#{userMoneyDetail.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | |
| | | parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap">update yeshi_ec_account_details_hongbao_map set |
| | | ahm_hongbao_id = #{hongBao.id,jdbcType=BIGINT},ahm_account_details_id |
| | | = |
| | | #{accountDetails.id,jdbcType=BIGINT},ahm_createtime = |
| | | #{userMoneyDetail.id,jdbcType=BIGINT},ahm_createtime = |
| | | #{createTime,jdbcType=TIMESTAMP},ahm_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} where ahm_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | update yeshi_ec_account_details_hongbao_map |
| | | <set> |
| | | <if test="hongBao != null">ahm_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if> |
| | | <if test="accountDetails != null">ahm_account_details_id=#{accountDetails.id,jdbcType=BIGINT}, |
| | | <if test="userMoneyDetail != null">ahm_account_details_id=#{userMoneyDetail.id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null">ahm_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">ahm_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.money.AccountDetailHongBaoMapMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | // 保存账户明细与红包的关系
|
| | | AccountDetailHongBaoMap map = new AccountDetailHongBaoMap();
|
| | | map.setAccountDetails(new AccountDetails(accountDetailsId));
|
| | | map.setUserMoneyDetail(new UserMoneyDetail(accountDetailsId));
|
| | | map.setCreateTime(new Date());
|
| | | map.setHongBao(new HongBao(hongBaoId));
|
| | | map.setUpdateTime(new Date());
|
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | import org.hibernate.Query;
|
| | | import org.hibernate.SQLQuery;
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.hongbao.HongBaoDao;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.ConfigMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.entity.admin.OrderAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoExtra;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.MoneyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.AccountMessageFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.push.XiaoMiPushUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class HongBaoServiceImpl implements HongBaoService {
|
| | |
| | | private ThreeSaleGiftService threeSaleGiftService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
| | | @Resource
|
| | |
| | | private OrderItemServcie orderItemService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | |
| | | MoneyRecord moneyRecord = new MoneyRecord(form, hongBao, new BigDecimal(money), "新人红包", "",
|
| | | System.currentTimeMillis(), 1);
|
| | | moneyRecordService.addMoneyRecord(moneyRecord);
|
| | | AccountDetails ac = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.XINREN, null, null, form);
|
| | |
|
| | | AccountMessage am = AccountMessageFactory.create(form, null, new BigDecimal(money),
|
| | | AccountMessageFactory.NEWUSER);
|
| | | accountDetailsService.save(ac);
|
| | | accountMessageService.save(am);
|
| | | userInfoService.addMoney(form, new BigDecimal(money));
|
| | | com.yeshi.fanli.entity.system.System system = form.getSystem();
|
| | |
| | | System.currentTimeMillis(), 1);
|
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | |
|
| | | AccountDetails ac = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.XINREN, null, null, form);
|
| | | accountDetailsMapper.insertSelective(ac);
|
| | | // 新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createNewerHongBao(hongBao);
|
| | | userMoneyDetail.setId(ac.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | |
| | | MoneyRecord moneyRecord = new MoneyRecord(find.getUserInfo(), find, find.getMoney(),
|
| | | hongBaoExtra.getTitle(), "", currentTimeMillis, 1);
|
| | | moneyRecordService.addMoneyRecord(moneyRecord);
|
| | | AccountDetails ad = AccountDetailsFactory.create(find, orderItem);
|
| | | AccountMessage am = AccountMessageFactory.create(find);
|
| | | accountDetailsService.save(ad);
|
| | | accountMessageService.save(am);
|
| | | return hongBaoExtra;
|
| | | }
|
| | |
| | | userInfoMapper.subHongBaoByUid(user.getId(), hb.getMoney());
|
| | | // 添加账目明细
|
| | | if (hb.getOrderItemId() != null) {
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + hb.getMoney(),
|
| | | AccountDetailsFactory.TUIKUAN, new OrderItem(hb.getOrderItemId()), null,
|
| | | hb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | }
|
| | |
|
| | | // 添加账户消息
|
| | |
| | | MoneyRecord moneyRecord = new MoneyRecord(hb.getUserInfo(), hb, hb.getMoney(),
|
| | | hongBaoExtra.getTitle(), "", currentTimeMillis, 1);
|
| | | moneyRecordService.addMoneyRecord(moneyRecord);
|
| | | AccountDetails ad = AccountDetailsFactory.create(hb, null);
|
| | | AccountMessage am = AccountMessageFactory.create(hb);
|
| | | accountDetailsService.save(ad);
|
| | | accountMessageService.save(am);
|
| | | }
|
| | | return null;
|
| | |
| | | System.out.println("订单:" + order);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalTiChengMoney(Long uid) {
|
| | |
|
| | |
| | | return hongBaoMapper.getTotalTiChengCount(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception{
|
| | | public List<Map<String, Object>> count24HOderByChannel(String channel, Integer type, String years, String startTime,
|
| | | String endTime) throws Exception {
|
| | | return hongBaoMapper.count24HOderByChannel(channel, type, years, startTime, endTime);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<Map<String, Object>> countHistoryOderByChannel(String channel, Integer type, String years,
|
| | | String startTime, String endTime) throws Exception{
|
| | | |
| | | return hongBaoMapper.countHistoryOderByChannel(channel, type, years, |
| | | startTime, endTime);
|
| | | String startTime, String endTime) throws Exception {
|
| | |
|
| | | return hongBaoMapper.countHistoryOderByChannel(channel, type, years, startTime, endTime);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public List<Object> dayFactory(String startTime, String endTime, List<Map<String, Object>> list) throws Exception {
|
| | | |
| | |
|
| | | List<Object> listObject = new ArrayList<Object>();
|
| | | |
| | |
|
| | | if (startTime.equals(endTime)) {
|
| | | |
| | |
|
| | | Map<String, Object> map = list.get(0);
|
| | | Object payMoney = map.get("payMoney");
|
| | | Object countOrder = map.get("countOrder");
|
| | | Object commision = map.get("commision");
|
| | | |
| | |
|
| | | if (payMoney == null) {
|
| | | map.put("payMoney", 0);
|
| | | }
|
| | |
| | | listObject.add(map);
|
| | | return listObject;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | String plusDay = "";
|
| | | for (int i = 0; i < 1000 ; i++) {
|
| | | for (int i = 0; i < 1000; i++) {
|
| | | if (i == 0) {
|
| | | plusDay = startTime;
|
| | | } else {
|
| | | plusDay = DateUtil.plusDay(i, startTime);
|
| | | }
|
| | | |
| | |
|
| | | Map<String, Object> mapObject = new HashMap<String, Object>();
|
| | | Object payMoney = null;
|
| | | Object countOrder = null;
|
| | | Object commision = null; |
| | | |
| | | Object commision = null;
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | Map<String, Object> map = list.get(j);
|
| | | Object createDate = map.get("showDate");
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (payMoney == null) {
|
| | | payMoney = 0;
|
| | | }
|
| | | mapObject.put("payMoney", payMoney);
|
| | | |
| | |
|
| | | if (countOrder == null) {
|
| | | countOrder = 0;
|
| | | }
|
| | | mapObject.put("countOrder", countOrder);
|
| | | |
| | |
|
| | | if (commision == null) {
|
| | | commision = 0;
|
| | | commision = 0;
|
| | | }
|
| | | mapObject.put("commision", commision);
|
| | | |
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd");
|
| | | Date parseDate = sdf.parse(plusDay.toString());
|
| | | |
| | |
|
| | | mapObject.put("showDate", sdf2.format(parseDate));
|
| | | |
| | |
|
| | | listObject.add(mapObject);
|
| | | |
| | |
|
| | | if (plusDay.equals(endTime)) {
|
| | | break; // 时间结束
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return listObject;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public List<Object> monthFactory(List<Map<String, Object>> list) {
|
| | | |
| | |
|
| | | List<Object> listObject = new ArrayList<Object>();
|
| | | // 12 个月处理
|
| | | for (int i = 1; i <= 12; i++) {
|
| | | Map<String, Object> mapObject = new HashMap<String, Object>();
|
| | | Object payMoney = null;
|
| | | Object countOrder = null;
|
| | | Object commision = null; |
| | | |
| | | Object commision = null;
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | Map<String, Object> map = list.get(j);
|
| | | Object createDate = map.get("showDate");
|
| | | String month = createDate.toString();
|
| | | if ((i+"").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
|
| | | if ((i + "").equalsIgnoreCase(month) || i == Integer.parseInt(month)) {
|
| | | payMoney = map.get("payMoney");
|
| | | countOrder = map.get("countOrder");
|
| | | commision = map.get("commision");
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (payMoney == null) {
|
| | | payMoney = 0;
|
| | | }
|
| | | mapObject.put("payMoney", payMoney);
|
| | | |
| | |
|
| | | if (countOrder == null) {
|
| | | countOrder = 0;
|
| | | }
|
| | | mapObject.put("countOrder", countOrder);
|
| | | |
| | |
|
| | | if (commision == null) {
|
| | | commision = 0;
|
| | | commision = 0;
|
| | | }
|
| | | mapObject.put("commision", commision);
|
| | | |
| | |
|
| | | mapObject.put("showDate", i + "月");
|
| | | |
| | |
|
| | | listObject.add(mapObject);
|
| | | }
|
| | | return listObject;
|
| | | }
|
| | | |
| | |
|
| | | public List<Object> yearFactory(List<Map<String, Object>> list) {
|
| | | |
| | |
|
| | | List<Object> listObject = new ArrayList<Object>();
|
| | | |
| | |
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Map<String, Object> map = list.get(i);
|
| | | Object payMoney = map.get("payMoney");
|
| | | Object countOrder = map.get("countOrder");
|
| | | Object commision = map.get("commision"); |
| | | |
| | | Object payMoney = map.get("payMoney");
|
| | | Object countOrder = map.get("countOrder");
|
| | | Object commision = map.get("commision");
|
| | |
|
| | | if (payMoney == null) {
|
| | | payMoney = 0;
|
| | | }
|
| | | map.put("payMoney", payMoney);
|
| | | |
| | |
|
| | | if (countOrder == null) {
|
| | | countOrder = 0;
|
| | | }
|
| | | map.put("countOrder", countOrder);
|
| | | |
| | |
|
| | | if (commision == null) {
|
| | | commision = 0;
|
| | | commision = 0;
|
| | | }
|
| | | map.put("commision", commision);
|
| | | |
| | |
|
| | | listObject.add(map);
|
| | | }
|
| | | |
| | |
|
| | | return listObject;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.MoneyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
| | | import org.springframework.transaction.annotation.Propagation;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.share.PidUserMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageMapper hongBaoManageMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | |
| | | // 将自己添加到用户
|
| | | Long uid = its.next();
|
| | | BigDecimal money = userMoney.get(uid);
|
| | | |
| | |
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.FANLI, null,
|
| | | null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = null;
|
| | | // 插入新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(uid,
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), null,
|
| | | money);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | userMoneyDetail = UserMoneyDetailFactory.createFanLi(uid, hongBaoOrder.getCommonOrder().getOrderNo(),
|
| | | hongBaoOrder.getCommonOrder().getSourceType(), null, money);
|
| | |
|
| | | } catch (UserMoneyDetailException e1) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e1,"订单号:"+hongBaoOrder.getCommonOrder().getOrderNo(),"");
|
| | | LogHelper.errorDetailInfo(e1, "订单号:" + hongBaoOrder.getCommonOrder().getOrderNo(), "");
|
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | // 添加资金明细与红包的映射关系
|
| | | for (HongBaoV2 v2 : userHongBao.get(uid)) {
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), accountDetails.getId());
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), userMoneyDetail.getId());
|
| | | }
|
| | | //增加用户资金
|
| | | // 增加用户资金
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | |
|
| | | // 站内信+推送
|
| | |
| | | // 邀请赚到账
|
| | | if (invitemoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, invitemoney);
|
| | | // 添加记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + invitemoney,
|
| | | AccountDetailsFactory.TICHENG, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | |
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, (int) validCount,
|
| | | (int) weiQuanCount, (int) invalidCount, invitemoney, new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, userMoneyDetail.getId());
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 记录返利红包与资金详情的对应关系
|
| | |
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, accountDetails.getId());
|
| | |
|
| | | // 发送推送
|
| | | try {
|
| | |
| | |
|
| | | if (sharemoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, sharemoney);
|
| | | // 添加记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + sharemoney,
|
| | | AccountDetailsFactory.SHARE_GOODS, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | | // 计算本月的有效订单,失效订单,维权订单
|
| | |
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, (int) validCount,
|
| | | (int) weiQuanCount, (int) invalidCount, sharemoney, new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, userMoneyDetail.getId());
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | // 记录返利红包与资金详情的对应关系
|
| | |
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, accountDetails.getId());
|
| | |
|
| | | // 发送推送
|
| | | try {
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.PidOrderMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.share.PidUserMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.order.PidOrderDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoManage;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | |
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 处理退款
|
| | | userInfoMapper.subHongBaoByUid(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | | // 添加资金明细
|
| | | AccountDetails ad = AccountDetailsFactory.create("-" + hongBao.getMoney(),
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, hongBao.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | |
| | |
|
| | |
|
| | |
|
| | |
| | | hongBaoMapper.updateByPrimaryKeySelective(updateChildHongBao);
|
| | | // 处理退款
|
| | | userInfoMapper.subHongBaoByUid(cb.getUserInfo().getId(), cb.getMoney());
|
| | | // 添加资金明细
|
| | | AccountDetails ad = AccountDetailsFactory.create("-" + cb.getMoney(),
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null,
|
| | | cb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | // 维权通知
|
| | | try {
|
| | |
| | | hongBaoMapper.updateByPrimaryKeySelective(updateChildHongBao);
|
| | | // 处理退款
|
| | | userInfoMapper.subHongBaoByUid(cb.getUserInfo().getId(), cb.getMoney());
|
| | | // 添加资金明细
|
| | | AccountDetails ad = AccountDetailsFactory.create("-" + cb.getMoney(),
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, cb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | // 维权通知
|
| | | try {
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanDrawBackMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 添加资金记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLiWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | |
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 添加资金记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShareWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | |
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 添加资金记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInviteWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | |
| | | import com.alipay.api.DefaultAlipayClient;
|
| | | import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
| | | import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.BindingAccountMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.BindingAccountDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | | |
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | |
| | | history.setName(name);
|
| | | history.setUid(uid);
|
| | | alipayAccountValidNormalHistoryMapper.insertSelective(history);
|
| | | // 资金记录 站内信
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + money.toString(),
|
| | | AccountDetailsFactory.VALID_ALIPAY_ACCOUNT, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | |
| | | import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
| | | import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractAuditRecordMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.AccountDetailsDao;
|
| | | import com.yeshi.fanli.dao.user.AccountMessageDao;
|
| | | import com.yeshi.fanli.dao.user.ExtractDao;
|
| | | import com.yeshi.fanli.dao.user.ExtractRecordDao;
|
| | | import com.yeshi.fanli.dao.user.MoneyRecordDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | |
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private SystemConfigService systemConfigService;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsService accountDetailsService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
| | | private MoneyRecordDao moneyRecordDao;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsDao accountDetailsDao;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageDao accountMessageDao;
|
| | |
|
| | | @Resource
|
| | | private PayInfoMapper payInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private MoneyRecordMapper moneyRecordMapper;
|
| | |
| | |
|
| | | // 更新提现记录审核表
|
| | | extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("+" + find.getMoney(), AccountDetailsFactory.HUIKUAN, null,
|
| | | find, find.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(find);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | | moneyRecord.setExtract(extract);
|
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("-" + extract.getMoney(), AccountDetailsFactory.TIXIAN, null,
|
| | | extract, user);
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtract(extract);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | |
|
| | | userInfoMapper.addHongBaoByUid(user.getId(), extract.getMoney());
|
| | |
|
| | | AccountDetails ad = AccountDetailsFactory.create("+" + extract.getMoney(), AccountDetailsFactory.HUIKUAN,
|
| | | null, extract, extract.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(extract);
|
| | | userMoneyDetail.setId(ad.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.qcloud.cos.model.COSObjectSummary;
|
| | | import com.qcloud.cos.model.ObjectListing;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.BindingAccountMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | |
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserConnectHistoryMapper userConnectHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoMapper;
|
| | |
| | | // 有2个或者2个以上的新人红包
|
| | | if (addCount - subCount > 1) {
|
| | | // 扣除一个新人红包
|
| | | AccountDetails accountDetails = new AccountDetails();
|
| | | accountDetails.setCreateTime(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
|
| | | accountDetails.setExtract(null);
|
| | | accountDetails.setMoney("-" + list.get(1).getMoney().toString());
|
| | | accountDetails.setOrderItem(null);
|
| | | accountDetails.setTitle(" 账号合并扣除重复新人红包");
|
| | | accountDetails.setType(AccountDetailsFactory.TUIKUAN);
|
| | | accountDetails.setUserInfo(mainUser);
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // TODO 扣除新人红包操作
|
| | |
|
| | | AccountMessage accountMessage = new AccountMessage();
|
| | | accountMessage.setContent(" 账号合并扣除重复新人红包" + list.get(1).getMoney().toString() + "元");
|
| | |
| | | // 备份用户信息
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | |
|
| | | // 备份资金明细
|
| | | List<AccountDetails> accountDetailsList = accountDetailsMapper.selectByUid(uid);
|
| | | // TODO 备份资金明细
|
| | | // 备份红包信息
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectByUid(uid);
|
| | | // 备份订单,子订单信息
|
| | |
| | |
|
| | | fw.write("#UserInfo" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(user) + "\r\n");
|
| | |
|
| | | fw.write("#AccountDetails" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(accountDetailsList) + "\r\n");
|
| | |
|
| | | fw.write("#HongBao" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(hongBaoList) + "\r\n");
|
| | |
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.dto.money.AccountDetails;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | public class AccountDetailsFactory {
|
| | |
|
| | | private static final Map<Integer, String> map = new HashMap<Integer, String>();
|
| | | /**
|
| | | * 提现
|
| | |
| | | map.put(XINREN_DEDUCT, "新人红包扣除");
|
| | | }
|
| | |
|
| | | public static AccountDetails create(String money, int type, OrderItem orderItem, Extract extract,
|
| | | UserInfo userInfo) {
|
| | | AccountDetails ad = new AccountDetails();
|
| | | ad.setCreateTime(TimeUtil.getWholeTime(System.currentTimeMillis()));
|
| | | ad.setExtract(extract);
|
| | | ad.setMoney(money);
|
| | | ad.setType(type);
|
| | | ad.setOrderItem(orderItem);
|
| | | ad.setUserInfo(userInfo);
|
| | | String title = map.get(type);
|
| | | ad.setTitle(title);
|
| | | return ad;
|
| | | }
|
| | |
|
| | | public static AccountDetails create(HongBao hb, OrderItem orderItem) {
|
| | | int type = hb.getType();
|
| | | if (type == Constant.TAOBAO) {
|
| | | return create("+" + hb.getMoney(), FANLI, orderItem, null, hb.getUserInfo());
|
| | | } else if (type == Constant.ONESALE || type == Constant.TAOBAO) {
|
| | | return create("+" + hb.getMoney(), TICHENG, null, null, hb.getUserInfo());
|
| | | } else if (type == Constant.HB_NEWUSER) {
|
| | | return create("+" + hb.getMoney(), XINREN, null, null, hb.getUserInfo());
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static AccountDetails create(UserMoneyDetail userMoneyDetail) {
|
| | | AccountDetails accountDetails = new AccountDetails(userMoneyDetail.getId());
|
| | | accountDetails.setCreateTime(
|
| | |
| | | if (userMoneyDetail.getMoney().compareTo(new BigDecimal("0")) >= 0)
|
| | | accountDetails.setMoney("+" + MoneyBigDecimalUtil.getWithNoZera(userMoneyDetail.getMoney()));
|
| | | else
|
| | | accountDetails.setMoney( MoneyBigDecimalUtil.getWithNoZera(userMoneyDetail.getMoney()) + "");
|
| | | accountDetails.setMoney(MoneyBigDecimalUtil.getWithNoZera(userMoneyDetail.getMoney()) + "");
|
| | | accountDetails.setState(userMoneyDetail.getState());
|
| | |
|
| | | String typeName = userMoneyDetail.getType().name();
|
| | |
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | |
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanli);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 原有返利数据同步
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderType
|
| | | * @param money
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldFanLi(Long uid, AccountDetails accountDetails, BigDecimal money)
|
| | | throws UserMoneyDetailException {
|
| | | int orderType = 1;
|
| | | String orderId = null;
|
| | | if (accountDetails.getOrderItem() == null)
|
| | | orderId = accountDetails.getId() + "";
|
| | | else
|
| | | orderId = accountDetails.getId() + "-" + accountDetails.getOrderItem().getOrderId();
|
| | |
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (uid == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(accountDetails.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanli);
|
| | | if (accountDetails.getOrderItem() != null)
|
| | | detail.setDescInfo("订单号:" + accountDetails.getOrderItem().getOrderId());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本的分享和邀请赚到账记录
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | * @param time
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createShareAndInvite(AccountDetails accountDetail) throws UserMoneyDetailException {
|
| | | if (accountDetail.getMoney() == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (accountDetail.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | if (accountDetail.getCreateTime() == null)
|
| | | throw new UserMoneyDetailException(1, "发生时间为空");
|
| | |
|
| | | Date time = new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | |
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.inviteAndShare.name() + "-"
|
| | | + accountDetail.getUserInfo().getId() + "-" + accountDetail.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetail.getMoney()));
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.inviteAndShare.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetail.getUserInfo());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返利维权
|
| | |
| | | return createHongBaoDeduct(hb, "新人红包扣除");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本的新人红包退款
|
| | | * |
| | | * @param hb
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldNewerHongBaoDeduct(AccountDetails accountDetails)
|
| | | throws UserMoneyDetailException {
|
| | | HongBao hb = new HongBao();
|
| | | hb.setId(accountDetails.getId());
|
| | | hb.setBeizhu("老版本");
|
| | | hb.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | hb.setUserInfo(accountDetails.getUserInfo());
|
| | | UserMoneyDetail userMoneyDetail = createHongBaoDeduct(hb, "新人红包扣除");
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | return userMoneyDetail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本售后订单扣款
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldWeiQuan(AccountDetails accountDetails) throws UserMoneyDetailException {
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "详情不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "用户不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.weiQuan.name() + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.weiQuan.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.weiQuan);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新人红包
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | |
|
| | | public static UserMoneyDetail createOldNewerHongBao(AccountDetails accountDetails) throws UserMoneyDetailException {
|
| | |
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "详情不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "用户不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil
|
| | | .Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "老版本新人红包" + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
|
| | | detail.setSubTitle("新人红包");
|
| | | detail.setType(UserMoneyDetailTypeEnum.hongbao);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本提现账号验证
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldExtractAccountValid(AccountDetails accountDetails)
|
| | | throws UserMoneyDetailException {
|
| | |
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "验证记录不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "UID不能为空");
|
| | | if (accountDetails.getMoney() == null)
|
| | | throw new UserMoneyDetailException(1, "金额不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil
|
| | | .Md5(UserMoneyDetailTypeEnum.extractVerify.name() + "-" + "老版本" + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractVerify);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返利奖励
|