|
@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -49,6 +50,9 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
private UserRenewalsFacade userRenewalsFacade;
|
|
|
@Autowired
|
|
|
private LantoneProductFacade lantoneProductFacade;
|
|
|
+ @Autowired
|
|
|
+ private OpenedProductsFacade openedProductsFacade;
|
|
|
+
|
|
|
public List<OpenedProducts> getByAppkeyAndSecretFac(Map map) {
|
|
|
return this.getByAppkeyAndSecret(map);
|
|
|
}
|
|
@@ -124,7 +128,7 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
lantoneProduct.setId(openUpOnTrialVO.getProductId());
|
|
|
LantoneProduct lantoneProducts = lantoneProductFacade.getById(lantoneProduct);
|
|
|
if (null == lantoneProducts || IsDeleteEnum.Y.getKey().equals(lantoneProducts.getIsDeleted())){
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "该产品已删除!");
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "该产品已删除");
|
|
|
}
|
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
Date now = new Date();
|
|
@@ -219,6 +223,16 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
OpenedProducts openedProducts = new OpenedProducts();
|
|
|
openedProducts.setUserId(modifyOpeningTimeVO.getUserId());
|
|
|
openedProducts.setProductId(modifyOpeningTimeVO.getProductId());
|
|
|
+ Map map =new HashMap();
|
|
|
+ map.put("userId",modifyOpeningTimeVO.getUserId());
|
|
|
+ map.put("productId",modifyOpeningTimeVO.getProductId());
|
|
|
+ List<OpenedProducts> opendList = openedProductsFacade.selectOpenedProducts(map);
|
|
|
+ for (OpenedProducts openedProducts1 :opendList) {
|
|
|
+ if(beforeTime(openedProducts1.getStartTime(),modifyOpeningTimeVO.getEndTime())){
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "输入有误,续费时间需大于到期时间");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
openedProducts.setEndTime(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime()));
|
|
|
openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
openedProducts.setGmtCreate(DateUtil.now());
|
|
@@ -260,5 +274,18 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
// long sec = diff % nd % nh % nm / ns;
|
|
|
return day + "天" + hour + "小时" + min + "分钟";
|
|
|
}
|
|
|
-
|
|
|
+ private Boolean beforeTime(Date startTime,String endTime) {
|
|
|
+ DateUtil dateUtil = new DateUtil();
|
|
|
+ //将日期转成Date对象作比较
|
|
|
+ Date fomatDate2 = dateUtil.parseDate(endTime);
|
|
|
+ //比较两个日期
|
|
|
+ int result = fomatDate2.compareTo(startTime);
|
|
|
+ //如果日期相等返回0
|
|
|
+ if (result == 0 || result > 0) {
|
|
|
+ //大于0,参数startTime小于endTime
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //小于0,参数startTime大于endTime
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|