提交 f14b0564 authored 作者: 吴德鹏's avatar 吴德鹏

结算金额提交

上级 4a692207
......@@ -48,14 +48,14 @@ public class TbCfHomePageEntityController extends Controller {
}
@GetMapping("/store")
public Result getStores( @RequestParam(required = false,defaultValue = "0") Integer pageNum, @RequestParam(defaultValue = "10",required = false) Integer pageSize) {
public Result getStores(@RequestParam(required = false, defaultValue = "0") Integer pageNum, @RequestParam(defaultValue = "10", required = false) Integer pageSize) {
return new Result<>(storeRepository.findAll(PageRequest.of(pageNum,pageSize)));
return new Result<>(storeRepository.findAll(PageRequest.of(pageNum, pageSize)));
}
//Fetch recommended items
@GetMapping("home/listPosts/recommend")
public List<Post> postList2(@RequestParam(value = "userId",required = false) String id, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
public List<Post> postList2(@RequestParam(value = "userId", required = false) String id, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
//Optional<TbCfUserInfo> byId = userRepository.findById(id);
//if( !byId.isPresent() ) return new ArrayList<>();
......@@ -63,7 +63,6 @@ public class TbCfHomePageEntityController extends Controller {
}
private Visit visitPost(Post post) {
Visit visit = new Visit();
visit.setPost(post);
......@@ -86,7 +85,7 @@ public class TbCfHomePageEntityController extends Controller {
//List users who are eligible to receive firebase cloud messages to their devices
@GetMapping("/home/clientWithFcm")
public Result getClientList( @RequestParam(value = "pageNo",required = false,defaultValue = "20") Integer pageNo, @RequestParam(value = "pageSize",required = false,defaultValue = "20") Integer pageSize){
public Result getClientList(@RequestParam(value = "pageNo", required = false, defaultValue = "20") Integer pageNo, @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize) {
List<TbCfUserInfo> allByFcmIsNotNull = userRepository.findAllByFcmIsNotNullOrderByLastLoginTimeDesc(PageRequest.of(pageNo, pageSize));
//Map list to Small map to minimize amount of json serialized information
return new Result<>(allByFcmIsNotNull.stream().map(TbCfUserInfo::smallMap).collect(Collectors.toList()));
......@@ -94,20 +93,21 @@ public class TbCfHomePageEntityController extends Controller {
//Send notification to the user by his code
@GetMapping("/home/sendNotification/byCode/{code}")
public Result sendFcm(@PathVariable("code") String id,@RequestParam("content") String content,@RequestParam("title") String title){
public Result sendFcm(@PathVariable("code") String id, @RequestParam("content") String content, @RequestParam("title") String title) {
Optional<TbCfUserInfo> byId = userRepository.findByCode(id);
if( byId.isPresent() && byId.get().hasFcm() ){
if (byId.isPresent() && byId.get().hasFcm()) {
TbCfUserInfo userInfo = byId.get();
sendNotification(userInfo.getFcm(),title,content);
sendNotification(userInfo.getFcm(), title, content);
return new Result();
}
return new Result(ResultCodeEnum.SUCCESS.getCode(),"No firebase messaging token found");
return new Result(ResultCodeEnum.SUCCESS.getCode(), "No firebase messaging token found");
}
@GetMapping("/home/middleColumn")
public Result getMiddleColumn( @RequestParam(value = "limit", defaultValue = "4") Integer limit){
public Result getMiddleColumn(@RequestParam(value = "limit", defaultValue = "4") Integer limit,
@RequestParam(value = "types", defaultValue = "0") Integer types) {
Result result = new Result<>();
try {
List<TbCfSort> moduleList = sortRepository.findAll(Sort.by(Sort.Order.asc("sort")));
......@@ -119,13 +119,25 @@ public class TbCfHomePageEntityController extends Controller {
//分类导航栏
if ("1".equals(type)) {
/*moduleMap.put("class_title", getTitleImage(1));*/
List<TbCfClassification> classificationList = classificationRepository.findAll(Sort.by(Sort.Order.asc("sort")));
// List<TbCfClassification> classificationList = classificationRepository.findAll(Sort.by(Sort.Order.asc("sort")));
List<TbCfClassification> classificationList;
if (types == 1) {
classificationList = classificationRepository.findAllByType(1, Sort.by(Sort.Order.asc("sort")));
classificationList.forEach(c -> {
String[] ids = c.getCategoryId().split(",");
int length = ids.length;
c.setNum(length);
c.setCategoryId(ids[length - 1]);
});
} else {
classificationList = classificationRepository.findAllByType(0, Sort.by(Sort.Order.asc("sort")));
}
moduleMap.put("classificationList", classificationList);
}
//爬虫品牌
if ("2".equals(type)) {
moduleMap.put("store_title", getTitleImage(2));
List<TbCfStore> storeStationList = storeRepository.findAll(PageRequest.of(0,limit,Sort.by(Sort.Order.desc("enableFlag"),Sort.Order.desc("storeCode")))).toList();
List<TbCfStore> storeStationList = storeRepository.findAll(PageRequest.of(0, limit, Sort.by(Sort.Order.desc("enableFlag"), Sort.Order.desc("storeCode")))).toList();
moduleMap.put("storeStationList", storeStationList);
}
//海报图
......@@ -136,7 +148,7 @@ public class TbCfHomePageEntityController extends Controller {
}
list.add(moduleMap);
}
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
List<TbCfColumn> hotColumnList = columnRepository.findAllByColumnType(4);
map.put("hot_title", hotColumnList);
list.add(map);
......
package com.example.afrishop_v3.models;
import lombok.Data;
import org.hibernate.annotations.Where;
import org.hibernate.sql.ast.Clause;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.io.Serializable;
/**
......@@ -15,7 +18,8 @@ import java.io.Serializable;
*/
@Entity
@Data
public class TbCfClassification{
@Where(clause = "is_show=1")
public class TbCfClassification {
/**
* 首页分类导航ID
......@@ -43,6 +47,13 @@ public class TbCfClassification{
*/
private String isShow;
private Integer type;
private String categoryId;
@Transient
private Integer num;
/**
* 设置:首页分类导航ID
*/
......@@ -56,6 +67,7 @@ public class TbCfClassification{
public String getId() {
return id;
}
/**
* 设置:一级分类ID
*/
......@@ -69,6 +81,7 @@ public class TbCfClassification{
public String getGoodtypeId() {
return goodtypeId;
}
/**
* 设置:标题
*/
......@@ -82,6 +95,7 @@ public class TbCfClassification{
public String getClassTitle() {
return classTitle;
}
/**
* 设置:图片
*/
......@@ -95,6 +109,7 @@ public class TbCfClassification{
public String getPicture() {
return picture;
}
/**
* 设置:排序
*/
......@@ -108,6 +123,7 @@ public class TbCfClassification{
public Integer getSort() {
return sort;
}
/**
* 设置:是否展示
*/
......
......@@ -8,4 +8,6 @@ import java.util.List;
public interface TbCfClassificationRepository extends PagingAndSortingRepository<TbCfClassification,String> {
List<TbCfClassification> findAll(Sort sort);
List<TbCfClassification> findAllByType(Integer type,Sort sort);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论