Ver Fonte

1、调整标签
2、调整统计数据

yys há 3 semanas atrás
pai
commit
0f2d74e1db

+ 2 - 0
fs-company-app/src/main/java/com/fs/app/controller/CompanyTagController.java

@@ -60,6 +60,7 @@ public class CompanyTagController extends AppBaseController {
             List<CompanyTag> list = companyTagService.selectCompanyTagByList(params);
             return R.ok().put("data", new PageInfo<>(list));
         } else {
+            params.put("companyUserId", getCompanyUserId());
             List<CompanyTag> list = companyTagService.selectCompanyTagListByMap(params);
             return R.ok().put("data", new PageInfo<>(list));
         }
@@ -74,6 +75,7 @@ public class CompanyTagController extends AppBaseController {
     public R add(@RequestBody CompanyTag companyTag) throws CustomException {
         log.debug("新增公司标签 companyTag: {}", JSON.toJSONString(companyTag));
         companyTag.setCompanyId(getCompanyId());
+        companyTag.setCompanyUserId(getCompanyUserId());
         companyTagService.insertCompanyTag(companyTag);
         return R.ok();
     }

+ 1 - 1
fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java

@@ -114,7 +114,7 @@ public class FsUserController extends AppBaseController {
         return ResponseResult.ok(userNumber);
     }
 
-    @Login
+//    @Login
     @GetMapping("/details")
     @ApiOperation("用户会员详情")
     public ResponseResult<UserDetailsVO> getUserDetails(@ApiParam(value = "用户id", required = true) @RequestParam Long userId,

+ 13 - 0
fs-service/src/main/java/com/fs/company/domain/CompanyTag.java

@@ -24,10 +24,23 @@ public class CompanyTag extends BaseEntity
     @Excel(name = "企业id")
     private Long companyId;
 
+    /** 企业id */
+    @Excel(name = "销售id")
+    private Long companyUserId;
+
     /** 标签 */
     @Excel(name = "标签")
     private String tag;
 
+    public Long getCompanyUserId() {
+        return companyUserId;
+    }
+
+    public CompanyTag setCompanyUserId(Long companyUserId) {
+        this.companyUserId = companyUserId;
+        return this;
+    }
+
     public void setTagId(Long tagId)
     {
         this.tagId = tagId;

+ 2 - 0
fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java

@@ -486,4 +486,6 @@ public interface FsUserMapper
     FsUser findUserByAppleKey(String appleKey);
 
     List<Map<String, Object>>  selectRegisterCount(@Param("companyId") Long companyId,@Param("startDate") String startDate,@Param("endDate") String endDate);
+
+    UserDetailsVO selectCountWatchCourse(@Param("userId") Long userId, @Param("fsUserId") Long fsUserId, @Param("dateTag") String dateTag,@Param("userCompanyId")  Long userCompanyId);
 }

+ 2 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java

@@ -865,7 +865,8 @@ public class FsUserServiceImpl implements IFsUserService {
 
     @Override
     public UserDetailsVO getUserDetails(Long userId, Long fsUserId, String dateTag, Long userCompanyId) {
-        UserDetailsVO countWatchCourse = fsUserMapper.getCountWatchCourse(userId, fsUserId, dateTag, userCompanyId);
+        UserDetailsVO countWatchCourse = fsUserMapper.selectCountWatchCourse(userId, fsUserId, dateTag, userCompanyId);
+//        UserDetailsVO countWatchCourse = fsUserMapper.getCountWatchCourse(userId, fsUserId, dateTag, userCompanyId);
 //        FsUserCompanyUser fsUserCompanyUser = userCompanyUserService.selectFsUserCompanyUserById(userCompanyId);
 
         UserDetailsVO countAnswer = fsUserMapper.getCountAnswer(userCompanyId, fsUserId, dateTag);

+ 9 - 1
fs-service/src/main/resources/mapper/company/CompanyTagMapper.xml

@@ -9,10 +9,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="companyId"    column="company_id"    />
         <result property="tag"    column="tag"    />
         <result property="createTime"    column="create_time"    />
+        <result property="companyUserId"    column="company_user_id"    />
     </resultMap>
 
     <sql id="selectCompanyTagVo">
-        select tag_id, company_id, tag, create_time from company_tag
+        select tag_id, company_id, tag, create_time,company_user_id from company_tag
     </sql>
 
     <select id="selectCompanyTagList" parameterType="CompanyTag" resultMap="CompanyTagResult">
@@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="companyId != null "> and company_id = #{companyId}</if>
             <if test="tag != null  and tag != ''"> and tag = #{tag}</if>
+            <if test="companyUserId != null  and companyUserId != ''"> and company_user_id = #{companyUserId}</if>
         </where>
     </select>
 
@@ -41,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="params.companyId != null">
                 and ct.company_id = #{params.companyId}
             </if>
+            <if test="params.companyUserId != null">
+                and (ct.company_user_id = #{params.companyUserId} or ct.company_user_id is null)
+            </if>
             <if test="params.tagName != null">
                 and ct.tag = #{params.tagName}
             </if>
@@ -99,11 +104,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">company_id,</if>
             <if test="tag != null">tag,</if>
             <if test="createTime != null">create_time,</if>
+            <if test="companyUserId != null">company_user_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyId != null">#{companyId},</if>
             <if test="tag != null">#{tag},</if>
             <if test="createTime != null">#{createTime},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
          </trim>
     </insert>
 
@@ -113,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">company_id = #{companyId},</if>
             <if test="tag != null">tag = #{tag},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
         </trim>
         where tag_id = #{tagId}
     </update>

+ 41 - 0
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -2481,5 +2481,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         group by ucu.company_id
     </select>
 
+    <select id="selectCountWatchCourse" resultType="com.fs.store.vo.h5.UserDetailsVO">
+        SELECT
+        <if test="dateTag == null or dateTag =='' or dateTag == '近七天' ">
+            ifnull( sum(case when log_type = 2 then 1 else 0 end), 0 ) AS completeWatchCount,
+            ifnull( count(*), 0 ) AS watchTimes,
+        </if>
+        <if test="dateTag != null and dateTag !='' and dateTag != '近七天' ">
+            ifnull( sum(case when log_type = 2 then 1 else 0 end), 0 ) AS completeWatchCount,
+            ifnull( count(*), 0 ) AS watchTimes,
+        </if>
+        fs_course_watch_log.user_id
+        FROM
+        fs_course_watch_log
+        INNER JOIN fs_user_company_user cu ON cu.user_id = fs_course_watch_log.user_id and cu.project_id = fs_course_watch_log.project
+        <where>
+            <if test="dateTag != null and dateTag !='' ">
+                <choose>
+                    <when test = "dateTag == '今天'">
+                        and to_days(fs_course_watch_log.create_time) = to_days(now())
+                    </when>
+                    <when test = "dateTag == '昨天'">
+                        and fs_course_watch_log.create_time &gt;= CURDATE() - INTERVAL 1 DAY
+                        AND fs_course_watch_log.create_time &lt; CURDATE()
+                    </when>
+                    <when test = "dateTag == '前天'">
+                        and fs_course_watch_log.create_time &gt;= CURDATE() - INTERVAL 2 DAY
+                        AND fs_course_watch_log.create_time &lt; CURDATE() - INTERVAL 1 DAY
+                    </when>
+                    <when test = "dateTag == '近七天'">
+                        and fs_course_watch_log.create_time &gt;= CURDATE() - INTERVAL 7 DAY
+                    </when>
+                </choose>
+            </if>
+            and fs_course_watch_log.user_id = #{fsUserId}
+            <if test="userCompanyId!=null">
+                and cu.id = #{userCompanyId}
+            </if>
+        </where>
+        GROUP BY
+        fs_course_watch_log.user_id
+    </select>
 
 </mapper>