فهرست منبع

Merge remote-tracking branch 'origin/dev/one' into dev/one

zhoutg 6 سال پیش
والد
کامیت
2d4ffb542e

+ 23 - 5
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -17,6 +17,7 @@ import com.diagbot.entity.OpenedProductsIndex;
 import com.diagbot.entity.OrderDetailsIndex;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.User;
+import com.diagbot.entity.UserRenewals;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
 import com.diagbot.entity.wrapper.ServiceInfoWrapper;
 import com.diagbot.entity.wrapper.UserRenewalsWrapper;
@@ -107,6 +108,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
                     "产品名称重复");
         }
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
         lantoneProduct.setGmtModified(DateUtil.now());
@@ -135,6 +140,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      */
     public Boolean stopProduct(UpdateProductVO updateProductVO) {
         LantoneProduct lantoneProduct = this.getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         if(updateProductVO.getServiceStatus() == lantoneProduct.getServiceStatus() && updateProductVO.getServiceStatus() == StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "该产品已启用,启用失败");
@@ -166,7 +175,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             renewalsInfosDTO.setProductId(updateProductVO.getId());
             renewalsInfosDTO.setRenewalsStatus(RenewalsEnum.NOT_RENEWALS.getKey());
             List<RenewalsInfosDTO> list =  userRenewalsFacade.selectUserRenewals(page,renewalsInfosDTO).getRecords();
-            if(list.contains(RenewalsEnum.NOT_RENEWALS.getKey()) && list.contains(CancelRenewalsEnum.NOT_CANCEL.getKey())){
+            UserRenewals userRenewals = new UserRenewals();
+            userRenewals.setRenewalsStatus(RenewalsEnum.NOT_RENEWALS.getKey());
+            userRenewals.setCancelRenewals(CancelRenewalsEnum.NOT_CANCEL.getKey());
+            if(list.contains(userRenewals)){
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                         "该产品无法停用,请先处理续费申请信息");
             }
@@ -186,6 +198,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      */
     public Boolean deleteProduct(UpdateProductVO updateProductVO) {
         LantoneProduct lantoneProduct = getById(updateProductVO.getId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         if(lantoneProduct.getServiceStatus()==StatusEnum.Enable.getKey()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "当前产品正在使用中不可删除");
@@ -204,12 +220,9 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "产品删除失败");
         }
-        List<OpenedProducts> list = openedProductsFacade.getOpendById(openedProducts);
-        if(list.size() != 0){
-            if(!productServiceFacade.deleteByProductId(updateProductVO.getId())){
+        if(!productServiceFacade.deleteByProductId(updateProductVO.getId())){
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                         "产品令牌删除失败");
-            }
         }
         return true;
     }
@@ -314,6 +327,11 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return 当条产品线下所有订单信息
      */
     public IPage<OpendProductDTO> opendedProduct(OppendedProductVO oppendedProductVO) {
+        LantoneProduct lantoneProduct = getById(oppendedProductVO.getProductId());
+        if(lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y)){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "该产品已删除");
+        }
         Page page =new Page();
         BeanUtil.copyProperties(oppendedProductVO,page);
         OpenedProductsIndex openedProductsIndex = new OpenedProductsIndex();

+ 28 - 0
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -207,6 +207,34 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
          if(user==null){
            	 return RespDTO.onError("该用户已不存在"); 
             }
+         //当用户是操作是启用的时候,先判断该产品是否是启用状态
+		if (startAndendByUserIdVO.getServiceStatus().equals(StatusEnum.Enable.getKey())) {
+			LantoneProduct lantoneProduct = new LantoneProduct();
+			lantoneProduct.setId(startAndendByUserIdVO.getProductId());
+			LantoneProduct lantone = lantoneProductFacade.getById(lantoneProduct);
+			if (lantone.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+				return RespDTO.onError("该产品已停用");
+			}
+		}
+		//判断该用户是否有续费申请单
+     	UserRenewals userRenewals = new UserRenewals();
+     	userRenewals.setUserId(startAndendByUserIdVO.getUserId());
+     	int userSum = userRenewalsFacade.getUserWaitingRenewal(userRenewals);
+     	if(userSum>0){
+      		 return RespDTO.onError("该产品无法停用,请先处理续费申请信息");
+         	}
+     	//验证是否有别的管理员操作过
+     	Map<String, Object> map = new HashMap<String, Object>();
+        map.put("userId", startAndendByUserIdVO.getUserId());
+        map.put("productId", startAndendByUserIdVO.getProductId());
+        List<OpenedProducts> OpenedProductsData = selectOpenedProducts(map);
+        if(OpenedProductsData != null){
+        	for(OpenedProducts openedProductsNew : OpenedProductsData){
+        		if(openedProductsNew.getServiceStatus().equals(startAndendByUserIdVO.getServiceStatus())){
+        			return RespDTO.onError("该产品已被"+StatusEnum.getName(startAndendByUserIdVO.getServiceStatus())+"无需先处理");	
+        		}
+        	}	
+        }
         boolean res = startAndendByuserId(openedProducts);
         if (!res) {
             throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);

