提交 8ddd194c authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 278ccae3
......@@ -112,7 +112,7 @@ public class ResourceController {
public CallBack<List<FgResourceVo>> batchGet(@RequestBody List<FgResourceForm> forms) {
return CallBack.success(resourceService.batchGet(forms));
}
// TODO URL 格式修改 /get/业务名称 使用get 方法查询,get方法下不存在 @RequestBody
@ApiOperation("根据资源id/资源类别,返回资源详情")
@GetMapping(ResourceRequestPath.GET + ResourceRequestPath.BATCH)
public CallBack<CollectionsVo> batchGet(GoodsForm forms) {
......
......@@ -570,25 +570,32 @@ public class ResourceServiceImpl extends BaseModelServiceImpl<PhyResource, Strin
@Override
public CollectionsVo get(GoodsForm forms) {
CollectionsVo collectionsVo = new CollectionsVo();
// TODO 常量值 交由 GoodsTypeStartEnum
if(forms.getGoodsType().contains("1-")){
FgPhyResourceVo fgPhyResourceVo = new FgPhyResourceVo();
// TODO 空指针异常
PhyResource phyResource = phyResourceMapper.selectByPrimaryKey(forms.getGoodsId());
try {
// TODO BeanUtils 使用 core包下 或者 spring包下, 不要使用 apache包下
BeanUtils.copyProperties(fgPhyResourceVo, phyResource);
} catch (Exception e) {
logger.error("批量查询实体资源信息-属性copy失败\n" + e.getMessage());
}
ResourceBinding record = new ResourceBinding();
record.setMainId(forms.getGoodsId());
// TODO 获取收藏商品vo 判断是否有绑定信息 需要使用 计数方法
List<ResourceBinding> resourceBindings = resourceBindingMapper.select(record);
fgPhyResourceVo.setIsHaveBinding(resourceBindings == null ? "0" : "1");
// TODO 判断 集合是否为空 使用 ArrayUtils.isNotEmpty 方法
if(resourceBindings != null){
// TODO 使用 boolean flag = resourceBindings.stream().map(ResourceBinding :: getOtherType).anymath(type -> GoodsTypeEnum.PDF.getCode().equals(type))
List<String> otherTypes = resourceBindings.stream().map(ResourceBinding :: getOtherType).collect(Collectors.toList());
fgPhyResourceVo.setIsTrialReading(otherTypes.contains(GoodsTypeEnum.PDF.getCode()) ? "0" : "1");
}
collectionsVo.setFgPhyResourceVo(fgPhyResourceVo);
} else {
FgEleResourceVo fgEleResourceVo = new FgEleResourceVo();
// TODO 空指针异常
EleResource eleResource = eleResourceMapper.selectByPrimaryKey(forms.getGoodsId());
try {
BeanUtils.copyProperties(fgEleResourceVo, eleResource);
......
......@@ -36,18 +36,22 @@ public class FgBrowseRecordsController {
@Autowired
private FgBrowseRecordsService browseRecordsService;
@ApiOperation("浏览记录批量删除")
@PostMapping(SysUserRequestPath.BATCH_DELETE)
public CallBack<Boolean> batchDelete(@ApiParam(value="*记录id集合",required= true ) @RequestBody List<Integer> oids){
// TODO 根据 oids 和当前登录人 id 删除 浏览记录
return browseRecordsService.batchDelete(oids) ? CallBack.success() : CallBack.fail();
}
@ApiOperation("删除当天")
// TODO BATCH_DELETE_TODAY 常量拼接不正确
@PostMapping(SysUserRequestPath.BATCH_DELETE_TODAY)
public CallBack<Boolean> batchDeleteToDay(@RequestBody QueryBrowseRecordsForm form ){
return CallBack.success(browseRecordsService.deleteByParam(form));
}
// TODO 会员id
@ApiOperation("浏览记录分页列表")
@GetMapping(SysUserRequestPath.OID + SysUserRequestPath.PAGE)
public CallBack<PageMap<String,List<CollectionsVo>>> page(@ApiParam(value = "*会员id", required = true) @PathVariable Integer oid,PageParam pageParam){
......@@ -57,4 +61,5 @@ public class FgBrowseRecordsController {
return CallBack.success(browseRecordsService.page(oid,pageParam));
}
// TODO 缺少接口, 获取指定数量的 浏览记录
}
......@@ -63,7 +63,7 @@ public class FgCollectionsController {
}
return CallBack.success(fgCollectionsService.page(pageParam));
}
// TODO isExist判断是否存在
@ApiOperation(value="判断是否收藏 true:被收藏 false:未收藏")
@GetMapping(SysUserRequestPath.CHECK_IS_COLLECT)
public CallBack<Boolean> check(CollectionsForm form){
......
......@@ -39,6 +39,7 @@ public interface FgBrowseRecordsMapper extends BaseMapper<BrowseRecords>{
* @author chyj
* @date: 2019年4月19日 上午10:20:49
*/
// TODO 使用 @Delete 注解 用户id不应该为空
@Select(" <script> "
+ " DELETE FROM sys_browse_records where 1=1 "
+ " <if test='(from.uid) != null'> "
......
......@@ -53,6 +53,7 @@ public class FgBrowseRecordsServiceImpl extends BaseServiceImpl<BrowseRecords, I
// 2. 取第n页数据
// 3. 组装PageInfo对象
startPage(pageParam);
// TODO oid 为用户id 从redis 中获取
List<CollectionsVo> result = fgBrowseRecordsMapper.list(oid);
Map<String, List<CollectionsVo>> map = result.stream().map(vo -> {
GoodsForm goodsForm = new GoodsForm();
......@@ -78,6 +79,7 @@ public class FgBrowseRecordsServiceImpl extends BaseServiceImpl<BrowseRecords, I
*/
@Override
public Boolean deleteByParam(QueryBrowseRecordsForm form) {
// TODO 根据用户id 和 日期删除浏览记录
return fgBrowseRecordsMapper.deleteByParam(form);
}
......
......@@ -67,8 +67,8 @@ public class FgCollectionsServiceImpl extends BaseModelServiceImpl<Collections,
goodsForm.setGoodsType(vo.getGoodsType());
CallBack<CollectionsVo> call = resourceClient.get(goodsForm);
if (call.hasEntity()){
vo.setFgEleResourceVo(call.getData().getFgEleResourceVo());
vo.setFgPhyResourceVo(call.getData().getFgPhyResourceVo());
vo.setFgEleResourceVo(call.getData().getFgEleResourceVo());
vo.setFgPhyResourceVo(call.getData().getFgPhyResourceVo());
}
}
return new PageInfo<CollectionsVo>(result);
......@@ -87,6 +87,7 @@ public class FgCollectionsServiceImpl extends BaseModelServiceImpl<Collections,
collections.setGoodsId(form.getGoodsId());
collections.setGoodsType(form.getGoodsType());
collections.setUserId(fgRedisManage.getMember().getId() == null ? "" : fgRedisManage.getMember().getId()+"");
// TODO 使用计数方法
List<Collections> result = fgcollectionsMapper.select(collections);
return !result.isEmpty();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论