| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.exception.elme.ElmeHongBaoOrderMapException;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.elme.ElmeOrderUtil;
|
| | |
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void processOrder(ElmeOrder elmeOrder) throws ElmeOrderException {
|
| | | try {
|
| | |
| | | if (map == null)// 订单不存在
|
| | | {
|
| | | Long uid = null;
|
| | | if (StringUtil.isNullOrEmpty(elmeOrder.getChannelId())) {//新版本
|
| | | if (StringUtil.isNullOrEmpty(elmeOrder.getChannelId())) {// 新版本
|
| | | UserExtraTaoBaoInfo extra = userExtraTaoBaoInfoService.getByRelationId(elmeOrder.getRid());
|
| | | if (extra != null)
|
| | | uid = extra.getUser().getId();
|
| | | } else {//老版本
|
| | | } else {// 老版本
|
| | | uid = Long.parseLong(elmeOrder.getRid());
|
| | | }
|
| | |
|
| | |
| | | } catch (ElmeHongBaoOrderMapException e) {
|
| | | throw new ElmeOrderException(e.getCode(), e.getMsg());
|
| | | }
|
| | | |
| | |
|
| | | } else {// 订单存在
|
| | | HongBaoV2 oldHongBao = hongBaoV2Service.selectByPrimaryKey(map.getHongBao().getId());
|
| | | if (oldHongBao == null)
|
| | |
| | | update.setPreGetTime(hongBao.getPreGetTime());
|
| | | update.setUpdateTime(new Date());
|
| | | hongBaoV2Service.updateByPrimaryKeySelective(update);
|
| | | |
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private HongBaoV2 createHongBao(ElmeOrder elmeOrder, UserInfo userInfo) {
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(elmeOrder.getOrderDate().getTime());
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(UserLevelEnum.daRen,
|
| | | elmeOrder.getOrderDate().getTime());
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | | hongBao.setCreateTime(new Date());
|
| | | hongBao.setGetTime(null);
|
| | |
| | | new BigDecimal(100)));
|
| | | if (elmeOrder.getIsSettle() == true)
|
| | | hongBao.setPreGetTime(new Date(elmeOrder.getOrderDate().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0||(elmeOrder.getState()!=null&&elmeOrder.getState()==0))
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0
|
| | | || (elmeOrder.getState() != null && elmeOrder.getState() == 0))
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | else {
|
| | | if (elmeOrder.getIsSettle() == true) {
|