| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | 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.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | 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;
|
| | |
| | | @Resource
|
| | | private UserOrderMsgNotificationService userOrderMsgNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void processOrder(ElmeOrder elmeOrder) throws ElmeOrderException {
|
| | | try {
|
| | |
| | | ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByOrderId(elmeOrder.getId());
|
| | | if (map == null)// 订单不存在
|
| | | {
|
| | | String rid = elmeOrder.getRid();
|
| | | if (StringUtil.isNullOrEmpty(rid))
|
| | | Long uid = null;
|
| | | if (StringUtil.isNullOrEmpty(elmeOrder.getChannelId())) {//新版本
|
| | | UserExtraTaoBaoInfo extra = userExtraTaoBaoInfoService.getByRelationId(elmeOrder.getRid());
|
| | | if (extra != null)
|
| | | uid = extra.getUser().getId();
|
| | | } else {//老版本
|
| | | uid = Long.parseLong(elmeOrder.getRid());
|
| | | }
|
| | |
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 查询映射用户
|
| | | UserInfo user = userInfoService.selectByPKey(Long.parseLong(rid));
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null)
|
| | | return;
|
| | | // 制造hongbao
|
| | |
| | | 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)
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0||(elmeOrder.getState()!=null&&elmeOrder.getState()==0))
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | else {
|
| | | if (elmeOrder.getIsSettle() == true) {
|