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

修改一个小bug

上级 2e0d1825
...@@ -81,7 +81,7 @@ public class FlutterWaveController extends Controller { ...@@ -81,7 +81,7 @@ public class FlutterWaveController extends Controller {
public ResponseEntity<String> payForOrderByCard(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) { public ResponseEntity<String> payForOrderByCard(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) {
RaveConstant.PUBLIC_KEY = PUBLIC_KEY; RaveConstant.PUBLIC_KEY = PUBLIC_KEY;
RaveConstant.SECRET_KEY = SECRET_KEY; RaveConstant.SECRET_KEY = SECRET_KEY;
RaveConstant.ENVIRONMENT = Environment.LIVE; //or LIVE RaveConstant.ENVIRONMENT = Environment.STAGING; //or LIVE
// Result result = new Result(); // Result result = new Result();
Optional<TbCfOrder> byId = repository.findById(orderId); Optional<TbCfOrder> byId = repository.findById(orderId);
...@@ -135,7 +135,7 @@ public class FlutterWaveController extends Controller { ...@@ -135,7 +135,7 @@ public class FlutterWaveController extends Controller {
public ResponseEntity<String> payForOrderByPhone(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) { public ResponseEntity<String> payForOrderByPhone(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) {
RaveConstant.PUBLIC_KEY = PUBLIC_KEY; RaveConstant.PUBLIC_KEY = PUBLIC_KEY;
RaveConstant.SECRET_KEY = SECRET_KEY; RaveConstant.SECRET_KEY = SECRET_KEY;
RaveConstant.ENVIRONMENT = Environment.LIVE; //or LIVE RaveConstant.ENVIRONMENT = Environment.STAGING; //or LIVE
// Result result = new Result(); // Result result = new Result();
Optional<TbCfOrder> byId = repository.findById(orderId); Optional<TbCfOrder> byId = repository.findById(orderId);
......
...@@ -99,7 +99,7 @@ public class ItemController { ...@@ -99,7 +99,7 @@ public class ItemController {
return new Result<>(map); return new Result<>(map);
} }
@GetMapping("/searchItems") /* @GetMapping("/searchItems")
public Result searchItems(@RequestParam(value = "name") String name, public Result searchItems(@RequestParam(value = "name") String name,
@RequestParam(value = "order", required = false) String order, @RequestParam(value = "order", required = false) String order,
@RequestParam(value = "pageNum", defaultValue = "0") Integer pageNum, @RequestParam(value = "pageNum", defaultValue = "0") Integer pageNum,
...@@ -124,6 +124,21 @@ public class ItemController { ...@@ -124,6 +124,21 @@ public class ItemController {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
return new Result(ResultCodeEnum.VALIDATE_ERROR.getCode(), e.getMessage()); return new Result(ResultCodeEnum.VALIDATE_ERROR.getCode(), e.getMessage());
} }
}*/
@GetMapping("/searchItems")
public Result searchItems(@RequestParam(value = "name") String name,
@RequestParam(value = "order", required = false) String order,
@RequestParam(value = "pageNum", defaultValue = "0") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
try {
Page<TbCfStationItem> page = repository.findByItemNameLike(name, PageRequest.of(pageNum, pageSize, getSort(order)));
return new Result<>(page);
} catch (Exception e) {
System.out.println(e.getMessage());
return new Result(ResultCodeEnum.VALIDATE_ERROR.getCode(), e.getMessage());
}
} }
@GetMapping("/queryHotRecommended") @GetMapping("/queryHotRecommended")
......
...@@ -141,7 +141,7 @@ public class OrderController extends Controller { ...@@ -141,7 +141,7 @@ public class OrderController extends Controller {
if (toitableId != null && !toitableId.isEmpty()) { if (toitableId != null && !toitableId.isEmpty()) {
boolean check = checkCoupon(toitableId, orderPrice); boolean check = checkCoupon(toitableId, orderPrice);
if (!check) { if (!check) {
return new Result<>(code, ""); return new Result<>(code, "Largest value Coupon selected");
} }
Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId); Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId);
...@@ -214,7 +214,7 @@ public class OrderController extends Controller { ...@@ -214,7 +214,7 @@ public class OrderController extends Controller {
if (toitableId != null && !toitableId.isEmpty()) { if (toitableId != null && !toitableId.isEmpty()) {
boolean check = checkCoupon(toitableId, orderPrice); boolean check = checkCoupon(toitableId, orderPrice);
if (!check) { if (!check) {
return new Result<>(code, ""); return new Result<>(code, "Largest value Coupon selected");
} }
Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId); Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId);
...@@ -341,7 +341,7 @@ public class OrderController extends Controller { ...@@ -341,7 +341,7 @@ public class OrderController extends Controller {
if (toitableId != null && !toitableId.isEmpty()) { if (toitableId != null && !toitableId.isEmpty()) {
boolean check = checkCoupon(toitableId, orderPrice); boolean check = checkCoupon(toitableId, orderPrice);
if (!check) { if (!check) {
return new Result<>(v_code, ""); return new Result<>(v_code, "Largest value Coupon selected");
} }
Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId); Optional<TbCfToicoupon> couponOptional = toicouponRepository.findById(toitableId);
......
...@@ -29,6 +29,9 @@ public interface TbCfStationItemRepository extends PagingAndSortingRepository<Tb ...@@ -29,6 +29,9 @@ public interface TbCfStationItemRepository extends PagingAndSortingRepository<Tb
@Query(value = "select a from #{#entityName} a order by a.itemTop desc,a.sort asc,a.createTime desc") @Query(value = "select a from #{#entityName} a order by a.itemTop desc,a.sort asc,a.createTime desc")
Page<TbCfStationItem> findAllItems(Pageable pageable); Page<TbCfStationItem> findAllItems(Pageable pageable);
@Query(value = "select a from #{#entityName} a where itemName like %?1%")
Page<TbCfStationItem> findByItemNameLike(String name, Pageable pageable);
@Query(value = "select a.item_id as itemId,a.item_code as itemCode,a.item_name as itemName,a.item_brief as itemBrief,a.item_category as itemCategory,a.item_price as itemPrice,a.discount_price as discountPrice,a.item_url as itemUrl,a.item_img as itemImg,a.item_tags as itemTags,a.item_label as itemLabel,a.item_num as itemNum,a.item_collection_num as itemCollectionNum,a.item_count as itemCount,a.item_sku as itemSku,a.item_top as itemTop,a.supplier as supplier,a.platform_code as platformCode,a.platform_name as platformName,a.enable_flag as enableFlag,a.create_time as createTime,a.item_categorytwo as itemCategorytwo,a.item_descrition_id as itemDescritionId,a.sort,a.template,MATCH(a.item_name, a.item_brief) AGAINST(?1 IN NATURAL LANGUAGE MODE) as score from tb_cf_station_item a where a.item_name LIKE CONCAT('%',?1,'%') or a.item_name SOUNDS LIKE ?1 or MATCH(a.item_name, a.item_brief) AGAINST(?1 IN NATURAL LANGUAGE MODE) ORDER BY IF(a.item_name LIKE CONCAT('%',?1,'%'),10000,IF(a.item_name SOUNDS LIKE ?1,9999,score)) desc,a.create_time DESC limit ?2,?3", nativeQuery = true) @Query(value = "select a.item_id as itemId,a.item_code as itemCode,a.item_name as itemName,a.item_brief as itemBrief,a.item_category as itemCategory,a.item_price as itemPrice,a.discount_price as discountPrice,a.item_url as itemUrl,a.item_img as itemImg,a.item_tags as itemTags,a.item_label as itemLabel,a.item_num as itemNum,a.item_collection_num as itemCollectionNum,a.item_count as itemCount,a.item_sku as itemSku,a.item_top as itemTop,a.supplier as supplier,a.platform_code as platformCode,a.platform_name as platformName,a.enable_flag as enableFlag,a.create_time as createTime,a.item_categorytwo as itemCategorytwo,a.item_descrition_id as itemDescritionId,a.sort,a.template,MATCH(a.item_name, a.item_brief) AGAINST(?1 IN NATURAL LANGUAGE MODE) as score from tb_cf_station_item a where a.item_name LIKE CONCAT('%',?1,'%') or a.item_name SOUNDS LIKE ?1 or MATCH(a.item_name, a.item_brief) AGAINST(?1 IN NATURAL LANGUAGE MODE) ORDER BY IF(a.item_name LIKE CONCAT('%',?1,'%'),10000,IF(a.item_name SOUNDS LIKE ?1,9999,score)) desc,a.create_time DESC limit ?2,?3", nativeQuery = true)
List<SearchModel> searchAllItems(@Param("name") String name, int num, int limit); List<SearchModel> searchAllItems(@Param("name") String name, int num, int limit);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论