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

结算金额提交

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