Ver código fonte

Merge branch 'master' into 宣传活动

Long 1 semana atrás
pai
commit
8a598f0e66

+ 36 - 0
fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java

@@ -674,11 +674,40 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
         if(content.getSetting() == null){
             return;
         }
+        List<QwSopTempSetting.Content.Setting> setting = content.getSetting().stream().filter(e -> "7".equals(e.getContentType())).collect(Collectors.toList());
+        if (!setting.isEmpty()) {
+            List<String> valuesList = PubFun.listToNewList(setting, QwSopTempSetting.Content.Setting::getValue);
+            if (valuesList != null && !valuesList.isEmpty()) {
+                try {
+                    List<QwSopTempVoice> voiceList = qwSopTempVoiceService.getVoiceByText(Long.parseLong(companyUserId), valuesList);
+                    if (voiceList != null && !voiceList.isEmpty()) {
+                        Map<String, QwSopTempVoice> collect = voiceList.stream().collect(Collectors.toMap(QwSopTempVoice::getVoiceTxt, e -> e));
+                        setting.parallelStream().filter(e -> "7".equals(e.getContentType())).forEach(st -> {
+                            QwSopTempVoice voice = collect.get(st.getValue());
+                            if (voice.getVoiceUrl() == null) {
+                                return;
+                            }
+                            st.setVoiceUrl(voice.getVoiceUrl());
+                            st.setVoiceDuration(voice.getDuration() + "");
+                        });
+                    }
+                } catch (NumberFormatException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
 //        // 发送语音 end
         if (content.getType()==5){
             sopAddTag(logVo,content,sendTime);
         }
 
+        //当语音模板的qw_sop_temp_voice中无对应语音,就不生成qw_sop_logs记录
+        if (content.getType() == 7 && content.getSetting() != null && !content.getSetting().isEmpty()) {
+            if (content.getSetting().get(0).getVoiceUrl() == null) {
+                return;
+            }
+        }
+
         if (StringUtils.isNotEmpty(logVo.getChatId())) {
             QwGroupChat groupChat = groupChatMap.get(logVo.getChatId());
             ruleTimeVO.setSendType(6);
@@ -839,11 +868,18 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
             case 5:
 //                handleTagMessage(sopLogs, content);
                 break;
+            case 7:
+                handleVoiceMessage(sopLogs, content, companyUserId);
+                break;
             default:
                 log.error("未知的消息类型 {},跳过处理。", type);
                 break;
         }
     }
+    private void handleVoiceMessage(QwSopLogs sopLogs, QwSopTempSetting.Content content, String companyUserId) {
+        sopLogs.setContentJson(JSON.toJSONString(content));
+        enqueueQwSopLogs(sopLogs);
+    }
 
     private void handleNormalMessage(QwSopLogs sopLogs, QwSopTempSetting.Content content,String companyUserId) {
 

+ 1 - 0
fs-service/src/main/java/com/fs/company/vo/CompanyUserImportVO.java

@@ -117,6 +117,7 @@ public class CompanyUserImportVO extends BaseEntity {
 
     private String voicePrintUrl;
 
+    @Excel(name = "销售区域编号")
     private String addressId;
 
     /** 看课域名 */

+ 7 - 7
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -656,6 +656,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 
             // 用户领取红包次数+1
             redisTemplateInteger.opsForValue().increment(userLimitKey, 1);
+
             return result;
         }catch (Exception e){
             logger.error("领取红包失败原因:{}", ExceptionUtils.getFullStackTrace(e),e);
@@ -729,10 +730,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
             TransferBillsResult transferBillsResult = transferService.transferBills(request);
             logger.info("商家转账支付完成:[msg:{}]", transferBillsResult);
             return R.ok("发送红包成功").put("data", transferBillsResult);
-        } catch (WxPayException e) {
-            e.printStackTrace();
-            logger.info("商家转账支付失败:[msg:{}]", e.getMessage());
-            return R.error("发送失败");
+        } catch (Exception e) {
+            logger.error("商家转账支付失败:参数: {} :原因: {}",JSON.toJSONString(param), e.getMessage(),e);
+            throw new RuntimeException(e);
         }
     }
 
@@ -781,9 +781,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
         try {
             TransferBatchesResult transferBatchesResult = transferService.transferBatches(request);
             return R.ok("发送红包成功").put("orderCode", transferBatchesResult.getOutBatchNo()).put("batchId", transferBatchesResult.getBatchId());
-        } catch (WxPayException e) {
-            e.printStackTrace();
-            return R.error("发送失败");
+        } catch (Exception e) {
+            logger.error("商家转账支付失败:参数: {} :原因: {}",JSON.toJSONString(param), e.getMessage(),e);
+            throw new RuntimeException(e);
         }
     }
 

+ 40 - 4
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -40,10 +40,7 @@ import com.fs.qw.vo.GroupUserExternalVo;
 import com.fs.qw.vo.QwSopCourseFinishTempSetting;
 import com.fs.qw.vo.QwSopRuleTimeVO;
 import com.fs.qw.vo.QwTagGroupListVO;
-import com.fs.sop.domain.QwSop;
-import com.fs.sop.domain.QwSopLogs;
-import com.fs.sop.domain.SopUserLogs;
-import com.fs.sop.domain.SopUserLogsInfo;
+import com.fs.sop.domain.*;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.mapper.QwSopMapper;
 import com.fs.sop.mapper.SopUserLogsInfoMapper;
@@ -53,6 +50,7 @@ import com.fs.sop.params.BatchSopUserLogsInfoParamU;
 import com.fs.sop.params.SendUserLogsInfoMsgParam;
 import com.fs.sop.params.SopUserLogsParamByDate;
 import com.fs.sop.service.IQwSopService;
+import com.fs.sop.service.IQwSopTempVoiceService;
 import com.fs.sop.service.ISopUserLogsInfoService;
 import com.fs.sop.service.ISopUserLogsService;
 import com.fs.sop.vo.ExtCourseSopWatchLogVO;
@@ -167,6 +165,10 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
     @Autowired
     private CompanyMapper companyMapper;
 
+    @Autowired
+    private IQwSopTempVoiceService sopTempVoiceService;
+
+
 
     @Override
     public void save(SopUserLogsInfo sopUserLogsInfo) {
@@ -617,6 +619,11 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
 
                                 st.setMiniprogramPage(linkByMiniApp);
                                 break;
+
+                            //语音
+                            case "7":
+                                createVoiceUrl(st, companyUserId, qwSop);
+                                break;
                         }
                     }
                     setting.setSetting(list);
