Parcourir la source

Merge remote-tracking branch 'origin/master'

三七 il y a 1 jour
Parent
commit
b4958c6940
20 fichiers modifiés avec 315 ajouts et 7 suppressions
  1. 6 0
      fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java
  2. 49 0
      fs-admin/src/main/java/com/fs/his/task/Task.java
  3. 1 4
      fs-admin/src/main/java/com/fs/qw/controller/QwExternalContactController.java
  4. 9 0
      fs-admin/src/main/java/com/fs/qw/controller/QwPushCountController.java
  5. 11 0
      fs-admin/src/main/java/com/fs/qw/controller/QwUserController.java
  6. 22 0
      fs-service/src/main/java/com/fs/fastGpt/domain/FastGptPushTokenTotal.java
  7. 2 2
      fs-service/src/main/java/com/fs/fastgptApi/util/EventLogUtils.java
  8. 2 0
      fs-service/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java
  9. 12 0
      fs-service/src/main/java/com/fs/qw/mapper/QwRestrictionPushRecordMapper.java
  10. 3 0
      fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java
  11. 1 0
      fs-service/src/main/java/com/fs/qw/service/IQwExternalContactService.java
  12. 3 0
      fs-service/src/main/java/com/fs/qw/service/IQwPushCountService.java
  13. 3 0
      fs-service/src/main/java/com/fs/qw/service/IQwUserService.java
  14. 5 0
      fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java
  15. 11 0
      fs-service/src/main/java/com/fs/qw/service/impl/QwPushCountServiceImpl.java
  16. 5 0
      fs-service/src/main/java/com/fs/qw/service/impl/QwUserServiceImpl.java
  17. 2 0
      fs-service/src/main/java/com/fs/statis/dto/ConsumptionBalanceDataDTO.java
  18. 127 0
      fs-service/src/main/resources/mapper/qw/QwExternalContactMapper.xml
  19. 38 1
      fs-service/src/main/resources/mapper/qw/QwRestrictionPushRecordMapper.xml
  20. 3 0
      fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

+ 6 - 0
fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java

@@ -1,5 +1,6 @@
 package com.fs.api.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.entity.SysDept;
 import com.fs.common.core.redis.RedisCache;
@@ -168,6 +169,11 @@ public class IndexStatisticsController {
                 );
             }
         }
+        BigDecimal redPacketCompanyMoney = redisCache.getCacheObject("redpacket_money");
+        if(ObjectUtils.isNull(redPacketCompanyMoney)){
+            redPacketCompanyMoney = BigDecimal.ZERO;
+        }
+        consumptionBalanceDataDTO.setRunTianBalance(redPacketCompanyMoney);
 
         return R.ok().put("data", consumptionBalanceDataDTO);
     }

+ 49 - 0
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -28,6 +28,7 @@ import com.fs.erp.dto.ErpOrderResponse;
 import com.fs.erp.mapper.FsErpFinishPushMapper;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.fastGpt.domain.FastGptEventTokenLog;
+import com.fs.fastGpt.domain.FastGptPushTokenTotal;
 import com.fs.fastGpt.domain.FastgptChatVoiceHomo;
 import com.fs.fastGpt.domain.FastgptEventLogTotal;
 import com.fs.fastGpt.mapper.FastGptChatSessionMapper;
@@ -35,6 +36,7 @@ import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
 import com.fs.fastGpt.service.IFastgptEventLogTotalService;
 import com.fs.fastgptApi.util.AudioUtils;
 import com.fs.fastgptApi.vo.AudioVO;
+import com.fs.gtPush.mapper.PushLogMapper;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.config.StoreConfig;
 import com.fs.his.domain.FsInquiryOrder;
@@ -53,6 +55,7 @@ import com.fs.his.vo.FsSubOrderResultVO;
 import com.fs.im.dto.*;
 import com.fs.im.service.IImService;
 import com.fs.qw.domain.QwCompany;
+import com.fs.qw.mapper.QwRestrictionPushRecordMapper;
 import com.fs.qw.service.*;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.sop.domain.QwSopTempVoice;
@@ -179,8 +182,54 @@ public class Task {
     @Autowired
     private IQwSopTempVoiceService qwSopTempVoiceService;
 
+    @Autowired
+    private QwRestrictionPushRecordMapper qwRestrictionPushRecordMapper;
+
     public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice";
 
+    /**
+     * sop任务token消耗统计
+     */
+    public void sopPushTokenTotal() {
+        // 判断是否是凌晨 00:00 - 00:59
+        boolean isEarlyMorning = isEarlyMorning();
+
+        // 获取日期字符串(今天或昨天)
+        String dateTime;
+        if (isEarlyMorning) {
+            dateTime = DateUtils.addDateDays(-1); // 昨天
+        } else {
+            dateTime = DateUtils.getDate(); // 今天
+        }
+        log.info("开始执行sop任务token消耗统计");
+        try {
+            List<FastGptPushTokenTotal> fastGptPushTotalList = qwRestrictionPushRecordMapper.selectFastgptPushTokenTotal(dateTime);
+            if (fastGptPushTotalList != null && !fastGptPushTotalList.isEmpty()) {
+                for (FastGptPushTokenTotal fastGptPushTotal : fastGptPushTotalList) {
+                    // 获取统计数据
+                    Integer type = fastGptPushTotal.getType();
+                    Long count = 0L;
+                    if(type == 7){
+                        count = fastGptPushTotal.getCount() * 450;
+                    }else{
+                        count = fastGptPushTotal.getCount() * 150;
+                    }
+                    fastGptPushTotal.setCount(count);
+                    FastGptPushTokenTotal pushTotal = qwRestrictionPushRecordMapper.selectFastGptPushTokenTotalByInfo(fastGptPushTotal);
+                    if(pushTotal == null){
+                        qwRestrictionPushRecordMapper.insertPushTokenTotal(fastGptPushTotal);
+                    }else{
+                        fastGptPushTotal.setId(pushTotal.getId());
+                        qwRestrictionPushRecordMapper.updatePushTokenTotal(fastGptPushTotal);
+                    }
+                }
+            }
+            log.info("结束执行sop任务token消耗统计");
+        } catch (Exception e) {
+            log.error("执行sop任务token消耗统计异常", e);
+        }
+    }
+
     /**
      * 一键生成语音定时任务
      */

+ 1 - 4
fs-admin/src/main/java/com/fs/qw/controller/QwExternalContactController.java

@@ -57,11 +57,8 @@ public class QwExternalContactController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(QwExternalContactParam qwExternalContact)
     {
-        if(ObjectUtil.isEmpty(qwExternalContact.getCompanyId())){
-            throw new ServiceException("操作失败,请选择企业!");
-        }
         startPage();
-        List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
+        List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVONewSys(qwExternalContact);
         list.forEach(item->{
 
             if (!Objects.equals(item.getTagIds(), "[]") && item.getTagIds()!=null) {

+ 9 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwPushCountController.java

@@ -6,6 +6,7 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.fastGpt.domain.FastGptPushTokenTotal;
 import com.fs.qw.domain.QwPushCount;
 import com.fs.qw.service.IQwPushCountService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -151,4 +152,12 @@ public class QwPushCountController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(qwPushCountService.deleteQwPushCountByIds(ids));
     }
+
+    @PreAuthorize("@ss.hasPermi('qw:qwPushCount:tokenList')")
+    @GetMapping("/tokenList")
+    public TableDataInfo tokenList(FastGptPushTokenTotal pushTokenInfo) {
+        startPage();
+        List<FastGptPushTokenTotal> list = qwPushCountService.selectFastGptPushTokenTotalList(pushTokenInfo);
+        return getDataTable(list);
+    }
 }

+ 11 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwUserController.java

@@ -5,11 +5,14 @@ import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.qw.param.QwFsUserParam;
 import com.fs.qw.service.IQwUserService;
+import com.fs.qw.vo.QwOptionsVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * 企微用户Controller
  *
@@ -34,4 +37,12 @@ public class QwUserController extends BaseController {
     public R getQwUserInfo(QwFsUserParam param){
         return R.ok().put("data",qwUserService.getQwUserInfo(param));
     }
+
+
+   @GetMapping("/getMyQwCompanyList")
+    public R getMyQwCompanyList()
+    {
+        List<QwOptionsVO> list = qwUserService.selectQwCompanyListOptionsVOBySys();
+        return  R.ok().put("data",list);
+    }
 }

+ 22 - 0
fs-service/src/main/java/com/fs/fastGpt/domain/FastGptPushTokenTotal.java

@@ -0,0 +1,22 @@
+package com.fs.fastGpt.domain;
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+public class FastGptPushTokenTotal extends BaseEntity {
+
+    private Long id;
+    private Integer type;
+    private Long qwUserId;
+    private Long companyId;
+    @Excel(name = "公司名称")
+    private String companyName;
+    @Excel(name = "token消耗数")
+    private Long count;
+    private Integer status;
+    @Excel(name = "生成时间")
+    private String statTime;
+
+}

+ 2 - 2
fs-service/src/main/java/com/fs/fastgptApi/util/EventLogUtils.java

@@ -80,7 +80,7 @@ public class EventLogUtils {
 
 
         EventLogQueue.addEventLog(fastGptEventLog); // 入队
-        fastGptChatMsgService.insertFastGptEventLog(fastGptEventLog);
+        //fastGptChatMsgService.insertFastGptEventLog(fastGptEventLog);
     }
 
     /**
@@ -104,7 +104,7 @@ public class EventLogUtils {
         fastGptEventTokenLog.setQwUserId(user.getId());
         fastGptEventTokenLog.setCreateTime(new Date());
 
-        //EventLogQueue.addEventTokenLog(fastGptEventTokenLog); // 入队
+        EventLogQueue.addEventTokenLog(fastGptEventTokenLog); // 入队
         //fastGptChatMsgService.insertFastGptEventTokenLog(fastGptEventTokenLog);
     }
 

+ 2 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java

@@ -520,4 +520,6 @@ public interface QwExternalContactMapper extends BaseMapper<QwExternalContact> {
     int batchUpdateUnionId(@Param("item") QwExternalContact item);
 
     void updateQwExternalContactStatusById(QwExternalContact qwExternalContact);
+
+    List<QwExternalContactVO> selectQwExternalContactListVONewSys(QwExternalContactParam qwExternalContact);
 }

+ 12 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwRestrictionPushRecordMapper.java

@@ -1,6 +1,7 @@
 package com.fs.qw.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.fastGpt.domain.FastGptPushTokenTotal;
 import com.fs.qw.domain.QwRestrictionPushRecord;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Param;
@@ -45,5 +46,16 @@ public interface QwRestrictionPushRecordMapper extends BaseMapper<QwRestrictionP
             "</foreach>" +
             "</script>")
     public int deleteQwRestrictionPushRecordIds(@Param("ids") Long[] ids);
+
+    List<FastGptPushTokenTotal> selectFastgptPushTokenTotal(String dateTime);
+
+    FastGptPushTokenTotal selectFastGptPushTokenTotalByInfo(FastGptPushTokenTotal fastGptPushTotal);
+
+    void insertPushTokenTotal(FastGptPushTokenTotal fastGptPushTotal);
+
+    void updatePushTokenTotal(FastGptPushTokenTotal fastGptPushTotal);
+
+    List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo);
+
 }
 

+ 3 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -438,4 +438,7 @@ public interface QwUserMapper extends BaseMapper<QwUser>
      * 根据销售公司和企微ID查询企微用户
      */
     List<QwUserVO> selectQwUserListVOByCompanyIdAndCorpIdAndNickName(@Param("companyId") Long companyId, @Param("corpId") String corpId, @Param("nickName") String nickName);
+
+    List<QwOptionsVO> selectQwCompanyListOptionsVOBySys();
+
 }

+ 1 - 0
fs-service/src/main/java/com/fs/qw/service/IQwExternalContactService.java

@@ -250,4 +250,5 @@ public interface IQwExternalContactService extends IService<QwExternalContact> {
     void updateQwExternalContactStatusById(QwExternalContact qwExternalContact);
 
     R getRepeat(RepeatParam param);
+    List<QwExternalContactVO> selectQwExternalContactListVONewSys(QwExternalContactParam qwExternalContact);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/qw/service/IQwPushCountService.java

@@ -1,6 +1,7 @@
 package com.fs.qw.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.fastGpt.domain.FastGptPushTokenTotal;
 import com.fs.qw.domain.QwPushCount;
 
 import java.util.List;
@@ -65,4 +66,6 @@ public interface IQwPushCountService extends IService<QwPushCount>{
      * @return 结果
      */
     int deleteQwPushCountById(Long id);
+
+    List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/qw/service/IQwUserService.java

@@ -196,4 +196,7 @@ public interface IQwUserService
      * 根据销售公司和企微ID查询企微用户
      */
     List<QwUserVO> selectQwUserListByCompanyIdAndCorpIdAndNickName(Long companyId, String corpId, String nickName);
+
+    List<QwOptionsVO> selectQwCompanyListOptionsVOBySys();
+
 }

+ 5 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -5894,6 +5894,11 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
         return R.ok().put("data", qwUsers.stream().map(e -> QwUserVO.builder().qwUserId(e.getQwUserId()).qwUserName(e.getQwUserName()).companyName(companyMap.getOrDefault(e.getCorpId(), qwCompany).getCorpName()).build()));
     }
 
+    @Override
+    public List<QwExternalContactVO> selectQwExternalContactListVONewSys(QwExternalContactParam qwExternalContact) {
+        return qwExternalContactMapper.selectQwExternalContactListVONewSys(qwExternalContact);
+    }
+
 
     public Boolean getSopAiChatByRedis(String qwUserId,String corpId,String externalUserId){
 

+ 11 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwPushCountServiceImpl.java

@@ -1,9 +1,12 @@
 package com.fs.qw.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.fastGpt.domain.FastGptPushTokenTotal;
 import com.fs.qw.domain.QwPushCount;
 import com.fs.qw.mapper.QwPushCountMapper;
+import com.fs.qw.mapper.QwRestrictionPushRecordMapper;
 import com.fs.qw.service.IQwPushCountService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -17,6 +20,9 @@ import java.util.List;
 @Service
 public class QwPushCountServiceImpl extends ServiceImpl<QwPushCountMapper, QwPushCount> implements IQwPushCountService {
 
+    @Autowired
+    private QwRestrictionPushRecordMapper pushRecordMapper;
+
     @Override
     public List<QwPushCount> selectQwPushCountLists() {
         return baseMapper.selectQwPushCountLists();
@@ -103,4 +109,9 @@ public class QwPushCountServiceImpl extends ServiceImpl<QwPushCountMapper, QwPus
     {
         return baseMapper.deleteQwPushCountById(id);
     }
+
+    @Override
+    public List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo) {
+        return pushRecordMapper.selectFastGptPushTokenTotalList(pushTokenInfo);
+    }
 }

+ 5 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwUserServiceImpl.java

@@ -1546,6 +1546,11 @@ public class QwUserServiceImpl implements IQwUserService
         return qwUserMapper.selectQwUserListVOByCompanyIdAndCorpIdAndNickName(companyId, corpId, nickName);
     }
 
+    @Override
+    public List<QwOptionsVO> selectQwCompanyListOptionsVOBySys() {
+        return qwUserMapper.selectQwCompanyListOptionsVOBySys();
+    }
+
 
     /**
      * 构建查询条件

+ 2 - 0
fs-service/src/main/java/com/fs/statis/dto/ConsumptionBalanceDataDTO.java

@@ -15,6 +15,8 @@ public class ConsumptionBalanceDataDTO implements Serializable {
      * 数值表示,单位可能是分或其他约定单位。
      */
     private BigDecimal balance;
+
+    private BigDecimal runTianBalance;
     /**
      * 今日消费金额。
      * 当天的总消费数额。

+ 127 - 0
fs-service/src/main/resources/mapper/qw/QwExternalContactMapper.xml

@@ -654,6 +654,133 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectQwExternalContactVo"/>
         where fs_user_id = #{userId} and company_user_id = #{companyUserId}
     </select>
+    <select id="selectQwExternalContactListVONewSys" resultType="com.fs.qw.vo.QwExternalContactVO">
+            select ec.*, qu.qw_user_name, qd.dept_name as departmentName
+            from qw_external_contact ec
+            left join qw_user qu on ec.user_id = qu.qw_user_id and qu.corp_id = ec.corp_id
+            left join qw_dept qd on qd.dept_id = qu.department and qd.corp_id = qu.corp_id
+            left join company_user cu on ec.company_user_id = cu.user_id
+            <where>
+                <if test="userId != null and userId != ''">
+                    and ec.user_id like concat(#{userId}, '%')
+                </if>
+                <if test="qwUserName != null and qwUserName != ''">
+                    and qu.qw_user_name like concat(#{qwUserName}, '%')
+                </if>
+                <if test="externalUserId != null and externalUserId != ''">
+                    and ec.external_user_id = #{externalUserId}
+                </if>
+                <if test="wayId != null and wayId != ''">
+                    and SUBSTRING_INDEX(ec.state, ':', -1) = #{wayId}
+                </if>
+                <if test="name != null and name != ''">
+                    and ec.name like concat(#{name}, '%')
+                </if>
+                <if test="type != null">
+                    and ec.type = #{type}
+                </if>
+                <if test="gender != null">
+                    and ec.gender = #{gender}
+                </if>
+                <if test="description != null and description != ''">
+                    and ec.description = #{description}
+                </if>
+
+                <if test="tagIds != null and tagIds.size() != 0">
+                    and (
+                    <foreach collection="tagIds" item="item" index="index" separator=" AND ">
+                        find_in_set(#{item}, REGEXP_REPLACE(ec.tag_ids, '[\"\\[\\]]', ''))
+                    </foreach>
+                    )
+                </if>
+
+                <if test="remarkMobiles != null and remarkMobiles != ''">
+                    and ec.remark_mobiles like concat(#{remarkMobiles}, '%')
+                </if>
+                <if test="remark != null and remark != ''">
+                    and ec.remark like concat('%', #{remark}, '%')
+                </if>
+                <if test="remarkCorpName != null and remarkCorpName != ''">
+                    and ec.remark_corp_name like concat('%', #{remarkCorpName}, '%')
+                </if>
+                <if test="addWay != null">
+                    and ec.add_way = #{addWay}
+                </if>
+                <if test="operUserid != null and operUserid != ''">
+                    and ec.oper_userid = #{operUserid}
+                </if>
+                <if test="corpId != null and corpId != ''">
+                    and ec.corp_id = #{corpId}
+                </if>
+                <!--<if test="companyId != null">
+                    and qu.company_id = #{companyId}
+                </if>
+                <if test="companyUserId != null">
+                    and ec.company_user_id = #{companyUserId}
+                </if>-->
+                <if test="customerId != null">
+                    and ec.customer_id = #{customerId}
+                </if>
+                <if test="status != null">
+                    and ec.status = #{status}
+                </if>
+                <if test="stageStatus != null">
+                    and ec.stage_status = #{stageStatus}
+                </if>
+                <if test="transferStatus != null">
+                    and ec.transfer_status = #{transferStatus}
+                </if>
+                <if test="qwUserId != null">
+                    and ec.qw_user_id = #{qwUserId}
+                </if>
+                <if test="level != null">
+                    and ec.level = #{level}
+                </if>
+                <if test="levelType != null">
+                    and ec.level_type = #{levelType}
+                </if>
+                <if test="isBind == 'isBind'">
+                    and ec.customer_id is not null
+                </if>
+                <if test="isBind == 'noBind'">
+                    and ec.customer_id is null
+                </if>
+                <if test="isBindMini == 'isBindMini'">
+                    and ec.fs_user_id is not null
+                </if>
+                <if test="isBindMini == 'noBindMini'">
+                    and ec.fs_user_id is null
+                </if>
+                <if test="lossTime != null">
+                    and DATE(ec.loss_time) = DATE(#{lossTime})
+                </if>
+                <if test="createTime != null">
+                    and DATE(ec.create_time) = DATE(#{createTime})
+                </if>
+                <if test="delTime != null">
+                    and DATE(ec.del_time) = DATE(#{delTime})
+                </if>
+                <if test="sTime != null">
+                    and DATE(ec.create_time) &gt;= DATE(#{sTime})
+                </if>
+                <if test="eTime != null">
+                    and DATE(ec.create_time) &lt;= DATE(#{eTime})
+                </if>
+                <if test="companyUserName != null and companyUserName != ''">
+                    and cu.user_name = #{companyUserName}
+                </if>
+                <if test="cuDeptIdList != null and !cuDeptIdList.isEmpty() and userType != '00'">
+                    AND cu.dept_id IN
+                    <foreach collection="cuDeptIdList" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="companyUser != null">
+                    and (cu.nick_name like concat('%', #{companyUser}, '%') or cu.phonenumber = #{companyUser})
+                </if>
+            </where>
+            order by ec.create_time desc, ec.id desc
+    </select>
 
 
 </mapper>

+ 38 - 1
fs-service/src/main/resources/mapper/qw/QwRestrictionPushRecordMapper.xml

@@ -3,5 +3,42 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.qw.mapper.QwRestrictionPushRecordMapper">
-    
+    <insert id="insertPushTokenTotal">
+        insert into fastgpt_push_token_total(type,qw_user_id,company_id,status,stat_time,count)
+        values(#{type},#{qwUserId},#{companyId},#{status},#{statTime},#{count})
+    </insert>
+    <update id="updatePushTokenTotal">
+        update fastgpt_push_token_total
+        set count=#{count}
+        where id=#{id}
+    </update>
+
+    <select id="selectFastgptPushTokenTotal" resultType="com.fs.fastGpt.domain.FastGptPushTokenTotal">
+        select id,`type`,qw_user_id as qwUserId,company_id as companyId,status,date_format(create_time,'%Y-%m-%d') as statTime,count(id) count
+        from qw_restriction_push_record
+        where  create_time like concat(#{createTime}, '%') and qw_user_id is not null and status = 1
+        GROUP BY `type`,company_id,qw_user_id
+        ORDER BY `type`,company_id,qw_user_id
+    </select>
+
+    <select id="selectFastGptPushTokenTotalByInfo" resultType="com.fs.fastGpt.domain.FastGptPushTokenTotal">
+        select id,type,qw_user_id as qwUserId,company_id as companyId,status,stat_time statTime,count
+        from fastgpt_push_token_total
+        where  type=#{type} and qw_user_id=#{qwUserId} and company_id=#{companyId} and status=#{status} and stat_time=#{statTime}
+    </select>
+    <select id="selectFastGptPushTokenTotalList" resultType="com.fs.fastGpt.domain.FastGptPushTokenTotal">
+        select ft.id,ft.type,ft.qw_user_id as qwUserId,ft.company_id as companyId,com.company_name as companyName,ft.status,ft.stat_time statTime,sum(ft.count) count
+        from fastgpt_push_token_total ft left join company com on ft.company_id= com.company_id
+        <where>
+            <if test="type != null" >and `ft.type` = #{type} </if>
+            <if test="qwUserId != null" >and ft.qw_user_id= #{qwUserId} </if>
+            <if test="companyId != null" >and ft.company_id= #{companyId} </if>
+            <if test="status != null" >and ft.status= #{status} </if>
+            <if test="beginTime != null and endTime != null" >
+                    AND date_format(ft.stat_time,'%Y-%m-%d') &gt;= #{beginTime}
+                    AND date_format(ft.stat_time,'%Y-%m-%d') &lt;= #{endTime}
+            </if>
+        </where>
+        group by ft.company_id,ft.stat_time
+    </select>
 </mapper>

+ 3 - 0
fs-service/src/main/resources/mapper/qw/QwUserMapper.xml

@@ -268,6 +268,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             (qw_user_id = #{query.qwUserId} AND corp_id = #{query.corpId})
         </foreach>
     </select>
+    <select id="selectQwCompanyListOptionsVOBySys" resultType="com.fs.qw.vo.QwOptionsVO">
+        select corp_id as dictValue,corp_name as dictLabel from qw_company
+    </select>
 
     <select id="selectQwUserListVOByCompanyIdAndCorpIdAndNickName" resultType="com.fs.qw.vo.QwUserVO">
         select