| | |
| | | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsConstant; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.dto.ScoreSettingDto; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallGoods; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.mall.service.IAdminMallMemberService; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsDetailVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMailGoodsUpdateVo; |
| | | import cc.mrbird.febs.mall.vo.MallMemberVo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | 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.RequestMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Controller("goodsView") |
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "modules/goods") |
| | |
| | | public class ViewMallGoodsController extends BaseController { |
| | | |
| | | private final IAdminMallGoodsService mallGoodsService; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | /** |
| | | * 商品列表 |
| | |
| | | model.addAttribute("goodsInfo", data); |
| | | return FebsUtil.view("modules/goods/goodsUpdateNew"); |
| | | } |
| | | |
| | | /** |
| | | * 商品配送设置 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("/deliverySetting") |
| | | public String deliverySetting(Model model) { |
| | | AdminRangeSettingVo adminRangeSettingVo = new AdminRangeSettingVo(); |
| | | DataDictionaryCustom deliverySetting = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.HOME_DELIVERY_AMOUNT.getType(), DataDictionaryEnum.HOME_DELIVERY_AMOUNT.getCode()); |
| | | if (ObjectUtil.isNotNull(deliverySetting)) { |
| | | adminRangeSettingVo.setHomeDeliveryAmount(Double.parseDouble(deliverySetting.getValue())); |
| | | } |
| | | DataDictionaryCustom rangeSwitch = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SWITCH.getType(), DataDictionaryEnum.RANGE_SWITCH.getCode()); |
| | | if (ObjectUtil.isNotNull(rangeSwitch)) { |
| | | adminRangeSettingVo.setRangeSwitch(Integer.parseInt(rangeSwitch.getValue())); |
| | | } |
| | | DataDictionaryCustom rangeSize = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SIZE.getType(), DataDictionaryEnum.RANGE_SIZE.getCode()); |
| | | if (ObjectUtil.isNotNull(rangeSize)) { |
| | | adminRangeSettingVo.setRangeSize(Integer.parseInt(rangeSize.getValue())); |
| | | } |
| | | model.addAttribute("deliverySetting", adminRangeSettingVo); |
| | | return FebsUtil.view("modules/goods/deliverySetting"); |
| | | } |
| | | |
| | | /** |
| | | * 配送费设置 |
| | | * @return |
| | | */ |
| | | @GetMapping("deliveryHomeList") |
| | | @RequiresPermissions("deliveryHomeList:view") |
| | | public String deliveryHomeList() { |
| | | return FebsUtil.view("modules/goods/deliveryHomeList"); |
| | | } |
| | | |
| | | /** |
| | | * 配送费设置 --- 编辑 |
| | | */ |
| | | @GetMapping("deliveryHomeUpdate/{id}") |
| | | @RequiresPermissions("deliveryHomeUpdate:update") |
| | | public String deliveryHomeUpdate(@PathVariable long id, Model model) { |
| | | DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectById(id); |
| | | AdminHomeDeliverySettingVo adminHomeDeliverySettingVo = JSONUtil.toBean(dataDictionaryCustom.getValue(), AdminHomeDeliverySettingVo.class); |
| | | adminHomeDeliverySettingVo.setId(id); |
| | | model.addAttribute("homeDeliverySetting", adminHomeDeliverySettingVo); |
| | | return FebsUtil.view("modules/goods/deliveryHomeUpdate"); |
| | | } |
| | | |
| | | /** |
| | | * 运费模板列表 |
| | | */ |
| | | @GetMapping("carriageRuleList") |
| | | @RequiresPermissions("carriageRuleList:view") |
| | | public String carriageRuleList() { |
| | | return FebsUtil.view("modules/goods/carriageRuleList"); |
| | | } |
| | | |
| | | /** |
| | | * 运费模板-新增 |
| | | */ |
| | | @GetMapping("carriageRuleAdd") |
| | | @RequiresPermissions("carriageRuleAdd:add") |
| | | public String carriageRuleAdd() { |
| | | return FebsUtil.view("modules/goods/carriageRuleAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 运费模板-编辑-详情 |
| | | */ |
| | | @GetMapping("carriageRuleUpdate/{id}") |
| | | @RequiresPermissions("carriageRuleUpdate:update") |
| | | public String carriageRuleUpdate(@PathVariable long id, Model model) { |
| | | AdminMallCarriageRuleVo adminMallCarriageRuleVo = mallGoodsService.selectCarriageRuleByRuleId(id); |
| | | model.addAttribute("carriageRule", adminMallCarriageRuleVo); |
| | | return FebsUtil.view("modules/goods/carriageRuleUpdate"); |
| | | } |
| | | } |