|
@@ -1,10 +1,12 @@
|
|
package com.caimei.modules.supervip.service;
|
|
package com.caimei.modules.supervip.service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import com.caimei.modules.supervip.dao.CmSvipHistoryDao;
|
|
import com.caimei.modules.supervip.dao.CmSvipHistoryDao;
|
|
import com.caimei.modules.supervip.entity.CmSvipHistory;
|
|
import com.caimei.modules.supervip.entity.CmSvipHistory;
|
|
|
|
+import com.caimei.modules.utils.DateUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -32,17 +34,29 @@ public class CmSvipHistoryService extends CrudService<CmSvipHistoryDao, CmSvipHi
|
|
}
|
|
}
|
|
|
|
|
|
public List<CmSvipHistory> findHistoryform(CmSvipHistory cmSvipHistory) {
|
|
public List<CmSvipHistory> findHistoryform(CmSvipHistory cmSvipHistory) {
|
|
|
|
+ Integer packageId = cmSvipHistory.getPackageId();
|
|
|
|
+ if (packageId != 99 && packageId !=666) {
|
|
|
|
+ Integer aPackage = svipDao.findPackage(packageId);
|
|
|
|
+ cmSvipHistory.setPackageId(aPackage);
|
|
|
|
+ } else {
|
|
|
|
+ cmSvipHistory.setPackageId(null);
|
|
|
|
+ }
|
|
List<CmSvipHistory> history = svipDao.findHistory(cmSvipHistory);
|
|
List<CmSvipHistory> history = svipDao.findHistory(cmSvipHistory);
|
|
|
|
+ //1生效2过期3未生效
|
|
for (CmSvipHistory svipHistory : history) {
|
|
for (CmSvipHistory svipHistory : history) {
|
|
- CmSvipHistory vp = svipDao.findEndTime(svipHistory.getUserId());
|
|
|
|
- CmSvipHistory vps=svipDao.findOutEndTime(svipHistory.getUserId());
|
|
|
|
- if (vp != null) {
|
|
|
|
|
|
+ Date beginTime = svipHistory.getBeginTime();
|
|
|
|
+ Date endTime = svipHistory.getEndTime();
|
|
|
|
+ //开始时间<现在
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ if (beginTime.after(now)) {
|
|
|
|
+ svipHistory.setStatus("3");
|
|
|
|
+ }
|
|
|
|
+ if (beginTime.before(now) && endTime.after(now)) {
|
|
svipHistory.setStatus("1");
|
|
svipHistory.setStatus("1");
|
|
- } else {
|
|
|
|
- svipHistory.setStatus("2");
|
|
|
|
}
|
|
}
|
|
- if(vps!=null){
|
|
|
|
- svipHistory.setStatus("3");
|
|
|
|
|
|
+ //终止时间>现在
|
|
|
|
+ if (endTime.before(now)) {
|
|
|
|
+ svipHistory.setStatus("2");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return history;
|
|
return history;
|
|
@@ -51,6 +65,13 @@ public class CmSvipHistoryService extends CrudService<CmSvipHistoryDao, CmSvipHi
|
|
@Override
|
|
@Override
|
|
public Page<CmSvipHistory> findPage(Page<CmSvipHistory> page, CmSvipHistory vip) {
|
|
public Page<CmSvipHistory> findPage(Page<CmSvipHistory> page, CmSvipHistory vip) {
|
|
Page<CmSvipHistory> pageReslut = super.findPage(page, vip);
|
|
Page<CmSvipHistory> pageReslut = super.findPage(page, vip);
|
|
|
|
+ Integer packageId = vip.getPackageId();
|
|
|
|
+ if (packageId != 99 && packageId !=666) {
|
|
|
|
+ Integer aPackage = svipDao.findPackage(packageId);
|
|
|
|
+ vip.setPackageId(aPackage);
|
|
|
|
+ }else {
|
|
|
|
+ vip.setPackageId(null);
|
|
|
|
+ }
|
|
List<CmSvipHistory> cmSvipHistories = svipDao.superFind(vip);
|
|
List<CmSvipHistory> cmSvipHistories = svipDao.superFind(vip);
|
|
for (CmSvipHistory cmSvipHistory : cmSvipHistories) {
|
|
for (CmSvipHistory cmSvipHistory : cmSvipHistories) {
|
|
CmSvipHistory vp = svipDao.findEndTime(cmSvipHistory.getUserId());
|
|
CmSvipHistory vp = svipDao.findEndTime(cmSvipHistory.getUserId());
|