Commit b8163943 authored by jim's avatar jim

log

parent 16abe225
...@@ -42,7 +42,7 @@ public class ShopController { ...@@ -42,7 +42,7 @@ public class ShopController {
shopStringResultDto.setId(shopService.addShop(principal.getName(), shopResultDto)); shopStringResultDto.setId(shopService.addShop(principal.getName(), shopResultDto));
resultDto.setData(shopStringResultDto); resultDto.setData(shopStringResultDto);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -56,7 +56,7 @@ public class ShopController { ...@@ -56,7 +56,7 @@ public class ShopController {
public ResultDto addShops(Principal principal, @RequestParam("file") MultipartFile file) { public ResultDto addShops(Principal principal, @RequestParam("file") MultipartFile file) {
ResultDto resultDto = new ResultDto(); ResultDto resultDto = new ResultDto();
String name = file.getOriginalFilename(); String name = file.getOriginalFilename();
if(name.length()<6 || !name.substring(name.length()-5).equals(".xlsx")){ if (name.length() < 6 || !name.substring(name.length() - 5).equals(".xlsx")) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", BrowserErrorCode.INFORMATIONNOTCOMPELETE.getCode()); statusInfo.put("code", BrowserErrorCode.INFORMATIONNOTCOMPELETE.getCode());
...@@ -87,7 +87,7 @@ public class ShopController { ...@@ -87,7 +87,7 @@ public class ShopController {
shopStringResultDto.setId(shopService.updateShop(principal.getName(), shopResultDto)); shopStringResultDto.setId(shopService.updateShop(principal.getName(), shopResultDto));
resultDto.setData(shopStringResultDto); resultDto.setData(shopStringResultDto);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -103,7 +103,7 @@ public class ShopController { ...@@ -103,7 +103,7 @@ public class ShopController {
try { try {
shopService.deleteShop(principal.getName(), shopRequestDto.getShopId()); shopService.deleteShop(principal.getName(), shopRequestDto.getShopId());
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -119,7 +119,8 @@ public class ShopController { ...@@ -119,7 +119,8 @@ public class ShopController {
try { try {
ipAndShopService.bindShop(principal.getName(), shopRequestDto); ipAndShopService.bindShop(principal.getName(), shopRequestDto);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
logger.error("fail to bind shop", e);
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -135,7 +136,7 @@ public class ShopController { ...@@ -135,7 +136,7 @@ public class ShopController {
try { try {
ipAndShopService.unBindShop(principal.getName(), shopRequestDto); ipAndShopService.unBindShop(principal.getName(), shopRequestDto);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -151,7 +152,7 @@ public class ShopController { ...@@ -151,7 +152,7 @@ public class ShopController {
try { try {
shopService.transferShop(principal.getName(), shopRequestDto.getShopId(), shopRequestDto.getToGroup()); shopService.transferShop(principal.getName(), shopRequestDto.getShopId(), shopRequestDto.getToGroup());
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -167,7 +168,7 @@ public class ShopController { ...@@ -167,7 +168,7 @@ public class ShopController {
try { try {
shopService.assignShops(principal.getName(), shopRequestDto.getShopIds(), shopRequestDto.getToUsers()); shopService.assignShops(principal.getName(), shopRequestDto.getShopIds(), shopRequestDto.getToUsers());
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -177,7 +178,7 @@ public class ShopController { ...@@ -177,7 +178,7 @@ public class ShopController {
return resultDto; return resultDto;
} }
@RequestMapping(value = "/list",method = RequestMethod.POST) @RequestMapping(value = "/list", method = RequestMethod.POST)
public ResultDto getShopList(Principal principal, @RequestBody ShopRequestDto shopRequestDto) { public ResultDto getShopList(Principal principal, @RequestBody ShopRequestDto shopRequestDto) {
ResultDto resultDto = new ResultDto(); ResultDto resultDto = new ResultDto();
try { try {
...@@ -185,7 +186,7 @@ public class ShopController { ...@@ -185,7 +186,7 @@ public class ShopController {
shopRequestDto.getAmount(), shopRequestDto.getFilter()); shopRequestDto.getAmount(), shopRequestDto.getFilter());
resultDto.setData(shopDtos); resultDto.setData(shopDtos);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -203,7 +204,7 @@ public class ShopController { ...@@ -203,7 +204,7 @@ public class ShopController {
List<String> subUsers = shopService.getShopUsers(principal.getName(), shopRequestDto.getShopId()); List<String> subUsers = shopService.getShopUsers(principal.getName(), shopRequestDto.getShopId());
resultDto.setData(subUsers); resultDto.setData(subUsers);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -220,7 +221,7 @@ public class ShopController { ...@@ -220,7 +221,7 @@ public class ShopController {
List<String> subUsers = shopService.getBatchShopUsers(principal.getName(), shopRequestDto.getShopIds()); List<String> subUsers = shopService.getBatchShopUsers(principal.getName(), shopRequestDto.getShopIds());
resultDto.setData(subUsers); resultDto.setData(subUsers);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
...@@ -237,7 +238,7 @@ public class ShopController { ...@@ -237,7 +238,7 @@ public class ShopController {
ShopResultDto shopDto = shopService.queryShop(principal.getName(), shopRequestDto.getShopId()); ShopResultDto shopDto = shopService.queryShop(principal.getName(), shopRequestDto.getShopId());
resultDto.setData(shopDto); resultDto.setData(shopDto);
resultDto.setStatus(0); resultDto.setStatus(0);
}catch (ClientRequestException e) { } catch (ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode()); statusInfo.put("code", e.getErrorCode());
......
...@@ -72,7 +72,7 @@ public class IpAndShopServiceImpl implements IpAndShopService { ...@@ -72,7 +72,7 @@ public class IpAndShopServiceImpl implements IpAndShopService {
try { try {
ipResourceRepository.addShopId(ipResource.getId(), shopId); ipResourceRepository.addShopId(ipResource.getId(), shopId);
} catch (Exception e) { } catch (Exception e) {
logger.error("fail to bind shop and ip", e.getMessage()); logger.error("fail to bind shop and ip", e);
throw new ClientRequestException(BrowserErrorCode.UNKNOWN); throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
} }
} }
......
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