|
@@ -1,23 +1,9 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.dto.AuthDetailDTO;
|
|
import com.diagbot.dto.AuthDetailDTO;
|
|
-import com.diagbot.dto.HasPermissionDTO;
|
|
|
|
import com.diagbot.dto.OrderDetialsDTO;
|
|
import com.diagbot.dto.OrderDetialsDTO;
|
|
import com.diagbot.dto.ProductAuthProgressDTO;
|
|
import com.diagbot.dto.ProductAuthProgressDTO;
|
|
import com.diagbot.dto.ProductLineDTO;
|
|
import com.diagbot.dto.ProductLineDTO;
|
|
@@ -26,20 +12,17 @@ import com.diagbot.dto.ProductOrderExportDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.UserOrgDTO;
|
|
import com.diagbot.dto.UserOrgDTO;
|
|
import com.diagbot.dto.WaitExamOrderCouDTO;
|
|
import com.diagbot.dto.WaitExamOrderCouDTO;
|
|
-import com.diagbot.entity.OpenedProducts;
|
|
|
|
import com.diagbot.entity.OrderDetailStatus;
|
|
import com.diagbot.entity.OrderDetailStatus;
|
|
import com.diagbot.entity.OrderDetails;
|
|
import com.diagbot.entity.OrderDetails;
|
|
import com.diagbot.entity.ProductOrder;
|
|
import com.diagbot.entity.ProductOrder;
|
|
import com.diagbot.entity.ProductOrderIndex;
|
|
import com.diagbot.entity.ProductOrderIndex;
|
|
import com.diagbot.entity.User;
|
|
import com.diagbot.entity.User;
|
|
import com.diagbot.entity.wrapper.ProductOrderWrapper;
|
|
import com.diagbot.entity.wrapper.ProductOrderWrapper;
|
|
-import com.diagbot.entity.wrapper.ServiceTokenWrapper;
|
|
|
|
import com.diagbot.enums.AuditStatusEnum;
|
|
import com.diagbot.enums.AuditStatusEnum;
|
|
import com.diagbot.enums.AuthStatusEnum;
|
|
import com.diagbot.enums.AuthStatusEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.NotPassEnum;
|
|
import com.diagbot.enums.NotPassEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
-import com.diagbot.enums.TokenTypeEnum;
|
|
|
|
import com.diagbot.enums.VisibleIdTypeEnum;
|
|
import com.diagbot.enums.VisibleIdTypeEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
@@ -50,13 +33,20 @@ import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.EntityUtil;
|
|
import com.diagbot.util.EntityUtil;
|
|
import com.diagbot.util.ExportBeanExcelUtil;
|
|
import com.diagbot.util.ExportBeanExcelUtil;
|
|
import com.diagbot.util.GsonUtil;
|
|
import com.diagbot.util.GsonUtil;
|
|
-import com.diagbot.util.ListUtil;
|
|
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.vo.AddOrderVO;
|
|
import com.diagbot.vo.AddOrderVO;
|
|
-import com.diagbot.vo.OpenProductCheckVO;
|
|
|
|
import com.diagbot.vo.OrderDetialsVO;
|
|
import com.diagbot.vo.OrderDetialsVO;
|
|
import com.diagbot.vo.ProductOrderExportVO;
|
|
import com.diagbot.vo.ProductOrderExportVO;
|
|
import com.diagbot.vo.ProductOrderVO;
|
|
import com.diagbot.vo.ProductOrderVO;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 订单业务
|
|
* 订单业务
|
|
@@ -181,7 +171,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
}
|
|
}
|
|
Map<Long, UserOrgDTO> dataMap =mapRespDTO.data;
|
|
Map<Long, UserOrgDTO> dataMap =mapRespDTO.data;
|
|
UserOrgDTO uo =dataMap.get(userId);
|
|
UserOrgDTO uo =dataMap.get(userId);
|
|
- if(uo.getAuStatus() != AuthStatusEnum.Authorized.getKey()){
|
|
|
|
|
|
+ if(uo.getAuStatus().intValue() != AuthStatusEnum.Authorized.getKey()){
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
"账号信息系不完善,请先认证");
|
|
"账号信息系不完善,请先认证");
|
|
}
|
|
}
|
|
@@ -197,12 +187,12 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int j =0; j<opendId.size();j++){
|
|
for (int j =0; j<opendId.size();j++){
|
|
- if(addOrderVO.getProductId().get(i)==opendId.get(j)){
|
|
|
|
|
|
+ if(addOrderVO.getProductId().get(i).longValue() == opendId.get(j).longValue()){
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请勿重复提交已开通产品");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请勿重复提交已开通产品");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (int k =0; k<orderDetailsId.size();k++){
|
|
for (int k =0; k<orderDetailsId.size();k++){
|
|
- if(addOrderVO.getProductId().get(i)==orderDetailsId.get(k)){
|
|
|
|
|
|
+ if(addOrderVO.getProductId().get(i).longValue() == orderDetailsId.get(k).longValue()){
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "产品正在审核中请勿重复提交");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "产品正在审核中请勿重复提交");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -271,65 +261,6 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
return waitExamOrderCouDTO;
|
|
return waitExamOrderCouDTO;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 已开通产品状态校验
|
|
|
|
- *
|
|
|
|
- * @param serviceTokenVo 参数
|
|
|
|
- * @return 是否有权限
|
|
|
|
- */
|
|
|
|
- public RespDTO<HasPermissionDTO> hasPermission(OpenProductCheckVO serviceTokenVo) {
|
|
|
|
- HasPermissionDTO hasPermissionDTO = new HasPermissionDTO();
|
|
|
|
- String appkey = serviceTokenVo.getAppkey();
|
|
|
|
- String secret = serviceTokenVo.getSecret();
|
|
|
|
- Map<String, Object> paramMap = new HashMap<>();
|
|
|
|
- paramMap.put("appkey", appkey);
|
|
|
|
- paramMap.put("secret", secret);
|
|
|
|
- paramMap.put("productId", serviceTokenVo.getProductId());
|
|
|
|
-
|
|
|
|
- //获取用户的id
|
|
|
|
- List<ServiceTokenWrapper> serviceTokenWrapperList = serviceTokenFacade.getByAppkeyAndSecretAndProductId(paramMap);
|
|
|
|
-
|
|
|
|
- if (ListUtil.isEmpty(serviceTokenWrapperList)) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "appkey或secret错误,appkey=【" + appkey + "】," + "secret=【" + secret + "】");
|
|
|
|
- }
|
|
|
|
- ServiceTokenWrapper st = serviceTokenWrapperList.get(0);
|
|
|
|
- if (StatusEnum.Disable.getKey() == st.getServiceStatus()) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品已停用");
|
|
|
|
- }
|
|
|
|
- if (TokenTypeEnum.Trial.getKey() == st.getType()) {
|
|
|
|
- Date date = new Date();
|
|
|
|
- if (st.getExpiringDate().getTime() < date.getTime()) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "访问权限已过期");
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- QueryWrapper<OpenedProducts> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- queryWrapper.eq("user_id", st.getUserId());
|
|
|
|
- queryWrapper.eq("product_id", st.getProductId());
|
|
|
|
- OpenedProducts op = openedProductsFacade.getOne(queryWrapper);
|
|
|
|
- if (op == null) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "无权限访问");
|
|
|
|
- }
|
|
|
|
- Date date = new Date();
|
|
|
|
- if (!(StatusEnum.Enable.getKey() == op.getServiceStatus())) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前服务已停用");
|
|
|
|
- }
|
|
|
|
- if (op.getStartTime().getTime() > date.getTime()) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品未在有效服务期内,无法使用");
|
|
|
|
- }
|
|
|
|
- if (op.getEndTime().getTime() < date.getTime()) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该产品已超出有效服务期,无法使用");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- hasPermissionDTO.setHasPermission(true);
|
|
|
|
- //获取用户的id
|
|
|
|
- if (st.getUserId() != null) {
|
|
|
|
- hasPermissionDTO.setUserId(st.getUserId().toString());
|
|
|
|
- }
|
|
|
|
- return RespDTO.onSuc(hasPermissionDTO);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 产品申请查询所有订单信息
|
|
* 产品申请查询所有订单信息
|
|
*
|
|
*
|
|
@@ -342,7 +273,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
ProductOrderIndex productOrderIndex =new ProductOrderIndex();
|
|
ProductOrderIndex productOrderIndex =new ProductOrderIndex();
|
|
BeanUtil.copyProperties(productOrderVO, productOrderIndex);
|
|
BeanUtil.copyProperties(productOrderVO, productOrderIndex);
|
|
//TODO
|
|
//TODO
|
|
- if(productOrderVO.getOrgName()!=null&&productOrderVO.getOrgName()!=""){
|
|
|
|
|
|
+ if(productOrderVO.getOrgName() != null && productOrderVO.getOrgName()!=""){
|
|
RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(productOrderVO.getOrgName());
|
|
RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(productOrderVO.getOrgName());
|
|
if(rlist == null || !"0".equals(rlist.code) ) {
|
|
if(rlist == null || !"0".equals(rlist.code) ) {
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,
|