@@ -716,6 +723,12 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
 
                                 st.setMiniprogramPage(linkByMiniApp);
                                 break;
+                            //语音
+                            case "7":
+                                if (qwUser.getCompanyUserId() != null) {
+                                    createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
+                                }
+                                break;
                         }
                     }
                     setting.setSetting(list);
@@ -889,6 +902,10 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
 
                             st.setMiniprogramPage(linkByMiniApp);
 
+                            break;
+                        //语音
+                        case "7":
+                            createVoiceUrl(st, companyUserId, qwSop);
                             break;
                         //app
                         case "9":
@@ -948,6 +965,21 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
         return R.ok();
     }
 
+    private void createVoiceUrl(QwSopCourseFinishTempSetting.Setting st, String companyUserId, QwSop qwSop) {
+        QwSopTempVoice qwSopTempVoice = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(Long.valueOf(companyUserId), st.getValue());
+        if (qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null && qwSopTempVoice.getRecordType() == 1) {
+            st.setVoiceUrl(qwSopTempVoice.getVoiceUrl());
+            st.setVoiceDuration(String.valueOf(qwSopTempVoice.getDuration()));
+        } else if (qwSopTempVoice == null) {
+            qwSopTempVoice = new QwSopTempVoice();
+            qwSopTempVoice.setCompanyUserId(Long.valueOf(companyUserId));
+            qwSopTempVoice.setVoiceTxt(st.getValue());
+            qwSopTempVoice.setRecordType(0);
+            sopTempVoiceService.insertQwSopTempVoice(qwSopTempVoice);
+        }
+    }
+
+
     @Override
     public R sendUserLogsInfoMsgType(SendUserLogsInfoMsgParam param) {
         //营期一键群发
@@ -1304,6 +1336,10 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
 
                     st.setMiniprogramPage(linkByMiniApp);
                     break;
+                case "7":
+                    QwSop qwSop = qwSopMapper.selectQwSopById(param.getSopId());
+                    createVoiceUrl(st, companyUserId, qwSop);
+                    break;
 
                 //自定义小程序
                 case "10":

+ 94 - 0
fs-service/src/main/resources/application-config-druid-ddgy.yml

@@ -0,0 +1,94 @@
+baidu:
+  token: 12313231232
+  back-domain: https://www.xxxx.com
+#配置
+logging:
+  level:
+    org.springframework.web: INFO
+    com.github.binarywang.demo.wx.cp: DEBUG
+    me.chanjar.weixin: DEBUG
+wx:
+  miniapp:
+    configs:
+      - appid: wx41   #
+        secret: 58910ae743005c396012b029c7def579
+        token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
+        aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
+        msgDataFormat: JSON
+      - appid: wxe
+        secret: 928d2961c81610d8f64b019597212fcd
+        token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
+        aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
+        msgDataFormat: JSON
+  cp:
+    corpId: wwb2a10
+    appConfigs:
+      - agentId: 100005
+        secret: ec7okROXJqkN
+        token: PPKOdAloMO
+        aesKey: PKvaxtpSvNGpfTDm7VUHIK8Wok2ESyYX24qpXJAdMP
+  pay:
+    appId: wx73f85f8d6119 #微信公众号或者小程序等的appid
+    mchId: 1611045 #微信支付商户号
+    mchKey: 8cab128997a3547c10898b877f38 #微信支付商户密钥
+    subAppId:  #服务商模式下的子商户公众账号ID
+    subMchId:  #服务商模式下的子商户号
+    keyPath: c:\\cert\\apiclient_cert.p12 # p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
+    notifyUrl: https://usepp.his.runtzh.com/app/wxpay/wxPayNotify
+  mp:
+    useRedis: false
+    redisConfig:
+      host: 127.0.0.1
+      port: 6379
+      timeout: 2000
+    configs:
+      - appId: wx571ea3a25f27fcdd # 第一个公众号的appid
+        secret: 600edcaee6b3e267f0218deac1558f3b # 公众号的appsecret
+        token: PPKOdAlCoMO # 接口配置里的Token值
+        aesKey: Eswa6VjwtVcw03qZy6Wllgrv5aytIA1SZPEU0kU2 # 接口配置里的EncodingAESKey值
+  # 开放平台app微信授权配置
+  open:
+    app-id: wx9746858bdb5e0643
+    secret: 32dfaa2b2dcad9229935ff089c65d372
+aifabu:  #爱链接
+  appKey: 7b471be905ab17ef358c610dd117601d008
+watch:
+  watchUrl: watch.ylrzcloud.com/prod-api
+#  account: tcloud
+#  password: mdf-m2h_6yw2$hq
+  account1: ccif #866655060138751
+  password1: cp-t5or_6xw7$mt
+  account2: tcloud #rt500台
+  password2: mdf-m2h_6yw2$hq
+  account3: whr
+  password3: v9xsKuqn_$d2y
+
+fs :
+  commonApi: http://172.16.0.45:8010
+  h5CommonApi: http://172.16.0.45:8010
+nuonuo:
+  key: 10924508
+  secret: A2EB20764D304D16
+# 存储捅配置
+tencent_cloud_config:
+  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
+  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  bucket: ddgy-1323137866
+  app_id: 1323137866
+  region: ap-chongqing
+  proxy: hat
+cloud_host:
+  company_name: 叮当国医
+  projectCode: DDGY
+#看课授权时显示的头像
+headerImg:
+  imgUrl: https://ddgy-1323137866.cos.ap-chongqing.myqcloud.com/fs/20251010/ddgy.jpg
+ipad:
+  ipadUrl: http://ipad.****.cn
+  aiApi: http://62:3000/api
+  voiceApi:
+  commonApi:
+wx_miniapp_temp:
+  pay_order_temp_id:
+  inquiry_temp_id:
+

+ 176 - 0
fs-service/src/main/resources/application-druid-ddgy.yml

@@ -0,0 +1,176 @@
+# 数据源配置
+spring:
+    profiles:
+        include: config-druid-hat,common
+    # redis 配置
+    redis:
+        # 地址
+        host: 172.16.0.35
+        # 端口,默认为6379
+        port: 6379
+        # 数据库索引
+        database: 0
+        # 密码
+        password: YlrztekDDGY251010!3@.
+        # 连接超时时间
+        timeout: 20s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 100
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
+    datasource:
+        #        clickhouse:
+        #            type: com.alibaba.druid.pool.DruidDataSource
+        #            driverClassName: com.clickhouse.jdbc.ClickHouseDriver
+        #            url: jdbc:clickhouse://cc-2vc8zzo26w0l7m2l6.public.clickhouse.ads.aliyuncs.com/sop?compress=0&use_server_time_zone=true&use_client_time_zone=false&timezone=Asia/Shanghai
+        #            username: rt_2024
+        #            password: Yzx_19860213
+        #            initialSize: 10
+        #            maxActive: 100
+        #            minIdle: 10
+        #            maxWait: 6000
+        mysql:
+            type: com.alibaba.druid.pool.DruidDataSource
+            driverClassName: com.mysql.cj.jdbc.Driver
+            druid:
+                # 主库数据源
+                master:
+                    url: jdbc:mysql://172.16.0.69:3306/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: root
+                    password: Ylrztek251010ddgy!3@.
+                # 从库数据源
+                slave:
+                    # 从数据源开关/默认关闭
+                    enabled: false
+                    url:
+                    username:
+                    password:
+                # 初始连接数
+                initialSize: 5
+                # 最小连接池数量
+                minIdle: 10
+                # 最大连接池数量
+                maxActive: 200
+                # 配置获取连接等待超时的时间
+                maxWait: 60000
+                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+                timeBetweenEvictionRunsMillis: 60000
+                # 配置一个连接在池中最小生存的时间,单位是毫秒
+                minEvictableIdleTimeMillis: 300000
+                # 配置一个连接在池中最大生存的时间,单位是毫秒
+                maxEvictableIdleTimeMillis: 900000
+                # 配置检测连接是否有效
+                validationQuery: SELECT 1 FROM DUAL
+                testWhileIdle: true
+                testOnBorrow: false
+                testOnReturn: false
+                webStatFilter:
+                    enabled: true
+                statViewServlet:
+                    enabled: false
+                    # 设置白名单,不填则允许所有访问
+                    allow:
+                    url-pattern: /druid/*
+                    # 控制台管理用户名和密码
+                    login-username: fs
+                    login-password: 123456
+                filter:
+                    stat:
+                        enabled: true
+                        # 慢SQL记录
+                        log-slow-sql: true
+                        slow-sql-millis: 1000
+                        merge-sql: true
+                    wall:
+                        config:
+                            multi-statement-allow: true
+        sop:
+            type: com.alibaba.druid.pool.DruidDataSource
+            driverClassName: com.mysql.cj.jdbc.Driver
+            druid:
+                # 主库数据源
+                master:
+                    url: jdbc:mysql://172.16.0.69:3306/sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: root
+                    password: Ylrztek251010ddgy!3@.
+                read:
+                    url: jdbc:mysql://172.16.0.69:3306/sop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: root
+                    password: Ylrztek251010ddgy!3@.
+                # 初始连接数
+                initialSize: 5
+                # 最小连接池数量
+                minIdle: 10
+                # 最大连接池数量
+                maxActive: 200
+                # 配置获取连接等待超时的时间
+                maxWait: 60000
+                # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+                timeBetweenEvictionRunsMillis: 60000
+                # 配置一个连接在池中最小生存的时间,单位是毫秒
+                minEvictableIdleTimeMillis: 300000
+                # 配置一个连接在池中最大生存的时间,单位是毫秒
+                maxEvictableIdleTimeMillis: 900000
+                # 配置检测连接是否有效
+                validationQuery: SELECT 1 FROM DUAL
+                testWhileIdle: true
+                testOnBorrow: false
+                testOnReturn: false
+                webStatFilter:
+                    enabled: true
+                statViewServlet:
+                    enabled: false
+                    # 设置白名单,不填则允许所有访问
+                    allow:
+                    url-pattern: /druid/*
+                    # 控制台管理用户名和密码
+                    login-username: fs
+                    login-password: 123456
+                filter:
+                    stat:
+                        enabled: true
+                        # 慢SQL记录
+                        log-slow-sql: true
+                        slow-sql-millis: 1000
+                        merge-sql: true
+                    wall:
+                        config:
+                            multi-statement-allow: true
+rocketmq:
+    name-server: rmq-1243b25nj.rocketmq.gz.public.tencenttdmq.com:8080 # RocketMQ NameServer 地址
+    producer:
+        group: my-producer-group
+        access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
+        secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey
+    consumer:
+        group: test-group
+        access-key: ak1243b25nj17d4b2dc1a03 # 替换为实际的 accessKey
+        secret-key: sk08a7ea1f9f4b0237 # 替换为实际的 secretKey
+custom:
+    token: "1o62d3YxvdHd4LEU7sK"
+    encoding-aes-key: "UJfTQ5qKTKlegjkXzJzxeHlUKvq5GyFbERN1iU"
+    corp-id: "ww51717e2b71d3"
+    secret: "6ODAmw-8W4t6h9mdzHh2Z4Apwj8mnsyRnjEDZOHdA7k"
+    private-key-path: "privatekey.pem"
+    webhook-url: "https://your-server.com/wecom/archive"
+# token配置
+token:
+    # 令牌自定义标识
+    header: Authorization
+    # 令牌密钥
+    secret: abcdefghijklmnopqrstuvwxyz
+    # 令牌有效期(默认30分钟)
+    expireTime: 180
+openIM:
+    secret: open
+    userID: imAd
+#是否为新商户,新商户不走mpOpenId
+isNewWxMerchant: false
+
+enableRedPackAccount: 1

+ 64 - 44
fs-service/src/main/resources/mapper/sop/QwSopTempVoiceMapper.xml

@@ -1,28 +1,29 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.sop.mapper.QwSopTempVoiceMapper">
 
     <resultMap type="QwSopTempVoice" id="QwSopTempVoiceResult">
         <result property="id"    column="id"    />
-        <result property="qwUserId"    column="qw_user_id"    />
+        <result property="companyUserId"    column="company_user_id"    />
         <result property="tempId"    column="temp_id"    />
         <result property="ruleId"    column="rule_id"    />
         <result property="contentId"    column="content_id"    />
         <result property="voiceTxt"    column="voice_txt"    />
         <result property="voiceUrl"    column="voice_url"    />
+        <result property="userVoiceUrl"    column="user_voice_url"    />
+        <result property="recordType"    column="record_type"    />
         <result property="createTime"    column="create_time"    />
     </resultMap>
 
     <sql id="selectQwSopTempVoiceVo">
-        select id, qw_user_id, temp_id, rule_id, content_id, voice_txt, voice_url, create_time from qw_sop_temp_voice
+        select id,company_user_id, temp_id, rule_id, content_id, voice_txt, voice_url, create_time from qw_sop_temp_voice
     </sql>
 
     <select id="selectQwSopTempVoiceList" parameterType="QwSopTempVoice" resultMap="QwSopTempVoiceResult">
         <include refid="selectQwSopTempVoiceVo"/>
         <where>
-            <if test="qwUserId != null  and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
             <if test="tempId != null  and tempId != ''"> and temp_id = #{tempId}</if>
             <if test="ruleId != null "> and rule_id = #{ruleId}</if>
             <if test="contentId != null "> and content_id = #{contentId}</if>
@@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectQwSopTempVoiceById" parameterType="Long" resultMap="QwSopTempVoiceResult">
-        <include refid="selectQwSopTempVoiceVo"/>
+        select id,company_user_id,duration, temp_id, rule_id, content_id, voice_txt, voice_url,user_voice_url,record_type, create_time from qw_sop_temp_voice
         where id = #{id}
     </select>
     <select id="listVoice" resultType="com.fs.sop.domain.QwSopTempVoice">
@@ -42,9 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getVoice" resultType="com.fs.sop.domain.QwSopTempVoice">
         select a.* from qw_sop_temp_voice a
         where a.company_user_id = #{companyUserId}
-        and a.company_id = #{companyId}
-        and a.temp_id = #{tempId}
-        and a.rule_id = #{rulesId}
+          and a.company_id = #{companyId}
+          and a.temp_id = #{tempId}
+          and a.rule_id = #{rulesId}
     </select>
     <select id="listVoiceTemp" resultType="com.fs.sop.domain.QwSopTempVoice">
         select * from qw_sop_temp_voice a where a.temp_id = #{tempId} and a.day_id =#{dayId}
@@ -59,49 +60,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where a.company_user_id in <foreach collection="userIdList" open="(" separator="," close=")" item="item">#{item}</foreach>
     </select>
 
+    <select id="selectQwSopTempVoiceByIdAndText" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select id,company_user_id companyUserId,voice_txt voiceTxt from qw_sop_temp_voice where id = #{id}
+                                                                                            and voice_txt = #{voiceTxt} and record_type in (0,1) limit 1
+    </select>
+    <select id="selectQwSopTempVoiceByIdAndUserVoiceUrl" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select id,company_user_id companyUserId from qw_sop_temp_voice where id = #{id} and record_type in (0,1,2) limit 1
+    </select>
+    <select id="selectQwSopTempVoiceNewList" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
+        user_voice_url userVoiceUrl from qw_sop_temp_voice
+        <where>
+            <if test="companyUserId != null"> and company_user_id = #{companyUserId}</if>
+            <if test="recordType != null"> and record_type = #{recordType}</if>
+        </where>
+        order by update_time desc,id desc
+    </select>
+
+    <select id="selectQwSopTempVoiceByQwUserIds" resultMap="QwSopTempVoiceResult">
+        select * from qw_sop_temp_voice where record_type = 0 and qw_user_id in
+        <foreach item="qwUserId" collection="ids"  open="(" separator="," close=")">
+            #{qwUserId}
+        </foreach>
+    </select>
+    <select id="selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select qw_user_id qwUserId,voice_url voiceUrl,voice_txt voiceTxt,user_voice_url userVoiceUrl,company_user_id companyUserId,
+               record_type recordType,duration from qw_sop_temp_voice where company_user_id = #{companyUserId} and voice_txt = #{voiceTxt}
+    </select>
+    <select id="selectQwSopTempVoiceByCompanyUserIdAndQwUserId" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select id,company_user_id companyUserId,voice_url voiceUrl,voice_txt voiceTxt,duration
+        from qw_sop_temp_voice
+        where company_user_id = #{companyUserId} and qw_user_id = #{qwUserId}
+          and voice_url  is not null
+            limit 1
+    </select>
+    <select id="selectQwSopTempVoiceListLimit" resultType="com.fs.sop.domain.QwSopTempVoice">
+        select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
+               user_voice_url userVoiceUrl from qw_sop_temp_voice
+        where record_type = #{recordType} and company_user_id is not null
+        order by date_format(create_time,'%y%m%d') desc,company_user_id desc limit 10
+    </select>
+
     <insert id="insertQwSopTempVoice" parameterType="QwSopTempVoice" useGeneratedKeys="true" keyProperty="id">
         insert into qw_sop_temp_voice
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="companyUserId != null">company_user_id,</if>
+            <if test="qwUserId != null">qw_user_id,</if>
             <if test="companyId != null">company_id,</if>
             <if test="tempId != null">temp_id,</if>
             <if test="ruleId != null">rule_id,</if>
             <if test="contentId != null">content_id,</if>
             <if test="voiceTxt != null">voice_txt,</if>
             <if test="voiceUrl != null">voice_url,</if>
+            <if test="userVoiceUrl != null">user_voice_url,</if>
             <if test="createTime != null">create_time,</if>
             <if test="duration != null">duration,</if>
-         </trim>
+            <if test="recordType != null">record_type,</if>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="qwUserId != null">#{qwUserId},</if>
             <if test="companyId != null">#{companyId},</if>
             <if test="tempId != null">#{tempId},</if>
             <if test="ruleId != null">#{ruleId},</if>
             <if test="contentId != null">#{contentId},</if>
             <if test="voiceTxt != null">#{voiceTxt},</if>
             <if test="voiceUrl != null">#{voiceUrl},</if>
+            <if test="userVoiceUrl != null">#{userVoiceUrl},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="duration != null">#{duration},</if>
-         </trim>
+            <if test="recordType != null">#{recordType},</if>
+        </trim>
     </insert>
     <insert id="insertBatch">
-        INSERT INTO qw_sop_temp_voice (temp_id, company_user_id, day_id, company_id, content_id, rule_id, voice_txt, voice_url, duration)
+        INSERT INTO qw_sop_temp_voice (temp_id, company_user_id, day_id, company_id, content_id, rule_id, voice_txt, voice_url,record_type, duration)
         VALUES
         <foreach collection="list" item="item" separator=",">
-            (#{item.tempId}, #{item.companyUserId}, #{item.dayId}, #{item.companyId}, #{item.contentId}, #{item.ruleId}, #{item.voiceTxt}, #{item.voiceUrl}, #{item.duration})
+            (#{item.tempId}, #{item.companyUserId}, #{item.dayId}, #{item.companyId}, #{item.contentId}, #{item.ruleId}, #{item.voiceTxt}, #{item.voiceUrl}, #{item.recordType},#{item.duration})
         </foreach>
     </insert>
 
     <update id="updateQwSopTempVoice" parameterType="QwSopTempVoice">
         update qw_sop_temp_voice
         <trim prefix="SET" suffixOverrides=",">
-            <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
             <if test="tempId != null">temp_id = #{tempId},</if>
             <if test="ruleId != null">rule_id = #{ruleId},</if>
             <if test="contentId != null">content_id = #{contentId},</if>
             <if test="voiceTxt != null">voice_txt = #{voiceTxt},</if>
             <if test="voiceUrl != null">voice_url = #{voiceUrl},</if>
+            <if test="userVoiceUrl != null">user_voice_url = #{userVoiceUrl},</if>
+            <if test="recordType != null">record_type = #{recordType},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="duration != null">duration = #{duration},</if>
         </trim>
         where id = #{id}
     </update>
@@ -119,34 +169,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="remove">
         delete from qw_sop_temp_voice a where a.temp_id = #{tempId} and a.day_id =#{dayId}
     </delete>
-
-    <select id="selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt" resultType="com.fs.sop.domain.QwSopTempVoice">
-        select qw_user_id qwUserId,voice_url voiceUrl,voice_txt voiceTxt,user_voice_url userVoiceUrl,company_user_id companyUserId,
-               record_type recordType,duration from qw_sop_temp_voice where company_user_id = #{companyUserId} and voice_txt = #{voiceTxt}
-    </select>
-    <select id="selectQwSopTempVoiceByCompanyUserIdAndQwUserId" resultType="com.fs.sop.domain.QwSopTempVoice">
-        select id,company_user_id companyUserId,voice_url voiceUrl,voice_txt voiceTxt,duration
-        from qw_sop_temp_voice
-        where company_user_id = #{companyUserId} and qw_user_id = #{qwUserId}
-          and voice_url  is not null
-            limit 1
-    </select>
-    <select id="selectQwSopTempVoiceListLimit" resultType="com.fs.sop.domain.QwSopTempVoice">
-        select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
-               user_voice_url userVoiceUrl from qw_sop_temp_voice
-        where record_type = #{recordType} and company_user_id is not null
-        order by date_format(create_time,'%y%m%d') desc,company_user_id desc limit 10
-    </select>
-    <select id="selectQwSopTempVoiceByIdAndUserVoiceUrl" resultType="com.fs.sop.domain.QwSopTempVoice">
-        select id,company_user_id companyUserId from qw_sop_temp_voice where id = #{id} and record_type in (0,1,2) limit 1
-    </select>
-    <select id="selectQwSopTempVoiceNewList" resultType="com.fs.sop.domain.QwSopTempVoice">
-        select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
-        user_voice_url userVoiceUrl from qw_sop_temp_voice
-        <where>
-            <if test="companyUserId != null"> and company_user_id = #{companyUserId}</if>
-            <if test="recordType != null"> and record_type = #{recordType}</if>
-        </where>
-        order by update_time desc,id desc
-    </select>
 </mapper>