| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import javax.annotation.PostConstruct;
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Component
|
| | | public class HongBaoFactory {
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | private static HongBaoFactory hongBaoFactory;
|
| | |
|
| | | @PostConstruct
|
| | | public void init() {
|
| | | hongBaoFactory = this;
|
| | | hongBaoFactory.hongBaoManageService = this.hongBaoManageService;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @param money
|
| | | * 金额
|
| | | * @param orderId
|
| | | * 系统的订单ID
|
| | | * @param parent
|
| | | * @param userInfo
|
| | | * @return
|
| | | */
|
| | | public static HongBao createHongBao(BigDecimal money, Long orderId, HongBao parent, UserInfo userInfo, int type) {
|
| | | return createHongBao(money, null, orderId, parent, userInfo, null, type, null, null);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | int type) {
|
| | | return createHongBao(money, param, orderId, parent, userInfo, null, type, null, null);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | int type, BigDecimal payMoney, Long auctionId) {
|
| | | return createHongBao(money, param, orderId, parent, userInfo, null, type, payMoney, auctionId);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | Long preGettime, int type, BigDecimal payMoney, Long auctionId) {
|
| | | HongBao hongBao = new HongBao();
|
| | | long timeMillis = System.currentTimeMillis();
|
| | | hongBao.setCreatetime(timeMillis);
|
| | | hongBao.setMoney(money);
|
| | | hongBao.setState(Constant.HB_NOTIME);
|
| | | if (param == null) {
|
| | | param = "{\"picture\":\"\"}";
|
| | | }
|
| | | hongBao.setParam(param);
|
| | | if (orderId != null) {
|
| | | Order order = new Order();
|
| | | order.setId(orderId);
|
| | | hongBao.setOrder(order);
|
| | | }
|
| | | hongBao.setParent(parent);
|
| | | // if(preGettime==null){
|
| | | // preGettime = preGettime(timeMillis,type);
|
| | | // }
|
| | | // if(timeMillis >= preGettime){
|
| | | // hongBao.setState(Constant.HB_GET);
|
| | | // }
|
| | | hongBao.setPreGettime(0L);
|
| | | hongBao.setUrank(userInfo.getRank());
|
| | | hongBao.setUserInfo(userInfo);
|
| | | hongBao.setType(type);
|
| | | hongBao.setAuctionId(auctionId);
|
| | | hongBao.setPayMoney(payMoney);
|
| | | hongBao.setVersion(2);
|
| | | hongBao.setGetTime(0L);
|
| | | hongBao.setHasChild(false);
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(HongBaoDTO hongBaoDTO) {
|
| | | HongBao hongBao = new HongBao();
|
| | | hongBao.setId(hongBaoDTO.getId());
|
| | | hongBao.setOrderId(hongBaoDTO.getOrderId());
|
| | |
|
| | | if (hongBaoDTO.getSettlement() != null&&hongBaoDTO.getSettlement().compareTo(new BigDecimal(0))>0)
|
| | | hongBao.setPayMoney(hongBaoDTO.getSettlement());
|
| | | else
|
| | | hongBao.setPayMoney(hongBaoDTO.getPayMoney());
|
| | |
|
| | | hongBao.setCreatetime(hongBaoDTO.getCreateTime().getTime());
|
| | | hongBao.setMoney(hongBaoDTO.getMoney());
|
| | | hongBao.setState(hongBaoDTO.getState());
|
| | | hongBao.setType(hongBaoDTO.getType());
|
| | | hongBao.setUserInfo(hongBaoDTO.getUserInfo());
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.util.factory; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.yeshi.fanli.dto.HongBao; |
| | | import com.yeshi.fanli.dto.HongBaoDTO; |
| | | import com.yeshi.fanli.entity.bus.user.Order; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | |
| | | @Component |
| | | public class HongBaoFactory { |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | private static HongBaoFactory hongBaoFactory; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | hongBaoFactory = this; |
| | | hongBaoFactory.hongBaoManageService = this.hongBaoManageService; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param money |
| | | * 金额 |
| | | * @param orderId |
| | | * 系统的订单ID |
| | | * @param parent |
| | | * @param userInfo |
| | | * @return |
| | | */ |
| | | public static HongBao createHongBao(BigDecimal money, Long orderId, HongBao parent, UserInfo userInfo, int type) { |
| | | return createHongBao(money, null, orderId, parent, userInfo, null, type, null, null); |
| | | } |
| | | |
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo, |
| | | int type) { |
| | | return createHongBao(money, param, orderId, parent, userInfo, null, type, null, null); |
| | | } |
| | | |
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo, |
| | | int type, BigDecimal payMoney, String auctionId) { |
| | | return createHongBao(money, param, orderId, parent, userInfo, null, type, payMoney, auctionId); |
| | | } |
| | | |
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo, |
| | | Long preGettime, int type, BigDecimal payMoney, String auctionId) { |
| | | HongBao hongBao = new HongBao(); |
| | | long timeMillis = System.currentTimeMillis(); |
| | | hongBao.setCreatetime(timeMillis); |
| | | hongBao.setMoney(money); |
| | | hongBao.setState(Constant.HB_NOTIME); |
| | | if (param == null) { |
| | | param = "{\"picture\":\"\"}"; |
| | | } |
| | | hongBao.setParam(param); |
| | | if (orderId != null) { |
| | | Order order = new Order(); |
| | | order.setId(orderId); |
| | | hongBao.setOrder(order); |
| | | } |
| | | hongBao.setParent(parent); |
| | | // if(preGettime==null){ |
| | | // preGettime = preGettime(timeMillis,type); |
| | | // } |
| | | // if(timeMillis >= preGettime){ |
| | | // hongBao.setState(Constant.HB_GET); |
| | | // } |
| | | hongBao.setPreGettime(0L); |
| | | hongBao.setUrank(userInfo.getRank()); |
| | | hongBao.setUserInfo(userInfo); |
| | | hongBao.setType(type); |
| | | hongBao.setAuctionId(auctionId); |
| | | hongBao.setPayMoney(payMoney); |
| | | hongBao.setVersion(2); |
| | | hongBao.setGetTime(0L); |
| | | hongBao.setHasChild(false); |
| | | return hongBao; |
| | | } |
| | | |
| | | public static HongBao createHongBao(HongBaoDTO hongBaoDTO) { |
| | | HongBao hongBao = new HongBao(); |
| | | hongBao.setId(hongBaoDTO.getId()); |
| | | hongBao.setOrderId(hongBaoDTO.getOrderId()); |
| | | |
| | | if (hongBaoDTO.getSettlement() != null&&hongBaoDTO.getSettlement().compareTo(new BigDecimal(0))>0) |
| | | hongBao.setPayMoney(hongBaoDTO.getSettlement()); |
| | | else |
| | | hongBao.setPayMoney(hongBaoDTO.getPayMoney()); |
| | | |
| | | hongBao.setCreatetime(hongBaoDTO.getCreateTime().getTime()); |
| | | hongBao.setMoney(hongBaoDTO.getMoney()); |
| | | hongBao.setState(hongBaoDTO.getState()); |
| | | hongBao.setType(hongBaoDTO.getType()); |
| | | hongBao.setUserInfo(hongBaoDTO.getUserInfo()); |
| | | return hongBao; |
| | | } |
| | | |
| | | } |