| | |
| | | |
| | | 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.dto.XcxSettingDto; |
| | | 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; |
| | | |
| | | /** |
| | | * 商品列表 |
| | |
| | | @RequiresPermissions("goodsList:view") |
| | | public String goodsList() { |
| | | return FebsUtil.view("modules/goods/goodsList"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("xcxSetting") |
| | | @RequiresPermissions("xcxSetting:view") |
| | | public String xcxSetting(Model model) { |
| | | String appId = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.XCX_APP_ID.getType(), |
| | | DataDictionaryEnum.XCX_APP_ID.getCode() |
| | | ).getValue(); |
| | | String mchId = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.XCX_MCH_ID.getType(), |
| | | DataDictionaryEnum.XCX_MCH_ID.getCode() |
| | | ).getValue(); |
| | | String mchKey = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.XCX_MCH_KEY.getType(), |
| | | DataDictionaryEnum.XCX_MCH_KEY.getCode() |
| | | ).getValue(); |
| | | String keyPath = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.XCX_MCH_KEY_PATH_P12.getType(), |
| | | DataDictionaryEnum.XCX_MCH_KEY_PATH_P12.getCode() |
| | | ).getValue(); |
| | | String notifyUrl = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.XCX_NOTICE_URL.getType(), |
| | | DataDictionaryEnum.XCX_NOTICE_URL.getCode() |
| | | ).getValue(); |
| | | XcxSettingDto xcxSettingDto = new XcxSettingDto(); |
| | | xcxSettingDto.setAppId(appId); |
| | | xcxSettingDto.setMchId(mchId); |
| | | xcxSettingDto.setMchKey(mchKey); |
| | | xcxSettingDto.setKeyPath(keyPath); |
| | | xcxSettingDto.setNotifyUrl(notifyUrl); |
| | | model.addAttribute("xcxSetting", xcxSettingDto); |
| | | return FebsUtil.view("modules/goods/xcxSetting"); |
| | | } |
| | | |
| | | /** |
| | | * app商品列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("goodsAppList") |
| | | @RequiresPermissions("goodsAppList:view") |
| | | public String goodsAppList() { |
| | | return FebsUtil.view("modules/goods/goodsAppList"); |
| | | } |
| | | /** |
| | | * app商品-新增 |
| | | * @return |
| | | */ |
| | | @GetMapping("goodsAppAddNew") |
| | | @RequiresPermissions("goodsAppAddNew:add") |
| | | public String goodsAppAddNew() { |
| | | return FebsUtil.view("modules/goods/goodsAppAddNew"); |
| | | } |
| | | /** |
| | | * app商品-编辑-详情 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("goodsAppUpdateNew/{id}") |
| | | @RequiresPermissions("goodsAppUpdateNew:update") |
| | | public String goodsAppUpdateNew(@PathVariable long id, Model model) { |
| | | MallGoods data = mallGoodsService.selectGoodsById(id); |
| | | model.addAttribute("goodsInfo", data); |
| | | return FebsUtil.view("modules/goods/goodsAppUpdateNew"); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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"); |
| | | } |
| | | } |