|
@@ -6,6 +6,7 @@ import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.dto.UserOrgDTO;
|
|
|
import com.diagbot.dto.WaitExamOrderCouDTO;
|
|
|
import com.diagbot.entity.LantoneProduct;
|
|
|
+import com.diagbot.entity.OpenedProducts;
|
|
|
import com.diagbot.entity.OrderDetails;
|
|
|
import com.diagbot.entity.OrderDetailsIndex;
|
|
|
import com.diagbot.entity.ProductOrder;
|
|
@@ -13,6 +14,8 @@ import com.diagbot.entity.ProductOrderIndex;
|
|
|
import com.diagbot.entity.ServiceInfo;
|
|
|
import com.diagbot.entity.wrapper.OrderDetailsWapper;
|
|
|
import com.diagbot.entity.wrapper.ProductOrderWrapper;
|
|
|
+import com.diagbot.enums.AuditStatusEnum;
|
|
|
+import com.diagbot.enums.TokenTypeEnum;
|
|
|
import com.diagbot.enums.VisibleIdTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
@@ -56,6 +59,8 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
|
private UserServiceClient userServiceClient;
|
|
|
@Autowired
|
|
|
private ProductOrderFacade productOrderFacade;
|
|
|
+ @Autowired
|
|
|
+ private OpenedProductsFacade openedProductsFacade;
|
|
|
|
|
|
/**
|
|
|
* 获取产品的认证进度
|
|
@@ -228,25 +233,51 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
|
*/
|
|
|
@Transactional
|
|
|
public Boolean updateAuditStatus(AuditStatusVO auditStatusVO){
|
|
|
- OrderDetails orderDetails =new OrderDetails();
|
|
|
- orderDetails.setId(auditStatusVO.getId());
|
|
|
+ OrderDetails orderDetails =orderDetailsFacade.getById(auditStatusVO.getId());
|
|
|
+ if(orderDetails==null){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "订单明细不存在");
|
|
|
+ }
|
|
|
orderDetails.setGmtModified(DateUtil.now());
|
|
|
orderDetails.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
- orderDetails.setAuditStatus(1);
|
|
|
+ orderDetails.setAuditStatus(auditStatusVO.getAuditStatus());
|
|
|
+ //TODO 审核不通过
|
|
|
+ if(auditStatusVO.getAuditStatus()== AuditStatusEnum.Veto.getKey()){
|
|
|
+ if(!orderDetailsFacade.updateById(orderDetails)){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "审核状态修改失败");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //TODO 审核通过 添加已开通产品 判断产品类型是否有online(添加服务 服务产品表 token表)
|
|
|
if(!orderDetailsFacade.updateById(orderDetails)){
|
|
|
- throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "审核状态修改失败");
|
|
|
}
|
|
|
+ Long userId =Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
+ OpenedProducts openedProducts =new OpenedProducts();
|
|
|
+ openedProducts.setGmtCreate(DateUtil.now());
|
|
|
+ openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
+ openedProducts.setProductId(1L);
|
|
|
+ openedProducts.setUserId(userId);
|
|
|
+ openedProducts.setStartTime(auditStatusVO.getStartTime());
|
|
|
+ openedProducts.setEndTime(auditStatusVO.getEndTime());
|
|
|
+ openedProducts.setOrderId(1L);
|
|
|
+ openedProductsFacade.save(openedProducts);
|
|
|
LantoneProduct lantoneProduct =new LantoneProduct();
|
|
|
- lantoneProduct.setId(auditStatusVO.getId());
|
|
|
+ if(lantoneProductFacade.getById(lantoneProduct).getAccessType().indexOf(TokenTypeEnum.Online.getKey())==-1){
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "该产品没有线上模式");
|
|
|
+ }
|
|
|
ServiceSaveVO serviceSaveVO =new ServiceSaveVO();
|
|
|
- ProductServiceSaveVO productServiceSaveVO =new ProductServiceSaveVO();
|
|
|
serviceSaveVO.setDescription(lantoneProduct.getDecription());
|
|
|
serviceSaveVO.setName(lantoneProduct.getName());
|
|
|
- serviceSaveVO.setType(1);
|
|
|
+ serviceSaveVO.setType(TokenTypeEnum.Online.getKey());
|
|
|
ServiceInfo serviceInfo = serviceInfoFacade.createService(serviceSaveVO);
|
|
|
+ ProductServiceSaveVO productServiceSaveVO =new ProductServiceSaveVO();
|
|
|
productServiceSaveVO.setProductId(auditStatusVO.getId());
|
|
|
productServiceSaveVO.setServiceId(serviceInfo.getId());
|
|
|
- productServiceSaveVO.setType(1);
|
|
|
+ productServiceSaveVO.setType(TokenTypeEnum.Online.getKey());
|
|
|
productServiceFacade.genProductService(productServiceSaveVO);
|
|
|
return true;
|
|
|
}
|