临时提交

This commit is contained in:
磷叶 2025-02-06 18:01:23 +08:00
parent 3f08b1f54a
commit 0c3cc1aa1d
2 changed files with 52 additions and 18 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.ss.store.domain;
import com.ruoyi.ss.store.domain.enums.StoreStatus;
import lombok.Data;
/**
@ -27,6 +28,9 @@ public class StoreBO extends Store {
bo.setType(getType());
bo.setContactName(getContactName());
bo.setContactMobile(getContactMobile());
bo.setBusinessTimeStart(getBusinessTimeStart());
bo.setBusinessTimeEnd(getBusinessTimeEnd());
bo.setShow(getShow());
return bo;
}
@ -50,6 +54,15 @@ public class StoreBO extends Store {
bo.setContactMobile(getContactMobile());
bo.setShow(getShow());
bo.setUseOutTime(getUseOutTime());
bo.setBusinessTimeStart(getBusinessTimeStart());
bo.setBusinessTimeEnd(getBusinessTimeEnd());
// 若不展示则默认为已生效
if (bo.getShow() == null || !bo.getShow()) {
bo.setStatus(StoreStatus.NORMAL.getStatus());
bo.setEnabled(true);
bo.setShow(false);
}
return bo;
}
@ -114,7 +127,6 @@ public class StoreBO extends Store {
bo.setStoreId(getStoreId());
bo.setBusinessTimeStart(getBusinessTimeStart());
bo.setBusinessTimeEnd(getBusinessTimeEnd());
bo.setShow(getShow());
bo.setUseOutTime(getUseOutTime());
return bo;
}

View File

@ -1,5 +1,19 @@
package com.ruoyi.web.controller.app;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonView;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.annotation.Anonymous;
@ -10,19 +24,18 @@ import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.store.domain.*;
import com.ruoyi.ss.store.domain.Store;
import com.ruoyi.ss.store.domain.StoreBO;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreView;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.StoreAssembler;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.store.service.StoreValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
/**
* 店铺Controller
@ -66,7 +79,7 @@ public class AppStoreController extends BaseController {
* @param data
* @return
*/
@ApiOperation("申请修改店铺信息")
@ApiOperation("修改店铺信息")
@PutMapping
public AjaxResult edit(@RequestBody @Validated(ValidGroup.FrontUpdate.class) StoreBO data) {
StoreVo store = storeService.selectSmStoreById(data.getStoreId());
@ -75,7 +88,16 @@ public class AppStoreController extends BaseController {
}
data = data.filterUpdateByApp();
ServiceUtil.assertion(storeValidator.preUpdateByApp(data));
return toAjax(storeService.updateApply(data));
// 若店铺在地图上显示则需要审核
Boolean finalShow = data.getShow() == null ? store.getShow() : data.getShow();
if (finalShow != null && finalShow) {
return toAjax(storeService.updateApply(data));
}
// 若店铺不在地图上显示则直接修改
else {
return toAjax(storeService.updateSmStore(data));
}
}
@ApiOperation("修改店铺配置")
@ -94,7 +116,6 @@ public class AppStoreController extends BaseController {
* @param storeId
* @return
*/
// @MchRequired
@ApiOperation("删除店铺信息")
@DeleteMapping("/{storeId}")
public AjaxResult delete(@PathVariable Long storeId) {
@ -107,18 +128,21 @@ public class AppStoreController extends BaseController {
return AjaxResult.success(storeService.logicDel(storeIds));
}
// @MchRequired
@ApiOperation("申请新增店铺")
// 新增店铺无需审核同时也无法在地图上显示
@ApiOperation("新增店铺")
@PostMapping
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) StoreBO store) {
store = store.filterCreateByApp();
store.setUserId(getUserId());
ServiceUtil.assertion(storeValidator.preCreateByApp(store));
return toAjax(storeService.insertAndApply(store));
// 若不需要展示则直接新增
if (store.getShow() == null || !store.getShow()) {
return toAjax(storeService.insertSmStore(store));
} else {
return toAjax(storeService.insertAndApply(store));
}
}
// @MchRequired
@ApiOperation("调整店铺排序")
@PutMapping("/changeSort")
public AjaxResult changeSort(@RequestBody List<Store> list) {
@ -162,7 +186,6 @@ public class AppStoreController extends BaseController {
return success(store);
}
// @MchRequired
@ApiOperation("商户获取店铺信息")
@GetMapping("/mch/{storeId}")
public AjaxResult getMchDetail(@PathVariable @ApiParam("店铺ID") Long storeId) {
@ -175,7 +198,6 @@ public class AppStoreController extends BaseController {
return success(store);
}
// @MchRequired
@ApiOperation("切换默认店铺")
@PutMapping("/{storeId}/setDefault")
public AjaxResult setDefaultStore(@PathVariable Long storeId) {