lmx 1 месяц назад
Родитель
Сommit
d6fea7ae05

+ 2 - 5
fs-company/src/main/java/com/fs/company/controller/company/GeneralCustomerEntryController.java

@@ -4,10 +4,7 @@ import com.fs.common.core.domain.R;
 import com.fs.company.param.EntryCustomerParam;
 import com.fs.company.service.IGeneralCustomerEntryService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author MixLiu
@@ -22,7 +19,7 @@ public class GeneralCustomerEntryController {
     IGeneralCustomerEntryService iGeneralCustomerEntryService;
 
     @PostMapping("/entryCustomer")
-    public R entryCustomer(EntryCustomerParam param){
+    public R entryCustomer(@RequestBody EntryCustomerParam param){
         iGeneralCustomerEntryService.entryCustomer(param);
        return R.ok("success");
     }

+ 1 - 0
fs-company/src/main/java/com/fs/framework/config/SecurityConfig.java

@@ -135,6 +135,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/qw/user/selectCloudByCompany").anonymous()
                 .antMatchers("/live/LiveMixLiuTestOpen/**").anonymous()
                 .antMatchers("/app/common/callbackAfterSendSingleMsgCommand").anonymous()
+                .antMatchers("/company/general/customer/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 4 - 6
fs-company/src/test/java/com/mixLiu/test/mixLiuTester.java

@@ -33,12 +33,10 @@ public class mixLiuTester {
 
     @Test
     public void test11(){
-        FsDoctor doctorMap = new FsDoctor();
-        doctorMap.setDoctorId(1L);
-        doctorMap.setJpushId("123");
+        String substring = "18580336425".substring(7, 11);
+        System.out.println(substring);
 
-        if(doctorMap.getStatus() != 1){
-            System.out.println("开始删除处方医生");
-        }
     }
+
+
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyVoiceRobotic.java

@@ -131,6 +131,8 @@ public class CompanyVoiceRobotic {
     private String qwUserId;
     private Integer taskType;
     private Integer sceneType;
+    @TableField(exist = false)
+    private String sceneTypeName;
     private LocalTime availableStartTime;
     private LocalTime availableEndTime;
 }

+ 12 - 2
fs-service/src/main/java/com/fs/company/service/impl/CompanyVoiceRoboticServiceImpl.java

@@ -144,10 +144,20 @@ public class CompanyVoiceRoboticServiceImpl extends ServiceImpl<CompanyVoiceRobo
     public List<CompanyVoiceRobotic> selectCompanyVoiceRoboticList(CompanyVoiceRobotic companyVoiceRobotic){
         return companyVoiceRoboticMapper.selectCompanyVoiceRoboticList(companyVoiceRobotic);
     }
+
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<CompanyVoiceRobotic> selectCompanyVoiceRoboticListCompany(CompanyVoiceRobotic companyVoiceRobotic){
-        return companyVoiceRoboticMapper.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic);
+    public List<CompanyVoiceRobotic> selectCompanyVoiceRoboticListCompany(CompanyVoiceRobotic companyVoiceRobotic) {
+        List<CompanyVoiceRobotic> companyVoiceRobotics = companyVoiceRoboticMapper.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic);
+        List<SysDictData> taskSceneType = DictUtils.getDictCache("task_scene_type");
+        companyVoiceRobotics.forEach(a -> {
+            if (null != a.getSceneType()) {
+                taskSceneType.stream().filter(b -> b.getDictValue().equals(a.getSceneType().toString())).findFirst().ifPresent(c -> {
+                    a.setSceneTypeName(c.getDictLabel());
+                });
+            }
+        });
+        return companyVoiceRobotics;
     }
 
     /**

+ 45 - 8
fs-service/src/main/java/com/fs/company/service/impl/GeneralCustomerEntryServiceImpl.java

@@ -11,9 +11,11 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.entity.SysDictData;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.spring.SpringUtils;
+import com.fs.company.domain.CompanyConfig;
 import com.fs.company.domain.CompanyVoiceRobotic;
 import com.fs.company.mapper.CompanyVoiceRoboticMapper;
 import com.fs.company.param.EntryCustomerParam;
+import com.fs.company.service.ICompanyConfigService;
 import com.fs.company.service.ICompanyVoiceRoboticService;
 import com.fs.company.service.IGeneralCustomerEntryService;
 import com.fs.company.util.CryptoUtil;
@@ -39,6 +41,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.time.LocalTime;
 import java.util.*;
 import java.util.concurrent.CompletableFuture;
@@ -67,6 +70,8 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
     @Autowired
     private SysDictDataMapper sysDictDataMapper;
 
+    @Autowired
+    ICompanyConfigService companyConfigService;
     /**
      * 录入客户
      *
@@ -210,11 +215,28 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
         }
         //客户数据解析,是否包含对话图 对话图解析标签&意向度标识 todo 庄旭组在研发此功能
         if (StringUtils.isNotBlank(data.getDialogue())) {
-            JSONObject jsonObject = analysisDialogue(data.getDialogue());
-            if (jsonObject != null) {
-                data.setIntention(jsonObject.getString("intention"));
-                data.setTags(jsonObject.getString("tags"));
+            try {
+                List<CrmCustomerAiTagVo> aiTags = getAiTags(data.getDialogue());
+                if(null != aiTags && !aiTags.isEmpty()){
+                    String tags = data.getTags()==null?"":data.getTags();
+                    StringBuilder sb = new StringBuilder(tags);
+                    aiTags.forEach(a->{
+                        sb.append(a.getName()).append(",");
+                    });
+                    if(sb.length() >0 &&  ',' == sb.charAt(sb.length()-1)){
+                        data.setTags(sb.substring(0,sb.length()-1));
+                    }
+                    data.setTags(sb.toString());
+                }
+                //todo 意向度分析
+            } catch (JsonProcessingException e) {
+                log.error("导入用户标签数据解析异常", e);
             }
+//            JSONObject jsonObject = analysisDialogue(data.getDialogue());
+//            if (jsonObject != null) {
+//                data.setIntention(jsonObject.getString("intention"));
+//                data.setTags(jsonObject.getString("tags"));
+//            }
         }
         //客户数据插入
         insertCrmCustomer(data);
@@ -239,10 +261,18 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
             log.error("手机号格式错误,{}", param.getMobile());
             return false;
         }
-        Long  customerId = crmCustomerMapper.selectCrmCustomerByCrmMobile(param.getMobile());
-        // todo 添加配置是否允许重复客户导入
-        if( null != customerId && true){
-            return false;
+        //根据配置项是否允许重复手机号客户录入
+        CompanyConfig config=companyConfigService.selectCompanyConfigByKey(param.getCompanyId(),"cId.config");
+        if (null != config) {
+            String configValue = config.getConfigValue();
+            JSONObject configObj = JSONObject.parseObject(configValue);
+            if(configObj.containsKey("allowRepeatCustomer") && null != configObj.getBoolean("allowRepeatCustomer") && !configObj.getBoolean("allowRepeatCustomer")){
+                Long  customerId = crmCustomerMapper.selectCrmCustomerByCrmMobileAndCompanyId(param.getCompanyId(),param.getMobile());
+                if( null != customerId && true){
+                    log.error("手机号重复数据,{}", param.getMobile());
+                    return false;
+                }
+            }
         }
         return true;
     }
@@ -265,6 +295,13 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
     public void insertCrmCustomer(EntryCustomerParam data){
         CrmCustomer insertObj = new CrmCustomer();
         BeanUtils.copyProperties(data,insertObj);
+        if(StringUtils.isBlank(insertObj.getCustomerName())){
+            insertObj.setCustomerName("客户"+insertObj.getMobile().substring(7,11));
+        }
+        insertObj.setIsLine(1);
+        if(null == insertObj.getCreateTime()){
+            insertObj.setCreateTime(new Date());
+        }
         crmCustomerMapper.insertCrmCustomer(insertObj);
         data.setCustomerId(insertObj.getCustomerId());
     }

+ 3 - 3
fs-service/src/main/java/com/fs/company/util/PhoneNumberUtil.java

@@ -56,20 +56,20 @@ public class PhoneNumberUtil {
     public static boolean isValid(String mobile) {
         // 空值校验
         if (StringUtils.isBlank(mobile)) {
-            log.warn("手机号校验失败:手机号为空");
+            log.error("手机号校验失败:手机号为空");
             return false;
         }
         // 去除首尾空格
         String trimmedMobile = mobile.trim();
         // 长度校验(手机号必须为11位)
         if (trimmedMobile.length() != MOBILE_LENGTH) {
-            log.warn("手机号校验失败:手机号长度不正确,当前长度={}", trimmedMobile.length());
+            log.error("手机号校验失败:手机号长度不正确,当前长度={}", trimmedMobile.length());
             return false;
         }
         // 格式校验(使用正则表达式)
         boolean isValid = MOBILE_PATTERN.matcher(trimmedMobile).matches();
         if (!isValid) {
-            log.warn("手机号校验失败:手机号格式不正确,mobile={}", trimmedMobile);
+            log.error("手机号校验失败:手机号格式不正确,mobile={}", trimmedMobile);
         }
         return isValid;
     }

+ 14 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCourseAnswerLogsMapper.java

@@ -118,6 +118,20 @@ public interface FsCourseAnswerLogsMapper
             "</script>"})
     FsCourseAnswerLogs selectRightLogByCourseVideo(@Param("videoId") Long videoId,@Param("userId") Long userId,@Param("qwUserId") String qwUserId);
 
+    @Select({"<script> " +
+            "select * from fs_course_answer_logs where video_id = #{videoId} and user_id = #{userId} and is_right = 1 " +
+            "<if test = 'qwUserId !=null '> " +
+            "and qw_user_id = #{qwUserId} " +
+            "</if>" +
+            "<if test = 'periodId !=null '> " +
+            " and period_id = #{periodId} " +
+            "</if>" +
+            "limit 1 " +
+            "</script>"})
+    FsCourseAnswerLogs selectRightLogByCourseVideoWithPeriodId(@Param("videoId") Long videoId,
+                                                               @Param("userId") Long userId,
+                                                               @Param("qwUserId") String qwUserId,
+                                                               @Param("periodId") Long periodId);
 
     @Select({"<script> " +
             "select count(0) from fs_course_answer_logs where video_id = #{videoId} and user_id = #{userId} and is_right = 0 " +

+ 3 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1630,6 +1630,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
         }
 
         FsCourseAnswerLogs rightLog = courseAnswerLogsMapper.selectRightLogByCourseVideo(param.getVideoId(), param.getUserId(), param.getQwUserId());
+        if("泽林文化".equals(signProjectName)){
+            rightLog = courseAnswerLogsMapper.selectRightLogByCourseVideoWithPeriodId(param.getVideoId(), param.getUserId(), param.getQwUserId(),param.getPeriodId());
+        }
         if (rightLog == null) {
             logger.error("未答题:{}", param.getUserId());
             return R.error("未答题");

+ 2 - 0
fs-service/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -969,6 +969,8 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
     @Select("select customer_id  from  crm_customer where mobile=#{remarkMobile} limit 1")
     Long selectCrmCustomerByCrmMobile(String remarkMobile);
 
+    @Select("select customer_id  from  crm_customer where company_id = #{companyId} and  mobile=#{remarkMobile} limit 1")
+    Long selectCrmCustomerByCrmMobileAndCompanyId(@Param("companyId") Long companyId, @Param("remarkMobile") String remarkMobile);
     /**
      *   根据userid和外部联系人id获取到客户详情
      */

+ 4 - 0
fs-service/src/main/resources/mapper/company/CompanyWxClientMapper.xml

@@ -96,6 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">remark,</if>
             <if test="createTime != null">create_time,</if>
             <if test="traceId != null">trace_id,</if>
+            <if test="roboticId != null">robotic_id,</if>
+            <if test="customerId != null">customer_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="roboticWxId != null">#{roboticWxId},</if>
@@ -108,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">#{remark},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="traceId != null">#{traceId},</if>
+            <if test="roboticId != null">#{roboticId},</if>
+            <if test="customerId != null">#{customerId},</if>
          </trim>
     </insert>