admin
2019-01-23 324aea6f8b2d36ea5b6fc1b03d29ad8dfae40259
fanli/src/main/java/com/yeshi/fanli/controller/client/UserOrderController.java
@@ -9,23 +9,27 @@
import javax.annotation.Resource;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.user.UserInfoExtraVO;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v1/user/order")
@@ -33,9 +37,15 @@
   
   @Resource
   private ConfigService configService;
   @Resource
   private AppVersionService appVersionService;
   @Resource
   private UserInfoService userInfoService;
   @Resource
   private UserInfoExtraService userInfoExtraService;
   
   @Resource
   private CommonOrderService commonOrderService;
@@ -91,6 +101,9 @@
         e.printStackTrace();
      }
      
      if (endTime != null && endTime.trim().length() > 0) {
         endTime += " 23:59:59";
      }
      
      try {
         long count = 0;
@@ -99,6 +112,7 @@
         int totalInvite = 0;
         long todayTotal = 0;
         BigDecimal todayMoney = null;
         
         // 查询列表
         List<CommonOrderVO> list = commonOrderService.getOrderByUid(page, uid, state, type, orderState,
@@ -194,6 +208,29 @@
         }
         UserInfo userInfo = UserUtil.filterForClientUser(user);
         // 1.5.0 版本之后返回新的等级
         String version = acceptData.getVersion();
         if (version != null && version.trim().length() > 0) {
            int versionCode = Integer.parseInt(version);
            String platform = acceptData.getPlatform();
            AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0");
            if (versionInfo != null) {
               int versionCode150 = versionInfo.getVersionCode();
               if (versionCode >= versionCode150) {
                  UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());                  if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
                     String picture = userInfoExtra.getUserRank().getPicture();
                     String icon = userInfoExtra.getUserRank().getIcon();
                     userInfo.setRankIcon(icon);
                     userInfo.setRankNamePicture(picture);
                  }
               }
            }
         }
         
         JSONObject data = new JSONObject();
         data.put("userInfo", userInfo);
@@ -360,22 +397,22 @@
      
      switch (slotTime) {
         case 1: // 最近三天
            startTime = DateUtil.reduceDay(3, endTime);
            startTime = DateUtil.reduceDay(2, endTime);
            break;
         case 2: // 最近七天
            startTime = DateUtil.reduceDay(7, endTime);
            startTime = DateUtil.reduceDay(6, endTime);
            break;
         case 3: // 最近15天 (半月)
            startTime = DateUtil.reduceDay(15, endTime);
            startTime = DateUtil.reduceDay(14, endTime);
            break;
         case 4: // 最近三十天 (本月)
            startTime = DateUtil.reduceDay(30, endTime);
            startTime = DateUtil.reduceDay(29, endTime);
            break;
         case 5: // 最近九十天(近三月)
            startTime = DateUtil.reduceDay(3*30, endTime);
            startTime = DateUtil.reduceDay(3*30-1, endTime);
            break;
         case 6: // 最近一百八十天(近半年)
            startTime = DateUtil.reduceDay(6*30, endTime);
            startTime = DateUtil.reduceDay(6*30-1, endTime);
            break;
         default:
            break;