|
@@ -1,24 +1,39 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.ProductAuthProgressDTO;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.dto.UserOrgDTO;
|
|
|
import com.diagbot.dto.WaitExamOrderCouDTO;
|
|
|
import com.diagbot.entity.LantoneProduct;
|
|
|
import com.diagbot.entity.OrderDetails;
|
|
|
+import com.diagbot.entity.OrderDetailsIndex;
|
|
|
import com.diagbot.entity.ProductOrder;
|
|
|
+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.VisibleIdTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.idc.VisibleIdCreater;
|
|
|
import com.diagbot.service.impl.ProductOrderServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddOrderVO;
|
|
|
+import com.diagbot.vo.AuditStatusVO;
|
|
|
+import com.diagbot.vo.OrderDetialsVO;
|
|
|
+import com.diagbot.vo.ProductOrderVO;
|
|
|
+import com.diagbot.vo.ProductServiceSaveVO;
|
|
|
+import com.diagbot.vo.ServiceSaveVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 订单业务
|
|
@@ -37,6 +52,10 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
|
private LantoneProductFacade lantoneProductFacade;
|
|
|
@Autowired
|
|
|
private ProductServiceFacade productServiceFacade;
|
|
|
+ @Autowired
|
|
|
+ private UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
+ private ProductOrderFacade productOrderFacade;
|
|
|
|
|
|
public List<ProductAuthProgressDTO> productAuthProgress(){
|
|
|
List<ProductAuthProgressDTO> retList = new ArrayList<ProductAuthProgressDTO>();
|
|
@@ -101,7 +120,124 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
|
|
|
waitExamOrderCouDTO.setCount(baseMapper.waitExamOrderCou());
|
|
|
return waitExamOrderCouDTO;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 查询所有订单明细
|
|
|
+ * @Author: wangyu
|
|
|
+ * @Date: 16:19 2018/9/21
|
|
|
+ */
|
|
|
+ public List<OrderDetailsWapper> getAllOrderDetials(OrderDetialsVO orderDetialsVO){
|
|
|
+ OrderDetailsIndex orderDetailsIndex =new OrderDetailsIndex();
|
|
|
+ Long curren = orderDetialsVO.getCurrent();
|
|
|
+ Long size =orderDetialsVO.getSize();
|
|
|
+ if(curren==null){
|
|
|
+ orderDetialsVO.setCurrent(1L);
|
|
|
+ }
|
|
|
+ if (size==null){
|
|
|
+ orderDetialsVO.setSize(10L);
|
|
|
+ }
|
|
|
+ BeanUtil.copyProperties(orderDetialsVO, orderDetailsIndex);
|
|
|
+ orderDetailsIndex.setIndex((orderDetialsVO.getCurrent().longValue()-1)*orderDetialsVO.getSize().longValue());
|
|
|
+ List<OrderDetailsWapper> list =orderDetailsFacade.seleAllOrderDetials(orderDetailsIndex);
|
|
|
+ List<Long> list1 =new ArrayList<>();
|
|
|
+ for (OrderDetails orderDetails:list) {
|
|
|
+ Long longs = orderDetails.getUserId();
|
|
|
+ list1.add(longs);
|
|
|
+ }
|
|
|
+ RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
|
|
|
+ if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "获取用户和机构信息失败");
|
|
|
+ }
|
|
|
+ Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
|
|
|
+ for(OrderDetailsWapper bean : list) {
|
|
|
+ UserOrgDTO uo = dataMap.get(bean.getUserId());
|
|
|
+ if(uo != null) {
|
|
|
+ bean.setUsername(uo.getUsername());
|
|
|
+ bean.setLinkman(uo.getLinkman());
|
|
|
+ bean.setEmail(uo.getEmail());
|
|
|
+ bean.setOrgId(uo.getOrgId());
|
|
|
+ bean.setOrgName(uo.getOrgName());
|
|
|
+ bean.setIsReject(uo.getIsReject());
|
|
|
+ bean.setAuStatus(uo.getAuStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 产品申请查询所有订单信息
|
|
|
+ * @Author: wangyu
|
|
|
+ * @Date: 20:23 2018/9/24
|
|
|
+ */
|
|
|
+ public List<ProductOrderWrapper> selectAllProductOrder(ProductOrderVO productOrderVO){
|
|
|
+ ProductOrderIndex productOrderIndex =new ProductOrderIndex();
|
|
|
+ Long curren = productOrderVO.getCurrent();
|
|
|
+ Long size =productOrderVO.getSize();
|
|
|
+ if(curren==null){
|
|
|
+ productOrderVO.setCurrent(1L);
|
|
|
+ }
|
|
|
+ if (size==null){
|
|
|
+ productOrderVO.setSize(10L);
|
|
|
+ }
|
|
|
+ BeanUtil.copyProperties(productOrderVO, productOrderIndex);
|
|
|
+ productOrderIndex.setIndex((productOrderVO.getCurrent().longValue()-1)*productOrderVO.getSize().longValue());
|
|
|
+ List<ProductOrderWrapper> list =productOrderFacade.selectAllProductOrder(productOrderIndex);
|
|
|
+ List<Long> list1 =new ArrayList<>();
|
|
|
+ for (ProductOrderWrapper productOrderWrapper:list) {
|
|
|
+ Long longs = productOrderWrapper.getUserId();
|
|
|
+ list1.add(longs);
|
|
|
+ }
|
|
|
+ RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
|
|
|
+ if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "获取用户和机构信息失败");
|
|
|
+ }
|
|
|
+ Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
|
|
|
+ for(ProductOrderWrapper bean : list) {
|
|
|
+ UserOrgDTO uo = dataMap.get(bean.getUserId());
|
|
|
+ if(uo != null) {
|
|
|
+ bean.setUsername(uo.getUsername());
|
|
|
+ bean.setLinkman(uo.getLinkman());
|
|
|
+ bean.setEmail(uo.getEmail());
|
|
|
+ bean.setOrgId(uo.getOrgId());
|
|
|
+ bean.setOrgName(uo.getOrgName());
|
|
|
+ bean.setIsReject(uo.getIsReject());
|
|
|
+ bean.setAuStatus(uo.getAuStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 产品申请审核接口
|
|
|
+ * @Author: wangyu
|
|
|
+ * @Date: 21:39 2018/9/24
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public CommonErrorCode updateAuditStatus(AuditStatusVO auditStatusVO){
|
|
|
+ OrderDetails orderDetails =new OrderDetails();
|
|
|
+ orderDetails.setId(auditStatusVO.getId());
|
|
|
+ orderDetails.setGmtModified(DateUtil.now());
|
|
|
+ orderDetails.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ orderDetails.setAuditStatus(1);
|
|
|
+ if(!orderDetailsFacade.updateById(orderDetails)){
|
|
|
+ return CommonErrorCode.FAIL;
|
|
|
+ }
|
|
|
+ LantoneProduct lantoneProduct =new LantoneProduct();
|
|
|
+ lantoneProduct.setId(auditStatusVO.getId());
|
|
|
+ ServiceSaveVO serviceSaveVO =new ServiceSaveVO();
|
|
|
+ ProductServiceSaveVO productServiceSaveVO =new ProductServiceSaveVO();
|
|
|
+ serviceSaveVO.setDescription(lantoneProduct.getDecription());
|
|
|
+ serviceSaveVO.setName(lantoneProduct.getName());
|
|
|
+ serviceSaveVO.setType(1);
|
|
|
+ ServiceInfo serviceInfo = serviceInfoFacade.createService(serviceSaveVO);
|
|
|
+ productServiceSaveVO.setProductId(auditStatusVO.getId());
|
|
|
+ productServiceSaveVO.setServiceId(serviceInfo.getId());
|
|
|
+ productServiceSaveVO.setType(1);
|
|
|
+ productServiceFacade.genProductService(productServiceSaveVO);
|
|
|
+ return CommonErrorCode.OK;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|