Bläddra i källkod

产品线管理产品停用

wangyu 6 år sedan
förälder
incheckning
7454ae9e4b

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/UserRenewalsWrapper.java

@@ -51,4 +51,10 @@ public class UserRenewalsWrapper {
      * 是否取消续费
      */
     private Integer cancelRenewals;
+
+    /**
+     * 产品id
+     */
+    private Long productId;
+
 }

+ 21 - 1
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -13,14 +13,18 @@ import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.OpenedProductsIndex;
+import com.diagbot.entity.OrderDetailsIndex;
 import com.diagbot.entity.ServiceInfo;
 import com.diagbot.entity.User;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
 import com.diagbot.entity.wrapper.ServiceInfoWrapper;
+import com.diagbot.entity.wrapper.UserRenewalsWrapper;
 import com.diagbot.enums.AccessTypeEnum;
+import com.diagbot.enums.AuditStatusEnum;
 import com.diagbot.enums.ChargeTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.ProductAuditEnum;
+import com.diagbot.enums.RenewalsEnum;
 import com.diagbot.enums.ServiceTypeEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.enums.TrialStatusEnum;
@@ -59,6 +63,8 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
     private OrderDetailsFacade orderDetailsFacade;
     @Autowired
     private ServiceInfoFacade serviceInfoFacade;
+    @Autowired
+    private UserRenewalsFacade userRenewalsFacade;
 
     /**
      * 产品线管理添加产品
@@ -133,10 +139,24 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
             openedProductsIndex.setProductId(updateProductVO.getId());
             openedProductsIndex.setServiceStatus(StatusEnum.Enable.getKey());
-            if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size()>0){
+            if(openedProductsFacade.getByProductId(page,openedProductsIndex).getRecords().size() > 0){
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                         "用户正在使用中,停用失败");
             }
+            OrderDetailsIndex orderDetailsIndex =new OrderDetailsIndex();
+            orderDetailsIndex.setProductId(updateProductVO.getId());
+            orderDetailsIndex.setAuditStatus(AuditStatusEnum.NotAudit.getKey());
+            if(orderDetailsFacade.seleAllOrderDetials(orderDetailsIndex).size() > 0){
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "该产品无法停用,请先处理申请信息");
+            }
+            UserRenewalsWrapper renewalsInfosDTO =new UserRenewalsWrapper();
+            renewalsInfosDTO.setProductId(updateProductVO.getId());
+            renewalsInfosDTO.setRenewalsStatus(RenewalsEnum.NOT_RENEWALS.getKey());
+            if(userRenewalsFacade.selectUserRenewals(page,renewalsInfosDTO).getRecords().size() > 0){
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "该产品无法停用,请先处理续费申请信息");
+            }
         }
         if (!updateById(lantoneProduct)) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,

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

@@ -247,7 +247,6 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
                 throw new CommonException(CommonErrorCode.NOT_EXISTS, "输入有误,续费时间需大于到期时间");
             }
         }
-        openedProducts.setServiceStatus(StatusEnum.Enable.getKey());
         openedProducts.setEndTime(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime()));
         openedProducts.setModifier(UserUtils.getCurrentPrincipleID());
         openedProducts.setGmtModified(DateUtil.now());

+ 3 - 0
diagbotman-service/src/main/resources/mapper/OrderDetailsMapper.xml

@@ -54,6 +54,9 @@
         <if test="productId != null and productId !=''">
             AND product_id = #{productId}
         </if>
+        <if test="auditStatus != null and auditStatus !=''">
+            AND a.audit_status = #{auditStatus}
+        </if>
     </select>
 
     <select id="selectAllOrderDetialsByOrderNum" resultType="com.diagbot.entity.OrderDetailStatus">

+ 5 - 2
diagbotman-service/src/main/resources/mapper/UserRenewalsMapper.xml

@@ -31,10 +31,10 @@
         <if test="renewalsInfosVO.renewalsStatus != null">
               AND renewals_status = #{renewalsInfosVO.renewalsStatus}
         </if>
-        <if test="renewalsInfosVO.startTime != null and renewalsInfosVO.endTime != null">
+        <if test="renewalsInfosVO.startTime != null and renewalsInfosVO.endTime != ''">
             AND apply_time BETWEEN #{renewalsInfosVO.startTime} and #{renewalsInfosVO.endTime}
         </if>
-        <if test="renewalsInfosVO.cancelRenewals != null and renewalsInfosVO.cancelRenewals != null">
+        <if test="renewalsInfosVO.cancelRenewals != null">
             AND cancel_renewals = #{renewalsInfosVO.cancelRenewals}
         </if>
         <if test="renewalsInfosVO.userId != null and renewalsInfosVO.userId.size > 0">
@@ -42,6 +42,9 @@
                 user_id = #{renewalsInfosVO.userId}
             </foreach>
         </if>
+        <if test="renewalsInfosVO.productId != null and renewalsInfosVO.productId != ''">
+            AND product_id = #{renewalsInfosVO.productId}
+        </if>
         ORDER BY apply_time DESC
     </select>