Merge remote-tracking branch 'origin/div' into div
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils; |
| | | import com.yeshi.fanli.dto.ChartTDO; |
| | | import com.yeshi.fanli.dto.common.CategoryInfoDTO; |
| | | import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods; |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | | import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService; |
| | | import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService; |
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService; |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService; |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService; |
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService; |
| | |
| | | |
| | | @Resource |
| | | private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService; |
| | | |
| | | @Resource |
| | | private CommonGoodsService commonGoodsService; |
| | | |
| | | /** |
| | | * 统计历史订单-淘宝订单 |
| | |
| | | long count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime, |
| | | sourceType, listShopId, listGoodsId, minTime, money, payment); |
| | | |
| | | // 查询是否维权 |
| | | for (CommonOrderVO order : list) { |
| | | |
| | | CommonOrderGoods goods = order.getCommonOrderGoods(); |
| | | if (goods != null) { |
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(Long.parseLong(goods.getGoodsId()), |
| | | goods.getGoodsType()); |
| | | if (commonGoods != null) { |
| | | String categoryInfo = commonGoods.getCategoryInfo(); |
| | | if (!StringUtil.isNullOrEmpty(categoryInfo)) { |
| | | JSONObject json = JSONObject.fromObject(categoryInfo); |
| | | CategoryInfoDTO otherDTO = (CategoryInfoDTO) JSONObject.toBean(json, CategoryInfoDTO.class); |
| | | if (otherDTO != null) { |
| | | goods.setCategory1(otherDTO.getCid1Name()); |
| | | goods.setCategory2(otherDTO.getCid2Name()); |
| | | goods.setCategory3(otherDTO.getCid3Name()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (order.getUserId() == null) |
| | | continue; |
| | | |
| | |
| | | if (list == null || list.size() == 0) {
|
| | | List<ESOrder> listES = esOrderService.query(key, uid.toString(), null);
|
| | | if (listES.size() != 0) {
|
| | | list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES);
|
| | | list = commonOrderService.searchOrderByUid(acceptData, page, Constant.PAGE_SIZE, uid, listES);
|
| | | count = commonOrderService.countSearchOrderByUid(uid, listES);
|
| | | }
|
| | | } else {
|
| | |
| | | List<ESOrder> listES = esOrderService.query(key, uid.toString(), listSource);
|
| | |
|
| | | if (listES.size() != 0) {
|
| | | list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES);
|
| | | // 2.1版本
|
| | | AcceptData acceptData = new AcceptData();
|
| | | acceptData.setPlatform("android");
|
| | | acceptData.setVersion("56");
|
| | | list = commonOrderService.searchOrderByUid(acceptData, page, Constant.PAGE_SIZE, uid, listES);
|
| | | count = commonOrderService.countSearchOrderByUid(uid, listES);
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.common;
|
| | |
|
| | | public class CategoryInfoDTO {
|
| | | // 一级类目ID
|
| | | private Long cid1;
|
| | | private String cid1Name;
|
| | | // 二级类目ID
|
| | | private Long cid2;
|
| | | private String cid2Name;
|
| | | // 三级类目ID
|
| | | private Long cid3;
|
| | | private String cid3Name;
|
| | |
|
| | | public Long getCid1() {
|
| | | return cid1;
|
| | | }
|
| | |
|
| | | public void setCid1(Long cid1) {
|
| | | this.cid1 = cid1;
|
| | | }
|
| | |
|
| | | public String getCid1Name() {
|
| | | return cid1Name;
|
| | | }
|
| | |
|
| | | public void setCid1Name(String cid1Name) {
|
| | | this.cid1Name = cid1Name;
|
| | | }
|
| | |
|
| | | public Long getCid2() {
|
| | | return cid2;
|
| | | }
|
| | |
|
| | | public void setCid2(Long cid2) {
|
| | | this.cid2 = cid2;
|
| | | }
|
| | |
|
| | | public String getCid2Name() {
|
| | | return cid2Name;
|
| | | }
|
| | |
|
| | | public void setCid2Name(String cid2Name) {
|
| | | this.cid2Name = cid2Name;
|
| | | }
|
| | |
|
| | | public Long getCid3() {
|
| | | return cid3;
|
| | | }
|
| | |
|
| | | public void setCid3(Long cid3) {
|
| | | this.cid3 = cid3;
|
| | | }
|
| | |
|
| | | public String getCid3Name() {
|
| | | return cid3Name;
|
| | | }
|
| | |
|
| | | public void setCid3Name(String cid3Name) {
|
| | | this.cid3Name = cid3Name;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.msg;
|
| | |
|
| | | /**
|
| | | * vip消息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class MsgAccountVipDTO {
|
| | | private String status; // 状态
|
| | | private String equity; // 权益
|
| | | private String reason; // 原因
|
| | |
|
| | | public String getStatus() {
|
| | | return status;
|
| | | }
|
| | |
|
| | | public void setStatus(String status) {
|
| | | this.status = status;
|
| | | }
|
| | |
|
| | | public String getEquity() {
|
| | | return equity;
|
| | | }
|
| | |
|
| | | public void setEquity(String equity) {
|
| | | this.equity = equity;
|
| | | }
|
| | |
|
| | | public String getReason() {
|
| | | return reason;
|
| | | }
|
| | |
|
| | | public void setReason(String reason) {
|
| | | this.reason = reason;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | update("账号修改"),
|
| | | level("账号等级"),
|
| | | connect("账号合并"),
|
| | | taoBaoAuthFail("账号绑定");
|
| | | taoBaoAuthFail("账号绑定"),
|
| | | vipApply("账户升级"),
|
| | | vipPgrade("账户升级");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeAccountTypeEnum(String desc) {
|
| | |
| | | @Column(name = "cog_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | // 分类
|
| | | private String category1;
|
| | | private String category2;
|
| | | private String category3;
|
| | | |
| | | public CommonOrderGoods() {
|
| | |
|
| | | }
|
| | |
| | | this.actualPrice = actualPrice;
|
| | | }
|
| | |
|
| | | public String getCategory1() {
|
| | | return category1;
|
| | | }
|
| | |
|
| | | public void setCategory1(String category1) {
|
| | | this.category1 = category1;
|
| | | }
|
| | |
|
| | | public String getCategory2() {
|
| | | return category2;
|
| | | }
|
| | |
|
| | | public void setCategory2(String category2) {
|
| | | this.category2 = category2;
|
| | | }
|
| | |
|
| | | public String getCategory3() {
|
| | | return category3;
|
| | | }
|
| | |
|
| | | public void setCategory3(String category3) {
|
| | | this.category3 = category3;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | co_order_goods_id,co_count,co_state,co_state_whole_order, |
| | | co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time, |
| | | MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time, |
| | | co_update_time,co_state_desc |
| | | co_update_time,co_state_desc,co_urank |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | | import com.yeshi.fanli.vo.order.CommonOrderGoodsVO; |
| | | import com.yeshi.fanli.vo.order.CommonOrderVO; |
| | |
| | | } |
| | | |
| | | // 数据加工重新组织 |
| | | orderVOFactory(acceptData, listOrder, listGoods, uid); |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | orderVOFactoryNew(acceptData, listOrder, listGoods, uid); |
| | | } else { |
| | | orderVOFactory(acceptData, listOrder, listGoods, uid); |
| | | } |
| | | |
| | | return listOrder; |
| | | } |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | for (CommonOrderVO order : listOrder) { |
| | | |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc(levelName); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | } |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> searchOrderByUid(int page, int size, Long uid, List<ESOrder> list) throws Exception { |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) throws Exception { |
| | | List<CommonOrderVO> listVO = commonOrderMapper.searchOrderByUid((page - 1) * size, size, uid, list); |
| | | |
| | | // 订单信息为空 |
| | |
| | | } |
| | | |
| | | // 数据加工重新组织 |
| | | orderVOFactoryNew(listVO, listGoods, uid); |
| | | orderVOFactoryNew(acceptData, listVO, listGoods, uid); |
| | | |
| | | return listVO; |
| | | } |
| | |
| | | * @param listGoods |
| | | * @param uid |
| | | */ |
| | | private void orderVOFactoryNew(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) |
| | | private void orderVOFactoryNew(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) |
| | | throws Exception { |
| | | List<String> listTB = new ArrayList<String>(); |
| | | List<String> listJD = new ArrayList<String>(); |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc(levelName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | } |
| | | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); |
| | |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | |
| | | |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | |
| | | BigDecimal totalPay = new BigDecimal(0); |
| | | BigDecimal totalActual = new BigDecimal(0); |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | |
| | | totalSettlement = commonOrder.getTotalPayment(); |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement); |
| | | |
| | | |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | // 商品价格 |
| | | BigDecimal actualPrice = commonGoodsVO.getActualPrice(); |
| | | if (actualPrice != null) { |
| | | Integer totalCount = commonOrder.getTotalCount(); |
| | | totalActual = MoneyBigDecimalUtil.add(totalActual, |
| | | MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice)); |
| | | } |
| | | |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | } |
| | | |
| | | // 2.1分享订单和返利订单实付金额大于或者小于券后价的时候,订单页面 只显示3天 下单时间开始 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType |
| | | && DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime |
| | | && totalPay.compareTo(totalActual) != 0) { |
| | | order.setFanliDesc("由实付金额*返利比计算而来"); |
| | | order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey())); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | |
| | | // 订单标识 |
| | | List<String> signList = new ArrayList<String>(); |
| | | /* 订单返利类型 转换 */ |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) { |
| | | // 自购 |
| | | hongbaoInfo = "返利"; |
| | |
| | | InputStream portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像 |
| | | InputStream erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码 |
| | | |
| | | // 官方默认头像 |
| | | if (portraitInputStream == null) { |
| | | portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png"); |
| | | } |
| | | |
| | | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片 |
| | | ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode); |
| | | |
| | |
| | | InputStream portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像 |
| | | InputStream erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码 |
| | | |
| | | // 官方默认头像 |
| | | if (portraitInputStream == null) { |
| | | portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png"); |
| | | } |
| | | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片 |
| | | ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, |
| | | erCodePostionX, erCodePostionY, erCodeSize, inviteCode); |
| | |
| | | portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png"); |
| | | |
| | | } else { |
| | | |
| | | targetPath = FileUtil.getCacheDir() + "/share_" + uid + "_" + System.currentTimeMillis() + ".jpg"; |
| | | erCodeTempPath = FileUtil.getCacheDir() + "/" + uid + "_" + System.currentTimeMillis() + ".jpg"; |
| | | |
| | |
| | | portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像 |
| | | erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码 |
| | | } |
| | | |
| | | |
| | | // 官方默认头像 |
| | | if (portraitInputStream == null) { |
| | | portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png"); |
| | | } |
| | | |
| | | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片 |
| | | ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, pX, pY, |
| | | size, inviteCode); |
| | |
| | | portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像 |
| | | } |
| | | |
| | | // 官方默认头像 |
| | | if (portraitInputStream == null) { |
| | | portraitInputStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png"); |
| | | } |
| | | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片 |
| | | ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode, |
| | | content, date); |
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.msg.MsgAccountDetailMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
|
| | | import com.yeshi.fanli.exception.msg.MsgOtherDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | msgAccountDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void addMsgVIP(Long uid, String title, String beiZhu, MsgAccountVipDTO dto) {
|
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setTitle(title);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeAccountTypeEnum.vipPgrade);
|
| | | msgAccountDetailMapper.insertSelective(detail);
|
| | | |
| | | userMsgReadStateService.addAccountMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | |
| | | 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.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | | |
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void applyVIPNew(Long uid) throws UserVIPInfoException {
|
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | } |
| | | |
| | | if (!verifyVipNew(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | | |
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserVIPInfo();
|
| | | userInfo.setId(uid);
|
| | | // 添加记录
|
| | | addUserVIPInfo(userInfo);
|
| | | }
|
| | |
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_INVALID)
|
| | | throw new UserVIPInfoException(2, "已经申请过");
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setApplyTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_VERIFING);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | |
| | | |
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setTitle("尊敬的高级会员,系统已收到你的超级会员升级申请,正在受理中");
|
| | | detail.setBeiZhu("如有疑问请联系我的-人工客服");
|
| | | detail.setRead(false);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent("我们将会在48小时内完成审核");
|
| | | detail.setType(MsgTypeAccountTypeEnum.vipApply);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void passVIPApplyNew(Long uid) throws UserVIPInfoException {
|
| | | UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userVIPInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | | |
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | throw new UserVIPInfoException(1, "该用户还不是高级会员");
|
| | | } |
| | | |
| | | if (!verifyVipNew(uid))
|
| | | throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
|
| | | |
| | | // 额外信息
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | |
|
| | | // 通过超级会员
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userVIPInfo.getId());
|
| | | info.setSuccessTime(new Date());
|
| | | info.setState(UserVIPInfo.STATE_SUCCESS);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | |
|
| | | // 添加金币
|
| | | userInfoExtraService.addGoldCoinByUid(uid, Constant.VIP_COLDCOIN_NUM);
|
| | | // 添加金币明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Constant.VIP_COLDCOIN_NUM);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniqueKey("VIP-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | try {
|
| | | // 奖励券
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | | for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | |
|
| | | // 赠送免单券
|
| | | for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | |
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("已将你的账户由高级会员升级为超级会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部超级会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, "恭喜你!经人工审核你满足升级超级会员条件", "如有疑问请联系我的-人工客服", msgDto);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | private boolean verifyVip(Long uid) {
|
| | | private boolean verifyVipNew(Long uid) {
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | |
| | | // 队员
|
| | | 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)) {
|
| | | UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
|
| | | userVIPPreInfoService.verifyVipPreInfo(uid, false);
|
| | | } |
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException {
|
| | | UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo == null) {
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | | }
|
| | | if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
|
| | | throw new UserVIPInfoException(2, "申请未处于审核状态");
|
| | | }
|
| | |
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userInfo.getId());
|
| | | info.setState(UserVIPInfo.STATE_INVALID);
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("你的账号仍是高级会员");
|
| | | msgDto.setReason(reason);
|
| | | msgAccountDetailService.addMsgVIP(uid, "很抱歉!经人工审核你未满足或不符合升级超级会员的条件", "如有疑问请联系我的-人工客服", msgDto);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.hibernate.annotations.LazyCollection;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPPreInfoMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | long countZiGou =hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | |
| | | * @param secondTeam
|
| | | */
|
| | | private boolean oneProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU || countShare >= Constant.VIP_PROCESS_1_SHARE
|
| | | || (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND)) {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPPreInfoMapper.insertSelective(info);
|
| | | return true;
|
| | | boolean process = false;
|
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_1_ZIGOU +"笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_1_SHARE) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_1_SHARE +"笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到"+ Constant.VIP_PROCESS_1_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_1_TEAM_SECOND +"人";
|
| | | }
|
| | | return false;
|
| | | |
| | | if (process) {
|
| | | try {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | addUserVIPPreInfo(info);
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("系统已将你的账户由快省达人升级为普通会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部普通会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } |
| | | return process;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param secondTeam
|
| | | */
|
| | | private boolean twoProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU || countShare >= Constant.VIP_PROCESS_2_SHARE
|
| | | || (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND)) {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_2);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | userVIPPreInfoMapper.insertSelective(info);
|
| | | return true;
|
| | | boolean process = false;
|
| | | String msg = "";
|
| | | if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU) {
|
| | | process = true;
|
| | | msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_2_ZIGOU +"笔";
|
| | | } else if (countShare >= Constant.VIP_PROCESS_2_SHARE) {
|
| | | process = true;
|
| | | msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_2_SHARE +"笔";
|
| | | } else if (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND) {
|
| | | process = true;
|
| | | msg = "直接粉丝达到"+ Constant.VIP_PROCESS_2_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_2_TEAM_SECOND +"人";
|
| | | }
|
| | | return false;
|
| | | |
| | | if (process) {
|
| | | try {
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_2);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | addUserVIPPreInfo(info);
|
| | | |
| | | // 消息
|
| | | MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
|
| | | msgDto.setStatus("系统已将你的账户由普通会员升级为高级会员");
|
| | | msgDto.setEquity("从收到本消息起,你将获得全部高级会员权益");
|
| | | msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } |
| | | return process;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public List<CommonOrderVO> searchOrderByUid(int page, int size, Long uid, List<ESOrder> list) throws Exception; |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) throws Exception; |
| | | |
| | | public long countSearchOrderByUid(Long uid, List<ESOrder> list); |
| | | |
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
|
| | |
|
| | |
| | | */
|
| | | public void readMsgByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 会员升级消息
|
| | | * @param uid
|
| | | * @param title
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void addMsgVIP(Long uid, String title, String beiZhu, MsgAccountVipDTO dto);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void inviteSeparate(Long workerId, Long bossId);
|
| | |
|
| | | /**
|
| | | * 超级会员申请通过
|
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void passVIPApplyNew(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 超级会员未通过
|
| | | * @param uid
|
| | | * @param reason
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException;
|
| | |
|
| | | /**
|
| | | * 超级会员申请
|
| | | * @param uid
|
| | | * @throws UserVIPInfoException
|
| | | */
|
| | | public void applyVIPNew(Long uid) throws UserVIPInfoException;
|
| | |
|
| | | }
|
| | |
| | | public static final int TLJ_NEW_USER_DEFINE = 10;
|
| | |
|
| | | // vip奖励券券5张
|
| | | public static final int VIP_COUPON_REWARD_NUM = 30;
|
| | | public static final int VIP_COUPON_REWARD_NUM = 15;
|
| | | // vip赠送免单券5张
|
| | | public static final int VIP_COUPON_GIVEFREE_NUM = 5;
|
| | | // vip赠送金币
|
| | |
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.yeshi.fanli.dto.common.CategoryInfoDTO;
|
| | | import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | |
| | | cg.setVideoUrl(null);
|
| | | cg.setState(goods.getState());
|
| | | cg.setMaterialLibType(goods.getMaterialLibType());
|
| | | |
| | | |
| | | // 分类信息
|
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
|
| | | Integer rootCatId = goods.getRootCatId();
|
| | | if (rootCatId != null) {
|
| | | categoryInfo.setCid1(Long.parseLong(rootCatId.toString()));
|
| | | }
|
| | | categoryInfo.setCid1Name(goods.getRootCategoryName());
|
| | | |
| | | Integer leafCatId = goods.getLeafCatId();
|
| | | if (leafCatId != null) {
|
| | | categoryInfo.setCid2(Long.parseLong(leafCatId.toString()));
|
| | | }
|
| | | categoryInfo.setCid2Name(goods.getLeafName());
|
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
|
| | | |
| | | return cg;
|
| | | }
|
| | |
|
| | |
| | | other.setPinGouInfo( goods.getPinGouInfo()); // 拼购信息
|
| | | other.setIsFreeShipping(goods.getIsFreeShipping()); // 是否包邮
|
| | | cg.setOtherInfo(JSONObject.toJSON(other).toString());
|
| | | |
| | | |
| | | // 分类信息
|
| | | JDCategoryInfo categoryJD = goods.getCategoryInfo();
|
| | | if (categoryJD != null) {
|
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
|
| | | categoryInfo.setCid1(categoryJD.getCid1());
|
| | | categoryInfo.setCid1Name(categoryJD.getCid1Name());
|
| | | categoryInfo.setCid2(categoryJD.getCid2());
|
| | | categoryInfo.setCid2Name(categoryJD.getCid2Name());
|
| | | categoryInfo.setCid3(categoryJD.getCid3());
|
| | | categoryInfo.setCid3Name(categoryJD.getCid3Name());
|
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
|
| | | }
|
| | |
|
| | | // 保留字段
|
| | | cg.setVideoCover(null);
|
| | |
| | | cg.setVideoUrl(null);
|
| | | cg.setState(goods.getState());
|
| | | cg.setMaterialLibType(1);
|
| | | |
| | | // 分类信息
|
| | | CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
|
| | | categoryInfo.setCid1(goods.getCategoryId());
|
| | | categoryInfo.setCid1Name(goods.getCategoryName());
|
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
|
| | | |
| | | |
| | | return cg;
|
| | | }
|
| | |
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | |
| | | public static UserMsgVO create(MsgAccountDetail msg) {
|
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | |
| | | if (msg.getType() == MsgTypeAccountTypeEnum.vipPgrade) {// 等级升级
|
| | | |
| | | contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("详 情", COLOR_TITLE), contentList));
|
| | | |
| | | MsgAccountVipDTO dto = new Gson().fromJson(msg.getContent(), MsgAccountVipDTO.class);
|
| | | if (dto != null) {
|
| | | if (!StringUtil.isNullOrEmpty(dto.getStatus())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getStatus() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状 态", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getEquity())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getEquity() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("权 益", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getReason())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getReason() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("原 因", COLOR_TITLE), contentList));
|
| | | }
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备 注", COLOR_TITLE), contentList));
|
| | | |
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | | |
| | | |
| | | if (msg.getType() == MsgTypeAccountTypeEnum.vipApply) {// vip升级申请
|
| | | |
| | | contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("申请进度", COLOR_TITLE), contentList));
|
| | | |
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getContent() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说 明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备 注", COLOR_TITLE), contentList));
|
| | | |
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("事项", COLOR_TITLE), contentList));
|
| | |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | //@Component implements MessageListener
|
| | | public class UserVIPMessageListener {
|
| | | @Component |
| | | public class UserVIPMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | // @Override
|
| | | // public Action consume(Message message, ConsumeContext context) {
|
| | | // |
| | | // LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(),
|
| | | // message.getTag(), new String(message.getBody()));
|
| | | // String tag = message.getTag();
|
| | | // if (tag == null)
|
| | | // tag = "";
|
| | | //
|
| | | // // 邀请相关
|
| | | // if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // // 邀请成功
|
| | | // if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {
|
| | | // UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()),UserInviteMQMsg.class);
|
| | | // // 会员等级升级
|
| | | // userVIPPreInfoService.verifyVipPreInfo(msg.getBossId(), true);
|
| | | // }
|
| | | // }
|
| | | // |
| | | // // 订单到账相关
|
| | | // if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | // OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | // OrderMoneyRecievedMQMsg.class);
|
| | | // if (dto != null) {
|
| | | // if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // // 会员等级升级
|
| | | // userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | // } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
|
| | | // // 会员等级升级
|
| | | // userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // |
| | | // return Action.CommitMessage;
|
| | | // }
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | |
| | | LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(),
|
| | | message.getTag(), new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | |
|
| | | // 邀请相关
|
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 邀请成功
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {
|
| | | UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()),UserInviteMQMsg.class);
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(msg.getBossId(), true);
|
| | | }
|
| | | }
|
| | | |
| | | // 订单到账相关
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
|
| | | // 会员等级升级
|
| | | userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.user;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | |
|
| | | public class UserLevelUtil {
|
| | | |
| | | public static String getLevelName(int orderRank) {
|
| | | if (orderRank == UserLevelEnum.daRen.getOrderRank()) {
|
| | | return UserLevelEnum.daRen.getName();
|
| | | }
|
| | | |
| | | if (orderRank == UserLevelEnum.normalVIP.getOrderRank()) {
|
| | | return UserLevelEnum.normalVIP.getName();
|
| | | }
|
| | | |
| | | if (orderRank == UserLevelEnum.highVIP.getOrderRank()) {
|
| | | return UserLevelEnum.highVIP.getName();
|
| | | }
|
| | | |
| | | if (orderRank == UserLevelEnum.superVIP.getOrderRank()) {
|
| | | return UserLevelEnum.superVIP.getName();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | private Integer otherState; // 1免单
|
| | |
|
| | | @Expose
|
| | | private boolean vipOrder;// 是否为超级用户订单
|
| | | private boolean vipOrder;// 是否为超级用户订单(2.1之后废弃)
|
| | |
|
| | | @Expose
|
| | | private String vipOrderDesc;// 超级订单描述
|
| | | private String vipOrderDesc;// 超级订单描述(2.1之后废弃)
|
| | |
|
| | | @Expose
|
| | | private String fanliDesc;// 返利说明
|
| | | @Expose
|
| | | private String fanliDescLink;// 返利说明链接
|
| | | |
| | | @Expose
|
| | | private String orderDesc;// 订单描述
|
| | |
|
| | |
|
| | | public String getVipOrderDesc() {
|
| | |
| | | public void setFanliDescLink(String fanliDescLink) {
|
| | | this.fanliDescLink = fanliDescLink;
|
| | | }
|
| | |
|
| | | public String getOrderDesc() {
|
| | | return orderDesc;
|
| | | }
|
| | |
|
| | | public void setOrderDesc(String orderDesc) {
|
| | | this.orderDesc = orderDesc;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | </bean>
|
| | |
|
| | |
|
| | | <!-- 邀请图修改消息订阅 -->
|
| | | <bean id="userVIPMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.user.UserVIPMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="userVIPConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">${rocketmq.AccessKey}</prop>
|
| | | <prop key="SecretKey">${rocketmq.SecretKey}</prop>
|
| | | <prop key="GROUP_ID">GID_USER_VIP</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 邀请队员成功 -->
|
| | | <entry value-ref="userVIPMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="inviteSuccess" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | |
| | | <!-- 订单到账 -->
|
| | | <entry value-ref="userVIPMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | |
|
| | | </beans> |
| | |
| | | package org.fanli.dynamic;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.File;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.FileOutputStream;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStreamReader;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | | import java.util.TreeMap;
|
| | |
|
| | | import org.junit.Test;
|
| | |
|
| | | import com.yeshi.fanli.entity.dynamic.InviteMaterial;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.InviteMaterialService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class Test_InviteMaterialService {
|
| | |
|
| | | |
| | | @Test
|
| | | public void insertMaterial() {
|
| | | try {
|
| | |
| | | String fliePath = "F:\\company_material\\invite\\name.txt";
|
| | | // File file = new File("F:\\company_material\\invite\\name.txt");//Text文件
|
| | | // BufferedReader buff = new BufferedReader(new FileReader(file));// 构造一个BufferedReader类来读取文件
|
| | | BufferedReader buff = new BufferedReader(new InputStreamReader(new FileInputStream(fliePath),"gbk"));
|
| | | |
| | | BufferedReader buff = new BufferedReader(new InputStreamReader(new FileInputStream(fliePath), "gbk"));
|
| | |
|
| | | while ((s = buff.readLine()) != null) {// 使用readLine方法,一次读一行
|
| | | if (!StringUtil.isNullOrEmpty(s)) {
|
| | | list.add(s.trim());
|
| | |
| | | buff.close();
|
| | |
|
| | | // 图片格式
|
| | | int startPic = 246;
|
| | | int endPic = 261;
|
| | | int startPic = 332;
|
| | | int endPic = 366;
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | String text = list.get(i);
|
| | | if (startPic > endPic) {
|
| | |
| | | }
|
| | | InviteMaterial record = new InviteMaterial();
|
| | | record.setText(text);
|
| | | record.setPicture("http://img.flqapp.com/resource/invite/everyday/"+ startPic +".jpg");
|
| | | record.setPicture("http://img.flqapp.com/resource/invite/everyday/" + startPic + ".jpg");
|
| | | record.setState(0);
|
| | | service.insert(record);
|
| | | startPic ++;
|
| | | |
| | | if (i == list.size()-1) {
|
| | | startPic++;
|
| | |
|
| | | if (i == list.size() - 1) {
|
| | | System.out.println("---------------------------------");
|
| | | System.out.println(text);
|
| | | System.out.println("---------------------------------");
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | // 图片重命名
|
| | | public static void main(String[] args) throws IOException {
|
| | | File[] file = new File("F:\\company_material\\pic").listFiles();
|
| | | int start = 500;
|
| | | for (int i = 0; i < file.length; i++) {
|
| | | // 得到图片
|
| | | File f = file[i];
|
| | | rename(f, start + "");
|
| | | start ++;
|
| | | }
|
| | | }
|
| | |
|
| | | private static void rename(File f, String name) throws IOException {
|
| | | FileInputStream fin = new FileInputStream(f);
|
| | | String s = new String("F:/company_material/imgs/" + name + ".jpg");
|
| | | FileOutputStream fou = new FileOutputStream(s);
|
| | | byte[] b = new byte[1024];
|
| | | int len;
|
| | | while ((len = fin.read(b)) != -1) {
|
| | | fou.write(b, 0, len);
|
| | | fou.flush();
|
| | | }
|
| | | fin.close();
|
| | | fou.close();
|
| | | }
|
| | | }
|