部分查询接口拆分成两个分别提供给后台管理系统与小程序使用
This commit is contained in:
parent
69a95f665a
commit
950c3aa95d
|
|
@ -43,10 +43,27 @@ public class GoodsController extends BaseController {
|
||||||
return PREFIX + "/goods";
|
return PREFIX + "/goods";
|
||||||
}
|
}
|
||||||
|
|
||||||
// @RequiresPermissions("goods:goods:list")
|
// @RequiresPermissions("goods:goods:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@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();
|
startPage();
|
||||||
List<Goods> list = goodsService.selectGoodsList(goods);
|
List<Goods> list = goodsService.selectGoodsList(goods);
|
||||||
list.forEach(one -> {
|
list.forEach(one -> {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,15 @@ public class FinancialDetailController extends BaseController {
|
||||||
// @RequiresPermissions("financial:detail:list")
|
// @RequiresPermissions("financial:detail:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@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();
|
startPage();
|
||||||
List<FinancialDetail> list = financialDetailService.selectFinancialDetailList(financialDetail);
|
List<FinancialDetail> list = financialDetailService.selectFinancialDetailList(financialDetail);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,20 @@ public class SysAreaController extends BaseController {
|
||||||
// @RequiresPermissions("system:area:list")
|
// @RequiresPermissions("system:area:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@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 {
|
try {
|
||||||
return AjaxResult.success(sysAreaService.selectSysAreaList(sysArea));
|
return AjaxResult.success(sysAreaService.selectSysAreaList(sysArea));
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,56 @@ public class WorkerController extends BaseController {
|
||||||
// @RequiresPermissions("worker:worker:list")
|
// @RequiresPermissions("worker:worker:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@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>();
|
List<WorkerListResponse> resList = new ArrayList<WorkerListResponse>();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue