Bladeren bron

销售app代码提交

yjwang 1 maand geleden
bovenliggende
commit
e086037794

+ 35 - 4
fs-company-app/src/main/java/com/fs/app/controller/aiSipCall/AiSipCallController.java

@@ -296,9 +296,9 @@ public class AiSipCallController extends AppBaseController {
                 getCompanyUserId(), startTime, endTime, encryptedMobile, remark, callStatus);
         if (list != null) {
             for (CrmCustomer c : list) {
-                if (StringUtils.isNotBlank(c.getMobile())) {
+                if(StringUtils.isNotBlank(c.getMobile())){
+                    String decrypted = PhoneUtil.decryptPhone(c.getMobile());
                     try {
-                        String decrypted = PhoneUtil.decryptPhone(c.getMobile());
                         c.setMobile(decrypted.replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                     } catch (Exception e) {
                         log.warn("[aiSipCall] 解密手机号失败, customerId={}", c.getCustomerId());
@@ -319,11 +319,27 @@ public class AiSipCallController extends AppBaseController {
     @ApiOperation("根据客户ID查询呼叫记录")
     @GetMapping("/getCallRecordByCustomerId")
     public TableDataInfo getCallRecordByCustomerId(
-            @RequestParam("customerId") Long customerId,
+            @RequestParam(value = "customerId", required = false) Long customerId,
+            @RequestParam(value = "startTime", required = false) String startTime,
+            @RequestParam(value = "endTime", required = false) String endTime,
             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
         AiSipCallOutboundCdr query = new AiSipCallOutboundCdr();
-        query.setCustomerId(customerId);
+        if (customerId != null) {
+            query.setCustomerId(customerId);
+        } else {
+            CompanyUser companyUser = companyUserService.selectCompanyUserById(getCompanyUserId());
+            if (companyUser != null) {
+                query.setOpnum(companyUser.getUserName());
+            }
+        }
+        if (StringUtils.isNotBlank(startTime)) {
+            query.setStartTimeStart(startTime);
+        }
+        if (StringUtils.isNotBlank(endTime)) {
+            query.setStartTimeEnd(endTime);
+        }
+
         PageHelper.startPage(pageNum, pageSize);
         List<AiSipCallOutboundCdr> list = aiSipCallOutboundCdrService.selectAiSipCallOutboundCdrList(query);
         return getDataTable(list);
@@ -349,6 +365,21 @@ public class AiSipCallController extends AppBaseController {
         }
     }
 
+    /**
+     * 设置客户解密状态为已解锁
+     */
+    @Login
+    @ApiOperation("设置客户解密状态为已解锁")
+    @PostMapping("/unlockCustomerDecrypt")
+    public AjaxResult unlockCustomerDecrypt(@RequestParam("customerId") Long customerId) {
+        if (customerId == null) {
+            return AjaxResult.error("客户ID不能为空");
+        }
+        int rows = crmCustomerMapper.updateCanDecryptByCustomerId(customerId);
+        String encryptedMobile = crmCustomerMapper.selectCrmCustomerPhoneByCustomerId(customerId);
+        return rows > 0 ? AjaxResult.success(PhoneUtil.decryptPhone(encryptedMobile)) : AjaxResult.error("解锁失败,客户不存在");
+    }
+
 
     /**
      * 生成6位随机串(替代 his_java 中的 com.fs.his.utils.RandomUtil#generateRandomCode)

+ 3 - 2
fs-company-app/src/main/resources/application.yml

@@ -1,9 +1,10 @@
 server:
+  port: 8007
 # Spring配置
 spring:
   profiles:
     #    active: druid-fcky-test
     active: dev
 
-  # 服务器的HTTP端口,默认为8080
-  port: 8007
+#  # 服务器的HTTP端口,默认为8080
+#  port: 8007

+ 1 - 6
fs-service/src/main/java/com/fs/crm/domain/CrmCustomer.java

@@ -198,12 +198,7 @@ public class CrmCustomer extends BaseEntity
     //    最后一次设置外呼记录id
     private Long lastEffectiveCallphoneLogId;
 
-    /** 是否可解密手机号 1=可解密 */
-    @TableField(exist = false)
+    /** 是否可解密手机号 1=已解密 0=未解密(默认) */
     private Integer canDecrypt;
 
-    /** 解密后的手机号明文 */
-    @TableField(exist = false)
-    private String decryptedMobile;
-
 }

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

@@ -1032,8 +1032,8 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
             "<if test='endTime != null and endTime != \"\"'> AND c.create_time &lt;= #{endTime} </if>" +
             "<if test='mobile != null and mobile != \"\"'> AND c.mobile LIKE CONCAT('%', #{mobile}, '%') </if>" +
             "<if test='remark != null and remark != \"\"'> AND c.remark LIKE CONCAT('%', #{remark}, '%') </if>" +
-            "<if test='callStatus != null and callStatus == 1'> AND EXISTS (SELECT 1 FROM ai_sip_call_outbound_cdr cdr WHERE cdr.customer_id = c.customer_id) </if>" +
-            "<if test='callStatus != null and callStatus == 2'> AND NOT EXISTS (SELECT 1 FROM ai_sip_call_outbound_cdr cdr WHERE cdr.customer_id = c.customer_id) </if>" +
+            "<if test='callStatus != null and callStatus == 1'> AND c.can_decrypt = 1 </if>" +
+            "<if test='callStatus != null and callStatus == 2'> AND (c.can_decrypt IS NULL OR c.can_decrypt = 0) </if>" +
             " ORDER BY c.customer_id DESC " +
             "</script>"})
     List<CrmCustomer> selectEffectiveCustomerList(
@@ -1044,6 +1044,12 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer> {
             @Param("remark") String remark,
             @Param("callStatus") Integer callStatus);
 
+    /**
+     * 更新客户解密状态为已解锁
+     */
+    @Update("UPDATE crm_customer SET can_decrypt = 1 WHERE customer_id = #{customerId}")
+    int updateCanDecryptByCustomerId(@Param("customerId") Long customerId);
+
     /**
      * 批量插入客户
      *

+ 6 - 6
fs-service/src/main/resources/application-common.yml

@@ -14,12 +14,12 @@ fs:
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
   captchaType: math
-#  jwt:
-#    # 加密秘钥
-#    secret: f4e2e52034348f86b67cde581c0f9eb5
-#    # token有效时长,7天,单位秒
-#    expire: 31536000
-#    header: AppToken
+  jwt:
+    # 加密秘钥
+    secret: f4e2e52034348f86b67cde581c0f9eb5
+    # token有效时长,7天,单位秒
+    expire: 31536000
+    header: AppToken
 # 开发环境配置
 server:
   servlet:

+ 6 - 6
fs-service/src/main/resources/application-config-dev.yml

@@ -57,12 +57,12 @@ wx:
 #fs :
 #  commonApi: http://172.16.0.16:8010
 #  h5CommonApi: http://119.29.195.254:8010
-#  jwt:
-#    # 加密秘钥
-#    secret: e10adc3949ba59abbe56e057f20f883e
-#    # token有效时长,7天,单位秒
-#    expire: 31536000
-#    header: AppToken
+  jwt:
+    # 加密秘钥
+    secret: e10adc3949ba59abbe56e057f20f883e
+    # token有效时长,7天,单位秒
+    expire: 31536000
+    header: AppToken
 #nuonuo:
 #  key: 10924508
 #  secret: A2EB20764D304D16

+ 1 - 0
fs-service/src/main/resources/db/tenant-initTable.sql

@@ -3078,6 +3078,7 @@ CREATE TABLE `crm_customer`
     `ai_call_remark` varchar(500) NULL DEFAULT NULL COMMENT 'AI外呼备注',
     `effective_record_path` varchar(1000) NULL DEFAULT NULL COMMENT '最后一次设置录音',
     `last_effective_callphone_log_id` bigint NULL DEFAULT NULL COMMENT '最后一次设置外呼记录id',
+    can_decrypt tinyint(1) DEFAULT 0 COMMENT '是否已解密 1=已解密 0=未解密(默认)',
     PRIMARY KEY (`customer_id`) USING BTREE,
     UNIQUE INDEX `customer_code`(`customer_code`) USING BTREE,
     INDEX                   `create_user_id`(`create_user_id`) USING BTREE,

+ 1 - 0
fs-service/src/main/resources/mapper/crm/CrmCustomerMapper.xml

@@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="clueId"    column="clue_id"    />
         <result property="qwName"    column="qw_name"    />
         <result property="historicalCommunication"    column="historical_communication"    />
+        <result property="canDecrypt"    column="can_decrypt"    />
     </resultMap>
 
     <sql id="selectCrmCustomerVo">