1 files added
8 files modified
| | |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsCategoryService; |
| | | import cc.mrbird.febs.mall.vo.AdminAddAddressTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | |
| | | } |
| | | |
| | | /** |
| | | * 商品分类-选择 |
| | | */ |
| | | @GetMapping("categorys/tree") |
| | | @ControllerEndpoint(exceptionMessage = "获取分类失败") |
| | | public List<AdminMallGoodsCategoryTreeVo> getParentCategorys(){ |
| | | return goodsCategoryService.getParentCategorys(); |
| | | } |
| | | |
| | | /** |
| | | * 商品分类-新增 |
| | | */ |
| | | @PostMapping("addCategory") |
| | | @ControllerEndpoint(operation = " 商品分类-新增", exceptionMessage = "新增失败") |
| | | @ControllerEndpoint(operation = " 商品分类-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse addCategory(@Valid MallGoodsCategory mallGoodsCategory) { |
| | | return goodsCategoryService.addCategory(mallGoodsCategory); |
| | | } |
| | | |
| | | /** |
| | | * 商品分类-编辑 |
| | | */ |
| | | @PostMapping("updateCategory") |
| | | @ControllerEndpoint(operation = " 商品分类-编辑", exceptionMessage = "操作失败") |
| | | public FebsResponse updateCategory(@Valid MallGoodsCategory mallGoodsCategory) { |
| | | return goodsCategoryService.updateCategory(mallGoodsCategory); |
| | | } |
| | | } |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryVo; |
| | | import cc.mrbird.febs.mall.vo.MallGoodsCategoryVo; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | List<MallGoodsCategory> selectRecommendCategoryList(); |
| | | |
| | | AdminMallGoodsCategoryVo getMallGoodsCategoryInfoById(@Param("id")long id); |
| | | |
| | | List<AdminMallGoodsCategoryTreeVo> getParentCategorys(); |
| | | } |
| | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryVo; |
| | | import cc.mrbird.febs.system.entity.Role; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | List<MallGoodsCategory> getCategorys(MallGoodsCategory mallGoodsCategory); |
| | | |
| | | AdminMallGoodsCategoryVo getMallGoodsCategoryInfoById(long id); |
| | | |
| | | List<AdminMallGoodsCategoryTreeVo> getParentCategorys(); |
| | | |
| | | FebsResponse updateCategory(MallGoodsCategory mallGoodsCategory); |
| | | } |
| | |
| | | import cc.mrbird.febs.mall.entity.MallGoodsCategory; |
| | | import cc.mrbird.febs.mall.mapper.MallGoodsCategoryMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsCategoryService; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo; |
| | | import cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | |
| | | if(CollUtil.isNotEmpty(categorys)){ |
| | | return new FebsResponse().fail().message("分类名称不能重复"); |
| | | } |
| | | Long parentIdParam = mallGoodsCategory.getParentId() == null ? 0L:mallGoodsCategory.getParentId(); |
| | | Integer isRecommendParam = mallGoodsCategory.getIsRecommend(); |
| | | if(parentIdParam > 0 && isRecommendParam == 1){ |
| | | return new FebsResponse().fail().message("子分类不能选择【是否推荐】为【是】"); |
| | | } |
| | | |
| | | MallGoodsCategory goodsCategory = new MallGoodsCategory(); |
| | | goodsCategory.setName(name); |
| | | goodsCategory.setIsRecommend(mallGoodsCategory.getIsRecommend()); |
| | | if(ObjectUtil.isNotEmpty(mallGoodsCategory.getParentId())){ |
| | | Long parentId = mallGoodsCategory.getParentId(); |
| | | MallGoodsCategory mallGoodsCategoryParent = mallGoodsCategoryMapper.selectById(parentId); |
| | |
| | | }else{ |
| | | goodsCategory.setParentIds(mallGoodsCategory.getParentId()+","); |
| | | } |
| | | goodsCategory.setIsRecommend(0); |
| | | }else{ |
| | | goodsCategory.setParentId(0L); |
| | | goodsCategory.setIsRecommend(mallGoodsCategory.getIsRecommend()); |
| | | } |
| | | mallGoodsCategoryMapper.insert(goodsCategory); |
| | | return new FebsResponse().success(); |
| | |
| | | return mallGoodsCategoryMapper.getMallGoodsCategoryInfoById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMallGoodsCategoryTreeVo> getParentCategorys() { |
| | | List<AdminMallGoodsCategoryTreeVo> adminMallGoodsCategoryTreeVos = mallGoodsCategoryMapper.getParentCategorys(); |
| | | return adminMallGoodsCategoryTreeVos; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse updateCategory(MallGoodsCategory mallGoodsCategoryParam) { |
| | | String name = mallGoodsCategoryParam.getName(); |
| | | if(StrUtil.isEmpty(name)){ |
| | | return new FebsResponse().fail().message("名称不能为空"); |
| | | } |
| | | Long parentIdParam = mallGoodsCategoryParam.getParentId() == null ? 0L:mallGoodsCategoryParam.getParentId(); |
| | | Integer isRecommendParam = mallGoodsCategoryParam.getIsRecommend(); |
| | | if(parentIdParam > 0 && isRecommendParam == 1){ |
| | | return new FebsResponse().fail().message("子分类不能选择【是否推荐】为【是】"); |
| | | } |
| | | |
| | | Long id = mallGoodsCategoryParam.getId(); |
| | | MallGoodsCategory mallGoodsCategory = mallGoodsCategoryMapper.selectById(id); |
| | | mallGoodsCategory.setName(mallGoodsCategoryParam.getName()); |
| | | if(ObjectUtil.isNotEmpty(mallGoodsCategoryParam.getParentId())){ |
| | | Long parentId = mallGoodsCategoryParam.getParentId(); |
| | | MallGoodsCategory mallGoodsCategoryParent = mallGoodsCategoryMapper.selectById(parentId); |
| | | mallGoodsCategory.setParentId(mallGoodsCategoryParam.getParentId()); |
| | | if(StrUtil.isNotEmpty(mallGoodsCategoryParent.getParentIds())){ |
| | | mallGoodsCategory.setParentIds(mallGoodsCategoryParent.getParentIds()+","+mallGoodsCategory.getParentId()+","); |
| | | }else{ |
| | | mallGoodsCategory.setParentIds(mallGoodsCategory.getParentId()+","); |
| | | } |
| | | mallGoodsCategory.setIsRecommend(0); |
| | | }else{ |
| | | mallGoodsCategory.setParentId(0L); |
| | | mallGoodsCategory.setIsRecommend(mallGoodsCategoryParam.getIsRecommend()); |
| | | } |
| | | mallGoodsCategoryMapper.updateById(mallGoodsCategory); |
| | | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | } |
| | |
| | | if(ObjectUtil.isEmpty(mallOrderRefund)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新重试"); |
| | | } |
| | | Integer status = mallOrderRefund.getStatus(); |
| | | if(status != 1){ |
| | | return new FebsResponse().fail().message("申请记录不是已申请状态,请刷新页面"); |
| | | } |
| | | mallOrderRefund.setStatus(2); |
| | | mallOrderRefundMapper.updateById(mallOrderRefund); |
| | | |
| | |
| | | if(ObjectUtil.isEmpty(mallOrderRefund)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新重试"); |
| | | } |
| | | Integer status = mallOrderRefund.getStatus(); |
| | | if(status != 1){ |
| | | return new FebsResponse().fail().message("申请记录不是已申请状态,请刷新页面"); |
| | | } |
| | | mallOrderRefund.setStatus(3); |
| | | mallOrderRefundMapper.updateById(mallOrderRefund); |
| | | |
| | |
| | | mallOrderRefundOperation.setOrderId(mallOrderRefund.getOrderId()); |
| | | mallOrderRefundOperation.setContent("不同意退款申请"); |
| | | mallOrderRefundOperationMapper.insert(mallOrderRefundOperation); |
| | | //恢复订单状态 |
| | | MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectById(mallOrderRefund.getOrderId()); |
| | | mallOrderInfo.setStatus(mallOrderRefund.getBeforeStatus()); |
| | | mallOrderInfoMapper.updateById(mallOrderInfo); |
| | | |
| | | return new FebsResponse().success(); |
| | | } |
| | |
| | | MallOrderRefund mallOrderRefund = mallOrderRefundMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallOrderRefund)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新重试"); |
| | | } |
| | | Integer status = mallOrderRefund.getStatus(); |
| | | if(status != 4){ |
| | | return new FebsResponse().fail().message("申请记录不是已申请状态,请刷新页面"); |
| | | } |
| | | mallOrderRefund.setStatus(5); |
| | | mallOrderRefundMapper.updateById(mallOrderRefund); |
| | |
| | | if(ObjectUtil.isEmpty(mallOrderRefund)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新重试"); |
| | | } |
| | | Integer status = mallOrderRefund.getStatus(); |
| | | if(status != 4){ |
| | | return new FebsResponse().fail().message("申请记录不是已申请状态,请刷新页面"); |
| | | } |
| | | mallOrderRefund.setStatus(2); |
| | | mallOrderRefund.setName(mallOrderRefundAddress.getName()); |
| | | mallOrderRefund.setPhone(mallOrderRefundAddress.getPhone()); |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "AdminMallGoodsCategoryTreeVo", description = "信息返回类") |
| | | public class AdminMallGoodsCategoryTreeVo { |
| | | |
| | | private Long parentId; |
| | | |
| | | private String name; |
| | | } |
| | |
| | | select * from mall_goods_category |
| | | where id=#{id} |
| | | </select> |
| | | |
| | | <select id="getParentCategorys" resultType="cc.mrbird.febs.mall.vo.AdminMallGoodsCategoryTreeVo"> |
| | | SELECT m.id parentId,m.name name FROM mall_goods_category m where m.parent_id = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | lay-verify="name" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label ">父类:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="parentId" |
| | | xm-select-direction="down" |
| | | xm-select="user-update-category" |
| | | xm-select-skin="default"> |
| | | <div class="layui-input-inline"> |
| | | <select name="parentId" class="categary-add-category"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label ">父类:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <select name="parentId"--> |
| | | <!-- xm-select-direction="down"--> |
| | | <!-- xm-select="user-update-category"--> |
| | | <!-- xm-select-skin="default">--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-form-item sftj"> |
| | | <label class="layui-form-label febs-form-item-require">是否推荐:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="isRecommend" value="1" title="是" > |
| | |
| | | |
| | | formSelects.render(); |
| | | |
| | | formSelects.config('user-update-category', { |
| | | searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | beforeSuccess: function (id, url, searchVal, result) { |
| | | var data = result.data; |
| | | var tranData = []; |
| | | for (var i = 0; i < data.length; i++) { |
| | | tranData.push({ |
| | | name: data[i].name, |
| | | value: data[i].id |
| | | }) |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/goodsCategory/categorys/tree', function (data) { |
| | | for (var k in data) |
| | | { |
| | | $(".categary-add-category").append("<option value='" + data[k].parentId + "'>" + data[k].name + "</option>"); |
| | | } |
| | | result.data = tranData; |
| | | return result; |
| | | }, |
| | | success: function () { |
| | | formSelects.value('user-update-category', member.id.split(',')); |
| | | }, |
| | | error: function (id, url, searchVal, err) { |
| | | console.error(err); |
| | | febs.alert.error('获取分类列表失败'); |
| | | } |
| | | layui.use('form', function () { |
| | | var form = layui.form; |
| | | form.render(); |
| | | }); |
| | | }); |
| | | |
| | | // $(".categary-add-category").on('click', function (){ |
| | | // console.log(1); |
| | | // }) |
| | | |
| | | // formSelects.config('user-update-category', { |
| | | // searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | // response: { |
| | | // statusCode: 200 |
| | | // }, |
| | | // beforeSuccess: function (id, url, searchVal, result) { |
| | | // var data = result.data; |
| | | // var tranData = []; |
| | | // for (var i = 0; i < data.length; i++) { |
| | | // tranData.push({ |
| | | // name: data[i].name, |
| | | // value: data[i].id |
| | | // }) |
| | | // } |
| | | // result.data = tranData; |
| | | // return result; |
| | | // }, |
| | | // success: function () { |
| | | // formSelects.value('user-update-category', member.id.split(',')); |
| | | // }, |
| | | // error: function (id, url, searchVal, err) { |
| | | // console.error(err); |
| | | // febs.alert.error('获取分类列表失败'); |
| | | // } |
| | | // }); |
| | | |
| | | form.on('submit(categary-add-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/goodsCategory/addCategory', data.field, function () { |
| | |
| | | lay-verify="name" autocomplete="off" class="layui-input" > |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label ">父类:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="parentId" |
| | | xm-select-direction="down" |
| | | xm-select="user-update-category" |
| | | xm-select-skin="default"> |
| | | <div class="layui-input-inline"> |
| | | <select name="parentId" class="categary-update-category"> |
| | | <option value="'+[[${member}]].parentId+'">请选择</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label ">父类:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <select name="parentId"--> |
| | | <!-- xm-select-direction="down"--> |
| | | <!-- xm-select="user-update-category"--> |
| | | <!-- xm-select-skin="default">--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">是否推荐:</label> |
| | | <div class="layui-input-block"> |
| | |
| | | |
| | | formSelects.render(); |
| | | |
| | | formSelects.config('user-update-category', { |
| | | searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | beforeSuccess: function (id, url, searchVal, result) { |
| | | var data = result.data; |
| | | var tranData = []; |
| | | for (var i = 0; i < data.length; i++) { |
| | | tranData.push({ |
| | | name: data[i].name, |
| | | value: data[i].id |
| | | }) |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/goodsCategory/categorys/tree', function (data) { |
| | | for (var k in data) |
| | | { |
| | | $(".categary-update-category").append("<option value='" + data[k].parentId + "'>" + data[k].name + "</option>"); |
| | | } |
| | | result.data = tranData; |
| | | return result; |
| | | }, |
| | | success: function () { |
| | | formSelects.value('user-update-category', member.parentId); |
| | | }, |
| | | error: function (id, url, searchVal, err) { |
| | | console.error(err); |
| | | febs.alert.error('获取分类列表失败'); |
| | | } |
| | | layui.use('form', function () { |
| | | var form = layui.form; |
| | | form.render(); |
| | | }); |
| | | }); |
| | | // formSelects.config('user-update-category', { |
| | | // searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | // response: { |
| | | // statusCode: 200 |
| | | // }, |
| | | // beforeSuccess: function (id, url, searchVal, result) { |
| | | // var data = result.data; |
| | | // var tranData = []; |
| | | // for (var i = 0; i < data.length; i++) { |
| | | // tranData.push({ |
| | | // name: data[i].name, |
| | | // value: data[i].id |
| | | // }) |
| | | // } |
| | | // result.data = tranData; |
| | | // return result; |
| | | // }, |
| | | // success: function () { |
| | | // formSelects.value('user-update-category', member.parentId); |
| | | // }, |
| | | // error: function (id, url, searchVal, err) { |
| | | // console.error(err); |
| | | // febs.alert.error('获取分类列表失败'); |
| | | // } |
| | | // }); |
| | | initUserValue(); |
| | | |
| | | function initUserValue() { |
| | |
| | | } |
| | | |
| | | form.on('submit(categary-update-form-submit)', function (data) { |
| | | febs.post(ctx + 'admin/goodsCategory/addCategory', data.field, function () { |
| | | febs.post(ctx + 'admin/goodsCategory/updateCategory', data.field, function () { |
| | | layer.closeAll(); |
| | | febs.alert.success('新增成功'); |
| | | $('#febs-user').find('#reset').click(); |