+ 1 - 9
diagbotman-service/src/main/java/com/diagbot/facade/UserRenewalsFacade.java

@@ -113,7 +113,7 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
             userRenewalsWrapper.setUserId(userIds);
         }
         List<RenewalsInfosDTO> list = this.selectUserRenewals(page,userRenewalsWrapper).getRecords();
-        List<ProductLineDTO> productList =lantoneProductFacade.productLines();
+        List<ProductLineDTO> productList =lantoneProductFacade.productLinesB();
         Map<Long, ProductLineDTO> productMap = EntityUtil.makeEntityMap(productList,"id");
         List<Long> userIds =new ArrayList<>();
         for (RenewalsInfosDTO renewalsInfosDTO:list) {
@@ -192,12 +192,4 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         }
         return true;
     }
-    /**
-     *查詢用户的待续费数量
-     * @param userRenewals
-     * @return
-     */
-    public int getUserWaitingRenewal(UserRenewals userRenewals){
-    	return this.getUserWaitingRenewal(userRenewals);
-    }
 }

+ 7 - 0
diagbotman-service/src/main/java/com/diagbot/mapper/LantoneProductMapper.java

@@ -28,6 +28,13 @@ public interface LantoneProductMapper extends BaseMapper<LantoneProduct> {
      */
     List<ProductLineDTO> productLines();
 
+    /**
+     * @Description: 查询所有产品信息系包括已删除的
+     * @Author: wangyu
+     * @Date: 9:49 2018/9/18
+     */
+    List<ProductLineDTO> productLinesB();
+
     /**
      * @Description: 根据产品名称分页查询
      * @Author: wangyu

+ 7 - 0
diagbotman-service/src/main/java/com/diagbot/service/LantoneProductService.java

@@ -27,6 +27,13 @@ public interface LantoneProductService extends IService<LantoneProduct> {
      */
     List<ProductLineDTO> productLines();
 
+    /**
+     * @Description: 查询所有产品信息系包括已删除的
+     * @Author: wangyu
+     * @Date: 9:49 2018/9/18
+     */
+    List<ProductLineDTO> productLinesB();
+
     /**
      * @Description: 朗通查询所有产品线
      * @Author: wangyu

+ 10 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/LantoneProductServiceImpl.java

@@ -39,6 +39,16 @@ public class LantoneProductServiceImpl extends ServiceImpl<LantoneProductMapper,
         return baseMapper.productLines();
     }
 
+    /**
+     * @Description: 显示朗通产品线
+     * @Author: wangyu
+     * @Date: 13:29 2018/9/18
+     */
+    @Override
+    public List<ProductLineDTO> productLinesB() {
+        return baseMapper.productLinesB();
+    }
+
     /**
      * @Description: 查询朗通所有产品线
      * @Author: wangyu

+ 5 - 0
diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml

@@ -47,6 +47,11 @@
         SELECT * FROM `diag_lantone_product` WHERE is_deleted = 'N'
     </select>
 
+
+    <select id="productLinesB" resultType="com.diagbot.dto.ProductLineDTO">
+        SELECT * FROM `diag_lantone_product`
+    </select>
+
     <!--根据产品名称分页查询-->
     <select id="selectProduct" resultType="com.diagbot.dto.LantoneProductDTO">
         SELECT

+ 1 - 1
diagbotman-service/src/main/resources/mapper/OpenedProductsMapper.xml

@@ -120,7 +120,7 @@
 		FROM
 		diag_opened_products
 		WHERE
-		user_id = #{userId} and is_deleted = 'N' and service_status = 1)
+		user_id = #{userId} and is_deleted = 'N')
 	</select>
 
     <select id="getConsoleOnTrialCount" parameterType="long" resultType="int">

+ 3 - 3
user-service/src/main/java/com/diagbot/facade/UserFacade.java

@@ -967,9 +967,9 @@ public class UserFacade extends UserServiceImpl {
                     "获取用户续费数量信息失败");
         }
         int renewalSum = renewalSums.data;
-        System.out.println("========renewalSu====="+renewalSum);
+        //System.out.println("========renewalSu====="+renewalSum);
         if(renewalSum>0){
-   		 return RespDTO.onError("该用户续费申请单,请先审核");
+   		 return RespDTO.onError("该用户存在续费申请单,请先审核");
       	}
         //查询用户是否有待审核的产品数量
         RespDTO<Integer> auditSums = diagbotmanClient.getOrderByUserToAudit(baseIdVO.getId());
@@ -978,7 +978,7 @@ public class UserFacade extends UserServiceImpl {
                     "审核的产品数量失败");
         }
         int auditSum = auditSums.data;
-        System.out.println("=========auditSumauditSum===="+auditSum);
+        //System.out.println("=========auditSumauditSum===="+auditSum);
         if(auditSum>0){
    		 return RespDTO.onError("该用户产品申请单,请先审核");
     	}