Commit 1f451baa by 田超

Merge branch 'feature/1005169' into 'master'

feat:[1005169]小程序首页和我的交互优化

See merge request rays/pcloud-book!1376
parents 45e6adde ffe036ee
......@@ -119,4 +119,12 @@ public interface AppletRecordBiz {
* @param trackDTO 埋点信息
*/
void track(Long wechatUserId, Long officialAccountsId, AppletTrackDTO trackDTO);
/**
* 最近一条足迹
* @author:zhuyajie
* @date:2021/8/4 10:42
* * @param null
*/
AppletRecordDTO getLatestAppletRecord(Long wechatUserId, Long officialAccountsId);
}
......@@ -76,6 +76,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
......@@ -896,4 +897,24 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
JedisClusterUtils.set(HANDLE_APPLET_RECORD_TYPE_CODE_STATUS_KEY, "stop", 3600);
}
@Override
public AppletRecordDTO getLatestAppletRecord(Long wechatUserId, Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
Map<String, Object> paramMap = new HashMap<>();
List<Integer> recordTypes = Arrays.asList(AppletRecordTypeEnum.APP.value,AppletRecordTypeEnum.PRODUCT.value,AppletRecordTypeEnum.BOOK.value);
paramMap.put("wechatUserIds", wechatUserIds);
paramMap.put("recordTypes", recordTypes);
paramMap.put("limit", 10);
List<AppletRecordDTO> recordList = appletRecordServeDao.listAppletRecordLimit(paramMap);
if (ListUtils.isEmpty(recordList)) {
return new AppletRecordDTO();
}
fillAppletRecord(recordList, YesOrNoNumEnum.NO.getValue());
recordList = recordList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
if (ListUtils.isEmpty(recordList)) {
return new AppletRecordDTO();
}
return recordList.get(0);
}
}
......@@ -25,4 +25,6 @@ public interface AppletRecordServeDao extends BaseDao<AppletRecordServe> {
void batchUpdate(List<AppletRecordDTO> recordList);
List<AppletRecordServe> getUserRecordListByType(Long wechatUserId, Integer recordType);
List<AppletRecordDTO> listAppletRecordLimit(Map<String, Object> map);
}
\ No newline at end of file
......@@ -51,4 +51,9 @@ public class AppletRecordServeDaoImpl extends BaseDaoImpl<AppletRecordServe> imp
paramMap.put("recordType", recordType);
return getSessionTemplate().selectList(getStatement("getUserRecordListByType"), paramMap);
}
@Override
public List<AppletRecordDTO> listAppletRecordLimit(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("listAppletRecordLimit"), map);
}
}
\ No newline at end of file
......@@ -162,4 +162,12 @@ public class AppletRecordFacade {
return new ResponseDto<>();
}
@ApiOperation("最近一条足迹")
@GetMapping("getLatestAppletRecord")
public ResponseDto<?> getLatestAppletRecord(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(appletRecordBiz.getLatestAppletRecord(wechatUserId, officialAccountsId));
}
}
\ No newline at end of file
......@@ -290,4 +290,30 @@
is_delete = 0
order by create_time desc
</select>
<select id="listAppletRecordLimit" parameterType="map" resultMap="com.pcloud.book.applet.dao.impl.AppletRecordDaoImpl.BaseResultMap4DTO">
SELECT
<include refid="Base_Column_List"/>
FROM
`applet_record_serve`
WHERE
is_delete = 0
<if test="wechatUserIds != null">
and wechat_user_id IN
<foreach collection="wechatUserIds" separator="," open="(" close=")" index="index" item="wechatUserId">
${wechatUserId}
</foreach>
</if>
<if test="recordTypes != null">
and record_type in
<foreach collection="recordTypes" index="index" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
and
create_date &gt; DATE_SUB(curdate(),INTERVAL 30 day)
ORDER BY
create_time DESC
limit #{limit}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment