yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
@@ -15,6 +15,7 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.account.UserUtil;
public class UserMoneyDetailFactory {
@@ -62,8 +63,8 @@
    * @return
    * @throws UserMoneyDetailException
    */
   public static UserMoneyDetail createShare(Long uid,int orderType, int validCount, int weiQuanCount, int invalidCount,
         BigDecimal money, Date time) throws UserMoneyDetailException {
   public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount,
         int invalidCount, BigDecimal money, Date time) throws UserMoneyDetailException {
      if (money == null)
         throw new UserMoneyDetailException(1, "返利金额为空");
@@ -77,7 +78,7 @@
      ca.setTime(time);
      ca.add(Calendar.MONTH, -1);
      String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
      String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
      UserMoneyDetail detail = new UserMoneyDetail();
      detail.setCreateTime(new Date());
@@ -104,8 +105,8 @@
    * @return
    * @throws UserMoneyDetailException
    */
   public static UserMoneyDetail createInvite(Long uid,int orderType, int validCount, int weiQuanCount, int invalidCount,
         BigDecimal money, Date time) throws UserMoneyDetailException {
   public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount,
         int invalidCount, BigDecimal money, Date time) throws UserMoneyDetailException {
      if (money == null)
         throw new UserMoneyDetailException(1, "返利金额为空");
@@ -119,7 +120,7 @@
      ca.setTime(time);
      ca.add(Calendar.MONTH, -1);
      String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
      String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
      UserMoneyDetail detail = new UserMoneyDetail();
      detail.setCreateTime(new Date());
@@ -208,7 +209,7 @@
      detail.setSubTitle("订单维权");
      detail.setType(UserMoneyDetailTypeEnum.shareWeiQuan);
      detail.setSourceIdentifyId(drawBack.getId());
      detail.setDescInfo("订单号:" + drawBack.getOrderId());
      detail.setDescInfo("订单号:" + UserUtil.filterOrderId(drawBack.getOrderId()));
      detail.setUpdateTime(new Date());
      detail.setUserInfo(new UserInfo(uid));
      detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
@@ -248,7 +249,7 @@
      detail.setSubTitle("订单维权");
      detail.setType(UserMoneyDetailTypeEnum.inviteWeiQuan);
      detail.setSourceIdentifyId(drawBack.getId());
      detail.setDescInfo("订单号:" + drawBack.getOrderId());
      detail.setDescInfo("订单号:" + UserUtil.filterOrderId(drawBack.getOrderId()));
      detail.setUpdateTime(new Date());
      detail.setUserInfo(new UserInfo(uid));
      detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
@@ -422,7 +423,7 @@
    * @return
    * @throws UserMoneyDetailException
    */
   public static UserMoneyDetail createOrderReward(String orderId,int orderType, BigDecimal money, UserInfo user)
   public static UserMoneyDetail createOrderReward(String orderId, int orderType, BigDecimal money, UserInfo user)
         throws UserMoneyDetailException {
      if (StringUtil.isNullOrEmpty(orderId))
         throw new UserMoneyDetailException(1, "订单号不能为空");
@@ -453,7 +454,7 @@
    * @return
    * @throws UserMoneyDetailException
    */
   public static UserMoneyDetail createRepeatStatistic(String orderId,int orderType,  BigDecimal money, UserInfo user)
   public static UserMoneyDetail createRepeatStatistic(String orderId, int orderType, BigDecimal money, UserInfo user)
         throws UserMoneyDetailException {
      if (StringUtil.isNullOrEmpty(orderId))
         throw new UserMoneyDetailException(1, "订单号不能为空");
@@ -498,4 +499,23 @@
      return detail;
   }
   public static UserMoneyDetail createScoreConvert(BigDecimal money, UserInfo user) throws UserMoneyDetailException {
      if (user == null)
         throw new UserMoneyDetailException(1, "UID不能为空");
      if (money == null)
         throw new UserMoneyDetailException(1, "金额不能为空");
      UserMoneyDetail detail = new UserMoneyDetail();
      detail.setCreateTime(new Date());
      detail.setIdentifyCode(StringUtil.Md5(
            UserMoneyDetailTypeEnum.scoreConvert.name() + "-" + System.currentTimeMillis() + "-" + user.getId()));
      detail.setMoney(money);
      detail.setTitle(UserMoneyDetailTypeEnum.scoreConvert.getDesc());
      detail.setType(UserMoneyDetailTypeEnum.scoreConvert);
      detail.setUpdateTime(new Date());
      detail.setUserInfo(user);
      return detail;
   }
}