|
@@ -9,12 +9,14 @@ import com.slodon.b2b2c.core.response.PagerInfo;
|
|
|
import com.slodon.b2b2c.core.response.SldResponse;
|
|
|
import com.slodon.b2b2c.core.util.*;
|
|
|
import com.slodon.b2b2c.dao.write.seller.StoreWriteMapper;
|
|
|
+import com.slodon.b2b2c.dto.StoreApplyAuditDTO;
|
|
|
import com.slodon.b2b2c.enums.WebSiteConstant;
|
|
|
import com.slodon.b2b2c.goods.example.GoodsCategoryExample;
|
|
|
import com.slodon.b2b2c.goods.pojo.GoodsCategory;
|
|
|
import com.slodon.b2b2c.model.goods.GoodsCategoryModel;
|
|
|
import com.slodon.b2b2c.model.seller.*;
|
|
|
import com.slodon.b2b2c.model.system.SettingModel;
|
|
|
+import com.slodon.b2b2c.seller.dto.StoreBusinessVO;
|
|
|
import com.slodon.b2b2c.seller.example.*;
|
|
|
import com.slodon.b2b2c.seller.pojo.*;
|
|
|
import com.slodon.b2b2c.system.pojo.Admin;
|
|
@@ -32,7 +34,6 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -180,33 +181,49 @@ public class AdminStoreAuditController {
|
|
|
vo.setOpenTime(store.getOpenTime());
|
|
|
}
|
|
|
|
|
|
+ List<StoreBusinessVO> storeBusinessVOList = new ArrayList<>();
|
|
|
+ StoreBusinessVO storeBusinessVO = new StoreBusinessVO();
|
|
|
+ storeBusinessVO.setWebSite(WebSiteConstant.MEMBER_OVERSEA);
|
|
|
+ storeBusinessVO.setStoreName(vo.getStoreName());
|
|
|
+ storeBusinessVO.setOpenTime(vo.getOpenTime());
|
|
|
+ storeBusinessVO.setStoreGradeId(vo.getStoreGradeId());
|
|
|
+ storeBusinessVO.setStoreGradeName(vo.getStoreGradeName());
|
|
|
+ storeBusinessVOList.add(storeBusinessVO);
|
|
|
|
|
|
- StoreSiteInfoExample storeSiteInfoExample =new StoreSiteInfoExample();
|
|
|
- storeSiteInfoExample.setStoreId(storeApply.getStoreId());
|
|
|
- storeSiteInfoExample.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
- StoreSiteInfo storeSiteInfo = storeSiteInfoModel.getStoreSiteInfo(storeSiteInfoExample);
|
|
|
- if (storeSiteInfo != null) {
|
|
|
- vo.setStoreGradeIdCn(storeSiteInfo.getStoreGradeId());
|
|
|
- vo.setStoreGradeNameCn(storeSiteInfo.getStoreGradeName());
|
|
|
- vo.setOpenTimeCn(storeSiteInfo.getOpenTime());
|
|
|
- }
|
|
|
+ StoreNameExample storeNameExample = new StoreNameExample();
|
|
|
+ storeNameExample.setStoreId(storeApply.getStoreId());
|
|
|
+ storeNameExample.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ StoreName storeName = storeNameModel.getStoreNameByExample(storeNameExample);
|
|
|
+
|
|
|
+ Store storeCn = storeSiteInfoModel.getStoreByStoreIdAndWebSite(storeApply.getStoreId(), WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ storeBusinessVO = new StoreBusinessVO();
|
|
|
+ storeBusinessVO.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ storeBusinessVO.setStoreName(storeName != null ? storeName.getStoreName() : "");
|
|
|
+ storeBusinessVO.setOpenTime(storeCn != null ? storeCn.getOpenTime() : null);
|
|
|
+ storeBusinessVO.setStoreGradeId(storeCn != null ? storeCn.getStoreGradeId() : null);
|
|
|
+ storeBusinessVO.setStoreGradeName(storeCn != null ? storeCn.getStoreGradeName() : null);
|
|
|
+ storeBusinessVOList.add(storeBusinessVO);
|
|
|
+
|
|
|
+ vo.setStoreBusinessVOList(storeBusinessVOList);
|
|
|
|
|
|
|
|
|
List<Setting> webSiteList = settingModel.getSiteSetting();
|
|
|
+ List<StoreGoodsCateVO> storeGoodsCateVOList = new ArrayList<>();
|
|
|
for (Setting setting : webSiteList) {
|
|
|
- bulidStoreGoodsCateVOList(vo, storeApply, webSiteList, setting.getValue());
|
|
|
+ bulidStoreGoodsCateVOList(storeGoodsCateVOList, storeApply, webSiteList, setting.getValue());
|
|
|
}
|
|
|
+ vo.setStoreGoodsCateVOList(storeGoodsCateVOList);
|
|
|
return SldResponse.success(vo, logMsg);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构建不同站点经营类目信息
|
|
|
- * @param vo
|
|
|
+ * @param storeGoodsCateVOList
|
|
|
* @param storeApply
|
|
|
* @param webSiteList
|
|
|
* @param webSite
|
|
|
*/
|
|
|
- private void bulidStoreGoodsCateVOList(StoreApplyDetailVO vo, StoreApply storeApply, List<Setting> webSiteList, String webSite) {
|
|
|
+ private void bulidStoreGoodsCateVOList(List<StoreGoodsCateVO> storeGoodsCateVOList, StoreApply storeApply, List<Setting> webSiteList, String webSite) {
|
|
|
|
|
|
//获取经营类目信息
|
|
|
StoreBindCategoryExample storeBindCategoryExample = new StoreBindCategoryExample();
|
|
@@ -217,7 +234,6 @@ public class AdminStoreAuditController {
|
|
|
GoodsCategoryExample goodsCategoryExample = new GoodsCategoryExample();
|
|
|
List<GoodsCategory> goodsCategoryList = goodsCategoryModel.getGoodsCategoryList(goodsCategoryExample, null);
|
|
|
|
|
|
- List<StoreGoodsCateVO> storeGoodsCateVOList = new ArrayList<>();
|
|
|
if (!CollectionUtils.isEmpty(storeBindCategoryList)) {
|
|
|
storeBindCategoryList.forEach(storeBindCategory -> {
|
|
|
StoreGoodsCateVO storeGoodsCateVO = new StoreGoodsCateVO(storeBindCategory);
|
|
@@ -227,12 +243,6 @@ public class AdminStoreAuditController {
|
|
|
storeGoodsCateVO.setGoodsCateName3(goodsCategoryList.stream().filter(goodsCategory -> goodsCategory.getCategoryId().equals(storeBindCategory.getGoodsCategoryId3())).findFirst().map(GoodsCategory::getCategoryName).orElse(""));
|
|
|
storeGoodsCateVOList.add(storeGoodsCateVO);
|
|
|
});
|
|
|
- if(WebSiteConstant.MEMBER_OVERSEA.equals(webSite)){
|
|
|
- vo.setStoreGoodsCateVOList(storeGoodsCateVOList);
|
|
|
- }else {
|
|
|
- vo.setStoreGoodsCateCnVOList(storeGoodsCateVOList);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -264,20 +274,37 @@ public class AdminStoreAuditController {
|
|
|
Store store = storeModel.getStoreByStoreId(storeApply.getStoreId());
|
|
|
vo.setOpenTime(store.getOpenTime());
|
|
|
|
|
|
- StoreSiteInfoExample storeSiteInfoExample =new StoreSiteInfoExample();
|
|
|
- storeSiteInfoExample.setStoreId(storeApply.getStoreId());
|
|
|
- storeSiteInfoExample.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
- StoreSiteInfo storeSiteInfo = storeSiteInfoModel.getStoreSiteInfo(storeSiteInfoExample);
|
|
|
- if (storeSiteInfo != null) {
|
|
|
- vo.setStoreGradeIdCn(storeSiteInfo.getStoreGradeId());
|
|
|
- vo.setStoreGradeNameCn(storeSiteInfo.getStoreGradeName());
|
|
|
- vo.setOpenTimeCn(storeSiteInfo.getOpenTime());
|
|
|
- }
|
|
|
+ List<StoreBusinessVO> storeBusinessVOList = new ArrayList<>();
|
|
|
+ StoreBusinessVO storeBusinessVO = new StoreBusinessVO();
|
|
|
+ storeBusinessVO.setWebSite(WebSiteConstant.MEMBER_OVERSEA);
|
|
|
+ storeBusinessVO.setStoreName(vo.getStoreName());
|
|
|
+ storeBusinessVO.setOpenTime(vo.getOpenTime());
|
|
|
+ storeBusinessVO.setStoreGradeId(vo.getStoreGradeId());
|
|
|
+ storeBusinessVO.setStoreGradeName(vo.getStoreGradeName());
|
|
|
+ storeBusinessVOList.add(storeBusinessVO);
|
|
|
+
|
|
|
+ StoreNameExample storeNameExample = new StoreNameExample();
|
|
|
+ storeNameExample.setStoreId(storeApply.getStoreId());
|
|
|
+ storeNameExample.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ StoreName storeName = storeNameModel.getStoreNameByExample(storeNameExample);
|
|
|
+
|
|
|
+ Store storeCn = storeSiteInfoModel.getStoreByStoreIdAndWebSite(storeApply.getStoreId(), WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ storeBusinessVO = new StoreBusinessVO();
|
|
|
+ storeBusinessVO.setWebSite(WebSiteConstant.MEMBER_DISTRIBUTOR);
|
|
|
+ storeBusinessVO.setStoreName(storeName != null ? storeName.getStoreName() : "");
|
|
|
+ storeBusinessVO.setOpenTime(storeCn != null ? storeCn.getOpenTime() : null);
|
|
|
+ storeBusinessVO.setStoreGradeId(storeCn != null ? storeCn.getStoreGradeId() : null);
|
|
|
+ storeBusinessVO.setStoreGradeName(storeCn != null ? storeCn.getStoreGradeName() : null);
|
|
|
+ storeBusinessVOList.add(storeBusinessVO);
|
|
|
+
|
|
|
+ vo.setStoreBusinessVOList(storeBusinessVOList);
|
|
|
|
|
|
List<Setting> webSiteList = settingModel.getSiteSetting();
|
|
|
+ List<StoreGoodsCateVO> storeGoodsCateVOList = new ArrayList<>();
|
|
|
for (Setting setting : webSiteList) {
|
|
|
- bulidStoreGoodsCateVOList(vo, storeApply, webSiteList, setting.getValue());
|
|
|
+ bulidStoreGoodsCateVOList(storeGoodsCateVOList, storeApply, webSiteList, setting.getValue());
|
|
|
}
|
|
|
+ vo.setStoreGoodsCateVOList(storeGoodsCateVOList);
|
|
|
}
|
|
|
|
|
|
return SldResponse.success(vos);
|
|
@@ -299,22 +326,15 @@ public class AdminStoreAuditController {
|
|
|
})
|
|
|
@PostMapping("audit")
|
|
|
public JsonResult<Object> audit(HttpServletRequest request,
|
|
|
- @RequestParam("applyId") Integer applyId,
|
|
|
- @RequestParam("isPass") Boolean isPass,
|
|
|
- @RequestParam(value = "refuseReason", required = false) String refuseReason,
|
|
|
- @RequestParam(value = "remark", required = false) String remark,
|
|
|
- @RequestParam(value = "scalingBindIds", required = false) String scalingBindIds,
|
|
|
- @RequestParam(value = "storeGradeId", required = false) Integer storeGradeId,
|
|
|
- @RequestParam(value = "storeGradeIdCn", required = false) Integer storeGradeIdCn,
|
|
|
- @RequestParam(value = "openTime", required = false) Integer openTime,
|
|
|
- @RequestParam(value = "openTimeCn", required = false) Integer openTimeCn) {
|
|
|
+ @RequestBody StoreApplyAuditDTO storeApplyAuditDTO)
|
|
|
+ {
|
|
|
|
|
|
Admin admin = UserUtil.getUser(request, Admin.class);
|
|
|
|
|
|
- AssertUtil.isTrue(!isPass && StringUtils.isEmpty(refuseReason), "请填写审核拒绝原因");
|
|
|
+ AssertUtil.isTrue(!storeApplyAuditDTO.getIsPass() && StringUtils.isEmpty(storeApplyAuditDTO.getRefuseReason()), "请填写审核拒绝原因");
|
|
|
// AssertUtil.isTrue(isPass && StringUtils.isEmpty(scalingBindIds), "请填写分佣比例");
|
|
|
|
|
|
- StoreApply storeApply = storeApplyModel.audit(applyId, isPass, refuseReason, remark, scalingBindIds, admin);
|
|
|
+ StoreApply storeApply = storeApplyModel.audit(storeApplyAuditDTO.getApplyId(), storeApplyAuditDTO.getIsPass(), storeApplyAuditDTO.getRefuseReason(), storeApplyAuditDTO.getRemark(), storeApplyAuditDTO.getScalingBindIds(), admin);
|
|
|
|
|
|
// //根据gradeId查询store_grade表
|
|
|
// StoreGrade storeGrade = storeGradeModel.getStoreGradeByGradeId(storeApply.getStoreGradeId());
|
|
@@ -347,21 +367,36 @@ public class AdminStoreAuditController {
|
|
|
// }
|
|
|
// vo.setStoreGoodsCateVOList(storeGoodsCateVOList);
|
|
|
// }
|
|
|
- if (isPass) {
|
|
|
- // 店铺审核增加开店时长
|
|
|
- if (!StringUtil.isNullOrZero(openTime) && !StringUtil.isNullOrZero(openTimeCn)) {
|
|
|
- storeApply.setApplyYear(openTime);
|
|
|
- storeApply.setApplyYearCn(openTimeCn);
|
|
|
- }else{
|
|
|
- throw new MallException("请选择开店时长");
|
|
|
+ if (storeApplyAuditDTO.getIsPass()) {
|
|
|
+ if (CollectionUtils.isEmpty(storeApplyAuditDTO.getStoreBusinessVOList())){
|
|
|
+ throw new MallException("请选择经营信息");
|
|
|
}
|
|
|
- if (!StringUtil.isNullOrZero(storeGradeId) && !StringUtil.isNullOrZero(storeGradeIdCn)){
|
|
|
- storeApply.setStoreGradeId(storeGradeId);
|
|
|
- storeApply.setStoreGradeIdCn(storeGradeIdCn);
|
|
|
- }else{
|
|
|
- throw new MallException("请选择店铺等级");
|
|
|
+ // 扩展站点可重新设计
|
|
|
+ for (StoreBusinessVO storeBusinessVO : storeApplyAuditDTO.getStoreBusinessVOList()){
|
|
|
+ if(WebSiteConstant.MEMBER_OVERSEA.equals(storeBusinessVO.getWebSite())){
|
|
|
+ if (!StringUtil.isNullOrZero(storeBusinessVO.getOpenTime())){
|
|
|
+ storeApply.setApplyYear(storeBusinessVO.getOpenTime());
|
|
|
+ }else {
|
|
|
+ throw new MallException("请选择开店时长");
|
|
|
+ }
|
|
|
+ if (!StringUtil.isNullOrZero(storeBusinessVO.getStoreGradeId())){
|
|
|
+ storeApply.setStoreGradeId(storeBusinessVO.getStoreGradeId());
|
|
|
+ }else {
|
|
|
+ throw new MallException("请选择店铺等级");
|
|
|
+ }
|
|
|
+ }else if (WebSiteConstant.MEMBER_DISTRIBUTOR.equals(storeBusinessVO.getWebSite())) {
|
|
|
+ if (!StringUtil.isNullOrZero(storeBusinessVO.getOpenTime())){
|
|
|
+ storeApply.setApplyYearCn(storeBusinessVO.getOpenTime());
|
|
|
+ }else {
|
|
|
+ throw new MallException("请选择开店时长");
|
|
|
+ }
|
|
|
+ if (!StringUtil.isNullOrZero(storeBusinessVO.getStoreGradeId())){
|
|
|
+ storeApply.setStoreGradeIdCn(storeBusinessVO.getStoreGradeId());
|
|
|
+ }else {
|
|
|
+ throw new MallException("请选择店铺等级");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
//todo 因业务需要暂不用此功能
|
|
|
// if (storeApply.getPayAmount().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
storeModel.openStore(storeApply);
|
|
@@ -385,18 +420,11 @@ public class AdminStoreAuditController {
|
|
|
@ApiImplicitParam(name = "remark", value = "备注,拒绝时选填"),
|
|
|
@ApiImplicitParam(name = "scalingBindIds", value = "分佣比例,审核通过时必填,例:bindId1-scaling1,bindId2-scaling2,..."),
|
|
|
@ApiImplicitParam(name = "openTime", value = "开店时长"),
|
|
|
- @ApiImplicitParam(name = "openTimeCn", value = "国内店铺开店时长"),
|
|
|
})
|
|
|
@PostMapping("batchAudit")
|
|
|
- public JsonResult<Object> batchAudit(HttpServletRequest request,
|
|
|
- @RequestParam("applyIds") String applyIds,
|
|
|
- @RequestParam("isPass") Boolean isPass,
|
|
|
- @RequestParam(value = "refuseReason", required = false) String refuseReason,
|
|
|
- @RequestParam(value = "remark", required = false) String remark,
|
|
|
- @RequestParam(value = "scalingBindIds", required = false) String scalingBindIds,
|
|
|
- @RequestParam(value = "openTime", required = false) Integer openTime,
|
|
|
- @RequestParam(value = "openTimeCn", required = false) Integer openTimeCn) {
|
|
|
+ public JsonResult<Object> batchAudit(HttpServletRequest request,@RequestBody StoreApplyAuditDTO storeApplyAuditDTO) {
|
|
|
//参数校验
|
|
|
+ String applyIds = storeApplyAuditDTO.getApplyIds();
|
|
|
AssertUtil.notEmpty(applyIds, "绑定id不能为空");
|
|
|
AssertUtil.notFormatFrontIds(applyIds, "applyIds格式错误,请重试");
|
|
|
Admin admin = UserUtil.getUser(request, Admin.class);
|
|
@@ -407,6 +435,11 @@ public class AdminStoreAuditController {
|
|
|
int total = 0;
|
|
|
RegisterPayVO vo = null;
|
|
|
ApplyRefuseVO applyRefuseVO = null;
|
|
|
+ Boolean isPass = storeApplyAuditDTO.getIsPass();
|
|
|
+ String refuseReason = storeApplyAuditDTO.getRefuseReason();
|
|
|
+ String remark = storeApplyAuditDTO.getRemark();
|
|
|
+ String scalingBindIds = storeApplyAuditDTO.getScalingBindIds();
|
|
|
+ Integer openTime = storeApplyAuditDTO.getOpenTime();
|
|
|
for (Integer applyId : array) {
|
|
|
|
|
|
AssertUtil.isTrue(!isPass && StringUtils.isEmpty(refuseReason), "请填写审核拒绝原因");
|
|
@@ -448,9 +481,9 @@ public class AdminStoreAuditController {
|
|
|
|
|
|
if (isPass) {
|
|
|
// 店铺审核增加开店时长
|
|
|
- if (!StringUtil.isNullOrZero(openTime) && !StringUtil.isNullOrZero(openTimeCn)) {
|
|
|
+ if (!StringUtil.isNullOrZero(openTime)) {
|
|
|
storeApply.setApplyYear(openTime);
|
|
|
- storeApply.setApplyYearCn(openTimeCn);
|
|
|
+ storeApply.setApplyYearCn(openTime);
|
|
|
}else{
|
|
|
throw new MallException("请选择开店时长");
|
|
|
}
|