部分查询接口拆分成两个分别提供给后台管理系统与小程序使用
This commit is contained in:
parent
69a95f665a
commit
950c3aa95d
|
|
@ -46,7 +46,24 @@ public class GoodsController extends BaseController {
|
|||
// @RequiresPermissions("goods:goods:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(@RequestBody Goods goods) {
|
||||
public TableDataInfo list(Goods goods) {
|
||||
startPage();
|
||||
List<Goods> list = goodsService.selectGoodsList(goods);
|
||||
list.forEach(one -> {
|
||||
// 补全商品
|
||||
List<GoodsArea> goodsAreas = goodsAreaService.selectByGoodsId(one.getGoodsId());
|
||||
one.setGoodsAreaList(goodsAreas);
|
||||
|
||||
// 补全商品类别
|
||||
List<GoodsStandard> goodsStandards = goodsStandardService.selectByGoodsId(one.getGoodsId());
|
||||
one.setGoodsStandardList(goodsStandards);
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo appList(@RequestBody Goods goods) {
|
||||
startPage();
|
||||
List<Goods> list = goodsService.selectGoodsList(goods);
|
||||
list.forEach(one -> {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,15 @@ public class FinancialDetailController extends BaseController {
|
|||
// @RequiresPermissions("financial:detail:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(@RequestBody FinancialDetail financialDetail) {
|
||||
public TableDataInfo list(FinancialDetail financialDetail) {
|
||||
startPage();
|
||||
List<FinancialDetail> list = financialDetailService.selectFinancialDetailList(financialDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo appList(@RequestBody FinancialDetail financialDetail) {
|
||||
startPage();
|
||||
List<FinancialDetail> list = financialDetailService.selectFinancialDetailList(financialDetail);
|
||||
return getDataTable(list);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,20 @@ public class SysAreaController extends BaseController {
|
|||
// @RequiresPermissions("system:area:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public AjaxResult list(@RequestBody SysArea sysArea)
|
||||
public AjaxResult list(SysArea sysArea)
|
||||
{
|
||||
try {
|
||||
return AjaxResult.success(sysAreaService.selectSysAreaList(sysArea));
|
||||
}catch (Exception e){
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public AjaxResult appList(@RequestBody SysArea sysArea)
|
||||
{
|
||||
try {
|
||||
return AjaxResult.success(sysAreaService.selectSysAreaList(sysArea));
|
||||
|
|
|
|||
|
|
@ -66,7 +66,56 @@ public class WorkerController extends BaseController {
|
|||
// @RequiresPermissions("worker:worker:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(@RequestBody WorkerListRequest workerListRequest)
|
||||
public TableDataInfo list(WorkerListRequest workerListRequest)
|
||||
{
|
||||
List<WorkerListResponse> resList = new ArrayList<WorkerListResponse>();
|
||||
|
||||
try {
|
||||
// 查询满足区域条件的师傅区域记录
|
||||
WorkerArea workerArea = new WorkerArea();
|
||||
workerArea.setDistrictId(workerListRequest.getAreaId());
|
||||
List<WorkerArea> workerAreaList = workerAreaService.getWorkerAreaList(workerArea);
|
||||
List<Long> workerIdsByArea = workerAreaList.stream().map(WorkerArea::getWorkerId).collect(Collectors.toList());
|
||||
// 查询满足技能条件的师傅技能记录
|
||||
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
||||
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
||||
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
||||
List<Long> workerIdsByCategory = workerGoodsCategoryList.stream().map(WorkerGoodsCategory::getWorkerId).collect(Collectors.toList());
|
||||
// 两个list中的workerid取交集
|
||||
List<Long> resWorkerIds = new ArrayList<>(CollectionUtils.intersection(workerIdsByArea, workerIdsByCategory));
|
||||
|
||||
if (CollectionUtils.isEmpty(resWorkerIds)) {
|
||||
// 交集不存在的情况直接返回空list
|
||||
return getDataTable(resList);
|
||||
}
|
||||
|
||||
startPage();
|
||||
Worker worker = new Worker();
|
||||
worker.setWorkerIds(CollectionUtils.isNotEmpty(resWorkerIds) ? resWorkerIds : null);
|
||||
worker.setName(workerListRequest.getWorkerName());
|
||||
List<Worker> list = workerService.getWorkList(worker);
|
||||
list.forEach(w -> {
|
||||
Goods goods = new Goods();
|
||||
goods.setWorkerId(w.getWorkerId());
|
||||
goods.setStatus(Integer.valueOf(GoodsStatus.OK.getCode()));
|
||||
WorkerListResponse workerListResponse = JSONObject.parseObject(JSON.toJSONString(w), WorkerListResponse.class);
|
||||
workerListResponse.setGoodsList(goodsService.selectGoodsList(goods));
|
||||
workerListResponse.setWorkerAreas(workerAreaService.getByWorker(w.getWorkerId()));
|
||||
workerListResponse.setGoodsCategories(workerGoodsCategoryService.getByWorker(w.getWorkerId()));
|
||||
workerListResponse.setSpecialSkills(specialSkillService.getByWorker(w.getWorkerId()));
|
||||
resList.add(workerListResponse);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
|
||||
return getDataTable(resList);
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo appList(@RequestBody WorkerListRequest workerListRequest)
|
||||
{
|
||||
List<WorkerListResponse> resList = new ArrayList<WorkerListResponse>();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue