Procházet zdrojové kódy

update 客服增加多个客服

wks před 1 rokem
rodič
revize
c33b96b9ce

+ 8 - 0
src/main/java/com/ydtech/modules/admin/model/vo/wechat/SysWechatCustomerDutyRulesVo.java

@@ -4,7 +4,9 @@ import com.ydtech.modules.admin.model.po.SysWechatCustomerDuty;
 import com.ydtech.utils.DateTimeUtil;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -13,6 +15,8 @@ import java.util.stream.Collectors;
 
 @Data
 @ApiModel("值班规则配置")
+@AllArgsConstructor
+@NoArgsConstructor
 public class SysWechatCustomerDutyRulesVo implements Serializable {
 
     private static final long serialVersionUID = 5313784741514176124L;
@@ -25,6 +29,8 @@ public class SysWechatCustomerDutyRulesVo implements Serializable {
 
     @Data
     @ApiModel("值班客服")
+    @AllArgsConstructor
+    @NoArgsConstructor
     public static class DutyCustomerDTO implements Serializable {
 
         private static final long serialVersionUID = -6002812616686817550L;
@@ -44,6 +50,8 @@ public class SysWechatCustomerDutyRulesVo implements Serializable {
 
     @Data
     @ApiModel("值班时间")
+    @AllArgsConstructor
+    @NoArgsConstructor
     public static class DutyDateTime implements Serializable {
 
         private static final long serialVersionUID = -633472086045531848L;

+ 10 - 1
src/main/java/com/ydtech/modules/admin/model/vo/wechat/SysWechatCustomerVo.java

@@ -6,7 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Data
@@ -41,7 +43,7 @@ public class SysWechatCustomerVo {
     private String receptionistId;
 
     @ApiModelProperty("值班客服")
-    private DutyCustomerDTO dutyCustomerDTO;
+    private List<DutyCustomerDTO> dutyCustomerDTO;
 
     @Data
     @AllArgsConstructor
@@ -57,4 +59,11 @@ public class SysWechatCustomerVo {
 
     }
 
+    public List<DutyCustomerDTO> getDutyCustomerDTO() {
+        if(CollectionUtils.isEmpty(dutyCustomerDTO)){
+            dutyCustomerDTO = new ArrayList<>();
+        }
+        return dutyCustomerDTO;
+    }
+
 }

+ 7 - 1
src/main/java/com/ydtech/modules/admin/service/impl/SysWechatCustomerBusinessServiceImpl.java

@@ -27,6 +27,7 @@ import me.chanjar.weixin.cp.bean.WxCpDepart;
 import me.chanjar.weixin.cp.bean.WxCpUser;
 import me.chanjar.weixin.cp.bean.kf.*;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
@@ -98,6 +99,10 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
             // 设置值班时间
             sysWechatCustomerVoPageInfo.getList().forEach(sysWechatCustomerVo -> {
                 List<SysWechatCustomerDuty> sysWechatCustomerDuties = dutyMap.get(Long.valueOf(sysWechatCustomerVo.getId()));
+                if(CollectionUtils.isEmpty(sysWechatCustomerDuties)){
+                    return;
+                }
+
                 Map<Long, List<SysWechatCustomerDuty>> collect = sysWechatCustomerDuties.stream()
                         .collect(Collectors.groupingBy(SysWechatCustomerDuty::getDutyCustomerId));
 
@@ -118,8 +123,9 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
                         dutyCustomerDTO.setDutyCustomer(sysWechatCustomer.getNickname());
                     }
                     dutyCustomerDTO.setDutyDatetime(collect1);
-                    sysWechatCustomerVo.setDutyCustomerDTO(dutyCustomerDTO);
+                    sysWechatCustomerVo.getDutyCustomerDTO().add(dutyCustomerDTO);
                 });
+
             });
         }
 

+ 5 - 5
src/main/java/com/ydtech/modules/admin/service/impl/SysWechatCustomerServiceImpl.java

@@ -76,21 +76,21 @@ public class SysWechatCustomerServiceImpl extends ServiceImpl<SysWechatCustomerM
     @Transactional(rollbackFor = Exception.class)
     public void saveOrUpdateCustomerDutyRules(SysWechatCustomerDutyRulesVo sysWechatCustomerDutyRules) {
         SysWechatCustomer customer = getByIdExist(sysWechatCustomerDutyRules.getCustomerId(), "客服不存在");
-        //
+        // 前端传入的值班客服ID
         List<String> dutyCustomerIdList = sysWechatCustomerDutyRules.getDutyCustomerDTOS()
                 .stream()
                 .map(SysWechatCustomerDutyRulesVo.DutyCustomerDTO::getDutyCustomerId)
                 .collect(Collectors.toList());
-        //
-        List<SysWechatCustomer> sysWechatCustomerList = lambdaQuery().in(SysWechatCustomer::getId, sysWechatCustomerDutyRules.getCustomerId())
+        // 数据库查出来的客服列表
+        List<SysWechatCustomer> sysWechatCustomerList = lambdaQuery().in(SysWechatCustomer::getId, dutyCustomerIdList)
                 .list();
-        //
+        // 过滤不包含的列表
         List<SysWechatCustomer> sysWechatCustomers = sysWechatCustomerList.stream()
                 .filter(sysWechatCustomer -> !dutyCustomerIdList.contains(String.valueOf(sysWechatCustomer.getId())))
                 .collect(Collectors.toList());
 
         if (!sysWechatCustomers.isEmpty()) {
-            throw new SystemException("");
+            throw new SystemException("值班客服不存在");
         }
 
         sysWechatCustomerDutyRules.getDutyCustomerDTOS().forEach(sysWechatCustomer -> {

+ 1 - 3
src/main/resources/mapper/modules/admin/SysWechatCustomerMapper.xml

@@ -29,12 +29,10 @@
         u.id as userId,
         c.department_id as departmentId,
         c.receptionist as receptionist,
-        c.receptionist_id as receptionistId,
-        swc.nickname as dutyCustomer
+        c.receptionist_id as receptionistId
         from sys_wechat_customer c
         left join sys_user u on u.id = c.user_id
         left join ins_upload_files f on f.id = c.avatar
-        left join sys_wechat_customer swc on swc.id = c.duty_customer_id
         <if test="nickname != null and nickname != ''">
             where c.nickname = #{nickname}
         </if>

+ 0 - 0
src/main/resources/mapper/SysWechatCustomerRecordingMapper.xml → src/main/resources/mapper/modules/admin/SysWechatCustomerRecordingMapper.xml