Commit 013beeb8 authored by renjie's avatar renjie

1.查询单个店铺

2.admin查找用户接口增加返回推广码和上线
parent 1a948058
......@@ -2,9 +2,11 @@ package com.edgec.browserbackend.account.dto;
import com.edgec.browserbackend.account.domain.Account;
import com.edgec.browserbackend.account.domain.Promotion;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Date;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AccountPromotionDto {
private String username;
private Date signupDate;
......
package com.edgec.browserbackend.account.dto;
import com.edgec.browserbackend.account.domain.Promotion;
import com.edgec.browserbackend.account.domain.UserPrePaidBilling;
import org.springframework.data.domain.Page;
......@@ -18,6 +19,9 @@ public class BillQueryResultDto {
double childBankTransfer;
double childBalanceUsed;
String promoter;
Promotion promotion;
public double getParentExpense() {
return parentExpense;
}
......@@ -97,4 +101,20 @@ public class BillQueryResultDto {
public void setParentBalanceUsed(double parentBalanceUsed) {
this.parentBalanceUsed = parentBalanceUsed;
}
public Promotion getPromotion() {
return promotion;
}
public void setPromoter(String promoter) {
this.promoter = promoter;
}
public String getPromoter() {
return promoter;
}
public void setPromotion(Promotion promotion) {
this.promotion = promotion;
}
}
......@@ -172,6 +172,14 @@ public class AdministratorServiceImpl implements AdministratorService {
billQueryResultDto.setParentWithdrawn(parentwithdrawn);
billQueryResultDto.setParentBalanceUsed(parentbalanceused);
Account promoter = null;
if (account.getPromotionCode() != null)
promoter = accountRepository.findByPromotion(account.getPromotionCode());
if (promoter != null)
billQueryResultDto.setPromoter(promoter.getName());
billQueryResultDto.setPromotion(account.getPromotion());
return billQueryResultDto;
}
......@@ -427,7 +435,7 @@ public class AdministratorServiceImpl implements AdministratorService {
}
}
}
if (x.getPromotion().isSale())
if (finalAccount.getPromotion().isSale())
promotion.setAllGift(promotion.getAllGift() + totalCommission * 0.1 + secondCommission * 0.02);
else
promotion.setAllGift(promotion.getAllGift() + totalCommission * 0.08);
......
......@@ -3,10 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
import com.edgec.browserbackend.browser.dto.*;
import com.edgec.browserbackend.browser.service.IpAndShopService;
import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
......@@ -230,4 +227,21 @@ public class ShopController {
}
return resultDto;
}
@RequestMapping(value = "/query", method = RequestMethod.POST)
public ResultDto queryShop(Principal principal, @RequestBody ShopRequestDto shopRequestDto) {
ResultDto resultDto = new ResultDto();
try {
ShopDto shopDto = shopService.queryShop(principal.getName(), shopRequestDto.getShopId());
resultDto.setData(shopDto);
resultDto.setStatus(0);
}catch (ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode());
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
}
return resultDto;
}
}
......@@ -301,6 +301,26 @@ public class ShopServiceImpl implements ShopService {
}
}
@Override
public ShopDto queryShop(String username, String shopId) {
Account account = accountRepository.findByName(username);
if (account == null) {
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
}
UserShop userShop = userShopRepository.findByUsernameAndShopId(username, shopId);
if (account.getPermission() < 8 || userShop == null) {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
}
Shop shop = shopRepository.findById(shopId).orElse(null);
if (shop == null) {
throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST);
}
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(shopId, false);
if (ipResource == null)
throw new ClientRequestException(BrowserErrorCode.IPNOTEXIST);
return new ShopDto(shop);
}
@Override
public ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto) {
if (amount > 100)
......
......@@ -2,10 +2,7 @@ package com.edgec.browserbackend.browser.service;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.domain.ShopSummary;
import com.edgec.browserbackend.browser.dto.ShopFilterDto;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.edgec.browserbackend.browser.dto.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
......@@ -25,6 +22,8 @@ public interface ShopService {
void assignShops(String username, List<String> shopIds, List<String> users);
ShopDto queryShop(String username, String shopId);
ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto);
ShopSummary getShopSummary(String username);
......
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