周总结:2020/08/14
一、周任务
工作任务
- 掌握Swagger文档的基本语法
- 首页0812需求测试问题的跟进
- 店铺官方账号粉丝取消关注功能的同步。(思考粉丝同步技术方案)
OKR计划
- 每周3道 leetcode算法题
- 本季度的完成的技能学习:SpringBoot、Dubbo文档输出
二、任务总结
任务一:掌握Swagger文档的学习
针对接口文档的学习,我感觉只需要掌握如何去使用(请求方式、请求的参数、返回值)等注释;常用的注释主要有:
1、 @Api:用在请求类上,说明该类的作用
tag = “说明该类的作用”
value = “该参数没什么实际意义,所以不需要配置”
示例:
@Api(tags = "用在请求类上,说明该类的作用")
2、@ApiOperation:用在请求方法上,说明方法的作用
values = “说明方法的作用”
notes = “方法的备注说明”
示例:
@ApiOperation(value = "用户注册",notes = "手机号和密码不能为空")
3、@ApiImplicitParams:用在请求方法上,包含一组参数说明
@ApiImplicitParam:用在@ApiImplicitParams注解中,指定一个参数的配置信息
name:参数名
value:参数的汉字说明、解释
require:参数的汉字说明、解释(是否为必须项)
patamType:参数放那个地方(header、path、form、body等)
dataType:参数类型,默认String,其它值dataType = “Integer”
defaultValue:参数的默认值
示例:
@ApiImplicitParams({
@ApiImplicitParam(name="mobile",value="手机号",required=true,paramType="form"),
@ApiImplicitParam(name="password",value="密码",required=true,paramType="form"),
@ApiImplicitParam(name="age",value="年龄",required=true,paramType="form",dataType="Integer")
})
4、@ApiResponse:用在请求方法上,包含一组参数响应
@ApiResponse:用在@ApiResponses注解中,指定一个参数的配置信息
code:参数名
message:参数的汉字说明、解释
response:抛出异常类
示例:
@APiOperation(value = "XX请求",notes = "多个参数,多种查询参数类型")
@ApiResponses({
@ApiResponse(code = 200,message = “请求成功”),
@ApiResponse(code = 404,message = “访问资源不存在”)
})
5、@ApiModel:用于响应类上,表示一个返回响应数据的信息
@ApiModelProperty:用在属性上面,描述响应类的属性
示例
@ApiModel(description = "返回响应数据")
public class Student{
@ApiModelProperty(value = "用户名")
private String userName;
@ApiModelProperty(value = "年龄")
private int age;
/*
* getter/setter
* */
}
任务二:0812需求
0819负责的需求:
1、完成时间轴翻转文案
2、必买好货的打标
- 接触到的第一个真实的开发:时间轴的翻转文案实现逻辑其实挺简单的,通过抓包的方式找到具体的接口,并通过接入层的逻辑跟了进去,再获取到时间轴对象时,新加字段,实现后台配置返回操作。
/**
* 99Mall查询tab和时间轴列表
*
* @param appCont 渠道 0-H5,1-XX微店,2-XXVIP
* @param strVersion 默认版本号0
* @param specialAxisIsRight 默认轴在左还是右 已废弃 一直在右边
* @author 逼哥2019年07月28日 新建
*/
@ApiOperation(value = "99Mall查询tab和时间轴列表 ", notes = "99Mall查询tab和时间轴列表 新人专场传 activityTimesId=-200")
@ResponseBody
@RequestMapping(value = "/queryAllActivityTimesListForMall99", method = RequestMethod.GET)
public BaseObject queryAllActivityTimesListForMall99(int appCont, String strVersion,
@RequestParam(defaultValue = "0") int specialAxisIsRight,
@ApiParam(name = "userType", value = "店主类型枚举 0-普通店主 1-新店主已开单 2-新店主未开单 ") Integer userType,
@ApiParam(name = "showNewUser", value = "灰度 参数") String showNewUser,
@ApiParam(name = "timeLocation", value = "灰度 参数") String timeLocation,
@ApiParam(name = "orderNum", value = "首单销量") @RequestParam(value = "orderNum", defaultValue = "0") int orderNum) {
...
}
- 实现必买好货打标需求:
/**
* 查询99mall时间轴商品列表
*
* @param appCont
* @param activityTimesId 时间轴Id
* @param strVersion 1 今天, 2 明天
* @return
*/
@ResponseBody
@RequestMapping(value = "/queryActivityItemsListForMall99", method = RequestMethod.GET)
@LoginPermission(requireLogin = false)
public BaseObject queryActivityItemsListForMall99(@RequestParam(value = "appCont") int appCont,
@RequestParam(value = "strVersion", defaultValue = "0") String strVersion,
@RequestParam(value = "activityTimesId", defaultValue = "0") int activityTimesId) {
.....
MallItemResponse mallItemResponse = mall99Service.queryActivityItemsListForMall99(request);
.....
//大概的实现逻辑:
//1、先从缓存中拿到时间轴信息
...
ActivityTimesBo activityTimesBo = redisCache.getObject(MALL99_ACTIVITY_TIMES + activityTimesId,
ActivityTimesBo.class);
//2、通过Key找到设置缓存的地方
private void dealActivityTimes(List<Integer> noStockIdList, ActivityTimesBo activityTimesBo,
int tabType) {
int activityTimesId = activityTimesBo.getActivityTimesId();
// 时间轴场次缓存key
String activityTimesKey = Mall99Constant.MALL99_ACTIVITY_TIMES + activityTimesId;
// 某个轴下关联的商品id列表缓存key
String mall99ItemsIdListKey = MALL_99_ITEMS_ID_LIST_AXIS + activityTimesId;
//3、更新缓存
// 删除之前场次活动所有缓存
boolean hasItems = refreshItemIdList(noStockIdList, mall99ItemsIdListKey, timeaxisItemBos);
// 过滤商品并将商品信息写入缓存
refreshItemBoListAndFilter(itemBos, itemBoMap);
// 写入商品对象缓存
ActivityTimesItemNew activityTimesItem = makeActivityTimesItemNew(itemBo, timeaxisItemBo);
//获取商品必买好货标签
if (itemBo.getItemBizWordsBo() != null) {
Integer itemServiceFeeFlag = (Integer) itemBo.getItemBizWordsBo().get("itemServiceFeeFlag");
//不是普通商品
if (activityTimesItemNew.getTopItemType() == 0) {
//如果是必买好货,则将商品的标签类型修改为必买好货
if (itemServiceFeeFlag != null && itemServiceFeeFlag == ItemServiceFeeEnum.MUST_BUY.key) {
activityTimesItemNew.setTopItemType(TagTypeEnum.MUSTBUY_GOODS.getKey());
}
}
}
任务三:店铺粉丝取消关注同步实现
需求介绍:
实现功能相对简单,因为之前的粉丝关注同步功能已经实现,现在的需求只是增加一个取消关注的同步。因此,在以前的功能之上新增加了一个判断:区分是取消操作还是关注操作,如果是取消操作的话也会发送消息到MQ中,实现同步操作。
三、思考与想法
完成了工作上的任务,但是对于执行OKR计划的执行力还是不够强;
- 这周留给自己的空余时间感觉不是很多,有两场足球比赛;原本计划是在这些时间段完成leetcode的刷题任务,但是由于团队活动而未完成任务。但是我感觉这个应该是可以克服的,刷题得坚持,只有坚持下去了才能慢慢看到。
- 后期会慢慢将自己的学进度进一步的提升速度,SpringBoot的学习进度感觉有些时间没有更新了,得加油!
- 工作归工作,但是还得注意锻炼,争取每周都得打一次羽毛球!