Browse Source

Merge branch 'master' of http://111.47.29.214:3000/udream-cxs/lift-server.git

Wei Ruifeng 4 years ago
parent
commit
5d9cd50b34

+ 1 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/motiontrail/mapper/MotionTrailMapper.java

@@ -33,6 +33,6 @@ public interface MotionTrailMapper extends BaseMapper<MotionTrail> {
     Integer addTrail(@Param("mobile") String mobile, @Param("mtCompanyId")Long mtCompanyId,
                      @Param("position")String position,@Param("createTime") Date createTime,@Param("userId") Long userId);
     
-    @Select("   SELECT * FROM motion_trail WHERE id IN(SELECT MAX(id) FROM motion_trail  WHERE mt_company_id=#{companyId} GROUP BY user_id)")
+    @Select("   SELECT * FROM motion_trail WHERE id IN(SELECT MAX(id) FROM motion_trail  WHERE mt_company_id=#{companyId} and position <> 'null,null' GROUP BY user_id)")
     List<MotionTrail> queryTrailByTeam(@Param("companyId")Long companyId);
 }

+ 5 - 8
lift-ud-service/src/main/java/cn/com/ty/lift/ud/motiontrail/service/impl/MotionTrailServiceImpl.java

@@ -1,12 +1,7 @@
 package cn.com.ty.lift.ud.motiontrail.service.impl;
 
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -109,8 +104,8 @@ public class MotionTrailServiceImpl extends ServiceImpl<MotionTrailMapper, Motio
         }
         List<MotionTrail> queryTrailByTeam = motionTrailMapper.queryTrailByTeam(request.getMtCompanyId());
         for (MotionTrail mt : queryTrailByTeam) {
-            UserInfoEntity byUserId = userInfoMapper.getByUserId(mt.getUserId());
-            mt.setUserInfo(byUserId);
+            UserInfoEntity userInfo = Optional.ofNullable(userInfoMapper.getByUserId(mt.getUserId())).orElse(new UserInfoEntity());
+            mt.setUserInfo(userInfo);
         }
         Map<String, List> rst = new HashMap<>();
         List polylines = new ArrayList();
@@ -124,6 +119,8 @@ public class MotionTrailServiceImpl extends ServiceImpl<MotionTrailMapper, Motio
             Map temp = new HashMap();
             temp.put("position", mark);
             temp.put("text", sdf.format(item.getCreateTime()));
+            temp.put("avatarUrl", item.getUserInfo().getAvatarUrl());
+            temp.put("name",item.getUserInfo().getName());
             texts.add(temp);
         });
         rst.put("polylines", polylines);

+ 1 - 1
lift-ud-service/src/main/java/cn/com/ty/lift/ud/userInfo/mapper/UserInfoMapper.java

@@ -244,7 +244,7 @@ public interface UserInfoMapper extends BaseMapper<UserInfoEntity> {
     @Update("UPDATE user_info SET average_score=#{avsore} where user_id=#{userId}")
     void updateAverageScore(@Param("userId")Long id,@Param("avsore")Integer avsore);
     
-    @Select("select * from user_info where maintenance_company_id = #{companyId}")
+//    @Select("select * from user_info where maintenance_company_id = #{companyId}")
     List<UserInfoEntity>getUserByCompanyId(@Param("companyId")Long companyId);
 
 

+ 9 - 0
lift-ud-service/src/main/java/cn/com/ty/lift/ud/userInfo/mapper/UserInfoMapper.xml

@@ -275,4 +275,13 @@
 <!-- 	) temp order by create_time; -->
 
 	</select>
+
+
+
+	<select id="getUserByCompanyId" resultMap="BaseResultMap">
+		select info.* from mt_company_user mt
+		left join user_info info on info.user_id = mt.user_id
+		where mt_company_id=#{companyId}
+
+	</select>
 </mapper>