|
@@ -3,8 +3,10 @@ package com.bosshand.virgo.api.controller;
|
|
|
|
|
|
import com.bosshand.virgo.api.model.Merchant;
|
|
|
import com.bosshand.virgo.api.service.MerchantService;
|
|
|
+import com.bosshand.virgo.api.service.ProjectItemTargetRoomService;
|
|
|
import com.bosshand.virgo.core.config.OperationControllerLog;
|
|
|
import com.bosshand.virgo.core.response.Response;
|
|
|
+import com.bosshand.virgo.core.utils.StringUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -22,6 +24,9 @@ public class MerchantController {
|
|
|
@Autowired
|
|
|
MerchantService merchantService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ProjectItemTargetRoomService projectItemTargetRoomService;
|
|
|
+
|
|
|
@OperationControllerLog(module = "客商管理", operation = "新增")
|
|
|
@ApiOperation("保存")
|
|
|
@RequestMapping(value = "", method = RequestMethod.POST)
|
|
@@ -42,6 +47,7 @@ public class MerchantController {
|
|
|
public Response list(@RequestBody Merchant merchant, @PathVariable int currPage, @PathVariable int pageSize) {
|
|
|
int totalCount = merchantService.getTotalCount(merchant);
|
|
|
List<Merchant> dataList = merchantService.getLimit(merchant, currPage, pageSize);
|
|
|
+ rooms(dataList);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("dataList", dataList);
|
|
|
result.put("totalCount", totalCount);
|
|
@@ -68,7 +74,19 @@ public class MerchantController {
|
|
|
@ApiOperation("详情")
|
|
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
|
|
public Response get(@PathVariable long id) {
|
|
|
- return Response.ok(merchantService.get(id));
|
|
|
+ Merchant merchant = merchantService.get(id);
|
|
|
+ Map<Long, String> rooms = new HashMap();
|
|
|
+ merchant.setRoomMap(projectItemTargetRoomService.getRoomLevel(rooms, merchant.getRoomIds()));
|
|
|
+ return Response.ok(merchant);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void rooms(List<Merchant> list) {
|
|
|
+ for (Merchant mc : list) {
|
|
|
+ Map<Long, String> rooms = new HashMap();
|
|
|
+ if (StringUtil.notBlank(mc.getRoomIds())) {
|
|
|
+ mc.setRoomMap(projectItemTargetRoomService.getRoomLevel(rooms, mc.getRoomIds()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|