Browse Source

询盘双重审核进度通知

chenlei1231 1 week ago
parent
commit
0123c10e78

+ 2 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/result/EnquiryListDto.java

@@ -82,6 +82,8 @@ public class EnquiryListDto {
 
   private String principalUid;
 
+  private String uid;
+
   private String principalName;
 
   /** 特殊字段名 */

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryServiceImpl.java

@@ -42,6 +42,7 @@ import org.jeecg.modules.adweb.enquiry.service.*;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
+import org.jeecg.modules.adweb.subscription.mapper.UserPlanSubscriptionMapper;
 import org.jeecg.modules.adweb.system.entity.SysException;
 import org.jeecg.modules.adweb.system.service.IMasterSubAccountRelationService;
 import org.jeecg.modules.adweb.system.service.ISysExceptionService;
@@ -50,6 +51,7 @@ import org.jeecg.modules.adweb.userCountry.entity.AdwebCountry;
 import org.jeecg.modules.adweb.userCountry.entity.AdwebUserCountry;
 import org.jeecg.modules.adweb.userCountry.service.IAdwebCountryService;
 import org.jeecg.modules.adweb.userCountry.service.IAdwebUserCountryService;
+import org.jeecg.modules.adweb.workflow.service.IExecuteNodeService;
 import org.jeecg.modules.message.websocket.WebSocket;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.entity.SysUser;
@@ -127,6 +129,10 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
   @Resource private ISubUserEmailService subUserEmailService;
 
+  @Resource private UserPlanSubscriptionMapper userPlanSubscriptionMapper;
+
+  @Resource private IExecuteNodeService executeNodeService;
+
   private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
 
   private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
@@ -395,6 +401,14 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
     // 发送询盘邮件
     sendValidateEmail(target, adwebSite, principalEmailMap);
+
+    // 如果站点套餐是苏豪全托管,则创建有效询盘审核流程
+    Map<String, String> subscribePlan =
+        userPlanSubscriptionMapper.getSubscribePlanBySiteId(adwebSite.getId());
+
+    if ("苏豪通全托管".equals(subscribePlan.get("planName")) && target.getUserEffective() == 1) {
+      executeNodeService.copyEnquiryVerifyFlow(target.getId().toString());
+    }
   }
 
   /** 设置询盘负责人 */

+ 2 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/product/service/IAdwebProductService.java

@@ -6,12 +6,9 @@ import org.jeecg.modules.adweb.product.entity.AdwebProduct;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 
 /**
- * @Description: wp站点产品
- * @Author: jeecg-boot
- * @Date: 2024-12-06
- * @Version: V1.0
+ * @Description: wp站点产品 @Author: jeecg-boot @Date: 2024-12-06 @Version: V1.0
  */
 public interface IAdwebProductService extends IService<AdwebProduct> {
 
-    void addOrUpdateProduct(ProductDTO productDTO, AdwebSite adwebSites);
+  void addOrUpdateProduct(ProductDTO productDTO, AdwebSite adwebSite);
 }

+ 12 - 8
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/product/service/impl/AdwebProductServiceImpl.java

@@ -43,21 +43,25 @@ public class AdwebProductServiceImpl extends ServiceImpl<AdwebProductMapper, Adw
    * @param adwebSites
    */
   @Override
-  public void addOrUpdateProduct(ProductDTO productDTO, AdwebSite adwebSites) {
+  public void addOrUpdateProduct(ProductDTO productDTO, AdwebSite adwebSite) {
     // 产品同步时,update 有可能是新增或者更新,根据数据库中记录进行再次判断
     if ("update".equals(productDTO.getActionType())
         || "delete".equals(productDTO.getActionType())) {
-      handleUpdate(productDTO, adwebSites);
+      handleUpdate(productDTO, adwebSite);
     } else {
-      handleAdd(productDTO, adwebSites);
+      handleAdd(productDTO, adwebSite);
     }
 
-    Sohoeb2bOrder siteOrderPost = sohoeb2bOrderService.getBySiteCode(adwebSites.getCode());
-    // 属于苏豪租户的站点 向苏豪接口发送产品信息
-    if ("江苏苏豪纺织集团有限公司".equals(adwebSites.getChannelProviderName()) && siteOrderPost != null) {
-      if (StringUtils.isNotBlank(siteOrderPost.getOrderUrl())) {
-        pushSohoeB2BProduct(productDTO, adwebSites);
+    try {
+      Sohoeb2bOrder siteOrderPost = sohoeb2bOrderService.getBySiteCode(adwebSite.getCode());
+      // 属于苏豪租户的站点 向苏豪接口发送产品信息
+      if ("江苏苏豪纺织集团有限公司".equals(adwebSite.getChannelProviderName()) && siteOrderPost != null) {
+        if (StringUtils.isNotBlank(siteOrderPost.getOrderUrl())) {
+          pushSohoeB2BProduct(productDTO, adwebSite);
+        }
       }
+    } catch (Exception e) {
+      log.error("推送产品到苏豪失败:{}", adwebSite.getName(), e);
     }
   }
 

+ 9 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/controller/AdwebSiteController.java

@@ -286,6 +286,15 @@ public class AdwebSiteController extends JeecgController<AdwebSite, IAdwebSiteSe
     return Result.ok(siteList);
   }
 
+  @GetMapping("/getSubscribePlanBySite")
+  public Result<?> getSubscribePlanBySite(
+      @RequestParam(name = "siteId", required = true) String siteId) {
+    Map<String, String> subscribePlan =
+        userPlanSubscriptionMapper.getSubscribePlanBySiteId(Integer.valueOf(siteId));
+
+    return Result.OK(subscribePlan);
+  }
+
   /**
    * 更新site表现阶段
    *

+ 17 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/workflow/controller/ExecuteNodeController.java

@@ -13,6 +13,7 @@ import java.util.Date;
 import java.util.List;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
@@ -26,6 +27,8 @@ import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.workflow.entity.ExecuteNode;
 import org.jeecg.modules.adweb.workflow.service.IExecuteNodeService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -45,6 +48,8 @@ public class ExecuteNodeController extends JeecgController<ExecuteNode, IExecute
 
   @Autowired private IAdwebEnquiryService adwebEnquiryService;
 
+  @Autowired private ISysUserService sysUserService;
+
   /**
    * 分页列表查询
    *
@@ -197,9 +202,18 @@ public class ExecuteNodeController extends JeecgController<ExecuteNode, IExecute
       // 询盘审核流程,在MQ消费插入询盘时自动创建
       executeNodeService.copyEnquiryVerifyFlow(enquiryId);
       list = executeNodeService.getEnquiryVerifyFlow(enquiryId);
+    }
 
-      return Result.ok(list);
+    // 设置审核人
+    for (ExecuteNode executeNode : list) {
+      if (StringUtils.isNotBlank(executeNode.getFinUid())) {
+        SysUser user = sysUserService.getById(executeNode.getFinUid());
+        if (user != null) {
+          executeNode.setFinName(user.getRealname());
+        }
+      }
     }
+
     return Result.OK(list);
   }
 
@@ -349,7 +363,8 @@ public class ExecuteNodeController extends JeecgController<ExecuteNode, IExecute
       if (CollectionUtils.isNotEmpty(unfinishedList)) {
         enquiryUpdateWrapper.set("verify_num", stepCount - unfinishedList.size());
       } else {
-        enquiryUpdateWrapper.set("verify_num", stepCount);
+        enquiryUpdateWrapper.set("verify_num", stepCount); // 设置审核步骤完成
+        enquiryUpdateWrapper.set("user_Effective", 1); // 设置为有效询盘
       }
     }
 

+ 4 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/workflow/entity/ExecuteNode.java

@@ -103,4 +103,8 @@ public class ExecuteNode implements Serializable {
   // 步骤数量
   @TableField(exist = false)
   private Integer stepCount;
+
+  // 审核人名称
+  @TableField(exist = false)
+  private String finName;
 }

+ 1 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mq/ProductReceiver.java

@@ -70,6 +70,7 @@ public class ProductReceiver extends BaseRabbiMqHandler<List<ProductDTO>> {
               try {
                 adwebProductService.addOrUpdateProduct(product, adwebSite);
               } catch (Exception e) {
+                log.error("产品入库失败:{}", e.getMessage());
 
                 // 拉取产品失败时,发送告警到飞书
                 long endTimeEnquiry = System.currentTimeMillis();
@@ -103,8 +104,6 @@ public class ProductReceiver extends BaseRabbiMqHandler<List<ProductDTO>> {
                     className,
                     methodName,
                     String.valueOf(msg));
-
-                log.error("产品入库失败:{}", e.getMessage());
               }
             }
           }