diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkcustomer/LpkCustomer.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkcustomer/LpkCustomer.java index 9e3ef3a..98effd7 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkcustomer/LpkCustomer.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkcustomer/LpkCustomer.java @@ -48,4 +48,5 @@ public class LpkCustomer { @ApiModelProperty("客户绑定的支行sid") private String customerBankSid; + private String orgPath; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoods.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoods.java index e2a1b13..8e21fe2 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoods.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoods.java @@ -1,5 +1,6 @@ package com.yxt.ordermall.api.lpkgoods; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -31,6 +32,8 @@ public class LpkGoods { private String price; private String picUrl; private String appContent; + @TableField(exist = false) + private String specificationUnitSid; private String specificationUnit; private String number; private String isAppletGrounding; @@ -38,9 +41,9 @@ public class LpkGoods { private String weight; private String useTo; - private Long brandId; // 品牌ID'; + private String brandId; // 品牌ID'; private String brandName; // 品牌名称'; - private Long categoryId; // 类别ID'; + private String categoryId; // 类别ID'; private String categoryName; // 类别名称'; @ApiModelProperty("阶梯重量") private String stepWeight; @@ -48,4 +51,6 @@ public class LpkGoods { private String stepPrice; private String periodValidity; private String sort; + private String spuSid; + private String skuSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDetailsVo.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDetailsVo.java index 3a2b4ed..951a8a0 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDetailsVo.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDetailsVo.java @@ -27,14 +27,17 @@ public class LpkGoodsDetailsVo implements Vo { private String picUrl;//图片 private String appContent; private String specificationUnit; + private String specificationUnitSid; private double number; private String content; private String weight; + private String isAppletGrounding; + private String useTo; - private Long brandId; // 品牌ID'; + private String brandId; // 品牌ID'; private String brandName; // 品牌名称'; - private Long categoryId; // 类别ID'; + private String categoryId; // 类别ID'; private String categoryName; // 类别名称'; @ApiModelProperty("阶梯重量") @@ -53,4 +56,9 @@ public class LpkGoodsDetailsVo implements Vo { private String goodsNumber; private String mefenPrice; private String sort; + private String spuSid; + private String skuSid; + private String useOrgSid; + private String createOrgSid; + private String userSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDto.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDto.java index f978299..9f4ed86 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDto.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsDto.java @@ -18,19 +18,21 @@ public class LpkGoodsDto implements Dto { private String barcode; private String name; private String unitName; + private String unitSid; private String typeCode; private String price; private String picUrl; private String appContent; private String specificationUnit; + private String specificationUnitSid; private double number; private String content; private String weight; private String useTo; - private Long brandId; // 品牌ID'; + private String brandId; // 品牌ID'; private String brandName; // 品牌名称'; - private Long categoryId; // 类别ID'; + private String categoryId; // 类别ID'; private String categoryName; // 类别名称'; @ApiModelProperty("阶梯重量") @@ -39,4 +41,10 @@ public class LpkGoodsDto implements Dto { private String stepPrice; private String periodValidity; private String sort; + + private String useOrgSid; + private String createOrgSid; + private String userSid; + private String signSid;//标识sid 用于两端系统相对应 + private String skuSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsQuery.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsQuery.java index 53371ca..59c4870 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsQuery.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsQuery.java @@ -2,6 +2,7 @@ package com.yxt.ordermall.api.lpkgoods; import com.yxt.common.core.query.Query; import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -17,4 +18,12 @@ public class LpkGoodsQuery implements Query { private String brandId; private String periodValidity; private String now; + private String orgLevelKey;//权限等级 + @ApiModelProperty("菜单路由") + private String menuUrl; + @ApiModelProperty("组织全路径sid") + private String orgPath; + @ApiModelProperty("用户sid") + private String userSid; + private int index; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsVo.java b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsVo.java index a384c73..f20dee1 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsVo.java +++ b/ordermall/src/main/java/com/yxt/ordermall/api/lpkgoods/LpkGoodsVo.java @@ -36,9 +36,9 @@ public class LpkGoodsVo implements Vo { private String useTo; private String weight; - private Long brandId; // 品牌ID'; + private String brandId; // 品牌ID'; private String brandName; // 品牌名称'; - private Long categoryId; // 类别ID'; + private String categoryId; // 类别ID'; private String categoryName; // 类别名称'; @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date periodValidity; diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/AdminMallRest.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/AdminMallRest.java index 540a849..7a860cc 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/AdminMallRest.java +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/AdminMallRest.java @@ -4,11 +4,15 @@ import com.yxt.common.core.result.ResultBean; import com.yxt.ordermall.apiadmin.vo.PmsBrandVo; import com.yxt.ordermall.apiadmin.vo.PmsProductCategoryVo; import com.yxt.ordermall.adminservice.AdminMallService; +import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoVo; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeVo; +import com.yxt.ordermall.feign.base.basebrandinfo.BaseBrandInfoFeign; +import com.yxt.ordermall.feign.base.basegoodstype.BaseGoodsTypeFeign; +import com.yxt.ordermall.utils.OrgPathQuery; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; @RestController("com.yxt.ordermall.adminapi.AdminMallRest") @@ -17,17 +21,35 @@ public class AdminMallRest { @Autowired private AdminMallService adminMallService; + @Autowired + BaseBrandInfoFeign baseBrandInfoFeign; + @Autowired + BaseGoodsTypeFeign baseGoodsTypeFeign; - @GetMapping(value = "/listAllBrand") - public ResultBean> listAllBrand() { + @PostMapping(value = "/listAllBrand") + public ResultBean> listAllBrand(@RequestBody OrgPathQuery query) { ResultBean rb = ResultBean.fireFail(); - List list = adminMallService.listBrand(); - return rb.success().setData(list); + ResultBean> list=baseBrandInfoFeign.listAll(query); + List brandVos=new ArrayList<>(); + for (BaseBrandInfoVo datum : list.getData()) { + PmsBrandVo vo=new PmsBrandVo(); + vo.setName(datum.getBrandName()); + vo.setSid(datum.getSid()); + brandVos.add(vo); + } + return rb.success().setData(brandVos); } - @GetMapping(value = "/listAllCategory") - public ResultBean> listAllCategory() { + @PostMapping(value = "/listAllCategory") + public ResultBean> listAllCategory(@RequestBody OrgPathQuery query) { ResultBean rb = ResultBean.fireFail(); - List list = adminMallService.listAllCategory(); - return rb.success().setData(list); + ResultBean> list=baseGoodsTypeFeign.listAll(query); + List list1 = new ArrayList<>(); + for (BaseGoodsTypeVo datum : list.getData()) { + PmsProductCategoryVo pmsProductCategoryVo=new PmsProductCategoryVo(); + pmsProductCategoryVo.setName(datum.getGoodsTypeName()); + pmsProductCategoryVo.setSid(datum.getSid()); + list1.add(pmsProductCategoryVo); + } + return rb.success().setData(list1); } } diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/BaseGoodsUnitRest.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/BaseGoodsUnitRest.java new file mode 100644 index 0000000..8eab219 --- /dev/null +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/BaseGoodsUnitRest.java @@ -0,0 +1,69 @@ +package com.yxt.ordermall.apiadmin.aggregation; + +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import com.yxt.ordermall.biz.func.basegoodsunit.BaseGoodsUnitDto; +import com.yxt.ordermall.biz.func.basegoodsunit.BaseGoodsUnitQuery; +import com.yxt.ordermall.biz.func.basegoodsunit.BaseGoodsUnitService; +import com.yxt.ordermall.biz.func.basegoodsunit.BaseGoodsUnitVo; +import com.yxt.ordermall.utils.OrgPathQuery; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author wangpengfei + * @date 2024/3/8 9:19 + */ +@Api(tags = "商品类型") +@RestController +@RequestMapping("/apiadmin/base/basegoodsunit") +public class BaseGoodsUnitRest { + @Autowired + BaseGoodsUnitService baseGoodsUnitService; + + + @ApiOperation("分页列表") + @PostMapping("/listPage") + public ResultBean> listPage(@RequestBody PagerQuery pq) { + return baseGoodsUnitService.listPage(pq); + } + @ApiOperation("查询所有的类别") + @PostMapping("/listAll") + public ResultBean> listAll(@RequestBody OrgPathQuery query) { + return baseGoodsUnitService.listAll(query); + } + + @ApiOperation("保存修改") + @PostMapping("/saveOrUpdate") + public ResultBean saveOrUpdate(@RequestBody BaseGoodsUnitDto dto) { + return baseGoodsUnitService.saveOrUpdate(dto); + } + + @ApiOperation("初始化") + @GetMapping("/initialization/{sid}") + public ResultBean initialization(@PathVariable("sid") String sid) { + return baseGoodsUnitService.initialization(sid); + } + + @ApiOperation("删除") + @DeleteMapping("/delete/{sid}") + public ResultBean delete(@PathVariable("sid") String sid) { + return baseGoodsUnitService.delete(sid); + } + @ApiOperation("删除") + @DeleteMapping("/delBySids") + public ResultBean delBySids(@RequestBody String[] sids) { + return baseGoodsUnitService.delAll(sids); + } + + @ApiOperation("更改可用状态") + @GetMapping("/updateIsEnable/{sid}/{isEnable}") + public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { + return baseGoodsUnitService.updateIsEnable(sid,isEnable); + } +} diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsBrandRest.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsBrandRest.java index a734720..eb8b949 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsBrandRest.java +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsBrandRest.java @@ -3,12 +3,16 @@ package com.yxt.ordermall.apiadmin.aggregation; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yxt.common.base.config.component.FileUploadComponent; +import com.yxt.common.base.utils.StringUtils; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoDto; import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoQuery; import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoVo; +import com.yxt.ordermall.biz.func.commonmethod.CommonMethod; +import com.yxt.ordermall.biz.func.commonmethod.DataRule; import com.yxt.ordermall.feign.base.basebrandinfo.BaseBrandInfoFeign; import com.yxt.ordermall.mallplus.biz.pms.service.IPmsBrandService; import com.yxt.ordermall.mallplus.mbg.pms.entity.PmsBrand; @@ -43,18 +47,28 @@ public class PmsBrandRest { private IPmsBrandService IPmsBrandService; @Autowired BaseBrandInfoFeign baseBrandInfoFeign; + @Autowired + CommonMethod commonMethod; + @Autowired + private FileUploadComponent fileUploadComponent; // @SysLog(MODULE = "pms", REMARK = "根据条件查询所有品牌表列表") @ApiOperation("根据条件查询所有品牌表列表") - @GetMapping(value = "/list") + @PostMapping(value = "/list") public ResultBean getPmsBrandByPage(@RequestBody PagerQuery pq) { - PmsBrand brand=new PmsBrand(); + BaseBrandInfoQuery query=pq.getParams(); + DataRule dataRule=commonMethod.dataRule(query.getOrgPath(),query.getMenuUrl(),query.getUserSid()).getData(); + pq.getParams().setOrgLevelKey(dataRule.getDataRuleId()); + pq.getParams().setIndex(dataRule.getIndex()); + List brands=new ArrayList<>(); PagerVo vo=new PagerVo(); ResultBean> voResultBean=baseBrandInfoFeign.listPage(pq); for (BaseBrandInfoVo record : voResultBean.getData().getRecords()) { - brand.setId(Long.valueOf(record.getBrandCode())); + PmsBrand brand=new PmsBrand(); +// brand.setId(Long.valueOf(record.getBrandCode())); brand.setName(record.getBrandName()); brand.setFirstLetter(record.getLetter()); + brand.setSid(record.getSid()); // brand.setSort(record.get); brands.add(brand); } @@ -67,75 +81,67 @@ public class PmsBrandRest { @ApiOperation("保存品牌表") @PostMapping(value = "/create") // @PreAuthorize("hasAuthority('pms:PmsBrand:create')") - public Object savePmsBrand(@RequestBody PmsBrand entity) { - + public ResultBean savePmsBrand(@RequestBody PmsBrand entity) { BaseBrandInfoDto dto =new BaseBrandInfoDto(); - dto.setBrandCode(entity.getId().toString()); + BeanUtil.copyProperties(entity,dto); +// dto.setBrandCode(entity.getId().toString()); + dto.setRemarks(entity.getBrandStory()); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + if(StringUtils.isNotBlank(entity.getLogo())){ + String path = entity.getLogo().substring(urlPrefix.length()); + dto.setImage(path); + } dto.setBrandName(entity.getName()); -// dto.set - baseBrandInfoFeign.saveOrUpdate(dto); - + dto.setLetter(entity.getFirstLetter()); - try { - if (IPmsBrandService.save(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); + return baseBrandInfoFeign.saveOrUpdate(dto); } // @SysLog(MODULE = "pms", REMARK = "更新品牌表") @ApiOperation("更新品牌表") @PostMapping(value = "/update/{id}") public Object updatePmsBrand(@RequestBody PmsBrand entity) { - try { - if (IPmsBrandService.updateById(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); + BaseBrandInfoDto dto =new BaseBrandInfoDto(); + BeanUtil.copyProperties(entity,dto); +// dto.setBrandCode(entity.getId().toString()); + dto.setRemarks(entity.getBrandStory()); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + if(StringUtils.isNotBlank(entity.getLogo())){ + String path = entity.getLogo().substring(urlPrefix.length()); + dto.setImage(path); } - return new CommonResult().failed(); + dto.setBrandName(entity.getName()); + dto.setLetter(entity.getFirstLetter()); + + return baseBrandInfoFeign.saveOrUpdate(dto); } // @SysLog(MODULE = "pms", REMARK = "删除品牌表") @ApiOperation("删除品牌表") - @GetMapping(value = "/delete/{id}") + @DeleteMapping(value = "/delete") // @PreAuthorize("hasAuthority('pms:PmsBrand:delete')") - public Object deletePmsBrand(@ApiParam("品牌表id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("品牌表id"); - } - if (IPmsBrandService.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); + public Object deletePmsBrand( @RequestBody String [] sids) { + return baseBrandInfoFeign.delBySids(sids); } // @SysLog(MODULE = "pms", REMARK = "给品牌表分配品牌表") @ApiOperation("查询品牌表明细") - @GetMapping(value = "/{id}") - public Object getPmsBrandById(@ApiParam("品牌表id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("品牌表id"); - } - PmsBrand coupon = IPmsBrandService.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询品牌表明细:%s", e.getMessage(), e); - return new CommonResult().failed(); + @GetMapping(value = "/{sid}") + public Object getPmsBrandById(@ApiParam("sid") @PathVariable String sid) { + ResultBean bean= baseBrandInfoFeign.initialization(sid); + PmsBrand coupon =new PmsBrand(); + BeanUtil.copyProperties(bean.getData(),coupon); + coupon.setName(bean.getData().getBrandName()); + coupon.setBrandStory(bean.getData().getRemarks()); + coupon.setFirstLetter(bean.getData().getLetter()); + coupon.setUseOrgSid(bean.getData().getUseOrgSid()); + coupon.setCreateOrgSid(bean.getData().getCreateOrgSid()); + coupon.setUserSid(bean.getData().getCreateOrgSid()); + if(StringUtils.isNotBlank(bean.getData().getImage())){ + coupon.setLogo(fileUploadComponent.getUrlPrefix()+bean.getData().getImage()); } - +// coupon.setId(Long.valueOf(bean.getData().getBrandCode())); + return new ResultBean<>().success().setData(coupon); } @ApiOperation(value = "批量删除品牌表") diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsProductCategoryRest.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsProductCategoryRest.java new file mode 100644 index 0000000..38034c0 --- /dev/null +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/aggregation/PmsProductCategoryRest.java @@ -0,0 +1,223 @@ +package com.yxt.ordermall.apiadmin.aggregation; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoQuery; +import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoVo; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeDto; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeQuery; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeVo; +import com.yxt.ordermall.biz.func.commonmethod.CommonMethod; +import com.yxt.ordermall.biz.func.commonmethod.DataRule; +import com.yxt.ordermall.feign.base.basegoodstype.BaseGoodsTypeFeign; +import com.yxt.ordermall.mallplus.biz.pms.service.IPmsProductCategoryService; +import com.yxt.ordermall.mallplus.mbg.pms.entity.PmsBrand; +import com.yxt.ordermall.mallplus.mbg.pms.entity.PmsProductCategory; +import com.yxt.ordermall.mallplus.mbg.pms.vo.PmsProductCategoryWithChildrenItem; +import com.zscat.mallplus.utils.CommonResult; +import com.zscat.mallplus.utils.ValidatorUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 产品分类 + *

+ * + * @author zscat + * @since 2019-04-19 + */ +@Slf4j +@RestController +@Api(tags = "PmsProductCategoryController", description = "产品分类管理") +@RequestMapping("/pms/PmsProductCategory") +public class PmsProductCategoryRest { + @Resource + private IPmsProductCategoryService IPmsProductCategoryService; + @Autowired + BaseGoodsTypeFeign baseGoodsTypeFeign; + @Autowired + CommonMethod commonMethod; + +// // @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品分类列表") +// @ApiOperation("根据条件查询所有产品分类列表") +// @PostMapping(value = "/list") +// public Object getPmsProductCategoryByPage(@RequestBody PagerQuery pq) { +// BaseGoodsTypeQuery query=pq.getParams(); +// DataRule dataRule=commonMethod.dataRule(query.getOrgPath(),query.getMenuUrl(),query.getUserSid()).getData(); +// pq.getParams().setOrgLevelKey(dataRule.getDataRuleId()); +// pq.getParams().setIndex(dataRule.getIndex()); +// PmsProductCategory c=new PmsProductCategory(); +// List list=new ArrayList<>(); +// PagerVo vo=new PagerVo(); +// ResultBean> voResultBean= baseGoodsTypeFeign.listPage(pq); +// for (BaseGoodsTypeVo record : voResultBean.getData().getRecords()) { +// c.setId(Long.valueOf(record.getGoodsTypeCode())); +// c.setName(record.getGoodsTypeName()); +// list.add(c); +// } +// BeanUtil.copyProperties(voResultBean.getData(),vo); +// vo.setRecords(list); +// return new ResultBean<>().success().setData(vo); +// } + + @ApiOperation("分页查询商品分类") + @PostMapping(value = "/list") + @ResponseBody + public ResultBean getList(@RequestBody PagerQuery pq) { + BaseGoodsTypeQuery query=pq.getParams(); + DataRule dataRule=commonMethod.dataRule(query.getOrgPath(),query.getMenuUrl(),query.getUserSid()).getData(); + pq.getParams().setOrgLevelKey(dataRule.getDataRuleId()); + pq.getParams().setIndex(dataRule.getIndex()); + + List list=new ArrayList<>(); + PagerVo vo=new PagerVo(); + ResultBean> voResultBean= baseGoodsTypeFeign.listPage(pq); + for (BaseGoodsTypeVo record : voResultBean.getData().getRecords()) { + PmsProductCategory c=new PmsProductCategory(); +// c.setId(Long.valueOf(record.getGoodsTypeCode())); + c.setDescription(record.getRemarks()); + c.setName(record.getGoodsTypeName()); + c.setSid(record.getSid()); + c.setShowStatus(record.getIsEnable()); + list.add(c); + } + BeanUtil.copyProperties(voResultBean.getData(),vo); + vo.setRecords(list); + return new ResultBean<>().success().setData(vo); + } + + // @SysLog(MODULE = "pms", REMARK = "保存产品分类") + @ApiOperation("保存产品分类") + @PostMapping(value = "/create") + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:create')") + public Object savePmsProductCategory(@RequestBody PmsProductCategory entity) { + BaseGoodsTypeDto dto =new BaseGoodsTypeDto(); + BeanUtil.copyProperties(entity,dto); +// dto.setGoodsTypeCode(entity.getId().toString()); + dto.setRemarks(entity.getDescription()); + dto.setGoodsTypeName(entity.getName()); + dto.setIsEnable(entity.getShowStatus()); + return baseGoodsTypeFeign.saveOrUpdate(dto); + } + + // @SysLog(MODULE = "pms", REMARK = "更新产品分类") + @ApiOperation("更新产品分类") + @PostMapping(value = "/update/{id}") + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") + public Object updatePmsProductCategory(@RequestBody PmsProductCategory entity) { + BaseGoodsTypeDto dto =new BaseGoodsTypeDto(); + BeanUtil.copyProperties(entity,dto); +// dto.setGoodsTypeCode(entity.getId().toString()); + dto.setRemarks(entity.getDescription()); + dto.setGoodsTypeName(entity.getName()); + dto.setIsEnable(entity.getShowStatus()); + return baseGoodsTypeFeign.saveOrUpdate(dto); + } + + // @SysLog(MODULE = "pms", REMARK = "删除产品分类") + @ApiOperation("删除产品分类") + @DeleteMapping(value = "/delete") + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") + public Object deletePmsProductCategory(@ApiParam("产品分类id") @RequestBody String [] sids) { + return baseGoodsTypeFeign.delBySids(sids); + } + + // @SysLog(MODULE = "pms", REMARK = "给产品分类分配产品分类") + @ApiOperation("查询产品分类明细") + @GetMapping(value = "/{sid}") + public Object getPmsProductCategoryById(@ApiParam("产品分类id") @PathVariable String sid) { + ResultBean bean= baseGoodsTypeFeign.initialization(sid); + PmsProductCategory coupon =new PmsProductCategory(); + BeanUtil.copyProperties(bean.getData(),coupon); + coupon.setName(bean.getData().getGoodsTypeName()); + coupon.setDescription(bean.getData().getRemarks()); + coupon.setUseOrgSid(bean.getData().getUseOrgSid()); + coupon.setCreateOrgSid(bean.getData().getCreateOrgSid()); + coupon.setShowStatus(bean.getData().getIsEnable()); + coupon.setUserSid(bean.getData().getCreateOrgSid()); + return new ResultBean<>().success().setData(coupon); + } + + @ApiOperation(value = "批量删除产品分类") + @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) + @ResponseBody + // @SysLog(MODULE = "pms", REMARK = "批量删除产品分类") + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") + public Object deleteBatch(@RequestParam("ids") List ids) { + boolean count = IPmsProductCategoryService.removeByIds(ids); + if (count) { + return new CommonResult().success(count); + } else { + return new CommonResult().failed(); + } + } + + @ApiOperation("查询所有一级分类及子分类") + @RequestMapping(value = "/list/withChildren", method = RequestMethod.GET) + @ResponseBody + public Object listWithChildren() { + List list = IPmsProductCategoryService.listWithChildren(); + return new CommonResult().success(list); + } + + @ApiOperation("修改导航栏显示状态") + @RequestMapping(value = "/update/navStatus", method = RequestMethod.POST) + @ResponseBody + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") + public Object updateNavStatus(@RequestParam("ids") Long ids, @RequestParam("navStatus") Integer navStatus) { + PmsProductCategory entity = new PmsProductCategory(); + entity.setId(ids); + entity.setNavStatus(navStatus); + + if (IPmsProductCategoryService.updateById(entity)) { + return new CommonResult().success(); + } else { + return new CommonResult().failed(); + } + } +// public Object updateNavStatus(@RequestParam("ids") List ids, @RequestParam("navStatus") Integer navStatus) { +// int count = IPmsProductCategoryService.updateNavStatus(ids, navStatus); +// if (count > 0) { +// return new CommonResult().success(count); +// } else { +// return new CommonResult().failed(); +// } +// } + + @ApiOperation("修改显示状态") + @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) + @ResponseBody + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") + public Object updateShowStatus(@RequestParam("sid") String sid, @RequestParam("showStatus") Integer showStatus) { + return baseGoodsTypeFeign.updateIsEnable(sid,String.valueOf(showStatus)); + } + + @ApiOperation("修改首页显示状态") + @RequestMapping(value = "/update/indexStatus", method = RequestMethod.POST) + @ResponseBody + // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") + public Object updateIndexStatus(@RequestParam("ids") Long ids, @RequestParam("indexStatus") Integer indexStatus) { + PmsProductCategory entity = new PmsProductCategory(); + entity.setId(ids); + entity.setIndexStatus(indexStatus); + if (IPmsProductCategoryService.updateById(entity)) { + return new CommonResult().success(); + } else { + return new CommonResult().failed(); + } + } + +} diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsBrandVo.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsBrandVo.java index c81ab12..f5b519c 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsBrandVo.java +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsBrandVo.java @@ -1,6 +1,7 @@ package com.yxt.ordermall.apiadmin.vo; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; @Data @@ -27,4 +28,12 @@ public class PmsBrandVo { * 专区大图 */ private String bigPic; + @TableField(exist = false) + private String sid; + @TableField(exist = false) + private String useOrgSid;//使用组织sid + @TableField(exist = false) + private String createOrgSid;//创建组织sid + @TableField(exist = false) + private String userSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsProductCategoryVo.java b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsProductCategoryVo.java index a0efcbb..c2b5c3c 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsProductCategoryVo.java +++ b/ordermall/src/main/java/com/yxt/ordermall/apiadmin/vo/PmsProductCategoryVo.java @@ -8,6 +8,7 @@ public class PmsProductCategoryVo { private Long parentId; private String name; + private String sid; private Integer level; private Integer sort; diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSku.java b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSku.java index 2c8da05..69afe87 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSku.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSku.java @@ -19,4 +19,5 @@ public class BaseGoodsSku extends BaseEntity { private String ownSpec;//sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序 private String barCode;//条形码 private String aidBarCode;//辅助条码 + private String signSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuDto.java b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuDto.java index ea2a3de..bb69bfc 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuDto.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuDto.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.yxt.common.core.dto.Dto; import com.yxt.ordermall.biz.func.basegoodsskuextend.BaseGoodsSkuExtendDto; +import com.yxt.ordermall.biz.lpkgoods.GoodsSkuSubunitDto; import lombok.Data; import java.util.Date; @@ -30,4 +31,6 @@ public class BaseGoodsSkuDto implements Dto { private BaseGoodsSkuExtendDto baseGoodsSkuExtend;//sku扩展 private String barCode;//条形码 private String aidBarCode;//辅助条码 + private GoodsSkuSubunitDto goodsSkuSubunit; + private String signSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuQuery.java b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuQuery.java index b8678db..9a91e99 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuQuery.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/BaseGoodsSkuQuery.java @@ -1,6 +1,7 @@ package com.yxt.ordermall.biz.func.basegoodssku; import com.yxt.common.core.query.Query; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -10,4 +11,12 @@ import lombok.Data; @Data public class BaseGoodsSkuQuery implements Query { private String name; + private String orgLevelKey;//权限等级 + @ApiModelProperty("菜单路由") + private String menuUrl; + @ApiModelProperty("组织全路径sid") + private String orgPath; + @ApiModelProperty("用户sid") + private String userSid; + private int index; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/GoodsSkuVo1.java b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/GoodsSkuVo1.java new file mode 100644 index 0000000..08e4121 --- /dev/null +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodssku/GoodsSkuVo1.java @@ -0,0 +1,41 @@ +package com.yxt.ordermall.biz.func.basegoodssku; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @author wangpengfei + * @date 2024/12/5 9:01 + */ +@Data +public class GoodsSkuVo1 { + private String id; + private String sid; + private String lockVersion; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date modifyTime; + private String remarks; + private String isEnable; + private String state; + private String isDelete; + private String title;//商品Skutitle + private String skuSid;// + private String goodsSkuCode;//skuCode + private String barCode;//条码 + private String picUrl;//图片 + private String salesPrice;//销售价格 + private String sortNo;//排序 + private String goodsName;//spuName + private String goodsCode;//spuName + private String spuSid;// + private String unitName;//单位 + private String unitSid;// + private String goodsTypeName;//分类 + private String typeSid;// + private String brandName;//品牌 + private String brandSid;// +} diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodsspu/BaseGoodsSpuDto.java b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodsspu/BaseGoodsSpuDto.java index 690eb9c..932e7a9 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodsspu/BaseGoodsSpuDto.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/func/basegoodsspu/BaseGoodsSpuDto.java @@ -20,6 +20,7 @@ public class BaseGoodsSpuDto implements Dto { private String sid; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; + private String createBySid; private String remarks; private String isEnable; private String goodsCode;//商品代码 diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/GoodsSkuSubunitDto.java b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/GoodsSkuSubunitDto.java new file mode 100644 index 0000000..dc8eb87 --- /dev/null +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/GoodsSkuSubunitDto.java @@ -0,0 +1,31 @@ +package com.yxt.ordermall.biz.lpkgoods; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yxt.common.core.dto.Dto; +import lombok.Data; + +import java.util.Date; + +/** + * @author wangpengfei + * @date 2024/2/26 13:38 + */ +@Data +public class GoodsSkuSubunitDto implements Dto { + private String id; + private String sid; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + private String remarks; + private String isEnable; + private String skuSid;// + private String unitName;//计量单位名称 + private String unitBarCode;//计量单位名称 + private String ruler;//换算规则(该单位与基础单位的量级关系)数字类型 + private String price;//销售价格后续害应该包括采购价、销售价、批发价、参考成本等多个价格字段 + private String weight;//重量 + private String volume;//体积 + private String vLength;//长 + private String vWidth;//宽 + private String vHeight;//高 +} diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsRest.java b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsRest.java index a9bcf8c..7488aa4 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsRest.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsRest.java @@ -6,6 +6,7 @@ import com.yxt.common.core.vo.PagerVo; import com.yxt.ordermall.api.appletgiftbag.MyGoodsVo; import com.yxt.ordermall.api.lpkgiftcard.LpkGiftCardQuery; import com.yxt.ordermall.api.lpkgoods.*; +import com.yxt.ordermall.utils.OrgPathQuery; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -100,8 +101,8 @@ public class LpkGoodsRest { } @ApiOperation("获取所有的商品类型和品牌") @GetMapping("/getGoodsTypeAndBrand") - public ResultBean getGoodsTypeAndBrand() { - return lpkGoodsService.getGoodsTypeAndBrand(); + public ResultBean getGoodsTypeAndBrand(@RequestBody OrgPathQuery query) { + return lpkGoodsService.getGoodsTypeAndBrand(query); } @ApiOperation("根据类型查询商品") @PostMapping("/getGoodsByType") diff --git a/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsService.java b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsService.java index 224e4fd..d62ff43 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsService.java +++ b/ordermall/src/main/java/com/yxt/ordermall/biz/lpkgoods/LpkGoodsService.java @@ -2,6 +2,7 @@ package com.yxt.ordermall.biz.lpkgoods; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.yxt.common.base.config.component.FileUploadComponent; @@ -21,21 +22,36 @@ import com.yxt.ordermall.api.shoppingcart.ShoppingCart; import com.yxt.ordermall.api.shoppingcart.ShoppingCartQuery; import com.yxt.ordermall.api.shoppingcart.ShoppingCartVo; import com.yxt.ordermall.biz.enterprisecertification.EnterpriseCertificationService; +import com.yxt.ordermall.biz.func.basebrandinfo.BaseBrandInfoVo; +import com.yxt.ordermall.biz.func.basegoodssku.*; +import com.yxt.ordermall.biz.func.basegoodsskuextend.BaseGoodsSkuExtendDto; +import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuDto; +import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuVo; +import com.yxt.ordermall.biz.func.basegoodsspudetail.BaseGoodsSpuDetailDto; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeQuery; +import com.yxt.ordermall.biz.func.basegoodstype.BaseGoodsTypeVo; +import com.yxt.ordermall.biz.func.commonmethod.CommonMethod; +import com.yxt.ordermall.biz.func.commonmethod.DataRule; import com.yxt.ordermall.biz.lpkcustomer.LpkCustomerService; import com.yxt.ordermall.biz.shoppingcart.ShoppingCartService; +import com.yxt.ordermall.feign.base.basebrandinfo.BaseBrandInfoFeign; +import com.yxt.ordermall.feign.base.basegoodssku.BaseGoodsSkuFeign; +import com.yxt.ordermall.feign.base.basegoodsspu.BaseGoodsSpuFeign; +import com.yxt.ordermall.feign.base.basegoodstype.BaseGoodsTypeFeign; import com.yxt.ordermall.mallplus.biz.pms.service.IPmsBrandService; import com.yxt.ordermall.mallplus.mbg.pms.entity.PmsBrand; import com.yxt.ordermall.mallplus.mbg.pms.entity.brand.BrandVo; import com.yxt.ordermall.utils.DoubleUtils; +import com.yxt.ordermall.utils.OrgPathQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.awt.*; +import java.awt.event.InputEvent; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; +import java.util.*; import java.util.List; /** @@ -55,77 +71,162 @@ public class LpkGoodsService extends MybatisBaseService> goodsListPage(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); LpkGoodsQuery query = pq.getParams(); - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("1", "1"); - if (StringUtils.isNotBlank(query.getName())) { - qw.like("name", query.getName()); - } - qw.orderByAsc("sort"); - IPage page = PagerUtil.queryToPage(pq); - IPage pagging = baseMapper.goodsListPage(page, qw); - PagerVo p = PagerUtil.pageToVo(pagging, null); - List records = pagging.getRecords(); - records.removeAll(Collections.singleton(null)); - if (!records.isEmpty()) { - for (LpkGoodsVo record : records) { - if (StringUtils.isNotBlank(record.getPicUrl())) { - record.setPicUrl(fileUploadComponent.getUrlPrefix() + record.getPicUrl()); - } + DataRule dataRule=commonMethod.dataRule(query.getOrgPath(),query.getMenuUrl(),query.getUserSid()).getData(); + pq.getParams().setOrgLevelKey(dataRule.getDataRuleId()); + pq.getParams().setIndex(dataRule.getIndex()); + PagerQuery baseGoodsSkuQueryPagerQuery=new PagerQuery<>(); + BeanUtil.copyProperties(pq,baseGoodsSkuQueryPagerQuery); + ResultBean>sku= baseGoodsSkuFeign.listPage(baseGoodsSkuQueryPagerQuery); + List records = new ArrayList<>(); + PagerVo vo=new PagerVo(); + BeanUtil.copyProperties(sku.getData(),vo); + LpkGoodsVo vv=new LpkGoodsVo(); + for (GoodsSkuVo1 record : sku.getData().getRecords()) { + vv.setCreateTime(new Date()); + vv.setCode(record.getGoodsCode()); + vv.setPrice(record.getSalesPrice()); + vv.setBarcode(record.getBarCode()); + vv.setName(record.getGoodsName()); + vv.setWeight(record.getTitle()); + vv.setUnitName(record.getUnitName()); + vv.setPrice(record.getSalesPrice()); + vv.setBrandId(record.getBrandSid()); + vv.setBrandName(record.getBrandName()); + vv.setCategoryId(record.getTypeSid()); + vv.setCategoryName(record.getGoodsTypeName()); + vv.setSort(record.getSortNo()); + vv.setSid(record.getSkuSid()); + if (StringUtils.isNotBlank(record.getPicUrl())) { + vv.setPicUrl(fileUploadComponent.getUrlPrefix() + record.getPicUrl()); } + LpkGoods lpkGoods = baseMapper.selectOne(new QueryWrapper().eq("skuSid", vv.getSid())); + vv.setIsAppletGrounding(lpkGoods.getIsAppletGrounding()); + vv.setUseTo(lpkGoods.getUseTo()); + records.add(vv); } - return rb.success().setData(p); + vo.setRecords(records); + return rb.success().setData(vo); } - - public ResultBean saveGoods(LpkGoodsDto dto) { + public ResultBean saveGoods(LpkGoodsDto dto) { ResultBean rb = ResultBean.fireFail(); - String sid = ""; - if (StringUtils.isNotBlank(dto.getSid())) { - sid = dto.getSid(); - LpkGoods lpkGoods = fetchBySid(dto.getSid()); - BeanUtil.copyProperties(dto, lpkGoods, "id", "sid"); - if (StringUtils.isNotBlank(dto.getPicUrl())) { - String urlPrefix = fileUploadComponent.getUrlPrefix(); - String path = dto.getPicUrl().substring(urlPrefix.length()); - lpkGoods.setPicUrl(path); - } - baseMapper.updateById(lpkGoods); - } else { - LpkGoods goods=baseMapper.selectOne(new QueryWrapper().eq("name",dto.getName())); - if(null!=goods){ - return rb.setMsg("商品名不能重复"); - } - LpkGoods lpkGoods = new LpkGoods(); - sid = lpkGoods.getSid(); - BeanUtil.copyProperties(dto, lpkGoods, "id", "sid"); - lpkGoods.setCreateTime(new DateTime()); - if (StringUtils.isNotBlank(dto.getPicUrl())) { - String urlPrefix = fileUploadComponent.getUrlPrefix(); - String path = dto.getPicUrl().substring(urlPrefix.length()); - lpkGoods.setPicUrl(path); - } - baseMapper.insert(lpkGoods); + dto.setSignSid(UUID.randomUUID().toString()); + BaseGoodsSpuDto spuDto=new BaseGoodsSpuDto(); + BaseGoodsSpuDetailDto detailDto=new BaseGoodsSpuDetailDto(); + detailDto.setGoodsExplain(dto.getAppContent()); + spuDto.setSid(dto.getSid()); + spuDto.setBrandSid(dto.getBrandId()); + spuDto.setBrandName(dto.getBrandName()); + spuDto.setGoodsName(dto.getName()); + spuDto.setGoodsTypeName(dto.getCategoryName()); + spuDto.setGoodsTypeSid(dto.getCategoryId()); + + spuDto.setGoodsUnitSid(dto.getSpecificationUnitSid()); + spuDto.setGoodsUnitName(dto.getSpecificationUnit()); + spuDto.setGoodsCode(dto.getCode()); + spuDto.setBarCode(dto.getBarcode()); + spuDto.setUseOrgSid(dto.getUseOrgSid()); + spuDto.setCreateOrgSid(dto.getUseOrgSid()); + spuDto.setCreateBySid(dto.getUserSid()); + spuDto.setSortNo(dto.getSort()); + List baseGoodsSkus=new ArrayList<>();//商品sku + BaseGoodsSkuDto dto1=new BaseGoodsSkuDto(); + BaseGoodsSkuExtendDto extendDto=new BaseGoodsSkuExtendDto(); + String urlPrefix = fileUploadComponent.getUrlPrefix(); + if(StringUtils.isNotBlank(dto.getPicUrl())){ + String path = dto.getPicUrl().substring(urlPrefix.length()); + extendDto.setPicUrl(path); + } + extendDto.setPackUnit(dto.getUnitName()); + extendDto.setSalesPrice(dto.getPrice()); + dto1.setSid(dto.getSkuSid()); + dto1.setTitle(dto.getWeight()); + dto1.setIndexes(dto.getRemarks()); + dto1.setRemarks(dto.getContent()); + dto1.setSignSid(dto.getSignSid()); + baseGoodsSkus.add(dto1); + for (BaseGoodsSkuDto goodsSkus : baseGoodsSkus) { + goodsSkus.setBaseGoodsSkuExtend(extendDto); } - return rb.success().setData(sid); + spuDto.setBaseGoodsSpuDetail(detailDto); + spuDto.setBaseGoodsSkus(baseGoodsSkus); + ResultBean> listResultBean = baseGoodsSpuFeign.saveOrUpdateByName(spuDto); + if(!listResultBean.getCode().equals("200")){ + return listResultBean; + } + Listskus= listResultBean.getData(); + + baseMapper.delete(new QueryWrapper().eq("spuSid",skus.get(0).getGoodsSpuSid())); + LpkGoods lpkGoods=new LpkGoods(); + BeanUtil.copyProperties(dto,lpkGoods); + lpkGoods.setSid(UUID.randomUUID().toString()); + lpkGoods.setSpuSid(skus.get(0).getGoodsSpuSid()); + lpkGoods.setSkuSid(skus.get(0).getSid()); + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); + lpkGoods.setPeriodValidity(sdf.format(new Date())); + lpkGoods.setSort("1"); + baseMapper.insert(lpkGoods); + return rb.success().setMsg("成功"); } - public ResultBean goodsInit(String sid) { + public ResultBean goodsInit(String sid) { ResultBean rb = ResultBean.fireFail(); - LpkGoodsDetailsVo vo = new LpkGoodsDetailsVo(); - LpkGoods lpkGoods = fetchBySid(sid); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - if (null != lpkGoods) { - BeanUtil.copyProperties(lpkGoods, vo); - if (StringUtils.isNotBlank(lpkGoods.getPicUrl())) { - vo.setPicUrl(fileUploadComponent.getUrlPrefix() + lpkGoods.getPicUrl()); - } - vo.setCreateTime(sdf.format(lpkGoods.getCreateTime())); + ResultBean w=baseGoodsSkuFeign.initialization(sid); + if(!w.getCode().equals("200")){ + return w; } - return rb.success().setData(vo); + ResultBean initialization = baseGoodsSpuFeign.initialization(w.getData().getGoodsSpuSid()); + if(!initialization.getCode().equals("200")){ + return initialization; + } + LpkGoods lpkGoods1 = baseMapper.selectOne(new QueryWrapper().eq("skuSid", w.getData().getSid())); + BaseGoodsSpuVo data = initialization.getData(); + LpkGoodsDetailsVo lpkGoods = new LpkGoodsDetailsVo(); + lpkGoods.setBarcode(data.getBarCode()); + lpkGoods.setCreateTime(data.getCreateTime().toString()); + lpkGoods.setCode(data.getGoodsCode()); + lpkGoods.setName(data.getGoodsName()); + lpkGoods.setUnitName(data.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getPackUnit()); +// lpkGoods.setTypeCode(); + lpkGoods.setPrice(data.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getSalesPrice()); + lpkGoods.setAppContent(data.getBaseGoodsSpuDetail().getGoodsExplain()); + lpkGoods.setSpecificationUnit(data.getGoodsUnitName()); + lpkGoods.setSpecificationUnitSid(data.getGoodsUnitSid()); +// lpkGoods.setNumber(d); + lpkGoods.setIsAppletGrounding(lpkGoods1.getIsAppletGrounding()); + lpkGoods.setContent(data.getBaseGoodsSkus().get(0).getRemarks()); + lpkGoods.setWeight(data.getBaseGoodsSkus().get(0).getTitle()); + lpkGoods.setUseTo(lpkGoods1.getUseTo()); + lpkGoods.setBrandId(data.getBrandSid()); + lpkGoods.setBrandName(data.getBrandName()); + lpkGoods.setCategoryId(data.getGoodsTypeSid()); + lpkGoods.setCategoryName(data.getTypeName()); + lpkGoods.setStepWeight(lpkGoods1.getStepWeight()); + lpkGoods.setPeriodValidity(DateUtil.parse(lpkGoods1.getPeriodValidity())); + lpkGoods.setSort(data.getSortNo()); + lpkGoods.setSpuSid(data.getSid()); + lpkGoods.setSkuSid(data.getBaseGoodsSkus().get(0).getSid()); + lpkGoods.setSid(data.getSid()); + lpkGoods.setRemarks(data.getBaseGoodsSkus().get(0).getIndexes()); + lpkGoods.setUseOrgSid(data.getUseOrgSid()); + lpkGoods.setCreateOrgSid(data.getCreateOrgSid()); + if (StringUtils.isNotBlank(data.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getPicUrl())) { + lpkGoods.setPicUrl(fileUploadComponent.getUrlPrefix() + data.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getPicUrl()); + } + return rb.success().setData(lpkGoods); } public ResultBean goodsDetails(String sid,String customerSid) { @@ -178,7 +279,7 @@ public class LpkGoodsService extends MybatisBaseService().eq("skuSid",sid)); if (null != lpkGoods) { lpkGoods.setIsAppletGrounding(state); baseMapper.updateById(lpkGoods); @@ -190,7 +291,8 @@ public class LpkGoodsService extends MybatisBaseService().eq("skuSid",sid)); if (null != lpkGoods) { lpkGoods.setUseTo(state); baseMapper.updateById(lpkGoods); @@ -304,16 +406,33 @@ public class LpkGoodsService extends MybatisBaseService list=baseMapper.getType(); return rb.success().setData(list); } - public ResultBean> getGoodsTypeAndBrand() { + public ResultBean> getGoodsTypeAndBrand(OrgPathQuery query) { ResultBean rb=new ResultBean().fail(); GoodsTypeVo vo=new GoodsTypeVo(); - List list=baseMapper.getType(); + ResultBean> listResultBean = baseGoodsTypeFeign.listAll(query); + List list=new ArrayList<>(); + for (BaseGoodsTypeVo datum : listResultBean.getData()) { + GoodsTypeVo vo1=new GoodsTypeVo(); + vo1.setName(datum.getGoodsTypeName()); +// vo1.setId(); + vo1.setSid(datum.getSid()); + } + GoodsTypeVo vo1=new GoodsTypeVo(); vo1.setName("全部分类"); vo1.setId("0"); + vo1.setSid("0"); list.add(0,vo1); vo.setTypeVos(list); - List list1= IPmsBrandService.getList().getData(); + ResultBean> listResultBean1 = baseBrandInfoFeign.listAll(query); + List list1= new ArrayList<>(); + for (BaseBrandInfoVo datum : listResultBean1.getData()) { + BrandVo vo2=new BrandVo(); + vo2.setBrandName(datum.getBrandName()); + vo2.setSid(datum.getSid()); + list1.add(vo2); + } + vo.setBrandVos(list1); return rb.success().setData(vo); } @@ -396,10 +515,51 @@ public class LpkGoodsService extends MybatisBaseService> listPage(@RequestBody PagerQuery pq); @ApiOperation("获取商品信息") @GetMapping("/getDetails") ResultBean getDetails(@RequestParam("sid") String sid); @@ -38,4 +40,6 @@ public interface BaseGoodsSkuFeign { @ApiOperation("根据code查询商品") @GetMapping("/getSkuByCode/{code}/{title}") public ResultBean getSkuByCode(@PathVariable("code") String code,@PathVariable("title") String title); + + } diff --git a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodssku/BaseGoodsSkuFeignFallback.java b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodssku/BaseGoodsSkuFeignFallback.java index 36fb464..dde8021 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodssku/BaseGoodsSkuFeignFallback.java +++ b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodssku/BaseGoodsSkuFeignFallback.java @@ -16,6 +16,11 @@ import java.util.List; **/ @Component public class BaseGoodsSkuFeignFallback implements BaseGoodsSkuFeign{ + @Override + public ResultBean> listPage(PagerQuery pq) { + return null; + } + @Override public ResultBean getDetails(String sid) { return null; diff --git a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeign.java b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeign.java index 36fe42e..8bc16dd 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeign.java +++ b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeign.java @@ -3,6 +3,7 @@ package com.yxt.ordermall.feign.base.basegoodsspu; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; +import com.yxt.ordermall.biz.func.basegoodssku.BaseGoodsSku; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuDto; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuQuery; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuVo; @@ -35,7 +36,9 @@ public interface BaseGoodsSpuFeign { @ApiOperation("保存修改") @PostMapping("/saveOrUpdate") public ResultBean saveOrUpdate(@RequestBody BaseGoodsSpuDto dto); - + @ApiOperation("保存修改") + @PostMapping("/saveOrUpdateByName") + public ResultBean> saveOrUpdateByName(@RequestBody BaseGoodsSpuDto dto); @ApiOperation("初始化") @GetMapping("/initialization/{sid}") public ResultBean initialization(@PathVariable("sid") String sid); diff --git a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeignFallback.java b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeignFallback.java index e8c0804..2394ae4 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeignFallback.java +++ b/ordermall/src/main/java/com/yxt/ordermall/feign/base/basegoodsspu/BaseGoodsSpuFeignFallback.java @@ -3,6 +3,7 @@ package com.yxt.ordermall.feign.base.basegoodsspu; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; +import com.yxt.ordermall.biz.func.basegoodssku.BaseGoodsSku; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuDto; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuQuery; import com.yxt.ordermall.biz.func.basegoodsspu.BaseGoodsSpuVo; @@ -31,6 +32,11 @@ public class BaseGoodsSpuFeignFallback implements BaseGoodsSpuFeign { return null; } + @Override + public ResultBean> saveOrUpdateByName(BaseGoodsSpuDto dto) { + return null; + } + @Override public ResultBean initialization(String sid) { return null; diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsBrandController.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsBrandController.java deleted file mode 100644 index f3fb3f9..0000000 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsBrandController.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.yxt.ordermall.mallplus.biz.pms.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yxt.common.core.result.ResultBean; -import com.yxt.ordermall.mallplus.biz.pms.service.IPmsBrandService; -import com.yxt.ordermall.mallplus.mbg.pms.entity.PmsBrand; -import com.yxt.ordermall.mallplus.mbg.pms.entity.brand.BrandVo; -import com.zscat.mallplus.utils.CommonResult; -import com.zscat.mallplus.utils.ValidatorUtils; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - *

- * 品牌表 - *

- * - * @author zscat - * @since 2019-04-19 - */ -@Slf4j -@RestController -@Api(tags = "PmsBrandController", description = "品牌表管理") -@RequestMapping("/pms/PmsBrand") -public class PmsBrandController { - @Resource - private IPmsBrandService IPmsBrandService; - - // @SysLog(MODULE = "pms", REMARK = "根据条件查询所有品牌表列表") - @ApiOperation("根据条件查询所有品牌表列表") - @GetMapping(value = "/list") - public Object getPmsBrandByPage(PmsBrand entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize - ) { - try { - if (ValidatorUtils.notEmpty(entity.getName())) { - return new CommonResult().success(IPmsBrandService.page(new Page(pageNum, pageSize), new QueryWrapper(new PmsBrand()).like("name", entity.getName()))); - } - return new CommonResult().success(IPmsBrandService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); - } catch (Exception e) { - log.error("根据条件查询所有品牌表列表:%s", e.getMessage(), e); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "保存品牌表") - @ApiOperation("保存品牌表") - @PostMapping(value = "/create") - // @PreAuthorize("hasAuthority('pms:PmsBrand:create')") - public Object savePmsBrand(@RequestBody PmsBrand entity) { - try { - if (IPmsBrandService.save(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "更新品牌表") - @ApiOperation("更新品牌表") - @PostMapping(value = "/update/{id}") - public Object updatePmsBrand(@RequestBody PmsBrand entity) { - try { - if (IPmsBrandService.updateById(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "删除品牌表") - @ApiOperation("删除品牌表") - @GetMapping(value = "/delete/{id}") - // @PreAuthorize("hasAuthority('pms:PmsBrand:delete')") - public Object deletePmsBrand(@ApiParam("品牌表id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("品牌表id"); - } - if (IPmsBrandService.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除品牌表:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "给品牌表分配品牌表") - @ApiOperation("查询品牌表明细") - @GetMapping(value = "/{id}") - public Object getPmsBrandById(@ApiParam("品牌表id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("品牌表id"); - } - PmsBrand coupon = IPmsBrandService.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询品牌表明细:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - - } - - @ApiOperation(value = "批量删除品牌表") - @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) - @ResponseBody - // @SysLog(MODULE = "pms", REMARK = "批量删除品牌表") - // @PreAuthorize("hasAuthority('pms:PmsBrand:delete')") - public Object deleteBatch(@RequestParam("ids") List ids) { - boolean count = IPmsBrandService.removeByIds(ids); - if (count) { - return new CommonResult().success(count); - } else { - return new CommonResult().failed(); - } - } - - @ApiOperation(value = "批量更新显示状态") - @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) - @ResponseBody - // @SysLog(MODULE = "pms", REMARK = "批量更新显示状态") - public Object updateShowStatus(@RequestParam("ids") List ids, - @RequestParam("showStatus") Integer showStatus) { - int count = IPmsBrandService.updateShowStatus(ids, showStatus); - if (count > 0) { - return new CommonResult().success(count); - } else { - return new CommonResult().failed(); - } - } - - @ApiOperation(value = "批量更新厂家制造商状态") - @RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST) - @ResponseBody - // @SysLog(MODULE = "pms", REMARK = "批量更新厂家制造商状态") - public Object updateFactoryStatus(@RequestParam("ids") List ids, - @RequestParam("factoryStatus") Integer factoryStatus) { - int count = IPmsBrandService.updateFactoryStatus(ids, factoryStatus); - if (count > 0) { - return new CommonResult().success(count); - } else { - return new CommonResult().failed(); - } - } - - @ApiOperation(value = "获取品牌") - @GetMapping("/getList") - ResultBean> getList(){ - return IPmsBrandService.getList(); - } -} diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsProductCategoryController.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsProductCategoryController.java index ac85ca7..061a4b6 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsProductCategoryController.java +++ b/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/controller/PmsProductCategoryController.java @@ -29,194 +29,194 @@ import java.util.List; @Api(tags = "PmsProductCategoryController", description = "产品分类管理") @RequestMapping("/pms/PmsProductCategory") public class PmsProductCategoryController { - @Resource - private IPmsProductCategoryService IPmsProductCategoryService; - - // @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品分类列表") - @ApiOperation("根据条件查询所有产品分类列表") - @GetMapping(value = "/list") - public Object getPmsProductCategoryByPage(PmsProductCategory entity, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize - ) { - try { - return new CommonResult().success(IPmsProductCategoryService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); - } catch (Exception e) { - log.error("根据条件查询所有产品分类列表:%s", e.getMessage(), e); - } - return new CommonResult().failed(); - } - - @ApiOperation("分页查询商品分类") - @RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET) - @ResponseBody - public Object getList(@PathVariable Long parentId, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, - @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { - PmsProductCategory entity = new PmsProductCategory(); - entity.setParentId(parentId); - QueryWrapper queryWrapper=new QueryWrapper<>(entity); - queryWrapper.orderByAsc("sort"); - return new CommonResult().success(IPmsProductCategoryService.page(new Page(pageNum, pageSize), queryWrapper)); - } - - // @SysLog(MODULE = "pms", REMARK = "保存产品分类") - @ApiOperation("保存产品分类") - @PostMapping(value = "/create") - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:create')") - public Object savePmsProductCategory(@RequestBody PmsProductCategory entity) { - try { - //查询是否存在相同级别的相同名称的分类 - Long parentId = entity.getParentId(); - String name = entity.getName(); - int count = IPmsProductCategoryService.selectCountByNameAndLevel(parentId,name); - if(count>0){ - return new CommonResult().failed("该分类已存在"); - } - if (IPmsProductCategoryService.saveAnd(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("保存产品分类:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "更新产品分类") - @ApiOperation("更新产品分类") - @PostMapping(value = "/update/{id}") - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") - public Object updatePmsProductCategory(@RequestBody PmsProductCategory entity) { - try { - //查询是否存在相同级别的相同名称的分类 - Long parentId = entity.getParentId(); - String name = entity.getName(); - Long id = entity.getId(); - int count = IPmsProductCategoryService.selectCountByNameAndLevelId(parentId,name,id); - if(count>0){ - return new CommonResult().failed("该分类已存在"); - } - if (IPmsProductCategoryService.updateAnd(entity)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("更新产品分类:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "删除产品分类") - @ApiOperation("删除产品分类") - @GetMapping(value = "/delete/{id}") - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") - public Object deletePmsProductCategory(@ApiParam("产品分类id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("产品分类id"); - } - if (IPmsProductCategoryService.removeById(id)) { - return new CommonResult().success(); - } - } catch (Exception e) { - log.error("删除产品分类:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - return new CommonResult().failed(); - } - - // @SysLog(MODULE = "pms", REMARK = "给产品分类分配产品分类") - @ApiOperation("查询产品分类明细") - @GetMapping(value = "/{id}") - public Object getPmsProductCategoryById(@ApiParam("产品分类id") @PathVariable Long id) { - try { - if (ValidatorUtils.empty(id)) { - return new CommonResult().paramFailed("产品分类id"); - } - PmsProductCategory coupon = IPmsProductCategoryService.getById(id); - return new CommonResult().success(coupon); - } catch (Exception e) { - log.error("查询产品分类明细:%s", e.getMessage(), e); - return new CommonResult().failed(); - } - - } - - @ApiOperation(value = "批量删除产品分类") - @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) - @ResponseBody - // @SysLog(MODULE = "pms", REMARK = "批量删除产品分类") - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") - public Object deleteBatch(@RequestParam("ids") List ids) { - boolean count = IPmsProductCategoryService.removeByIds(ids); - if (count) { - return new CommonResult().success(count); - } else { - return new CommonResult().failed(); - } - } - - @ApiOperation("查询所有一级分类及子分类") - @RequestMapping(value = "/list/withChildren", method = RequestMethod.GET) - @ResponseBody - public Object listWithChildren() { - List list = IPmsProductCategoryService.listWithChildren(); - return new CommonResult().success(list); - } - - @ApiOperation("修改导航栏显示状态") - @RequestMapping(value = "/update/navStatus", method = RequestMethod.POST) - @ResponseBody - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") - public Object updateNavStatus(@RequestParam("ids") Long ids, @RequestParam("navStatus") Integer navStatus) { - PmsProductCategory entity = new PmsProductCategory(); - entity.setId(ids); - entity.setNavStatus(navStatus); - - if (IPmsProductCategoryService.updateById(entity)) { - return new CommonResult().success(); - } else { - return new CommonResult().failed(); - } - } -// public Object updateNavStatus(@RequestParam("ids") List ids, @RequestParam("navStatus") Integer navStatus) { -// int count = IPmsProductCategoryService.updateNavStatus(ids, navStatus); -// if (count > 0) { +// @Resource +// private IPmsProductCategoryService IPmsProductCategoryService; +// +// // @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品分类列表") +// @ApiOperation("根据条件查询所有产品分类列表") +// @GetMapping(value = "/list") +// public Object getPmsProductCategoryByPage(PmsProductCategory entity, +// @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, +// @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize +// ) { +// try { +// return new CommonResult().success(IPmsProductCategoryService.page(new Page(pageNum, pageSize), new QueryWrapper<>(entity))); +// } catch (Exception e) { +// log.error("根据条件查询所有产品分类列表:%s", e.getMessage(), e); +// } +// return new CommonResult().failed(); +// } +// +// @ApiOperation("分页查询商品分类") +// @RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET) +// @ResponseBody +// public Object getList(@PathVariable Long parentId, +// @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, +// @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { +// PmsProductCategory entity = new PmsProductCategory(); +// entity.setParentId(parentId); +// QueryWrapper queryWrapper=new QueryWrapper<>(entity); +// queryWrapper.orderByAsc("sort"); +// return new CommonResult().success(IPmsProductCategoryService.page(new Page(pageNum, pageSize), queryWrapper)); +// } +// +// // @SysLog(MODULE = "pms", REMARK = "保存产品分类") +// @ApiOperation("保存产品分类") +// @PostMapping(value = "/create") +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:create')") +// public Object savePmsProductCategory(@RequestBody PmsProductCategory entity) { +// try { +// //查询是否存在相同级别的相同名称的分类 +// Long parentId = entity.getParentId(); +// String name = entity.getName(); +// int count = IPmsProductCategoryService.selectCountByNameAndLevel(parentId,name); +// if(count>0){ +// return new CommonResult().failed("该分类已存在"); +// } +// if (IPmsProductCategoryService.saveAnd(entity)) { +// return new CommonResult().success(); +// } +// } catch (Exception e) { +// log.error("保存产品分类:%s", e.getMessage(), e); +// return new CommonResult().failed(); +// } +// return new CommonResult().failed(); +// } +// +// // @SysLog(MODULE = "pms", REMARK = "更新产品分类") +// @ApiOperation("更新产品分类") +// @PostMapping(value = "/update/{id}") +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") +// public Object updatePmsProductCategory(@RequestBody PmsProductCategory entity) { +// try { +// //查询是否存在相同级别的相同名称的分类 +// Long parentId = entity.getParentId(); +// String name = entity.getName(); +// Long id = entity.getId(); +// int count = IPmsProductCategoryService.selectCountByNameAndLevelId(parentId,name,id); +// if(count>0){ +// return new CommonResult().failed("该分类已存在"); +// } +// if (IPmsProductCategoryService.updateAnd(entity)) { +// return new CommonResult().success(); +// } +// } catch (Exception e) { +// log.error("更新产品分类:%s", e.getMessage(), e); +// return new CommonResult().failed(); +// } +// return new CommonResult().failed(); +// } +// +// // @SysLog(MODULE = "pms", REMARK = "删除产品分类") +// @ApiOperation("删除产品分类") +// @GetMapping(value = "/delete/{id}") +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") +// public Object deletePmsProductCategory(@ApiParam("产品分类id") @PathVariable Long id) { +// try { +// if (ValidatorUtils.empty(id)) { +// return new CommonResult().paramFailed("产品分类id"); +// } +// if (IPmsProductCategoryService.removeById(id)) { +// return new CommonResult().success(); +// } +// } catch (Exception e) { +// log.error("删除产品分类:%s", e.getMessage(), e); +// return new CommonResult().failed(); +// } +// return new CommonResult().failed(); +// } +// +// // @SysLog(MODULE = "pms", REMARK = "给产品分类分配产品分类") +// @ApiOperation("查询产品分类明细") +// @GetMapping(value = "/{id}") +// public Object getPmsProductCategoryById(@ApiParam("产品分类id") @PathVariable Long id) { +// try { +// if (ValidatorUtils.empty(id)) { +// return new CommonResult().paramFailed("产品分类id"); +// } +// PmsProductCategory coupon = IPmsProductCategoryService.getById(id); +// return new CommonResult().success(coupon); +// } catch (Exception e) { +// log.error("查询产品分类明细:%s", e.getMessage(), e); +// return new CommonResult().failed(); +// } +// +// } +// +// @ApiOperation(value = "批量删除产品分类") +// @RequestMapping(value = "/delete/batch", method = RequestMethod.GET) +// @ResponseBody +// // @SysLog(MODULE = "pms", REMARK = "批量删除产品分类") +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:delete')") +// public Object deleteBatch(@RequestParam("ids") List ids) { +// boolean count = IPmsProductCategoryService.removeByIds(ids); +// if (count) { // return new CommonResult().success(count); // } else { // return new CommonResult().failed(); // } // } - - @ApiOperation("修改显示状态") - @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) - @ResponseBody - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") - public Object updateShowStatus(@RequestParam("ids") Long ids, @RequestParam("showStatus") Integer showStatus) { - PmsProductCategory entity = new PmsProductCategory(); - entity.setId(ids); - entity.setShowStatus(showStatus); - if (IPmsProductCategoryService.updateById(entity)) { - return new CommonResult().success(); - } else { - return new CommonResult().failed(); - } - } - - @ApiOperation("修改首页显示状态") - @RequestMapping(value = "/update/indexStatus", method = RequestMethod.POST) - @ResponseBody - // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") - public Object updateIndexStatus(@RequestParam("ids") Long ids, @RequestParam("indexStatus") Integer indexStatus) { - PmsProductCategory entity = new PmsProductCategory(); - entity.setId(ids); - entity.setIndexStatus(indexStatus); - if (IPmsProductCategoryService.updateById(entity)) { - return new CommonResult().success(); - } else { - return new CommonResult().failed(); - } - } +// +// @ApiOperation("查询所有一级分类及子分类") +// @RequestMapping(value = "/list/withChildren", method = RequestMethod.GET) +// @ResponseBody +// public Object listWithChildren() { +// List list = IPmsProductCategoryService.listWithChildren(); +// return new CommonResult().success(list); +// } +// +// @ApiOperation("修改导航栏显示状态") +// @RequestMapping(value = "/update/navStatus", method = RequestMethod.POST) +// @ResponseBody +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") +// public Object updateNavStatus(@RequestParam("ids") Long ids, @RequestParam("navStatus") Integer navStatus) { +// PmsProductCategory entity = new PmsProductCategory(); +// entity.setId(ids); +// entity.setNavStatus(navStatus); +// +// if (IPmsProductCategoryService.updateById(entity)) { +// return new CommonResult().success(); +// } else { +// return new CommonResult().failed(); +// } +// } +//// public Object updateNavStatus(@RequestParam("ids") List ids, @RequestParam("navStatus") Integer navStatus) { +//// int count = IPmsProductCategoryService.updateNavStatus(ids, navStatus); +//// if (count > 0) { +//// return new CommonResult().success(count); +//// } else { +//// return new CommonResult().failed(); +//// } +//// } +// +// @ApiOperation("修改显示状态") +// @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST) +// @ResponseBody +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") +// public Object updateShowStatus(@RequestParam("ids") Long ids, @RequestParam("showStatus") Integer showStatus) { +// PmsProductCategory entity = new PmsProductCategory(); +// entity.setId(ids); +// entity.setShowStatus(showStatus); +// if (IPmsProductCategoryService.updateById(entity)) { +// return new CommonResult().success(); +// } else { +// return new CommonResult().failed(); +// } +// } +// +// @ApiOperation("修改首页显示状态") +// @RequestMapping(value = "/update/indexStatus", method = RequestMethod.POST) +// @ResponseBody +// // @PreAuthorize("hasAuthority('pms:PmsProductCategory:update')") +// public Object updateIndexStatus(@RequestParam("ids") Long ids, @RequestParam("indexStatus") Integer indexStatus) { +// PmsProductCategory entity = new PmsProductCategory(); +// entity.setId(ids); +// entity.setIndexStatus(indexStatus); +// if (IPmsProductCategoryService.updateById(entity)) { +// return new CommonResult().success(); +// } else { +// return new CommonResult().failed(); +// } +// } } diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/service/impl/PmsProductCategoryServiceImpl.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/service/impl/PmsProductCategoryServiceImpl.java index 7d2059d..5744d60 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/service/impl/PmsProductCategoryServiceImpl.java +++ b/ordermall/src/main/java/com/yxt/ordermall/mallplus/biz/pms/service/impl/PmsProductCategoryServiceImpl.java @@ -54,7 +54,7 @@ public class PmsProductCategoryServiceImpl extends ServiceImpl ids, Integer showStatus) { PmsProductCategory productCategory = new PmsProductCategory(); - productCategory.setShowStatus(showStatus); +// productCategory.setShowStatus(showStatus); return categoryMapper.update(productCategory, new QueryWrapper().in("id", ids)); } diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsBrand.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsBrand.java index 8fc0729..e57fa26 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsBrand.java +++ b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsBrand.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.zscat.mallplus.utils.BaseEntity; +import lombok.Data; import java.io.Serializable; @@ -17,10 +18,18 @@ import java.io.Serializable; * @since 2019-04-19 */ @TableName("pms_brand") +@Data public class PmsBrand extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; - + @TableField(exist = false) + private String sid; + @TableField(exist = false) + private String useOrgSid;//使用组织sid + @TableField(exist = false) + private String createOrgSid;//创建组织sid + @TableField(exist = false) + private String userSid; @TableId(value = "id", type = IdType.AUTO) private Long id; diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsProductCategory.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsProductCategory.java index c1e9033..a016c90 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsProductCategory.java +++ b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/PmsProductCategory.java @@ -57,7 +57,7 @@ public class PmsProductCategory extends BaseEntity implements Serializable { * 显示状态:0->不显示;1->显示 */ @TableField("show_status") - private Integer showStatus; + private String showStatus; /** * 是否是首页分类0-->不是,1-->是 */ @@ -83,5 +83,12 @@ public class PmsProductCategory extends BaseEntity implements Serializable { private List productAttributeIdList; @TableField(exist = false) private List childList; - + @TableField(exist = false) + private String sid; + @TableField(exist = false) + private String useOrgSid;//使用组织sid + @TableField(exist = false) + private String createOrgSid;//创建组织sid + @TableField(exist = false) + private String userSid; } diff --git a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/brand/BrandVo.java b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/brand/BrandVo.java index 764ff7e..7586eb4 100644 --- a/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/brand/BrandVo.java +++ b/ordermall/src/main/java/com/yxt/ordermall/mallplus/mbg/pms/entity/brand/BrandVo.java @@ -22,4 +22,5 @@ public class BrandVo { @ApiModelProperty("起订协议") private String qdxy; private String count; + private String sid; }