Commit 380fd545 authored by wangyihao's avatar wangyihao

新增 店铺 和 员工 过滤条件 搜索接口

parent db64f8fc
package cn.com.fqy.controller.mapi;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
......@@ -21,6 +22,7 @@ import cn.com.fqy.core.service.WorkerService;
/**
* H5首页数据服务类
*
* @author Administrator
*
*/
......@@ -35,12 +37,6 @@ public class IndexController {
@Resource
WorkerService workerService;
@RequestMapping("fqy")
@ResponseBody
public String fqy (){
return "fqy";
}
/**
* 分页展示广告
*/
......@@ -49,15 +45,15 @@ public class IndexController {
public ResultInfo<List<Advert>> getAdvertList() {
ResultInfo<List<Advert>> resultInfo = new ResultInfo<List<Advert>>();
Advert advert = new Advert();
advert.setIsAvailable(1); //可用
advert.setIsAvailable(1); // 可用
Query q = new Query(advert);
PageFinder<Advert> pageResult = advertService.getAdvertPagedList(q);
if(null != pageResult && pageResult.getData().size()>0) {
if (null != pageResult && pageResult.getData().size() > 0) {
List<Advert> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
} else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
......@@ -72,18 +68,18 @@ public class IndexController {
public ResultInfo<List<Store>> getStoreList() {
ResultInfo<List<Store>> resultInfo = new ResultInfo<List<Store>>();
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
store.setIsRecommend(1); //店铺推荐状态
store.setIsDeleted(0); // 未删除
store.setIsAvailable(1); // 店铺启用状态
store.setIsShopping(1); // 店铺展示状态
store.setIsRecommend(1); // 店铺推荐状态
Query q = new Query(store);
PageFinder<Store> pageResult = storeService.getStorePagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
if (null != pageResult && pageResult.getData().size() > 0) {
List<Store> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
} else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
......@@ -98,18 +94,18 @@ public class IndexController {
public ResultInfo<List<Worker>> getWorkerList() {
ResultInfo<List<Worker>> resultInfo = new ResultInfo<List<Worker>>();
Worker worker = new Worker();
worker.setIsDeleted(0); //未删除
worker.setIsAuditing(1);//已审核
worker.setIsShopping(1);//已展示
worker.setIsRecommend(1);//已推荐
worker.setIsDeleted(0); // 未删除
worker.setIsAuditing(1);// 已审核
worker.setIsShopping(1);// 已展示
worker.setIsRecommend(1);// 已推荐
Query q = new Query(worker);
PageFinder<Worker> pageResult = workerService.getWorkerPagedList(q);
if(null != pageResult && pageResult.getData().size() > 0) {
if (null != pageResult && pageResult.getData().size() > 0) {
List<Worker> result = pageResult.getData();
resultInfo.setData(result);
resultInfo.setCode(Constant.SUCCESS);
resultInfo.setMsg("请求成功");
}else {
} else {
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg("暂无数据");
}
......@@ -117,18 +113,121 @@ public class IndexController {
}
// /**
// * 搜索查询 - 待需求明确
// */
// @RequestMapping("searchShop")
// @ResponseBody
// public PageFinder<Store> searchShopResult(Store store){
// store.setIsDeleted(0); //未删除
// store.setIsAvailable(1); //店铺启用状态
// store.setIsShopping(1); //店铺展示状态
// Query q = new Query(store);
// return storeService.getStorePagedList(q);
// }
/**
* 搜索查询 - 待需求明确
* 店铺搜索查询
*/
@RequestMapping("searchShop")
@RequestMapping("searchShopResult")
@ResponseBody
public PageFinder<Store> searchShopResult(String addkey){
Store store = new Store();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
return storeService.getStorePagedList(q);
public ResultInfo<List<Store>> searchShopResult(Store store) {
ResultInfo<List<Store>> resultInfo = new ResultInfo<>();
List<Store> listQuery = new ArrayList<>();
store.setIsDeleted(0); // 未删除
store.setIsAvailable(1); // 店铺启用状态
store.setIsShopping(1); // 店铺展示状态
String str = store.getConsumeInterval();
String[] arrStr = str.split("-");
int firstNumber = Integer.valueOf(arrStr[0]);
int lastNUmber = Integer.valueOf(arrStr[1]);
store.setConsumeInterval(null);
List<Store> storelist = storeService.getStoreList(new Query(store));
if (storelist.size() > 0 && storelist != null) {
for (Store list : storelist) {
String[] strQuery = list.getConsumeInterval().split("-");
int firstNumber1 = Integer.valueOf(strQuery[0]);
int lastNUmber1 = Integer.valueOf(strQuery[1]);
if (lastNUmber1 < firstNumber || firstNumber1 > lastNUmber) {
continue;
}
listQuery.add(list);
}
if (listQuery.size() > 0 && listQuery != null) {
resultInfo.setCode("1");
resultInfo.setData(listQuery);
} else {
resultInfo.setCode("0");
resultInfo.setMsg("暂无该区间信息");
}
} else {
resultInfo.setCode("0");
resultInfo.setMsg("暂无信息");
}
return resultInfo;
}
/**
* 员工搜索查询
*/
@RequestMapping("searchWorkerResult")
@ResponseBody
public ResultInfo<List<Worker>> searchWorkerResult(Worker worker) {
ResultInfo<List<Worker>> resultInfo = new ResultInfo<>();
List<Worker> listQuery = new ArrayList<>();
worker.setIsDeleted(0); // 未删除
worker.setIsShopping(1); // 店铺展示状态
int firstNumber = 0;
int lastNUmber = 0;
int firstNumber1 = 0;
int lastNUmber1 = 0;
// 身高区间过滤
if (worker.getWorkerHeight() != null && !"".equals(worker.getWorkerHeight())) {
String str = worker.getWorkerHeight();
String[] arrStr = str.split("-");
firstNumber = Integer.valueOf(arrStr[0]);
lastNUmber = Integer.valueOf(arrStr[1]);
worker.setWorkerHeight(null);
}
// 体重区间过滤
if (worker.getWorkerWeight() != null && !"".equals(worker.getWorkerWeight())) {
String str1 = worker.getWorkerHeight();
String[] arrStr1 = str1.split("-");
firstNumber1 = Integer.valueOf(arrStr1[0]);
lastNUmber1 = Integer.valueOf(arrStr1[1]);
worker.setWorkerWeight(null);
}
List<Worker> workerlist = workerService.getWorkerList(new Query(worker));
if (workerlist.size() > 0 && workerlist != null) {
for (Worker list : workerlist) {
int hegit = Integer.valueOf(list.getWorkerHeight());
if (firstNumber != 0 && lastNUmber != 0) {
if (hegit < firstNumber || hegit > lastNUmber) {
continue;
}
}
if (firstNumber1 != 0 && lastNUmber1 != 0) {
int weight = Integer.valueOf(list.getWorkerWeight());
if (hegit < firstNumber1 || hegit > lastNUmber1) {
continue;
}
}
listQuery.add(list);
}
if (listQuery.size() > 0 && listQuery != null) {
resultInfo.setCode("1");
resultInfo.setData(listQuery);
} else {
resultInfo.setCode("0");
resultInfo.setMsg("暂无该区间信息");
}
} else {
resultInfo.setCode("0");
resultInfo.setMsg("暂无信息");
}
return resultInfo;
}
}
......@@ -34,7 +34,7 @@ public class WebWorkerController {
@Resource
private StoreService storeService;
@Resource
WorkerService workerService;
private WorkerService workerService;
/**
* 根据条件查询员工列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment