mallplus部分代码
This commit is contained in:
1202
docs/databases/mallplus1-pms-20240117113448.sql
Normal file
1202
docs/databases/mallplus1-pms-20240117113448.sql
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,136 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbum;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsAlbumService;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsAlbumController", description = "管理")
|
||||
@RequestMapping("/pms/PmsAlbum")
|
||||
public class PmsAlbumController {
|
||||
@Resource
|
||||
private IPmsAlbumService IPmsAlbumService;
|
||||
|
||||
// // @SysLog(MODULE = "pms", REMARK = "查询pms_album表")
|
||||
@ApiOperation("查询pms_album表")
|
||||
@GetMapping(value = "/list")
|
||||
|
||||
public Object getPmsAlbumByPage(PmsAlbum entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsAlbumService.page(new Page<PmsAlbum>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
} catch (Exception e) {
|
||||
log.error("分页获取pms_album列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "保存pms_album表")
|
||||
@ApiOperation("保存pms_album表")
|
||||
@PostMapping(value = "/create")
|
||||
|
||||
public Object saveAlbum(@RequestBody PmsAlbum entity) {
|
||||
try {
|
||||
if (IPmsAlbumService.save(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存pms_album表:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "更新pms_album")
|
||||
@ApiOperation("更新pms_album")
|
||||
@PostMapping(value = "/update/{id}")
|
||||
|
||||
public Object updateAlbum(@RequestBody PmsAlbum entity) {
|
||||
try {
|
||||
if (IPmsAlbumService.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 = "删除pms_album数据")
|
||||
@ApiOperation("删除相册表数据")
|
||||
@GetMapping(value = "/delete/{id}")
|
||||
|
||||
public Object deleteRole(@ApiParam("相册表_id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("PmsAlbum_id");
|
||||
}
|
||||
if (IPmsAlbumService.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 = "根据ID查询pms_album")
|
||||
@ApiOperation("根据ID查询pms_album")
|
||||
@GetMapping(value = "/{id}")
|
||||
|
||||
public Object getRoleById(@ApiParam("相册表_id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("PmsAlbum_id");
|
||||
}
|
||||
PmsAlbum pmsAlbum = IPmsAlbumService.getById(id);
|
||||
return new CommonResult().success(pmsAlbum);
|
||||
} catch (Exception e) {
|
||||
log.error("pms_album表明细:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除PmsAlbum表")
|
||||
@RequestMapping(value = "/delete/batch", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量删除PmsAlbum表")
|
||||
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsAlbumService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbumPic;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsAlbumPicService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 画册图片表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsAlbumPicController", description = "画册图片表管理")
|
||||
@RequestMapping("/pms/PmsAlbumPic")
|
||||
public class PmsAlbumPicController {
|
||||
@Resource
|
||||
private IPmsAlbumPicService IPmsAlbumPicService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有画册图片表列表")
|
||||
@ApiOperation("根据条件查询所有画册图片表列表")
|
||||
@GetMapping(value = "/list")
|
||||
|
||||
public Object getPmsAlbumPicByPage(PmsAlbumPic entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsAlbumPicService.page(new Page<PmsAlbumPic>(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")
|
||||
|
||||
public Object savePmsAlbumPic(@RequestBody PmsAlbumPic entity) {
|
||||
try {
|
||||
if (IPmsAlbumPicService.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 updatePmsAlbumPic(@RequestBody PmsAlbumPic entity) {
|
||||
try {
|
||||
if (IPmsAlbumPicService.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}")
|
||||
|
||||
public Object deletePmsAlbumPic(@ApiParam("画册图片表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("画册图片表id");
|
||||
}
|
||||
if (IPmsAlbumPicService.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 getPmsAlbumPicById(@ApiParam("画册图片表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("画册图片表id");
|
||||
}
|
||||
PmsAlbumPic coupon = IPmsAlbumPicService.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 = "批量删除画册图片表")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsAlbumPicService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsBrand;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsBrandService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 品牌表
|
||||
* </p>
|
||||
*
|
||||
* @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<PmsBrand>(pageNum, pageSize), new QueryWrapper<PmsBrand>(new PmsBrand()).like("name", entity.getName())));
|
||||
}
|
||||
return new CommonResult().success(IPmsBrandService.page(new Page<PmsBrand>(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<Long> 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<Long> 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<Long> ids,
|
||||
@RequestParam("factoryStatus") Integer factoryStatus) {
|
||||
int count = IPmsBrandService.updateFactoryStatus(ids, factoryStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsComment;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsCommentService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品评价表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsCommentController", description = "商品评价表管理")
|
||||
@RequestMapping("/pms/PmsComment")
|
||||
public class PmsCommentController {
|
||||
@Resource
|
||||
private IPmsCommentService IPmsCommentService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品评价表列表")
|
||||
@ApiOperation("根据条件查询所有商品评价表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsComment:read')")
|
||||
public Object getPmsCommentByPage(PmsComment entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsCommentService.page(new Page<PmsComment>(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:PmsComment:create')")
|
||||
public Object savePmsComment(@RequestBody PmsComment entity) {
|
||||
try {
|
||||
if (IPmsCommentService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsComment:update')")
|
||||
public Object updatePmsComment(@RequestBody PmsComment entity) {
|
||||
try {
|
||||
if (IPmsCommentService.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:PmsComment:delete')")
|
||||
public Object deletePmsComment(@ApiParam("商品评价表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品评价表id");
|
||||
}
|
||||
if (IPmsCommentService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsComment:read')")
|
||||
public Object getPmsCommentById(@ApiParam("商品评价表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品评价表id");
|
||||
}
|
||||
PmsComment coupon = IPmsCommentService.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:PmsComment:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsCommentService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsCommentReplay;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsCommentReplayService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品评价回复表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsCommentReplayController", description = "产品评价回复表管理")
|
||||
@RequestMapping("/pms/PmsCommentReplay")
|
||||
public class PmsCommentReplayController {
|
||||
@Resource
|
||||
private IPmsCommentReplayService IPmsCommentReplayService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品评价回复表列表")
|
||||
@ApiOperation("根据条件查询所有产品评价回复表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsCommentReplay:read')")
|
||||
public Object getPmsCommentReplayByPage(PmsCommentReplay entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsCommentReplayService.page(new Page<PmsCommentReplay>(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:PmsCommentReplay:create')")
|
||||
public Object savePmsCommentReplay(@RequestBody PmsCommentReplay entity) {
|
||||
try {
|
||||
if (IPmsCommentReplayService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsCommentReplay:update')")
|
||||
public Object updatePmsCommentReplay(@RequestBody PmsCommentReplay entity) {
|
||||
try {
|
||||
if (IPmsCommentReplayService.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:PmsCommentReplay:delete')")
|
||||
public Object deletePmsCommentReplay(@ApiParam("产品评价回复表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品评价回复表id");
|
||||
}
|
||||
if (IPmsCommentReplayService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsCommentReplay:read')")
|
||||
public Object getPmsCommentReplayById(@ApiParam("产品评价回复表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品评价回复表id");
|
||||
}
|
||||
PmsCommentReplay coupon = IPmsCommentReplayService.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:PmsCommentReplay:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsCommentReplayService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsFeightTemplate;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsFeightTemplateService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 运费模版
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsFeightTemplateController", description = "运费模版管理")
|
||||
@RequestMapping("/pms/PmsFeightTemplate")
|
||||
public class PmsFeightTemplateController {
|
||||
@Resource
|
||||
private IPmsFeightTemplateService IPmsFeightTemplateService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有运费模版列表")
|
||||
@ApiOperation("根据条件查询所有运费模版列表")
|
||||
@GetMapping(value = "/list")
|
||||
public Object getPmsFeightTemplateByPage(PmsFeightTemplate entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsFeightTemplateService.page(new Page<PmsFeightTemplate>(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("create_time")));
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有运费模版列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "保存运费模版")
|
||||
@ApiOperation("保存运费模版")
|
||||
@PostMapping(value = "/create")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsFeightTemplate:create')")
|
||||
public Object savePmsFeightTemplate(@RequestBody PmsFeightTemplate entity) {
|
||||
try {
|
||||
entity.setCreateTime(new Date());
|
||||
if (IPmsFeightTemplateService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsFeightTemplate:update')")
|
||||
public Object updatePmsFeightTemplate(@RequestBody PmsFeightTemplate entity) {
|
||||
try {
|
||||
if (IPmsFeightTemplateService.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:PmsFeightTemplate:delete')")
|
||||
public Object deletePmsFeightTemplate(@ApiParam("运费模版id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("运费模版id");
|
||||
}
|
||||
if (IPmsFeightTemplateService.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 getPmsFeightTemplateById(@ApiParam("运费模版id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("运费模版id");
|
||||
}
|
||||
PmsFeightTemplate coupon = IPmsFeightTemplateService.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:PmsFeightTemplate:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsFeightTemplateService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGiftsCategory;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsGiftsCategoryService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助分类表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsGiftsCategoryController", description = "帮助分类表管理")
|
||||
@RequestMapping("/pms/PmsGiftsCategory")
|
||||
public class PmsGiftsCategoryController {
|
||||
@Resource
|
||||
private IPmsGiftsCategoryService IPmsGiftsCategoryService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有帮助分类表列表")
|
||||
@ApiOperation("根据条件查询所有帮助分类表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGiftsCategory:read')")
|
||||
public Object getPmsGiftsCategoryByPage(PmsGiftsCategory entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsGiftsCategoryService.page(new Page<PmsGiftsCategory>(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:PmsGiftsCategory:create')")
|
||||
public Object savePmsGiftsCategory(@RequestBody PmsGiftsCategory entity) {
|
||||
try {
|
||||
if (IPmsGiftsCategoryService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGiftsCategory:update')")
|
||||
public Object updatePmsGiftsCategory(@RequestBody PmsGiftsCategory entity) {
|
||||
try {
|
||||
if (IPmsGiftsCategoryService.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:PmsGiftsCategory:delete')")
|
||||
public Object deletePmsGiftsCategory(@ApiParam("帮助分类表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("帮助分类表id");
|
||||
}
|
||||
if (IPmsGiftsCategoryService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGiftsCategory:read')")
|
||||
public Object getPmsGiftsCategoryById(@ApiParam("帮助分类表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("帮助分类表id");
|
||||
}
|
||||
PmsGiftsCategory coupon = IPmsGiftsCategoryService.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:PmsGiftsCategory:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsGiftsCategoryService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGifts;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsGiftsService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsGiftsController", description = "帮助表管理")
|
||||
@RequestMapping("/pms/PmsGifts")
|
||||
public class PmsGiftsController {
|
||||
@Resource
|
||||
private IPmsGiftsService IPmsGiftsService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有帮助表列表")
|
||||
@ApiOperation("根据条件查询所有帮助表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGifts:read')")
|
||||
public Object getPmsGiftsByPage(PmsGifts entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
if (ValidatorUtils.notEmpty(entity.getTitle())) {
|
||||
return new CommonResult().success(IPmsGiftsService.page(new Page<PmsGifts>(pageNum, pageSize), new QueryWrapper<PmsGifts>(new PmsGifts()).like("title", entity.getTitle())));
|
||||
}
|
||||
return new CommonResult().success(IPmsGiftsService.page(new Page<PmsGifts>(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:PmsGifts:create')")
|
||||
public Object savePmsGifts(@RequestBody PmsGifts entity) {
|
||||
try {
|
||||
entity.setCreateTime(new Date());
|
||||
if (IPmsGiftsService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGifts:update')")
|
||||
public Object updatePmsGifts(@RequestBody PmsGifts entity) {
|
||||
try {
|
||||
if (IPmsGiftsService.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:PmsGifts:delete')")
|
||||
public Object deletePmsGifts(@ApiParam("帮助表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("帮助表id");
|
||||
}
|
||||
if (IPmsGiftsService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsGifts:read')")
|
||||
public Object getPmsGiftsById(@ApiParam("帮助表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("帮助表id");
|
||||
}
|
||||
PmsGifts coupon = IPmsGiftsService.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:PmsGifts:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsGiftsService.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") Long ids,
|
||||
@RequestParam("showStatus") Integer showStatus) {
|
||||
PmsGifts g = new PmsGifts();
|
||||
g.setId(ids);
|
||||
g.setShowStatus(showStatus);
|
||||
if (IPmsGiftsService.updateById(g)) {
|
||||
return new CommonResult().success();
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsMemberPrice;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsMemberPriceService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品会员价格表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsMemberPriceController", description = "商品会员价格表管理")
|
||||
@RequestMapping("/pms/PmsMemberPrice")
|
||||
public class PmsMemberPriceController {
|
||||
@Resource
|
||||
private IPmsMemberPriceService IPmsMemberPriceService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品会员价格表列表")
|
||||
@ApiOperation("根据条件查询所有商品会员价格表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsMemberPrice:read')")
|
||||
public Object getPmsMemberPriceByPage(PmsMemberPrice entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsMemberPriceService.page(new Page<PmsMemberPrice>(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:PmsMemberPrice:create')")
|
||||
public Object savePmsMemberPrice(@RequestBody PmsMemberPrice entity) {
|
||||
try {
|
||||
if (IPmsMemberPriceService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsMemberPrice:update')")
|
||||
public Object updatePmsMemberPrice(@RequestBody PmsMemberPrice entity) {
|
||||
try {
|
||||
if (IPmsMemberPriceService.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:PmsMemberPrice:delete')")
|
||||
public Object deletePmsMemberPrice(@ApiParam("商品会员价格表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品会员价格表id");
|
||||
}
|
||||
if (IPmsMemberPriceService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsMemberPrice:read')")
|
||||
public Object getPmsMemberPriceById(@ApiParam("商品会员价格表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品会员价格表id");
|
||||
}
|
||||
PmsMemberPrice coupon = IPmsMemberPriceService.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:PmsMemberPrice:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsMemberPriceService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.EsShopGoodsGroupMap;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProduct;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsGoodsGroupMapMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeCategoryService;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductAttributeCategoryItem;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品属性分类表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductAttributeCategoryController", description = "产品属性分类表管理")
|
||||
@RequestMapping("/pms/PmsProductAttributeCategory")
|
||||
public class PmsProductAttributeCategoryController {
|
||||
@Resource
|
||||
private IPmsProductAttributeCategoryService IPmsProductAttributeCategoryService;
|
||||
@Resource
|
||||
private PmsGoodsGroupMapMapper shopGoodsGroupMapMapper;
|
||||
|
||||
@Resource
|
||||
private IPmsProductService pmsProductService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品属性分类表列表")
|
||||
@ApiOperation("根据条件查询所有产品属性分类表列表")
|
||||
@GetMapping(value = "/list")
|
||||
public Object getPmsProductAttributeCategoryByPage(PmsProductAttributeCategory entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductAttributeCategoryService.page(new Page<PmsProductAttributeCategory>(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:PmsProductAttributeCategory:create')")
|
||||
public Object create(@RequestParam String name,
|
||||
@RequestParam(value = "pic", required = false) String pic,
|
||||
@RequestParam(value = "showIndex", required = false) Integer showIndex,
|
||||
@RequestParam(value = "style", required = false) Integer style) {
|
||||
try {
|
||||
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
|
||||
productAttributeCategory.setName(name);
|
||||
productAttributeCategory.setShowIndex(showIndex);
|
||||
productAttributeCategory.setStyle(style);
|
||||
productAttributeCategory.setPic(pic);
|
||||
if (IPmsProductAttributeCategoryService.save(productAttributeCategory)) {
|
||||
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 = "/createSingle")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttributeCategory:create')")
|
||||
public Object createSingle(@RequestBody PmsProductAttributeCategory productAttributeCategory) {
|
||||
try {
|
||||
if (IPmsProductAttributeCategoryService.save(productAttributeCategory)) {
|
||||
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:PmsProductAttributeCategory:update')")
|
||||
public Object updatePmsProductAttributeCategory(@PathVariable Long id, @RequestParam String name) {
|
||||
try {
|
||||
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
|
||||
productAttributeCategory.setName(name);
|
||||
productAttributeCategory.setId(id);
|
||||
if (IPmsProductAttributeCategoryService.updateById(productAttributeCategory)) {
|
||||
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:PmsProductAttributeCategory:delete')")
|
||||
public Object deletePmsProductAttributeCategory(@ApiParam("产品属性分类表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品属性分类表id");
|
||||
}
|
||||
if (IPmsProductAttributeCategoryService.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 getPmsProductAttributeCategoryById(@ApiParam("产品属性分类表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品属性分类表id");
|
||||
}
|
||||
PmsProductAttributeCategory coupon = IPmsProductAttributeCategoryService.getById(id);
|
||||
if (coupon != null) {
|
||||
List<EsShopGoodsGroupMap> list = shopGoodsGroupMapMapper.selEsShopGoodsGroupMap(coupon.getId());
|
||||
List<PmsProduct> lists = new ArrayList<PmsProduct>();
|
||||
for (EsShopGoodsGroupMap lis : list) {
|
||||
//根据商品ID查询商品名称、商品图片、商品虚拟库存
|
||||
PmsProduct es = pmsProductService.getById(lis.getGoodsId());
|
||||
if (es != null) {
|
||||
lists.add(es);
|
||||
}
|
||||
}
|
||||
coupon.setListGoods(lists);
|
||||
}
|
||||
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:PmsProductAttributeCategory:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductAttributeCategoryService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "获取所有商品属性分类及其下属性")
|
||||
@ApiOperation("获取所有商品属性分类及其下属性")
|
||||
@RequestMapping(value = "/list/withAttr", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getListWithAttr() {
|
||||
List<PmsProductAttributeCategoryItem> productAttributeCategoryResultList = IPmsProductAttributeCategoryService.getListWithAttr();
|
||||
return new CommonResult().success(productAttributeCategoryResultList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttribute;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.ProductAttrInfo;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品属性参数表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductAttributeController", description = "商品属性参数表管理")
|
||||
@RequestMapping("/pms/PmsProductAttribute")
|
||||
public class PmsProductAttributeController {
|
||||
@Resource
|
||||
private IPmsProductAttributeService IPmsProductAttributeService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品属性参数表列表")
|
||||
@ApiOperation("根据条件查询所有商品属性参数表列表")
|
||||
@GetMapping(value = "/listAll")
|
||||
public Object getPmsProductAttributeByPage(PmsProductAttribute entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductAttributeService.page(new Page<PmsProductAttribute>(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("id")));
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有商品属性参数表列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据分类查询属性列表或参数列表")
|
||||
@ApiOperation("根据分类查询属性列表或参数列表")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性,1表示参数", required = true, paramType = "query", dataType = "integer")})
|
||||
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@PathVariable Long cid,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
PmsProductAttribute entity = new PmsProductAttribute();
|
||||
entity.setProductAttributeCategoryId(cid);
|
||||
entity.setType(type);
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductAttributeService.page(new Page<PmsProductAttribute>(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:PmsProductAttribute:create')")
|
||||
public Object savePmsProductAttribute(@RequestBody PmsProductAttribute entity) {
|
||||
try {
|
||||
if (entity.getType() == null) {
|
||||
return new CommonResult().failed("请选择类型");
|
||||
}
|
||||
if (IPmsProductAttributeService.saveAndUpdate(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存商品属性参数表:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed(e.getMessage());
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "更新商品属性参数表")
|
||||
@ApiOperation("更新商品属性参数表")
|
||||
@PostMapping(value = "/update/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttribute:update')")
|
||||
public Object updatePmsProductAttribute(@RequestBody PmsProductAttribute entity) {
|
||||
try {
|
||||
if (IPmsProductAttributeService.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:PmsProductAttribute:delete')")
|
||||
public Object deletePmsProductAttribute(@ApiParam("商品属性参数表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品属性参数表id");
|
||||
}
|
||||
if (IPmsProductAttributeService.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 getPmsProductAttributeById(@ApiParam("商品属性参数表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品属性参数表id");
|
||||
}
|
||||
PmsProductAttribute coupon = IPmsProductAttributeService.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.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量删除商品属性参数表")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttribute:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductAttributeService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据商品分类的id获取商品属性及属性分类")
|
||||
@ApiOperation("根据商品分类的id获取商品属性及属性分类")
|
||||
@RequestMapping(value = "/attrInfo/{productCategoryId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getAttrInfo(@PathVariable Long productCategoryId) {
|
||||
List<ProductAttrInfo> productAttrInfoList = IPmsProductAttributeService.getProductAttrInfo(productCategoryId);
|
||||
return new CommonResult().success(productAttrInfoList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeValue;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeValueService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 存储产品参数信息的表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductAttributeValueController", description = "存储产品参数信息的表管理")
|
||||
@RequestMapping("/pms/PmsProductAttributeValue")
|
||||
public class PmsProductAttributeValueController {
|
||||
@Resource
|
||||
private IPmsProductAttributeValueService IPmsProductAttributeValueService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有存储产品参数信息的表列表")
|
||||
@ApiOperation("根据条件查询所有存储产品参数信息的表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttributeValue:read')")
|
||||
public Object getPmsProductAttributeValueByPage(PmsProductAttributeValue entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductAttributeValueService.page(new Page<PmsProductAttributeValue>(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:PmsProductAttributeValue:create')")
|
||||
public Object savePmsProductAttributeValue(@RequestBody PmsProductAttributeValue entity) {
|
||||
try {
|
||||
if (IPmsProductAttributeValueService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttributeValue:update')")
|
||||
public Object updatePmsProductAttributeValue(@RequestBody PmsProductAttributeValue entity) {
|
||||
try {
|
||||
if (IPmsProductAttributeValueService.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:PmsProductAttributeValue:delete')")
|
||||
public Object deletePmsProductAttributeValue(@ApiParam("存储产品参数信息的表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("存储产品参数信息的表id");
|
||||
}
|
||||
if (IPmsProductAttributeValueService.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 getPmsProductAttributeValueById(@ApiParam("存储产品参数信息的表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("存储产品参数信息的表id");
|
||||
}
|
||||
PmsProductAttributeValue coupon = IPmsProductAttributeValueService.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:PmsProductAttributeValue:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductAttributeValueService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategoryAttributeRelation;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductCategoryAttributeRelationService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductCategoryAttributeRelationController", description = "产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)管理")
|
||||
@RequestMapping("/pms/PmsProductCategoryAttributeRelation")
|
||||
public class PmsProductCategoryAttributeRelationController {
|
||||
@Resource
|
||||
private IPmsProductCategoryAttributeRelationService IPmsProductCategoryAttributeRelationService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)列表")
|
||||
@ApiOperation("根据条件查询所有产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductCategoryAttributeRelation:read')")
|
||||
public Object getPmsProductCategoryAttributeRelationByPage(PmsProductCategoryAttributeRelation entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductCategoryAttributeRelationService.page(new Page<PmsProductCategoryAttributeRelation>(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:PmsProductCategoryAttributeRelation:create')")
|
||||
public Object savePmsProductCategoryAttributeRelation(@RequestBody PmsProductCategoryAttributeRelation entity) {
|
||||
try {
|
||||
if (IPmsProductCategoryAttributeRelationService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductCategoryAttributeRelation:update')")
|
||||
public Object updatePmsProductCategoryAttributeRelation(@RequestBody PmsProductCategoryAttributeRelation entity) {
|
||||
try {
|
||||
if (IPmsProductCategoryAttributeRelationService.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:PmsProductCategoryAttributeRelation:delete')")
|
||||
public Object deletePmsProductCategoryAttributeRelation(@ApiParam("产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)id");
|
||||
}
|
||||
if (IPmsProductCategoryAttributeRelationService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductCategoryAttributeRelation:read')")
|
||||
public Object getPmsProductCategoryAttributeRelationById(@ApiParam("产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类)id");
|
||||
}
|
||||
PmsProductCategoryAttributeRelation coupon = IPmsProductCategoryAttributeRelationService.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:PmsProductCategoryAttributeRelation:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductCategoryAttributeRelationService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategory;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductCategoryService;
|
||||
import com.yxt.yythmall.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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品分类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@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<PmsProductCategory>(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);
|
||||
return new CommonResult().success(IPmsProductCategoryService.page(new Page<PmsProductCategory>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
}
|
||||
|
||||
// @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<Long> 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<PmsProductCategoryWithChildrenItem> 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<Long> 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductConsult;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductConsultService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品咨询表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductConsultController", description = "产品咨询表管理")
|
||||
@RequestMapping("/pms/PmsProductConsult")
|
||||
public class PmsProductConsultController {
|
||||
@Resource
|
||||
private IPmsProductConsultService IPmsProductConsultService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品咨询表列表")
|
||||
@ApiOperation("根据条件查询所有产品咨询表列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductConsult:read')")
|
||||
public Object getPmsProductConsultByPage(PmsProductConsult entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductConsultService.page(new Page<PmsProductConsult>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有产品咨询表列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "删除产品咨询表")
|
||||
@ApiOperation("删除产品咨询表")
|
||||
@GetMapping(value = "/delete/{id}")
|
||||
public Object deletePmsProductConsult(@ApiParam("产品咨询表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品咨询表id");
|
||||
}
|
||||
if (IPmsProductConsultService.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 getPmsProductConsultById(@ApiParam("产品咨询表id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品咨询表id");
|
||||
}
|
||||
PmsProductConsult coupon = IPmsProductConsultService.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 = "批量删除产品咨询表")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductConsultService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,538 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.enums.ConstansValue;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProduct;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductVertifyRecord;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSkuStock;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductService;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsSkuStockService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductParam;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductResult;
|
||||
//import com.zscat.mallplus.ums.entity.UmsMemberTag;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.IdStatus;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品信息
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductController", description = "商品信息管理")
|
||||
@RequestMapping("/pms/PmsProduct")
|
||||
public class PmsProductController {
|
||||
@Resource
|
||||
private IPmsProductService IPmsProductService;
|
||||
// @Resource
|
||||
// private com.zscat.mallplus.ums.service.IUmsMemberTagService IUmsMemberTagService;
|
||||
@Resource
|
||||
private IPmsSkuStockService skuStockService;
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品信息列表")
|
||||
@ApiOperation("根据条件查询所有商品信息列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:read')")
|
||||
public Object getPmsProductByPage(PmsProduct entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
IPage<PmsProduct> page = null;
|
||||
if (ValidatorUtils.empty(entity.getStatus())) {
|
||||
entity.setStatus(0);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(entity.getKeyword())) {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setPublishStatus(0);
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
} else {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setPublishStatus(0);
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
|
||||
}
|
||||
return new CommonResult().success(page);
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有商品信息列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品信息列表")
|
||||
@ApiOperation("根据条件查询所有商品信息列表")
|
||||
@GetMapping(value = "/listBySku")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:read')")
|
||||
public Object listBySku(PmsProduct entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
IPage<PmsProduct> page = null;
|
||||
if (ValidatorUtils.empty(entity.getStatus())) {
|
||||
entity.setStatus(0);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(entity.getKeyword())) {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setPublishStatus(0);
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
} else {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
|
||||
}
|
||||
if (page.getRecords()!=null && page.getRecords().size()>0){
|
||||
for (PmsProduct product : page.getRecords()) {
|
||||
List<PmsSkuStock> skuStockList = skuStockService.list(new QueryWrapper<PmsSkuStock>().eq("product_id", product.getId()));
|
||||
product.setSkuStockList(skuStockList);
|
||||
}
|
||||
}
|
||||
|
||||
return new CommonResult().success(page);
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有商品信息列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
@ApiOperation("根据商品名称或货号模糊查询")
|
||||
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(String keyword) {
|
||||
List<PmsProduct> productList = IPmsProductService.list(keyword);
|
||||
return new CommonResult().success(productList);
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "保存商品信息")
|
||||
@ApiOperation("保存商品信息")
|
||||
@PostMapping(value = "/create")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:create')")
|
||||
public Object savePmsProduct(@RequestBody PmsProductParam productParam) {
|
||||
try {
|
||||
productParam.setDeleteStatus(1);
|
||||
int count = IPmsProductService.create(productParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存商品信息:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "更新商品信息")
|
||||
@ApiOperation("更新商品信息")
|
||||
@PostMapping(value = "/update/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:update')")
|
||||
public Object updatePmsProduct(@PathVariable Long id, @RequestBody PmsProductParam productParam) {
|
||||
try {
|
||||
int count = IPmsProductService.update(id, productParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("更新商品信息:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "删除商品信息")
|
||||
@ApiOperation("删除商品信息")
|
||||
@GetMapping(value = "/delete/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:delete')")
|
||||
public Object deletePmsProduct(@ApiParam("商品信息id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品信息id");
|
||||
}
|
||||
if (IPmsProductService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:read')")
|
||||
public Object getPmsProductById(@ApiParam("商品信息id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品信息id");
|
||||
}
|
||||
PmsProduct coupon = IPmsProductService.getById(id);
|
||||
// if (ValidatorUtils.notEmpty(coupon.getTags())){
|
||||
// String[] ids = coupon.getTags().split(",");
|
||||
// List<UmsMemberTag> tagList = IUmsMemberTagService.list(new QueryWrapper<UmsMemberTag>().eq("type",2).eq("status",1).in("id",ids));
|
||||
// coupon.setTagList(tagList);
|
||||
// }
|
||||
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:PmsProduct:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据商品id获取商品编辑信息")
|
||||
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据商品id获取商品编辑信息")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:read')")
|
||||
public Object getUpdateInfo(@PathVariable Long id) {
|
||||
PmsProductResult productResult = IPmsProductService.getUpdateInfo(id);
|
||||
// if (ValidatorUtils.notEmpty(productResult.getTags())){
|
||||
// String[] ids = productResult.getTags().split(",");
|
||||
// List<UmsMemberTag> tagList = IUmsMemberTagService.list(new QueryWrapper<UmsMemberTag>().eq("type",2).in("id",ids));
|
||||
// productResult.setTagList(tagList);
|
||||
// }
|
||||
return new CommonResult().success(productResult);
|
||||
}
|
||||
|
||||
@ApiOperation("根据商品id获取审核信息")
|
||||
@RequestMapping(value = "/fetchVList/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "据商品id获取审核信息")
|
||||
public Object fetchVList(@PathVariable Long id) {
|
||||
List<PmsProductVertifyRecord> list = IPmsProductService.getProductVertifyRecord(id);
|
||||
return new CommonResult().success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改审核状态")
|
||||
@RequestMapping(value = "/update/verifyStatus")
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量修改审核状态")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:update')")
|
||||
public Object updateVerifyStatus(@RequestParam("ids") Long ids,
|
||||
@RequestParam("verifyStatus") Integer verifyStatus,
|
||||
@RequestParam("detail") String detail) {
|
||||
int count = IPmsProductService.updateVerifyStatus(ids, verifyStatus, detail);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量上下架")
|
||||
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量上下架")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:update')")
|
||||
public Object updatePublishStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("publishStatus") Integer publishStatus) {
|
||||
int count = IPmsProductService.updatePublishStatus(ids, publishStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量上下架")
|
||||
@RequestMapping(value = "/publishStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量上下架")
|
||||
public Object updatePublishStatu(@RequestBody IdStatus ids, BindingResult result) {
|
||||
PmsProduct product = new PmsProduct();
|
||||
product.setId(ids.getId());
|
||||
product.setPublishStatus(ids.getStatus());
|
||||
Boolean count = IPmsProductService.updateById(product);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量推荐商品")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量推荐商品")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:update')")
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("recommendStatus") Integer recommendStatus) {
|
||||
int count = IPmsProductService.updateRecommendStatus(ids, recommendStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量设为新品")
|
||||
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量设为新品")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:update')")
|
||||
public Object updateNewStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("newStatus") Integer newStatus) {
|
||||
int count = IPmsProductService.updateNewStatus(ids, newStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量设为分销")
|
||||
@RequestMapping(value = "/update/isFenxiao", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量设为分销")
|
||||
public Object updateisFenxiao(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("newStatus") Integer newStatus) {
|
||||
int count = IPmsProductService.updateisFenxiao(ids, newStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量设为会员商品")
|
||||
@RequestMapping(value = "/update/isVip", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量设为会员商品")
|
||||
public Object updateisVip(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("newStatus") Integer newStatus) {
|
||||
int count = IPmsProductService.updateisVip(ids, newStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("批量修改删除状态")
|
||||
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量修改删除状态")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProduct:delete')")
|
||||
public Object updateDeleteStatus(@RequestParam("ids") List<Long> ids,
|
||||
@RequestParam("deleteStatus") Integer deleteStatus) {
|
||||
int count = IPmsProductService.updateDeleteStatus(ids, deleteStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/goods/list")
|
||||
public Object getPmsProductListByPage(PmsProduct entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
IPage<PmsProduct> page = null;
|
||||
if (ValidatorUtils.empty(entity.getStatus())) {
|
||||
entity.setStatus(0);
|
||||
}
|
||||
if (ValidatorUtils.notEmpty(entity.getKeyword())) {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
like("name", entity.getKeyword()).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
} else {
|
||||
if (entity.getStatus() == 1) {
|
||||
entity.setPublishStatus(1);
|
||||
entity.setVerifyStatus(1);
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 2) {
|
||||
entity.setDeleteStatus(1);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
eq("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 3) {
|
||||
entity.setDeleteStatus(1);
|
||||
entity.setPublishStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
gt("stock", 0).orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else if (entity.getStatus() == 4) {
|
||||
entity.setDeleteStatus(0);
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
} else {
|
||||
page = IPmsProductService.page(new Page<PmsProduct>(pageNum, pageSize), new QueryWrapper<PmsProduct>(entity).
|
||||
orderByDesc("create_time").select(ConstansValue.sampleGoodsList));
|
||||
}
|
||||
|
||||
}
|
||||
return new CommonResult().success(page);
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有商品信息列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量上下架")
|
||||
@RequestMapping(value = "/updateReComStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateReComStatus(@RequestBody IdStatus ids, BindingResult result) {
|
||||
PmsProduct product = new PmsProduct();
|
||||
product.setId(ids.getId());
|
||||
if (ids.getType() == 1) { // 1推荐2 上下架 3 审核 4 删除 5 分销 6 会员
|
||||
product.setRecommandStatus(ids.getStatus());
|
||||
} else if (ids.getType() == 2) {
|
||||
product.setPublishStatus(ids.getStatus());
|
||||
} else if (ids.getType() == 3) {
|
||||
product.setVerifyStatus(ids.getStatus());
|
||||
} else if (ids.getType() == 4) {
|
||||
product.setDeleteStatus(ids.getStatus());
|
||||
} else if (ids.getType() == 5) {
|
||||
product.setIsFenxiao(ids.getStatus());
|
||||
} else if (ids.getType() == 6) {
|
||||
product.setIsVip(ids.getStatus());
|
||||
}
|
||||
|
||||
|
||||
Boolean count = IPmsProductService.updateById(product);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductFullReduction;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductFullReductionService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品满减表(只针对同商品)
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductFullReductionController", description = "产品满减表(只针对同商品)管理")
|
||||
@RequestMapping("/pms/PmsProductFullReduction")
|
||||
public class PmsProductFullReductionController {
|
||||
@Resource
|
||||
private IPmsProductFullReductionService IPmsProductFullReductionService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品满减表(只针对同商品)列表")
|
||||
@ApiOperation("根据条件查询所有产品满减表(只针对同商品)列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductFullReduction:read')")
|
||||
public Object getPmsProductFullReductionByPage(PmsProductFullReduction entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductFullReductionService.page(new Page<PmsProductFullReduction>(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:PmsProductFullReduction:create')")
|
||||
public Object savePmsProductFullReduction(@RequestBody PmsProductFullReduction entity) {
|
||||
try {
|
||||
if (IPmsProductFullReductionService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductFullReduction:update')")
|
||||
public Object updatePmsProductFullReduction(@RequestBody PmsProductFullReduction entity) {
|
||||
try {
|
||||
if (IPmsProductFullReductionService.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:PmsProductFullReduction:delete')")
|
||||
public Object deletePmsProductFullReduction(@ApiParam("产品满减表(只针对同商品)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品满减表(只针对同商品)id");
|
||||
}
|
||||
if (IPmsProductFullReductionService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductFullReduction:read')")
|
||||
public Object getPmsProductFullReductionById(@ApiParam("产品满减表(只针对同商品)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品满减表(只针对同商品)id");
|
||||
}
|
||||
PmsProductFullReduction coupon = IPmsProductFullReductionService.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:PmsProductFullReduction:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductFullReductionService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductLadder;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductLadderService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品阶梯价格表(只针对同商品)
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductLadderController", description = "产品阶梯价格表(只针对同商品)管理")
|
||||
@RequestMapping("/pms/PmsProductLadder")
|
||||
public class PmsProductLadderController {
|
||||
@Resource
|
||||
private IPmsProductLadderService IPmsProductLadderService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有产品阶梯价格表(只针对同商品)列表")
|
||||
@ApiOperation("根据条件查询所有产品阶梯价格表(只针对同商品)列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductLadder:read')")
|
||||
public Object getPmsProductLadderByPage(PmsProductLadder entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductLadderService.page(new Page<PmsProductLadder>(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:PmsProductLadder:create')")
|
||||
public Object savePmsProductLadder(@RequestBody PmsProductLadder entity) {
|
||||
try {
|
||||
if (IPmsProductLadderService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductLadder:update')")
|
||||
public Object updatePmsProductLadder(@RequestBody PmsProductLadder entity) {
|
||||
try {
|
||||
if (IPmsProductLadderService.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:PmsProductLadder:delete')")
|
||||
public Object deletePmsProductLadder(@ApiParam("产品阶梯价格表(只针对同商品)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品阶梯价格表(只针对同商品)id");
|
||||
}
|
||||
if (IPmsProductLadderService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductLadder:read')")
|
||||
public Object getPmsProductLadderById(@ApiParam("产品阶梯价格表(只针对同商品)id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("产品阶梯价格表(只针对同商品)id");
|
||||
}
|
||||
PmsProductLadder coupon = IPmsProductLadderService.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:PmsProductLadder:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductLadderService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductOperateLog;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductOperateLogService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductOperateLogController", description = "管理")
|
||||
@RequestMapping("/pms/PmsProductOperateLog")
|
||||
public class PmsProductOperateLogController {
|
||||
@Resource
|
||||
private IPmsProductOperateLogService IPmsProductOperateLogService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有列表")
|
||||
@ApiOperation("根据条件查询所有列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductOperateLog:read')")
|
||||
public Object getPmsProductOperateLogByPage(PmsProductOperateLog entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductOperateLogService.page(new Page<PmsProductOperateLog>(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:PmsProductOperateLog:create')")
|
||||
public Object savePmsProductOperateLog(@RequestBody PmsProductOperateLog entity) {
|
||||
try {
|
||||
if (IPmsProductOperateLogService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductOperateLog:update')")
|
||||
public Object updatePmsProductOperateLog(@RequestBody PmsProductOperateLog entity) {
|
||||
try {
|
||||
if (IPmsProductOperateLogService.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:PmsProductOperateLog:delete')")
|
||||
public Object deletePmsProductOperateLog(@ApiParam("id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("id");
|
||||
}
|
||||
if (IPmsProductOperateLogService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductOperateLog:read')")
|
||||
public Object getPmsProductOperateLogById(@ApiParam("id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("id");
|
||||
}
|
||||
PmsProductOperateLog coupon = IPmsProductOperateLogService.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:PmsProductOperateLog:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductOperateLogService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductVertifyRecord;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductVertifyRecordService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品审核记录
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsProductVertifyRecordController", description = "商品审核记录管理")
|
||||
@RequestMapping("/pms/PmsProductVertifyRecord")
|
||||
public class PmsProductVertifyRecordController {
|
||||
@Resource
|
||||
private IPmsProductVertifyRecordService IPmsProductVertifyRecordService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有商品审核记录列表")
|
||||
@ApiOperation("根据条件查询所有商品审核记录列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductVertifyRecord:read')")
|
||||
public Object getPmsProductVertifyRecordByPage(PmsProductVertifyRecord entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsProductVertifyRecordService.page(new Page<PmsProductVertifyRecord>(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:PmsProductVertifyRecord:create')")
|
||||
public Object savePmsProductVertifyRecord(@RequestBody PmsProductVertifyRecord entity) {
|
||||
try {
|
||||
if (IPmsProductVertifyRecordService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductVertifyRecord:update')")
|
||||
public Object updatePmsProductVertifyRecord(@RequestBody PmsProductVertifyRecord entity) {
|
||||
try {
|
||||
if (IPmsProductVertifyRecordService.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:PmsProductVertifyRecord:delete')")
|
||||
public Object deletePmsProductVertifyRecord(@ApiParam("商品审核记录id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品审核记录id");
|
||||
}
|
||||
if (IPmsProductVertifyRecordService.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}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductVertifyRecord:read')")
|
||||
public Object getPmsProductVertifyRecordById(@ApiParam("商品审核记录id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("商品审核记录id");
|
||||
}
|
||||
PmsProductVertifyRecord coupon = IPmsProductVertifyRecordService.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:PmsProductVertifyRecord:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsProductVertifyRecordService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSkuStock;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsSkuStockService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku的库存
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsSkuStockController", description = "sku的库存管理")
|
||||
@RequestMapping("/pms/PmsSkuStock")
|
||||
public class PmsSkuStockController {
|
||||
@Resource
|
||||
private IPmsSkuStockService IPmsSkuStockService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据条件查询所有sku的库存列表")
|
||||
@ApiOperation("根据条件查询所有sku的库存列表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:read')")
|
||||
public Object getPmsSkuStockByPage(PmsSkuStock entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsSkuStockService.page(new Page<PmsSkuStock>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有sku的库存列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "保存sku的库存")
|
||||
@ApiOperation("保存sku的库存")
|
||||
@PostMapping(value = "/create")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:create')")
|
||||
public Object savePmsSkuStock(@RequestBody PmsSkuStock entity) {
|
||||
try {
|
||||
if (IPmsSkuStockService.save(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存sku的库存:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "更新sku的库存")
|
||||
@ApiOperation("更新sku的库存")
|
||||
@PostMapping(value = "/update/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:update')")
|
||||
public Object updatePmsSkuStock(@RequestBody PmsSkuStock entity) {
|
||||
try {
|
||||
if (IPmsSkuStockService.updateById(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("更新sku的库存:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "删除sku的库存")
|
||||
@ApiOperation("删除sku的库存")
|
||||
@GetMapping(value = "/delete/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:delete')")
|
||||
public Object deletePmsSkuStock(@ApiParam(name = "pid", value = "sku的库存id", required = true) @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("sku的库存id");
|
||||
}
|
||||
if (IPmsSkuStockService.removeById(id)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("删除sku的库存:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "给sku的库存分配sku的库存")
|
||||
@ApiOperation("查询sku的库存明细")
|
||||
@GetMapping(value = "select/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:read')")
|
||||
public Object getPmsSkuStockById(@ApiParam("sku的库存id") @PathVariable Long id, @RequestParam(value = "keyword", required = false) String keyword) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("sku的库存id");
|
||||
}
|
||||
return new CommonResult().success(IPmsSkuStockService.getList(id, keyword));
|
||||
} catch (Exception e) {
|
||||
log.error("查询sku的库存明细:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除sku的库存")
|
||||
@RequestMapping(value = "/delete/batch", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量删除sku的库存")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSkuStock:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsSkuStockService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据商品编号及编号模糊搜索sku库存")
|
||||
@ApiOperation("根据商品编号及编号模糊搜索sku库存")
|
||||
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@PathVariable Long pid, @RequestParam(value = "keyword", required = false) String keyword) {
|
||||
List<PmsSkuStock> skuStockList = IPmsSkuStockService.getList(pid, keyword);
|
||||
return new CommonResult().success(skuStockList);
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量更新库存信息")
|
||||
@ApiOperation("批量更新库存信息")
|
||||
@RequestMapping(value = "/updatePid/{pid}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long pid, @RequestBody List<PmsSkuStock> skuStockList) {
|
||||
int count = IPmsSkuStockService.update(pid, skuStockList);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
// import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSmallNaviconCategory;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsSmallNaviconCategoryService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "PmsSmallNaviconCategoryController", description = "管理")
|
||||
@RequestMapping("/pms/smallNaviconCategory")
|
||||
public class PmsSmallNaviconCategoryController {
|
||||
@Resource
|
||||
private IPmsSmallNaviconCategoryService IPmsSmallNaviconCategoryService;
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "查询pms_small_navicon_category表")
|
||||
@ApiOperation("查询pms_small_navicon_category表")
|
||||
@GetMapping(value = "/list")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:read')")
|
||||
public Object getPmsSmallNaviconCategoryByPage(PmsSmallNaviconCategory entity,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IPmsSmallNaviconCategoryService.page(new Page<PmsSmallNaviconCategory>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
} catch (Exception e) {
|
||||
log.error("分页获取pms_small_navicon_category列表:%s", e.getMessage(), e);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "保存pms_small_navicon_category表")
|
||||
@ApiOperation("保存pms_small_navicon_category表")
|
||||
@PostMapping(value = "/create")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:create')")
|
||||
public Object saveSmallNaviconCategory(@RequestBody PmsSmallNaviconCategory entity) {
|
||||
try {
|
||||
if (IPmsSmallNaviconCategoryService.save(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存pms_small_navicon_category表:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "更新pms_small_navicon_category")
|
||||
@ApiOperation("更新pms_small_navicon_category")
|
||||
@PostMapping(value = "/update/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:update')")
|
||||
public Object updateSmallNaviconCategory(@RequestBody PmsSmallNaviconCategory entity) {
|
||||
try {
|
||||
if (IPmsSmallNaviconCategoryService.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 = "删除pms_small_navicon_category数据")
|
||||
@ApiOperation("删除小程序首页nav管理数据")
|
||||
@GetMapping(value = "/delete/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:delete')")
|
||||
public Object deleteRole(@ApiParam("小程序首页nav管理_id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("PmsSmallNaviconCategory_id");
|
||||
}
|
||||
if (IPmsSmallNaviconCategoryService.removeById(id)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("删除小程序首页nav管理数据:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
// @SysLog(MODULE = "pms", REMARK = "根据ID查询pms_small_navicon_category")
|
||||
@ApiOperation("根据ID查询pms_small_navicon_category")
|
||||
@GetMapping(value = "/{id}")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:read')")
|
||||
public Object getRoleById(@ApiParam("小程序首页nav管理_id") @PathVariable Long id) {
|
||||
try {
|
||||
if (ValidatorUtils.empty(id)) {
|
||||
return new CommonResult().paramFailed("PmsSmallNaviconCategory_id");
|
||||
}
|
||||
PmsSmallNaviconCategory pmsSmallNaviconCategory = IPmsSmallNaviconCategoryService.getById(id);
|
||||
return new CommonResult().success(pmsSmallNaviconCategory);
|
||||
} catch (Exception e) {
|
||||
log.error("pms_small_navicon_category表明细:%s", e.getMessage(), e);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除PmsSmallNaviconCategory表")
|
||||
@RequestMapping(value = "/delete/batch", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
// @SysLog(MODULE = "pms", REMARK = "批量删除PmsSmallNaviconCategory表")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsSmallNaviconCategory:delete')")
|
||||
public Object deleteBatch(@RequestParam("ids") List<Long> ids) {
|
||||
boolean count = IPmsSmallNaviconCategoryService.removeByIds(ids);
|
||||
if (count) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbumPic;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 画册图片表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsAlbumPicService extends IService<PmsAlbumPic> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbum;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 相册表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsAlbumService extends IService<PmsAlbum> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsBrand;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 品牌表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsBrandService extends IService<PmsBrand> {
|
||||
|
||||
int updateShowStatus(List<Long> ids, Integer showStatus);
|
||||
|
||||
int updateFactoryStatus(List<Long> ids, Integer factoryStatus);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsCommentReplay;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品评价回复表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsCommentReplayService extends IService<PmsCommentReplay> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsComment;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品评价表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsCommentService extends IService<PmsComment> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsFeightTemplate;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 运费模版 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsFeightTemplateService extends IService<PmsFeightTemplate> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGiftsCategory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助分类表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
public interface IPmsGiftsCategoryService extends IService<PmsGiftsCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGifts;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
public interface IPmsGiftsService extends IService<PmsGifts> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsMemberPrice;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品会员价格表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsMemberPriceService extends IService<PmsMemberPrice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductAttributeCategoryItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品属性分类表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductAttributeCategoryService extends IService<PmsProductAttributeCategory> {
|
||||
|
||||
List<PmsProductAttributeCategoryItem> getListWithAttr();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttribute;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.ProductAttrInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品属性参数表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductAttributeService extends IService<PmsProductAttribute> {
|
||||
|
||||
List<ProductAttrInfo> getProductAttrInfo(Long productCategoryId);
|
||||
|
||||
boolean saveAndUpdate(PmsProductAttribute entity);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeValue;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 存储产品参数信息的表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductAttributeValueService extends IService<PmsProductAttributeValue> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategoryAttributeRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductCategoryAttributeRelationService extends IService<PmsProductCategoryAttributeRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductCategoryWithChildrenItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品分类 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductCategoryService extends IService<PmsProductCategory> {
|
||||
|
||||
List<PmsProductCategoryWithChildrenItem> listWithChildren();
|
||||
|
||||
int updateNavStatus(List<Long> ids, Integer navStatus);
|
||||
|
||||
int updateShowStatus(List<Long> ids, Integer showStatus);
|
||||
|
||||
int updateIndexStatus(List<Long> ids, Integer indexStatus);
|
||||
|
||||
boolean updateAnd(PmsProductCategory entity);
|
||||
|
||||
boolean saveAnd(PmsProductCategory entity);
|
||||
|
||||
int selectCountByNameAndLevel(Long parentId, String name);
|
||||
|
||||
int selectCountByNameAndLevelId(Long parentId, String name, Long id);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductConsult;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品咨询表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductConsultService extends IService<PmsProductConsult> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductFullReduction;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品满减表(只针对同商品) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductFullReductionService extends IService<PmsProductFullReduction> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductLadder;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品阶梯价格表(只针对同商品) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductLadderService extends IService<PmsProductLadder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductOperateLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductOperateLogService extends IService<PmsProductOperateLog> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProduct;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductVertifyRecord;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductParam;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductResult;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductService extends IService<PmsProduct> {
|
||||
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
|
||||
int create(PmsProductParam productParam);
|
||||
|
||||
/**
|
||||
* 根据商品编号获取更新信息
|
||||
*/
|
||||
PmsProductResult getUpdateInfo(Long id);
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
*/
|
||||
@Transactional
|
||||
int update(Long id, PmsProductParam productParam);
|
||||
|
||||
/**
|
||||
* 批量修改审核状态
|
||||
*
|
||||
* @param ids 产品id
|
||||
* @param verifyStatus 审核状态
|
||||
* @param detail 审核详情
|
||||
*/
|
||||
@Transactional
|
||||
int updateVerifyStatus(Long ids, Integer verifyStatus, String detail);
|
||||
|
||||
/**
|
||||
* 批量修改商品上架状态
|
||||
*/
|
||||
int updatePublishStatus(List<Long> ids, Integer publishStatus);
|
||||
|
||||
/**
|
||||
* 批量修改商品推荐状态
|
||||
*/
|
||||
int updateRecommendStatus(List<Long> ids, Integer recommendStatus);
|
||||
|
||||
/**
|
||||
* 批量修改新品状态
|
||||
*/
|
||||
int updateNewStatus(List<Long> ids, Integer newStatus);
|
||||
|
||||
int updateisFenxiao(List<Long> ids, Integer newStatus);
|
||||
|
||||
/**
|
||||
* 批量删除商品
|
||||
*/
|
||||
int updateDeleteStatus(List<Long> ids, Integer deleteStatus);
|
||||
|
||||
/**
|
||||
* 根据商品名称或者货号模糊查询
|
||||
*/
|
||||
List<PmsProduct> list(String keyword);
|
||||
|
||||
List<PmsProductVertifyRecord> getProductVertifyRecord(Long id);
|
||||
|
||||
int updateisVip(List<Long> ids, Integer newStatus);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductVertifyRecord;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品审核记录 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsProductVertifyRecordService extends IService<PmsProductVertifyRecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSkuStock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku的库存 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
public interface IPmsSkuStockService extends IService<PmsSkuStock> {
|
||||
/**
|
||||
* 根据产品id和skuCode模糊搜索
|
||||
*/
|
||||
List<PmsSkuStock> getList(Long pid, String keyword);
|
||||
|
||||
/**
|
||||
* 批量更新商品库存信息
|
||||
*/
|
||||
int update(Long pid, List<PmsSkuStock> skuStockList);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSmallNaviconCategory;
|
||||
|
||||
/**
|
||||
* 小程序首页nav管理
|
||||
*
|
||||
* @author zscat
|
||||
* @email 951449465@qq.com
|
||||
* @date 2019-05-08 00:09:37
|
||||
*/
|
||||
|
||||
public interface IPmsSmallNaviconCategoryService extends IService<PmsSmallNaviconCategory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbumPic;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsAlbumPicMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsAlbumPicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 画册图片表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsAlbumPicServiceImpl extends ServiceImpl<PmsAlbumPicMapper, PmsAlbumPic> implements IPmsAlbumPicService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsAlbum;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsAlbumMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsAlbumService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 相册表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsAlbumServiceImpl extends ServiceImpl<PmsAlbumMapper, PmsAlbum> implements IPmsAlbumService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsBrand;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsBrandMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsBrandService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 品牌表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsBrandServiceImpl extends ServiceImpl<PmsBrandMapper, PmsBrand> implements IPmsBrandService {
|
||||
@Resource
|
||||
private PmsBrandMapper brandMapper;
|
||||
|
||||
@Override
|
||||
public int updateShowStatus(List<Long> ids, Integer showStatus) {
|
||||
PmsBrand pmsBrand = new PmsBrand();
|
||||
pmsBrand.setShowStatus(showStatus);
|
||||
return brandMapper.update(pmsBrand, new QueryWrapper<PmsBrand>().in("id", ids));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFactoryStatus(List<Long> ids, Integer factoryStatus) {
|
||||
PmsBrand pmsBrand = new PmsBrand();
|
||||
pmsBrand.setFactoryStatus(factoryStatus);
|
||||
return brandMapper.update(pmsBrand, new QueryWrapper<PmsBrand>().in("id", ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsCommentReplay;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsCommentReplayMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsCommentReplayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品评价回复表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsCommentReplayServiceImpl extends ServiceImpl<PmsCommentReplayMapper, PmsCommentReplay> implements IPmsCommentReplayService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsComment;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsCommentMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsCommentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品评价表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsCommentServiceImpl extends ServiceImpl<PmsCommentMapper, PmsComment> implements IPmsCommentService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsFeightTemplate;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsFeightTemplateMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsFeightTemplateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 运费模版 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsFeightTemplateServiceImpl extends ServiceImpl<PmsFeightTemplateMapper, PmsFeightTemplate> implements IPmsFeightTemplateService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGiftsCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsGiftsCategoryMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsGiftsCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助分类表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Service
|
||||
public class PmsGiftsCategoryServiceImpl extends ServiceImpl<PmsGiftsCategoryMapper, PmsGiftsCategory> implements IPmsGiftsCategoryService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsGifts;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsGiftsMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsGiftsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Service
|
||||
public class PmsGiftsServiceImpl extends ServiceImpl<PmsGiftsMapper, PmsGifts> implements IPmsGiftsService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsMemberPrice;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsMemberPriceMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsMemberPriceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品会员价格表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsMemberPriceServiceImpl extends ServiceImpl<PmsMemberPriceMapper, PmsMemberPrice> implements IPmsMemberPriceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductAttributeCategoryMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeCategoryService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductAttributeCategoryItem;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品属性分类表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductAttributeCategoryServiceImpl extends ServiceImpl<PmsProductAttributeCategoryMapper, PmsProductAttributeCategory> implements IPmsProductAttributeCategoryService {
|
||||
|
||||
@Resource
|
||||
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
|
||||
|
||||
@Override
|
||||
public List<PmsProductAttributeCategoryItem> getListWithAttr() {
|
||||
return productAttributeCategoryMapper.getListWithAttr();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zscat.mallplus.exception.BusinessMallException;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttribute;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductAttributeCategoryMapper;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductAttributeMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.ProductAttrInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品属性参数表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductAttributeServiceImpl extends ServiceImpl<PmsProductAttributeMapper, PmsProductAttribute> implements IPmsProductAttributeService {
|
||||
|
||||
@Resource
|
||||
private PmsProductAttributeMapper productAttributeMapper;
|
||||
@Resource
|
||||
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
|
||||
|
||||
@Override
|
||||
public List<ProductAttrInfo> getProductAttrInfo(Long productCategoryId) {
|
||||
return productAttributeMapper.getProductAttrInfo(productCategoryId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean saveAndUpdate(PmsProductAttribute entity) {
|
||||
int count = productAttributeMapper.selectCount(new QueryWrapper<PmsProductAttribute>().eq("product_attribute_category_id", entity.getProductAttributeCategoryId()).eq("type", entity.getType()));
|
||||
if (count >= 3) {
|
||||
throw new BusinessMallException("规格或者属性数量不能超过3个");
|
||||
}
|
||||
productAttributeMapper.insert(entity);
|
||||
//新增商品属性以后需要更新商品属性分类数量
|
||||
|
||||
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectById(entity.getProductAttributeCategoryId());
|
||||
if (entity.getType() == 0) {
|
||||
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount() + 1);
|
||||
} else if (entity.getType() == 1) {
|
||||
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount() + 1);
|
||||
}
|
||||
productAttributeCategoryMapper.updateById(pmsProductAttributeCategory);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductAttributeValue;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductAttributeValueMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductAttributeValueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 存储产品参数信息的表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductAttributeValueServiceImpl extends ServiceImpl<PmsProductAttributeValueMapper, PmsProductAttributeValue> implements IPmsProductAttributeValueService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategoryAttributeRelation;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductCategoryAttributeRelationMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductCategoryAttributeRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品的分类和属性的关系表,用于设置分类筛选条件(只支持一级分类) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductCategoryAttributeRelationServiceImpl extends ServiceImpl<PmsProductCategoryAttributeRelationMapper, PmsProductCategoryAttributeRelation> implements IPmsProductCategoryAttributeRelationService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProduct;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductCategoryAttributeRelation;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductCategoryAttributeRelationMapper;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductCategoryMapper;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductCategoryAttributeRelationService;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductCategoryService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductCategoryWithChildrenItem;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品分类 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductCategoryServiceImpl extends ServiceImpl<PmsProductCategoryMapper, PmsProductCategory> implements IPmsProductCategoryService {
|
||||
|
||||
@Resource
|
||||
private PmsProductCategoryMapper categoryMapper;
|
||||
@Resource
|
||||
private PmsProductMapper productMapper;
|
||||
@Resource
|
||||
private IPmsProductCategoryAttributeRelationService pmsProductCategoryAttributeRelationService;
|
||||
@Resource
|
||||
private PmsProductCategoryAttributeRelationMapper productCategoryAttributeRelationMapper;
|
||||
|
||||
@Override
|
||||
public List<PmsProductCategoryWithChildrenItem> listWithChildren() {
|
||||
return categoryMapper.listWithChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateNavStatus(List<Long> ids, Integer navStatus) {
|
||||
PmsProductCategory productCategory = new PmsProductCategory();
|
||||
productCategory.setNavStatus(navStatus);
|
||||
return categoryMapper.update(productCategory, new QueryWrapper<PmsProductCategory>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateShowStatus(List<Long> ids, Integer showStatus) {
|
||||
PmsProductCategory productCategory = new PmsProductCategory();
|
||||
productCategory.setShowStatus(showStatus);
|
||||
return categoryMapper.update(productCategory, new QueryWrapper<PmsProductCategory>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateIndexStatus(List<Long> ids, Integer indexStatus) {
|
||||
PmsProductCategory productCategory = new PmsProductCategory();
|
||||
productCategory.setIndexStatus(indexStatus);
|
||||
return categoryMapper.update(productCategory, new QueryWrapper<PmsProductCategory>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAnd(PmsProductCategory entity) {
|
||||
PmsProductCategory productCategory = new PmsProductCategory();
|
||||
setCategoryLevel(entity);
|
||||
//更新商品分类时要更新商品中的名称
|
||||
PmsProduct product = new PmsProduct();
|
||||
product.setProductCategoryName(entity.getName());
|
||||
|
||||
productMapper.update(product, new QueryWrapper<PmsProduct>().eq("product_category_id", entity.getId()));
|
||||
//同时更新筛选属性的信息
|
||||
if (!CollectionUtils.isEmpty(entity.getProductAttributeIdList())) {
|
||||
|
||||
productCategoryAttributeRelationMapper.delete(new QueryWrapper<>(new PmsProductCategoryAttributeRelation()).eq("product_category_id", entity.getId()));
|
||||
insertRelationList(entity.getId(), entity.getProductAttributeIdList());
|
||||
} else {
|
||||
productCategoryAttributeRelationMapper.delete(new QueryWrapper<>(new PmsProductCategoryAttributeRelation()).eq("product_category_id", entity.getId()));
|
||||
|
||||
}
|
||||
categoryMapper.updateById(entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveAnd(PmsProductCategory entity) {
|
||||
PmsProductCategory productCategory = new PmsProductCategory();
|
||||
productCategory.setProductCount(0);
|
||||
BeanUtils.copyProperties(entity, productCategory);
|
||||
//没有父分类时为一级分类
|
||||
setCategoryLevel(productCategory);
|
||||
int count = categoryMapper.insert(productCategory);
|
||||
//创建筛选属性关联
|
||||
List<Long> productAttributeIdList = entity.getProductAttributeIdList();
|
||||
if (!CollectionUtils.isEmpty(productAttributeIdList)) {
|
||||
insertRelationList(productCategory.getId(), productAttributeIdList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCountByNameAndLevel(Long parentId, String name) {
|
||||
return baseMapper.selectCountByNameAndLevel(parentId,name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCountByNameAndLevelId(Long parentId, String name, Long id) {
|
||||
return baseMapper.selectCountByNameAndLevelId(parentId,name,id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入商品分类与筛选属性关系表
|
||||
*
|
||||
* @param productCategoryId 商品分类id
|
||||
* @param productAttributeIdList 相关商品筛选属性id集合
|
||||
*/
|
||||
private void insertRelationList(Long productCategoryId, List<Long> productAttributeIdList) {
|
||||
List<PmsProductCategoryAttributeRelation> relationList = new ArrayList<>();
|
||||
for (Long productAttrId : productAttributeIdList) {
|
||||
PmsProductCategoryAttributeRelation relation = new PmsProductCategoryAttributeRelation();
|
||||
relation.setProductAttributeId(productAttrId);
|
||||
relation.setProductCategoryId(productCategoryId);
|
||||
relationList.add(relation);
|
||||
}
|
||||
pmsProductCategoryAttributeRelationService.saveBatch(relationList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类的parentId设置分类的level
|
||||
*/
|
||||
private void setCategoryLevel(PmsProductCategory productCategory) {
|
||||
//没有父分类时为一级分类
|
||||
if (productCategory.getParentId() == null || productCategory.getParentId() == 0) {
|
||||
productCategory.setLevel(0);
|
||||
} else {
|
||||
//有父分类时选择根据父分类level设置
|
||||
PmsProductCategory parentCategory = categoryMapper.selectById(productCategory.getParentId());
|
||||
if (parentCategory != null) {
|
||||
productCategory.setLevel(parentCategory.getLevel() + 1);
|
||||
} else {
|
||||
productCategory.setLevel(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductConsult;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductConsultMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductConsultService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品咨询表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductConsultServiceImpl extends ServiceImpl<PmsProductConsultMapper, PmsProductConsult> implements IPmsProductConsultService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductFullReduction;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductFullReductionMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductFullReductionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品满减表(只针对同商品) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductFullReductionServiceImpl extends ServiceImpl<PmsProductFullReductionMapper, PmsProductFullReduction> implements IPmsProductFullReductionService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductLadder;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductLadderMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductLadderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品阶梯价格表(只针对同商品) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductLadderServiceImpl extends ServiceImpl<PmsProductLadderMapper, PmsProductLadder> implements IPmsProductLadderService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductOperateLog;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductOperateLogMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductOperateLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductOperateLogServiceImpl extends ServiceImpl<PmsProductOperateLogMapper, PmsProductOperateLog> implements IPmsProductOperateLogService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
//import com.zscat.mallplus.cms.service.ICmsPrefrenceAreaProductRelationService;
|
||||
//import com.zscat.mallplus.cms.service.ICmsSubjectProductRelationService;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.*;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.*;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.*;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductParam;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.vo.PmsProductResult;
|
||||
//import com.zscat.mallplus.sys.entity.SysUser;
|
||||
//import com.zscat.mallplus.ums.service.RedisService;
|
||||
import com.yxt.yythmall.mallplus.biz.util.DateUtils;
|
||||
import com.yxt.yythmall.mallplus.biz.util.JsonUtil;
|
||||
import com.yxt.yythmall.mallplus.biz.util.UserUtils;
|
||||
import com.zscat.mallplus.utils.IdWorker;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import com.zscat.mallplus.vo.Rediskey;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PmsProductServiceImpl extends ServiceImpl<PmsProductMapper, PmsProduct> implements IPmsProductService {
|
||||
|
||||
@Resource
|
||||
private PmsProductMapper productMapper;
|
||||
@Resource
|
||||
private IPmsMemberPriceService memberPriceDao;
|
||||
@Resource
|
||||
private PmsMemberPriceMapper memberPriceMapper;
|
||||
@Resource
|
||||
private IPmsProductLadderService productLadderDao;
|
||||
@Resource
|
||||
private PmsProductLadderMapper productLadderMapper;
|
||||
@Resource
|
||||
private IPmsProductFullReductionService productFullReductionDao;
|
||||
@Resource
|
||||
private PmsProductFullReductionMapper productFullReductionMapper;
|
||||
@Resource
|
||||
private IPmsSkuStockService skuStockDao;
|
||||
@Resource
|
||||
private PmsSkuStockMapper skuStockMapper;
|
||||
@Resource
|
||||
private IPmsProductAttributeValueService productAttributeValueDao;
|
||||
@Resource
|
||||
private PmsProductAttributeValueMapper productAttributeValueMapper;
|
||||
// @Resource
|
||||
// private ICmsSubjectProductRelationService subjectProductRelationDao;
|
||||
@Resource
|
||||
private CmsSubjectProductRelationMapper subjectProductRelationMapper;
|
||||
// @Resource
|
||||
// private ICmsPrefrenceAreaProductRelationService prefrenceAreaProductRelationDao;
|
||||
@Resource
|
||||
private CmsPrefrenceAreaProductRelationMapper prefrenceAreaProductRelationMapper;
|
||||
|
||||
@Resource
|
||||
private PmsProductVertifyRecordMapper productVertifyRecordDao;
|
||||
|
||||
@Resource
|
||||
private PmsProductVertifyRecordMapper productVertifyRecordMapper;
|
||||
// @Resource
|
||||
// private RedisService redisService;
|
||||
|
||||
@Override
|
||||
public int create(PmsProductParam productParam) {
|
||||
int count;
|
||||
//创建商品
|
||||
PmsProduct product = productParam;
|
||||
product.setCreateTime(new Date());
|
||||
product.setId(null);
|
||||
//处理sku的编码
|
||||
handleSkuStockCode(productParam.getSkuStockList(), product);
|
||||
if (ValidatorUtils.isEmpty(product.getProductSn())) {
|
||||
product.setProductSn(IdWorker.getId() + "");
|
||||
}
|
||||
if (ValidatorUtils.empty(product.getExpireTime())) {
|
||||
product.setExpireTime(DateUtils.strToDate(DateUtils.addDay(new Date(), 5)));
|
||||
}
|
||||
if (ValidatorUtils.empty(product.getOriginalPrice())) {
|
||||
product.setOriginalPrice(product.getPrice());
|
||||
}
|
||||
if (ValidatorUtils.empty(product.getUnit())) {
|
||||
product.setUnit("件");
|
||||
}
|
||||
// SysUser user = UserUtils.getCurrentMember();
|
||||
// product.setStoreName(user.getStoreName());
|
||||
//product.setStoreId(user.getStoreId());
|
||||
if (ValidatorUtils.empty(product.getAlbumPics())) {
|
||||
product.setAlbumPics(product.getPic());
|
||||
}
|
||||
/* Long[] tagList = productParam.getTagLists();
|
||||
String tags=null;
|
||||
if(tagList!=null && tagList.length>0){
|
||||
for (Long tag:tagList){
|
||||
tags=tags+tag+",";
|
||||
}
|
||||
tags.substring(0,tags.length()-1);
|
||||
}
|
||||
product.setTags(tags);*/
|
||||
productMapper.insert(product);
|
||||
//根据促销类型设置价格:、阶梯价格、满减价格
|
||||
Long productId = product.getId();
|
||||
//会员价格
|
||||
// relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), productId);
|
||||
//阶梯价格
|
||||
// relateAndInsertList(productLadderDao, productParam.getProductLadderList(), productId);
|
||||
//满减价格
|
||||
// relateAndInsertList(productFullReductionDao, productParam.getProductFullReductionList(), productId);
|
||||
|
||||
//添加sku库存信息
|
||||
relateAndInsertList(skuStockDao, productParam.getSkuStockList(), productId);
|
||||
//添加商品参数,添加自定义商品规格
|
||||
relateAndInsertList(productAttributeValueDao, productParam.getProductAttributeValueList(), productId);
|
||||
//关联专题
|
||||
// relateAndInsertList(subjectProductRelationDao, productParam.getSubjectProductRelationList(), productId);
|
||||
//关联优选
|
||||
// relateAndInsertList(prefrenceAreaProductRelationDao, productParam.getPrefrenceAreaProductRelationList(), productId);
|
||||
//关联专题
|
||||
|
||||
// if (!CollectionUtils.isEmpty(productParam.getSubjectProductRelationList())) {
|
||||
// for (CmsSubjectProductRelation relation : productParam.getSubjectProductRelationList()) {
|
||||
// relation.setProductId(productId);
|
||||
// subjectProductRelationDao.save(relation);
|
||||
// }
|
||||
// }
|
||||
// //关联优选
|
||||
// if (!CollectionUtils.isEmpty(productParam.getPrefrenceAreaProductRelationList())) {
|
||||
// for (CmsPrefrenceAreaProductRelation relation : productParam.getPrefrenceAreaProductRelationList()) {
|
||||
// relation.setProductId(productId);
|
||||
// prefrenceAreaProductRelationDao.save(relation);
|
||||
// }
|
||||
// }
|
||||
count = 1;
|
||||
// redisService.set(String.format(Rediskey.GOODSDETAIL, product.getId()), JsonUtil.objectToJson(productParam));
|
||||
return count;
|
||||
}
|
||||
|
||||
private void handleSkuStockCode(List<PmsSkuStock> skuStockList, PmsProduct product) {
|
||||
if (CollectionUtils.isEmpty(skuStockList)) return;
|
||||
int stock = 0;
|
||||
for (int i = 0; i < skuStockList.size(); i++) {
|
||||
PmsSkuStock skuStock = skuStockList.get(i);
|
||||
skuStock.setProductName(product.getName());
|
||||
if (StringUtils.isEmpty(skuStock.getSkuCode())) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//日期
|
||||
sb.append(sdf.format(new Date()));
|
||||
//四位商品id
|
||||
sb.append(String.format("%04d", product.getProductCategoryId()));
|
||||
//三位索引id
|
||||
sb.append(String.format("%03d", i + 1));
|
||||
skuStock.setSkuCode(sb.toString());
|
||||
}
|
||||
if (skuStock.getStock() != null && skuStock.getStock() > 0) {
|
||||
stock = stock + skuStock.getStock();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
product.setStock(stock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PmsProductResult getUpdateInfo(Long id) {
|
||||
return productMapper.getUpdateInfo(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Long id, PmsProductParam productParam) {
|
||||
|
||||
int count;
|
||||
//更新商品信息
|
||||
PmsProduct product = productParam;
|
||||
product.setId(id);
|
||||
if (ValidatorUtils.isEmpty(product.getProductSn())) {
|
||||
product.setProductSn(IdWorker.getId() + "");
|
||||
}
|
||||
handleSkuStockCode(productParam.getSkuStockList(), product);
|
||||
/* Long[] tagList = productParam.getTagLists();
|
||||
String tags=null;
|
||||
if(tagList!=null && tagList.length>0){
|
||||
for (Long tag:tagList){
|
||||
tags=tags+tag+",";
|
||||
}
|
||||
tags.substring(0,tags.length()-1);
|
||||
}
|
||||
product.setTags(tags);*/
|
||||
productMapper.updateById(product);
|
||||
// redisService.remove(String.format(Rediskey.GOODSDETAIL, product.getId()));
|
||||
//会员价格
|
||||
// memberPriceMapper.delete(new QueryWrapper<>(new PmsMemberPrice()).eq("product_id", id));
|
||||
// relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), id);
|
||||
//阶梯价格
|
||||
|
||||
productLadderMapper.delete(new QueryWrapper<>(new PmsProductLadder()).eq("product_id", id));
|
||||
relateAndInsertList(productLadderDao, productParam.getProductLadderList(), id);
|
||||
//满减价格
|
||||
|
||||
productFullReductionMapper.delete(new QueryWrapper<>(new PmsProductFullReduction()).eq("product_id", id));
|
||||
relateAndInsertList(productFullReductionDao, productParam.getProductFullReductionList(), id);
|
||||
//修改sku库存信息
|
||||
skuStockMapper.delete(new QueryWrapper<>(new PmsSkuStock()).eq("product_id", id));
|
||||
|
||||
relateAndInsertList(skuStockDao, productParam.getSkuStockList(), id);
|
||||
//修改商品参数,添加自定义商品规格
|
||||
|
||||
productAttributeValueMapper.delete(new QueryWrapper<>(new PmsProductAttributeValue()).eq("product_id", id));
|
||||
relateAndInsertList(productAttributeValueDao, productParam.getProductAttributeValueList(), id);
|
||||
|
||||
//关联专题
|
||||
subjectProductRelationMapper.delete(new QueryWrapper<>(new CmsSubjectProductRelation()).eq("product_id", id));
|
||||
// relateAndInsertList(subjectProductRelationDao, productParam.getSubjectProductRelationList(), id);
|
||||
// if (!CollectionUtils.isEmpty(productParam.getSubjectProductRelationList())) {
|
||||
// for (CmsSubjectProductRelation relation : productParam.getSubjectProductRelationList()) {
|
||||
// relation.setProductId(id);
|
||||
// subjectProductRelationDao.save(relation);
|
||||
// }
|
||||
// }
|
||||
//关联优选
|
||||
|
||||
prefrenceAreaProductRelationMapper.delete(new QueryWrapper<>(new CmsPrefrenceAreaProductRelation()).eq("product_id", id));
|
||||
// relateAndInsertList(prefrenceAreaProductRelationDao, productParam.getPrefrenceAreaProductRelationList(), id);
|
||||
// if (!CollectionUtils.isEmpty(productParam.getPrefrenceAreaProductRelationList())) {
|
||||
// for (CmsPrefrenceAreaProductRelation relation : productParam.getPrefrenceAreaProductRelationList()) {
|
||||
// relation.setProductId(id);
|
||||
// prefrenceAreaProductRelationDao.save(relation);
|
||||
// }
|
||||
// }
|
||||
count = 1;
|
||||
|
||||
// redisService.set(String.format(Rediskey.GOODSDETAIL, product.getId()), JsonUtil.objectToJson(productParam));
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateVerifyStatus(Long ids, Integer verifyStatus, String detail) {
|
||||
PmsProduct product = new PmsProduct();
|
||||
product.setVerifyStatus(verifyStatus);
|
||||
int count = productMapper.update(product, new QueryWrapper<PmsProduct>().eq("id", ids));
|
||||
//修改完审核状态后插入审核记录
|
||||
|
||||
PmsProductVertifyRecord record = new PmsProductVertifyRecord();
|
||||
record.setProductId(ids);
|
||||
record.setCreateTime(new Date());
|
||||
record.setDetail(detail);
|
||||
record.setStatus(verifyStatus);
|
||||
// record.setVertifyMan(UserUtils.getCurrentMember().getUsername());
|
||||
productVertifyRecordMapper.insert(record);
|
||||
// redisService.remove(String.format(Rediskey.GOODSDETAIL, product.getId()));
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateisFenxiao(List<Long> ids, Integer newStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setIsFenxiao(newStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateisVip(List<Long> ids, Integer newStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setIsVip(newStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePublishStatus(List<Long> ids, Integer publishStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setPublishStatus(publishStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
public void clerGoodsRedis(List<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
// redisService.remove(String.format(Rediskey.GOODSDETAIL, id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRecommendStatus(List<Long> ids, Integer recommendStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setRecommandStatus(recommendStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateNewStatus(List<Long> ids, Integer newStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setNewStatus(newStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDeleteStatus(List<Long> ids, Integer deleteStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
record.setDeleteStatus(deleteStatus);
|
||||
clerGoodsRedis(ids);
|
||||
return productMapper.update(record, new QueryWrapper<PmsProduct>().in("id", ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> list(String keyword) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("delete_status", 1);
|
||||
|
||||
if (!StringUtils.isEmpty(keyword)) {
|
||||
queryWrapper.like("name", keyword);
|
||||
|
||||
}
|
||||
return productMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProductVertifyRecord> getProductVertifyRecord(Long id) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("product_id", id);
|
||||
|
||||
return productVertifyRecordMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 建立和插入关系表操作
|
||||
*
|
||||
* @param dao 可以操作的dao
|
||||
* @param dataList 要插入的数据
|
||||
* @param productId 建立关系的id
|
||||
*/
|
||||
private void relateAndInsertList(Object dao, List dataList, Long productId) {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(dataList)) return;
|
||||
for (Object item : dataList) {
|
||||
Method setId = item.getClass().getMethod("setId", Long.class);
|
||||
setId.invoke(item, (Long) null);
|
||||
Method setProductId = item.getClass().getMethod("setProductId", Long.class);
|
||||
setProductId.invoke(item, productId);
|
||||
}
|
||||
Method insertList = dao.getClass().getMethod("saveBatch", Collection.class);
|
||||
insertList.invoke(dao, dataList);
|
||||
} catch (Exception e) {
|
||||
|
||||
log.warn("创建产品出错:{}", e.getMessage());
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsProductVertifyRecord;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsProductVertifyRecordMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsProductVertifyRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品审核记录 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductVertifyRecordServiceImpl extends ServiceImpl<PmsProductVertifyRecordMapper, PmsProductVertifyRecord> implements IPmsProductVertifyRecordService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSkuStock;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsSkuStockMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsSkuStockService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* sku的库存 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PmsSkuStockServiceImpl extends ServiceImpl<PmsSkuStockMapper, PmsSkuStock> implements IPmsSkuStockService {
|
||||
@Resource
|
||||
private PmsSkuStockMapper skuStockMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PmsSkuStock> getList(Long pid, String keyword) {
|
||||
QueryWrapper q = new QueryWrapper();
|
||||
q.eq("product_id", pid);
|
||||
|
||||
if (!StringUtils.isEmpty(keyword)) {
|
||||
q.like("sku_code", keyword);
|
||||
}
|
||||
return skuStockMapper.selectList(q);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Long pid, List<PmsSkuStock> skuStockList) {
|
||||
return skuStockMapper.replaceList(skuStockList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.yythmall.mallplus.biz.pms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.entity.PmsSmallNaviconCategory;
|
||||
import com.yxt.yythmall.mallplus.mbg.pms.mapper.PmsSmallNaviconCategoryMapper;
|
||||
import com.yxt.yythmall.mallplus.biz.pms.service.IPmsSmallNaviconCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-14
|
||||
*/
|
||||
@Service
|
||||
public class PmsSmallNaviconCategoryServiceImpl extends ServiceImpl<PmsSmallNaviconCategoryMapper, PmsSmallNaviconCategory> implements IPmsSmallNaviconCategoryService {
|
||||
}
|
||||
118
src/main/java/com/yxt/yythmall/mallplus/biz/util/BuildTree.java
Normal file
118
src/main/java/com/yxt/yythmall/mallplus/biz/util/BuildTree.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
|
||||
//import com.zscat.mallplus.bo.Tree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BuildTree {
|
||||
|
||||
// public static <T> Tree<T> build(List<Tree<T>> nodes) {
|
||||
//
|
||||
// if (nodes == null) {
|
||||
// return null;
|
||||
// }
|
||||
// List<Tree<T>> topNodes = new ArrayList<Tree<T>>();
|
||||
//
|
||||
// for (Tree<T> children : nodes) {
|
||||
//
|
||||
// String pid = children.getParentId();
|
||||
// if (pid == null || "0".equals(pid)) {
|
||||
// topNodes.add(children);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// for (Tree<T> parent : nodes) {
|
||||
// String id = parent.getId();
|
||||
// if (id != null && id.equals(pid)) {
|
||||
// parent.getChildren().add(children);
|
||||
// children.setHasParent(true);
|
||||
// parent.setChildren(true);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// Tree<T> root = new Tree<T>();
|
||||
// if (topNodes.size() == 1) {
|
||||
// root = topNodes.get(0);
|
||||
// } else {
|
||||
// root.setId("-1");
|
||||
// root.setParentId("");
|
||||
// root.setHasParent(false);
|
||||
// root.setChildren(true);
|
||||
// root.setChecked(true);
|
||||
// root.setChildren(topNodes);
|
||||
// root.setTitle("顶级节点");
|
||||
// Map<String, Object> state = new HashMap<>(16);
|
||||
// state.put("opened", true);
|
||||
// root.setState(state);
|
||||
// }
|
||||
//
|
||||
// return root;
|
||||
// }
|
||||
//
|
||||
// public static <T> List<Tree<T>> buildList(List<Tree<T>> nodes, String idParam) {
|
||||
// if (nodes == null) {
|
||||
// return null;
|
||||
// }
|
||||
// List<Tree<T>> topNodes = new ArrayList<Tree<T>>();
|
||||
//
|
||||
// for (Tree<T> children : nodes) {
|
||||
//
|
||||
// String pid = children.getParentId();
|
||||
// if (pid == null || idParam.equals(pid)) {
|
||||
// topNodes.add(children);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// for (Tree<T> parent : nodes) {
|
||||
// String id = parent.getId();
|
||||
// if (id != null && id.equals(pid)) {
|
||||
// parent.getChildren().add(children);
|
||||
// children.setHasParent(true);
|
||||
// parent.setChildren(true);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return topNodes;
|
||||
// }
|
||||
//
|
||||
// public static List<Tree> buildList1(List<Tree> nodes, String idParam) {
|
||||
// if (nodes == null) {
|
||||
// return null;
|
||||
// }
|
||||
// List<Tree> topNodes = new ArrayList<Tree>();
|
||||
//
|
||||
// for (Tree children : nodes) {
|
||||
//
|
||||
// String pid = children.getParentId();
|
||||
// if (pid == null || idParam.equals(pid)) {
|
||||
// topNodes.add(children);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// for (Tree parent : nodes) {
|
||||
// String id = parent.getId();
|
||||
// if (id != null && id.equals(pid)) {
|
||||
// parent.getChildren().add(children);
|
||||
// children.setHasParent(true);
|
||||
// parent.setChildren(true);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return topNodes;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
|
||||
/**
|
||||
* sql字段转java
|
||||
*
|
||||
* @author mallplus
|
||||
* @date 2019-01-03
|
||||
*/
|
||||
public class ColUtil {
|
||||
|
||||
/**
|
||||
* 转换mysql数据类型为java数据类型
|
||||
*
|
||||
* @param type 数据库字段类型
|
||||
* @return String
|
||||
*/
|
||||
static String cloToJava(String type) {
|
||||
Configuration config = getConfig();
|
||||
assert config != null;
|
||||
return config.getString(type, "unknowType");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
*/
|
||||
public static PropertiesConfiguration getConfig() {
|
||||
try {
|
||||
return new PropertiesConfiguration("generator.properties");
|
||||
} catch (ConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
426
src/main/java/com/yxt/yythmall/mallplus/biz/util/DateUtils.java
Normal file
426
src/main/java/com/yxt/yythmall/mallplus/biz/util/DateUtils.java
Normal file
@@ -0,0 +1,426 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日期处理
|
||||
*/
|
||||
public class DateUtils {
|
||||
/**
|
||||
* 时间格式(yyyy-MM-dd)
|
||||
*/
|
||||
public final static String DATE_PATTERN = "yyyy-MM-dd";
|
||||
/**
|
||||
* 时间格式(yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
private final static Logger logger = LoggerFactory.getLogger(DateUtils.class);
|
||||
private static final DateFormat FORMATER_DATE_YMD = new SimpleDateFormat("yyyy-MM-dd");
|
||||
/**
|
||||
* 无分隔符日期格式 "yyyyMMddHHmmssSSS"
|
||||
*/
|
||||
public static String DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS_SSS = "yyyyMMddHHmmssSSS";
|
||||
// 日期转换格式数组
|
||||
public static String[][] regularExp = new String[][]{
|
||||
|
||||
// 默认格式
|
||||
{"\\d{4}-((([0][1,3-9]|[1][0-2]|[1-9])-([0-2]\\d|[3][0,1]|[1-9]))|((02|2)-(([1-9])|[0-2]\\d)))\\s+([0,1]\\d|[2][0-3]|\\d):([0-5]\\d|\\d):([0-5]\\d|\\d)",
|
||||
DATE_TIME_PATTERN},
|
||||
// 仅日期格式 年月日
|
||||
{"\\d{4}-((([0][1,3-9]|[1][0-2]|[1-9])-([0-2]\\d|[3][0,1]|[1-9]))|((02|2)-(([1-9])|[0-2]\\d)))",
|
||||
DATE_PATTERN},
|
||||
// 带毫秒格式
|
||||
{"\\d{4}((([0][1,3-9]|[1][0-2]|[1-9])([0-2]\\d|[3][0,1]|[1-9]))|((02|2)(([1-9])|[0-2]\\d)))([0,1]\\d|[2][0-3])([0-5]\\d|\\d)([0-5]\\d|\\d)\\d{1,3}",
|
||||
DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS_SSS}
|
||||
};
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
|
||||
private static Calendar calendar = Calendar.getInstance();
|
||||
|
||||
public static Date toDate(String d) throws Exception {
|
||||
return FORMATER_DATE_YMD.parse(d);
|
||||
}
|
||||
|
||||
public static String format(Date date) {
|
||||
return format(date, DATE_PATTERN);
|
||||
}
|
||||
|
||||
public static String format(Date date, String pattern) {
|
||||
if (date != null) {
|
||||
SimpleDateFormat df = new SimpleDateFormat(pattern);
|
||||
return df.format(date);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算距离现在多久,非精确
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String getTimeBefore(Date date) {
|
||||
Date now = new Date();
|
||||
long l = now.getTime() - date.getTime();
|
||||
long day = l / (24 * 60 * 60 * 1000);
|
||||
long hour = (l / (60 * 60 * 1000) - day * 24);
|
||||
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
|
||||
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
|
||||
String r = "";
|
||||
if (day > 0) {
|
||||
r += day + "天";
|
||||
} else if (hour > 0) {
|
||||
r += hour + "小时";
|
||||
} else if (min > 0) {
|
||||
r += min + "分";
|
||||
} else if (s > 0) {
|
||||
r += s + "秒";
|
||||
}
|
||||
r += "前";
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算距离现在多久,精确
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static String getTimeBeforeAccurate(Date date) {
|
||||
Date now = new Date();
|
||||
long l = now.getTime() - date.getTime();
|
||||
long day = l / (24 * 60 * 60 * 1000);
|
||||
long hour = (l / (60 * 60 * 1000) - day * 24);
|
||||
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
|
||||
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
|
||||
String r = "";
|
||||
if (day > 0) {
|
||||
r += day + "天";
|
||||
}
|
||||
if (hour > 0) {
|
||||
r += hour + "小时";
|
||||
}
|
||||
if (min > 0) {
|
||||
r += min + "分";
|
||||
}
|
||||
if (s > 0) {
|
||||
r += s + "秒";
|
||||
}
|
||||
r += "前";
|
||||
return r;
|
||||
}
|
||||
|
||||
public static String addDay(Date s, int n) {
|
||||
|
||||
SimpleDateFormat FORMATER_DATE_YMD = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar cd = Calendar.getInstance();
|
||||
cd.setTime(s);
|
||||
cd.add(Calendar.DATE, n);//增加一天
|
||||
//cd.add(Calendar.MONTH, n);//增加一个月
|
||||
return FORMATER_DATE_YMD.format(cd.getTime());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为时间类型格式
|
||||
*
|
||||
* @param strDate 日期
|
||||
* @return
|
||||
*/
|
||||
public static Date strToDate(String strDate) {
|
||||
try {
|
||||
String strType = getDateFormat(strDate);
|
||||
SimpleDateFormat sf = new SimpleDateFormat(strType);
|
||||
return new Date((sf.parse(strDate).getTime()));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的日期格式字符串,获取日期的格式
|
||||
*
|
||||
* @return 秒
|
||||
*/
|
||||
public static String getDateFormat(String date_str) {
|
||||
String style = null;
|
||||
if (StringUtils.isEmpty(date_str)) {
|
||||
return null;
|
||||
}
|
||||
boolean b = false;
|
||||
for (int i = 0; i < regularExp.length; i++) {
|
||||
b = date_str.matches(regularExp[i][0]);
|
||||
if (b) {
|
||||
style = regularExp[i][1];
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(style)) {
|
||||
logger.info("date_str:" + date_str);
|
||||
logger.info("日期格式获取出错,未识别的日期格式");
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前时间的"yyyy-MM-dd"格式字符串
|
||||
*/
|
||||
public static String currentDay() {
|
||||
DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return formater.format(new Date());
|
||||
}
|
||||
|
||||
public static int calculateDaysNew(Date first, Date second) {
|
||||
int days = 0;
|
||||
|
||||
if (second.before(first)) {
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(second);
|
||||
calendar1.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar1.set(Calendar.MINUTE, 0);
|
||||
calendar1.set(Calendar.SECOND, 0);
|
||||
calendar1.set(Calendar.MILLISECOND, 0);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(first);
|
||||
calendar2.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar2.set(Calendar.MINUTE, 0);
|
||||
calendar2.set(Calendar.SECOND, 0);
|
||||
calendar2.set(Calendar.MILLISECOND, 0);
|
||||
while (calendar1.compareTo(calendar2) != 0) {
|
||||
calendar1.add(Calendar.DAY_OF_YEAR, 1);
|
||||
days++;
|
||||
}
|
||||
days = -days;
|
||||
} else {
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
calendar1.setTime(first);
|
||||
calendar1.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar1.set(Calendar.MINUTE, 0);
|
||||
calendar1.set(Calendar.SECOND, 0);
|
||||
calendar1.set(Calendar.MILLISECOND, 0);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
calendar2.setTime(second);
|
||||
calendar2.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar2.set(Calendar.MINUTE, 0);
|
||||
calendar2.set(Calendar.SECOND, 0);
|
||||
calendar2.set(Calendar.MILLISECOND, 0);
|
||||
while (calendar1.compareTo(calendar2) != 0) {
|
||||
calendar1.add(Calendar.DAY_OF_YEAR, 1);
|
||||
days++;
|
||||
}
|
||||
}
|
||||
|
||||
return days;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当月的第一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String geFirstDayByMonth() {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.MONTH, 0);
|
||||
c.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天
|
||||
return FORMATER_DATE_YMD.format(c.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当月的第一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Date geFirstDayDateByMonth() {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.MONTH, 0);
|
||||
c.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天
|
||||
return c.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当月的最后一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String geLastDayByMonth() {
|
||||
Calendar ca = Calendar.getInstance();
|
||||
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
return FORMATER_DATE_YMD.format(ca.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前周的第一天:
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Date getFirstDayOfWeek() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
try {
|
||||
cal.setTime(new Date());
|
||||
cal.set(Calendar.DAY_OF_WEEK, 1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前周最后一天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Date getLastDayOfWeek() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
try {
|
||||
cal.setTime(new Date());
|
||||
cal.set(Calendar.DAY_OF_WEEK, 1);
|
||||
cal.set(Calendar.DATE, cal.get(Calendar.DATE) + 6);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/*
|
||||
输入日期字符串比如201703,返回当月第一天的Date
|
||||
*/
|
||||
public static Date getMinDateMonth(String month) {
|
||||
try {
|
||||
Date nowDate = sdf.parse(month);
|
||||
calendar = Calendar.getInstance();
|
||||
calendar.setTime(nowDate);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
|
||||
return calendar.getTime();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
输入日期字符串,返回当月最后一天的Date
|
||||
*/
|
||||
public static Date getMaxDateMonth(String month) {
|
||||
try {
|
||||
Date nowDate = sdf.parse(month);
|
||||
calendar = Calendar.getInstance();
|
||||
calendar.setTime(nowDate);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
return calendar.getTime();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static String getLastMonth() {
|
||||
LocalDate today = LocalDate.now();
|
||||
today = today.minusMonths(1);
|
||||
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
return formatters.format(today);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上个月最后一天
|
||||
*/
|
||||
public static Date getLastMonthLastDay(){
|
||||
|
||||
SimpleDateFormat sf=new SimpleDateFormat(DATE_TIME_PATTERN);
|
||||
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
|
||||
int month=calendar.get(Calendar.MONTH);
|
||||
|
||||
calendar.set(Calendar.MONTH, month-1);
|
||||
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
|
||||
return calendar.getTime();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上个月第一天
|
||||
*/
|
||||
public static Date getLastMonthFirstDay(){
|
||||
|
||||
SimpleDateFormat format=new SimpleDateFormat(DATE_TIME_PATTERN);
|
||||
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
return calendar.getTime();
|
||||
}
|
||||
/**
|
||||
* 获取上周周一(第一天是周一)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Date getPreviousMonday() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// 将每周第一天设为星期一,默认是星期天
|
||||
cal.setFirstDayOfWeek(Calendar.MONDAY);
|
||||
cal.add(Calendar.DATE, -1 * 7);
|
||||
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
|
||||
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
/**
|
||||
* 获取上周周日(第一天是周一)
|
||||
* @return
|
||||
*/
|
||||
public static Date getSunday() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
//将每周第一天设为星期一,默认是星期天
|
||||
cal.setFirstDayOfWeek(Calendar.MONDAY);
|
||||
cal.add(Calendar.DATE, -1*7);
|
||||
cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
|
||||
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 59);
|
||||
cal.set(Calendar.SECOND, 59);
|
||||
cal.set(Calendar.MILLISECOND, 59);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
getLastMonthFirstDay();
|
||||
getLastMonthLastDay();
|
||||
SimpleDateFormat format=new SimpleDateFormat(DATE_TIME_PATTERN);
|
||||
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
System.out.println("上个月第一天:"+format.format(calendar.getTime()));
|
||||
|
||||
|
||||
System.out.println(getLastMonth());
|
||||
String month = "201705";
|
||||
System.out.println(getMinDateMonth(month));
|
||||
System.out.println(getMaxDateMonth(month));
|
||||
System.out.println(DateUtils.geLastDayByMonth());
|
||||
System.out.println(DateUtils.addDay(new Date(), -7));
|
||||
System.out.println(DateUtils.calculateDaysNew(DateUtils.toDate(DateUtils.addDay(new Date(), -7)), new Date()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
//import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
//import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
//import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
//import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
//import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class EasyPoiUtils {
|
||||
|
||||
private EasyPoiUtils() {
|
||||
}
|
||||
|
||||
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
|
||||
try {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// private static <T> void defaultExport(List<T> dataList, Class<?> clz, String fileName, HttpServletResponse response, ExportParams exportParams) {
|
||||
// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, clz, dataList);
|
||||
// if (workbook != null) {
|
||||
// downLoadExcel(fileName, response, workbook);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static <T> void exportExcel(List<T> dataList, String title, String sheetName, Class<?> clz, String fileName, boolean isCreateHeader, HttpServletResponse response) {
|
||||
// ExportParams exportParams = new ExportParams(title, sheetName);
|
||||
// exportParams.setCreateHeadRows(isCreateHeader);
|
||||
// defaultExport(dataList, clz, fileName, response, exportParams);
|
||||
// }
|
||||
|
||||
// public static <T> void exportExcel(List<T> dataList, String title, String sheetName, Class<?> clz, String fileName, HttpServletResponse response) {
|
||||
// defaultExport(dataList, clz, fileName, response, new ExportParams(title, sheetName));
|
||||
// }
|
||||
|
||||
// private static void defaultExport(List<Map<String, Object>> dataList, String fileName, HttpServletResponse response) {
|
||||
// Workbook workbook = ExcelExportUtil.exportExcel(dataList, ExcelType.HSSF);
|
||||
// if (workbook != null) {
|
||||
// downLoadExcel(fileName, response, workbook);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void exportExcel(List<Map<String, Object>> dataList, String fileName, HttpServletResponse response) {
|
||||
// defaultExport(dataList, fileName, response);
|
||||
// }
|
||||
|
||||
// public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> clz) {
|
||||
// if (StringUtils.isBlank(filePath)) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setTitleRows(titleRows);
|
||||
// params.setHeadRows(headerRows);
|
||||
//
|
||||
// try {
|
||||
// return ExcelImportUtil.importExcel(new File(filePath), clz, params);
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> clz) {
|
||||
// if (file == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setTitleRows(titleRows);
|
||||
// params.setHeadRows(headerRows);
|
||||
//
|
||||
// try {
|
||||
// return ExcelImportUtil.importExcel(file.getInputStream(), clz, params);
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static <T> List<T> importExcel(MultipartFile file, Class<T> clz) {
|
||||
// if (file == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// ImportParams params = new ImportParams();
|
||||
// params.setTitleRows(1);
|
||||
// params.setHeadRows(1);
|
||||
// try {
|
||||
// return ExcelImportUtil.importExcel(file.getInputStream(), clz, params);
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件类型<p>允许上传的类型<p/>
|
||||
*
|
||||
* @author Peter
|
||||
* @date 2018-4-11
|
||||
*/
|
||||
public class FileTypeMap {
|
||||
|
||||
public static final Map<String, String> map = new HashMap<String, String>(9);
|
||||
|
||||
static {
|
||||
map.put("jpeg", "FFD8FF");
|
||||
map.put("jpg", "FFD8FFE0");
|
||||
map.put("png", "89504E47");
|
||||
map.put("wav", "57415645");
|
||||
map.put("avi", "41564920");
|
||||
map.put("mp4", "00000020667479706D70");
|
||||
map.put("mp3", "49443303000000002176");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
279
src/main/java/com/yxt/yythmall/mallplus/biz/util/FileUtil.java
Normal file
279
src/main/java/com/yxt/yythmall/mallplus/biz/util/FileUtil.java
Normal file
@@ -0,0 +1,279 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.poi.excel.BigExcelWriter;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
//import com.zscat.mallplus.exception.BusinessMallException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* File工具类,扩展 hutool 工具包
|
||||
*
|
||||
* @author mallplus
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
/**
|
||||
* 定义GB的计算常量
|
||||
*/
|
||||
private static final int GB = 1024 * 1024 * 1024;
|
||||
/**
|
||||
* 定义MB的计算常量
|
||||
*/
|
||||
private static final int MB = 1024 * 1024;
|
||||
/**
|
||||
* 定义KB的计算常量
|
||||
*/
|
||||
private static final int KB = 1024;
|
||||
|
||||
/**
|
||||
* 格式化小数
|
||||
*/
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
/**
|
||||
* MultipartFile转File
|
||||
*/
|
||||
public static File toFile(MultipartFile multipartFile) {
|
||||
// 获取文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String prefix = "." + getExtensionName(fileName);
|
||||
File file = null;
|
||||
try {
|
||||
// 用uuid作为文件名,防止生成的临时文件重复
|
||||
file = File.createTempFile(IdUtil.simpleUUID(), prefix);
|
||||
// MultipartFile to File
|
||||
multipartFile.transferTo(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名,不带 .
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Java文件操作 获取不带扩展名的文件名
|
||||
*/
|
||||
public static String getFileNameNoEx(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length()))) {
|
||||
return filename.substring(0, dot);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小转换
|
||||
*/
|
||||
public static String getSize(long size) {
|
||||
String resultSize;
|
||||
if (size / GB >= 1) {
|
||||
//如果当前Byte的值大于等于1GB
|
||||
resultSize = DF.format(size / (float) GB) + "GB ";
|
||||
} else if (size / MB >= 1) {
|
||||
//如果当前Byte的值大于等于1MB
|
||||
resultSize = DF.format(size / (float) MB) + "MB ";
|
||||
} else if (size / KB >= 1) {
|
||||
//如果当前Byte的值大于等于1KB
|
||||
resultSize = DF.format(size / (float) KB) + "KB ";
|
||||
} else {
|
||||
resultSize = size + "B ";
|
||||
}
|
||||
return resultSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* inputStream 转 File
|
||||
*/
|
||||
static File inputStreamToFile(InputStream ins, String name) throws Exception {
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
OutputStream os = new FileOutputStream(file);
|
||||
int bytesRead;
|
||||
byte[] buffer = new byte[8192];
|
||||
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
os.close();
|
||||
ins.close();
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload(MultipartFile file, String filePath) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
|
||||
String name = getFileNameNoEx(file.getOriginalFilename());
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
String nowStr = "-" + format.format(date);
|
||||
try {
|
||||
String fileName = name + nowStr + "." + suffix;
|
||||
String path = filePath + fileName;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
dest.getParentFile().mkdirs();
|
||||
}
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String fileToBase64(File file) throws Exception {
|
||||
FileInputStream inputFile = new FileInputStream(file);
|
||||
String base64;
|
||||
byte[] buffer = new byte[(int) file.length()];
|
||||
inputFile.read(buffer);
|
||||
inputFile.close();
|
||||
base64 = Base64.encode(buffer);
|
||||
return base64.replaceAll("[\\s*\t\n\r]", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
public static void downloadExcel(List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
|
||||
String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
//response为HttpServletResponse对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
// 终止后删除临时文件
|
||||
file.deleteOnExit();
|
||||
writer.flush(out, true);
|
||||
//此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
}
|
||||
|
||||
public static String getFileType(String type) {
|
||||
String documents = "txt doc pdf ppt pps xlsx xls docx";
|
||||
String music = "mp3 wav wma mpa ram ra aac aif m4a";
|
||||
String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg";
|
||||
String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg";
|
||||
if (image.contains(type)) {
|
||||
return "图片";
|
||||
} else if (documents.contains(type)) {
|
||||
return "文档";
|
||||
} else if (music.contains(type)) {
|
||||
return "音乐";
|
||||
} else if (video.contains(type)) {
|
||||
return "视频";
|
||||
} else {
|
||||
return "其他";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileTypeByMimeType(String type) {
|
||||
String mimeType = new MimetypesFileTypeMap().getContentType("." + type);
|
||||
return mimeType.split("/")[0];
|
||||
}
|
||||
|
||||
public static void checkSize(long maxSize, long size) {
|
||||
// if (size > (maxSize * 1024 * 1024)) {
|
||||
// throw new BusinessMallException("文件超出规定大小");
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个文件是否相同
|
||||
*/
|
||||
public static boolean check(File file1, File file2) {
|
||||
String img1Md5 = getMd5(file1);
|
||||
String img2Md5 = getMd5(file2);
|
||||
return img1Md5.equals(img2Md5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个文件是否相同
|
||||
*/
|
||||
public static boolean check(String file1Md5, String file2Md5) {
|
||||
return file1Md5.equals(file2Md5);
|
||||
}
|
||||
|
||||
private static byte[] getByte(File file) {
|
||||
// 得到文件长度
|
||||
byte[] b = new byte[(int) file.length()];
|
||||
try {
|
||||
InputStream in = new FileInputStream(file);
|
||||
try {
|
||||
in.read(b);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private static String getMd5(byte[] bytes) {
|
||||
// 16进制字符
|
||||
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
try {
|
||||
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
|
||||
mdTemp.update(bytes);
|
||||
byte[] md = mdTemp.digest();
|
||||
int j = md.length;
|
||||
char[] str = new char[j * 2];
|
||||
int k = 0;
|
||||
// 移位 输出字符串
|
||||
for (byte byte0 : md) {
|
||||
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
|
||||
str[k++] = hexDigits[byte0 & 0xf];
|
||||
}
|
||||
return new String(str);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getMd5(File file) {
|
||||
return getMd5(getByte(file));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 文件工具类
|
||||
*
|
||||
* @author Peter
|
||||
* @date 2018-4-11
|
||||
*/
|
||||
public class FileUtils {
|
||||
/**
|
||||
* 判断文件类型是否合法<>通过魔数判断</>
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkFileMagicNum(final MultipartFile file) {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
// 获取文件上传时带的后缀
|
||||
String fileName = file.getOriginalFilename();
|
||||
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
// 由文件后缀得到的魔数,由于后缀可以伪造,所以该魔数不一定是文件的真实魔数
|
||||
String magicNum = FileTypeMap.map.get(suffix.toLowerCase());
|
||||
// 取不到魔数,说明该文件类型不能上传
|
||||
if (magicNum == null) {
|
||||
return false;
|
||||
}
|
||||
// 取到魔数之后,判断与文件的是否相同
|
||||
byte[] b = new byte[30];
|
||||
try {
|
||||
InputStream in = file.getInputStream();
|
||||
// 读取上传文件的前30个字节
|
||||
in.read(b, 0, 30);
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String realMagicNum = bytesToHex(b);
|
||||
// 判断文件开始的一段内容是否是匹配的魔数
|
||||
if (realMagicNum.toUpperCase().startsWith(magicNum)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转换成16进制字符串
|
||||
*
|
||||
* @param src
|
||||
* @return
|
||||
*/
|
||||
public static String bytesToHex(final byte[] src) {
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
if (src == null || src.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
int v = src[i] & 0xFF;
|
||||
String hv = Integer.toHexString(v);
|
||||
if (hv.length() < 2) {
|
||||
stringBuilder.append(0);
|
||||
}
|
||||
stringBuilder.append(hv);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
public static String getSuffix(final MultipartFile file) {
|
||||
if (file == null || file.getSize() == 0) {
|
||||
return null;
|
||||
}
|
||||
String fileName = file.getOriginalFilename();
|
||||
return fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
}
|
||||
315
src/main/java/com/yxt/yythmall/mallplus/biz/util/GenUtil.java
Normal file
315
src/main/java/com/yxt/yythmall/mallplus/biz/util/GenUtil.java
Normal file
@@ -0,0 +1,315 @@
|
||||
//package com.zscat.mallplus.util;
|
||||
//
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import cn.hutool.extra.template.*;
|
||||
//import com.zscat.mallplus.bo.ColumnInfo;
|
||||
//import com.zscat.mallplus.sys.entity.GenConfig;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.io.FileWriter;
|
||||
//import java.io.IOException;
|
||||
//import java.io.Writer;
|
||||
//import java.time.LocalDate;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * 代码生成
|
||||
// *
|
||||
// * @author mallplus
|
||||
// * @date 2019-01-02
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class GenUtil {
|
||||
//
|
||||
// private static final String TIMESTAMP = "Timestamp";
|
||||
//
|
||||
// private static final String BIGDECIMAL = "BigDecimal";
|
||||
//
|
||||
// private static final String PK = "PRI";
|
||||
//
|
||||
// private static final String EXTRA = "auto_increment";
|
||||
//
|
||||
// /**
|
||||
// * 获取后端代码模板名称
|
||||
// *
|
||||
// * @return List
|
||||
// */
|
||||
// private static List<String> getAdminTemplateNames() {
|
||||
// List<String> templateNames = new ArrayList<>();
|
||||
// templateNames.add("Entity");
|
||||
//
|
||||
// templateNames.add("Mapper");
|
||||
//
|
||||
// templateNames.add("Service");
|
||||
// templateNames.add("ServiceImpl");
|
||||
// templateNames.add("menu.sql");
|
||||
// templateNames.add("Controller");
|
||||
// return templateNames;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取前端代码模板名称
|
||||
// *
|
||||
// * @return List
|
||||
// */
|
||||
// private static List<String> getFrontTemplateNames() {
|
||||
// List<String> templateNames = new ArrayList<>();
|
||||
// templateNames.add("api");
|
||||
// templateNames.add("index");
|
||||
// templateNames.add("eForm");
|
||||
// templateNames.add("add");
|
||||
// templateNames.add("update");
|
||||
// return templateNames;
|
||||
// }
|
||||
// /**
|
||||
// * 获取前端代码模板名称
|
||||
// *
|
||||
// * @return List
|
||||
// */
|
||||
// private static List<String> getFrontTemplateNames1() {
|
||||
// List<String> templateNames = new ArrayList<>();
|
||||
// templateNames.add("api");
|
||||
// templateNames.add("index");
|
||||
// templateNames.add("eForm");
|
||||
// templateNames.add("add");
|
||||
// templateNames.add("update");
|
||||
// return templateNames;
|
||||
// }
|
||||
// /**
|
||||
// * 生成代码
|
||||
// *
|
||||
// * @param columnInfos 表元数据
|
||||
// */
|
||||
// public static void generatorCode(List<ColumnInfo> columnInfos, GenConfig genConfig, String tableName) throws IOException {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("package", genConfig.getPack());
|
||||
// map.put("moduleName", genConfig.getModuleName());
|
||||
// map.put("author", genConfig.getAuthor());
|
||||
// map.put("date", LocalDate.now().toString());
|
||||
// map.put("tableName", tableName);
|
||||
// map.put("prefix", genConfig.getPrefix());
|
||||
//
|
||||
// String className = StringUtils.toCapitalizeCamelCase(tableName);
|
||||
// String changeClassName = StringUtils.toCamelCase(tableName);
|
||||
//
|
||||
// // 判断是否去除表前缀
|
||||
// if (StringUtils.isNotEmpty(genConfig.getPrefix())) {
|
||||
// className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(tableName, genConfig.getPrefix()));
|
||||
// changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(tableName, genConfig.getPrefix()));
|
||||
// }
|
||||
// map.put("className", className);
|
||||
// map.put("upperCaseClassName", className.toUpperCase());
|
||||
// map.put("changeClassName", changeClassName);
|
||||
// map.put("hasTimestamp", false);
|
||||
// map.put("queryHasTimestamp", false);
|
||||
// map.put("queryHasBigDecimal", false);
|
||||
// map.put("hasBigDecimal", false);
|
||||
// map.put("hasQuery", false);
|
||||
// map.put("auto", false);
|
||||
//
|
||||
// List<Map<String, Object>> columns = new ArrayList<>();
|
||||
// List<Map<String, Object>> queryColumns = new ArrayList<>();
|
||||
// for (ColumnInfo column : columnInfos) {
|
||||
// Map<String, Object> listMap = new HashMap<>();
|
||||
// listMap.put("columnComment", column.getColumnComment());
|
||||
// listMap.put("columnKey", column.getColumnKey());
|
||||
//
|
||||
// String colType = ColUtil.cloToJava(column.getColumnType().toString());
|
||||
// String changeColumnName = StringUtils.toCamelCase(column.getColumnName().toString());
|
||||
// String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName().toString());
|
||||
// if (PK.equals(column.getColumnKey())) {
|
||||
// map.put("pkColumnType", colType);
|
||||
// map.put("pkChangeColName", changeColumnName);
|
||||
// map.put("pkCapitalColName", capitalColumnName);
|
||||
// }
|
||||
// if (TIMESTAMP.equals(colType)) {
|
||||
// map.put("hasTimestamp", true);
|
||||
// }
|
||||
// if (BIGDECIMAL.equals(colType)) {
|
||||
// map.put("hasBigDecimal", true);
|
||||
// }
|
||||
// if (EXTRA.equals(column.getExtra())) {
|
||||
// map.put("auto", true);
|
||||
// }
|
||||
// listMap.put("columnType", colType);
|
||||
// listMap.put("columnName", column.getColumnName());
|
||||
// listMap.put("isNullable", column.getIsNullable());
|
||||
// listMap.put("columnShow", column.getColumnShow());
|
||||
// listMap.put("changeColumnName", changeColumnName);
|
||||
// listMap.put("capitalColumnName", capitalColumnName);
|
||||
//
|
||||
// // 判断是否有查询,如有则把查询的字段set进columnQuery
|
||||
// if (!StringUtils.isBlank(column.getColumnQuery())) {
|
||||
// listMap.put("columnQuery", column.getColumnQuery());
|
||||
// map.put("hasQuery", true);
|
||||
// if (TIMESTAMP.equals(colType)) {
|
||||
// map.put("queryHasTimestamp", true);
|
||||
// }
|
||||
// if (BIGDECIMAL.equals(colType)) {
|
||||
// map.put("queryHasBigDecimal", true);
|
||||
// }
|
||||
// queryColumns.add(listMap);
|
||||
// }
|
||||
// columns.add(listMap);
|
||||
// }
|
||||
// map.put("columns", columns);
|
||||
// map.put("queryColumns", queryColumns);
|
||||
// TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
||||
//
|
||||
// // 生成后端代码
|
||||
// List<String> templates = getAdminTemplateNames();
|
||||
// for (String templateName : templates) {
|
||||
// Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl");
|
||||
// String filePath = getAdminFilePath(templateName, genConfig, className);
|
||||
//
|
||||
// assert filePath != null;
|
||||
// File file = new File(filePath);
|
||||
//
|
||||
// // 如果非覆盖生成
|
||||
// if (!genConfig.getCover() && FileUtil.exist(file)) {
|
||||
// continue;
|
||||
// }
|
||||
// // 生成代码
|
||||
// // genFile(file, template, map);
|
||||
// }
|
||||
//
|
||||
// // 生成前端代码
|
||||
// List<String> templates1 = getFrontTemplateNames();
|
||||
// for (String templateName : templates1) {
|
||||
// Template template = engine.getTemplate("generator/front/" + templateName + ".ftl");
|
||||
// String filePath = getFrontFilePath(templateName, genConfig, map.get("changeClassName").toString());
|
||||
//
|
||||
// assert filePath != null;
|
||||
// File file = new File(filePath);
|
||||
//
|
||||
// // 如果非覆盖生成
|
||||
// if (!genConfig.getCover() && FileUtil.exist(file)) {
|
||||
// continue;
|
||||
// }
|
||||
// // 生成代码
|
||||
// genFile(file, template, map);
|
||||
// }
|
||||
// // 生成前端代码2
|
||||
// List<String> templates2 = getFrontTemplateNames1();
|
||||
// for (String templateName : templates2) {
|
||||
// Template template = engine.getTemplate("generator/front1/" + templateName + ".ftl");
|
||||
// String filePath = getFrontFilePath1(templateName, genConfig, map.get("changeClassName").toString());
|
||||
//
|
||||
// assert filePath != null;
|
||||
// File file = new File(filePath);
|
||||
//
|
||||
// // 如果非覆盖生成
|
||||
// if (!genConfig.getCover() && FileUtil.exist(file)) {
|
||||
// continue;
|
||||
// }
|
||||
// // 生成代码
|
||||
// genFile(file, template, map);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 定义后端文件路径以及名称
|
||||
// */
|
||||
// private static String getAdminFilePath(String templateName, GenConfig genConfig, String className) {
|
||||
//
|
||||
// String packagePath = genConfig.getPath();
|
||||
// if ("Entity".equals(templateName)) {
|
||||
// return packagePath + File.separator + "entity" + File.separator + className + ".java";
|
||||
// }
|
||||
//
|
||||
// if ("Controller".equals(templateName)) {
|
||||
// return packagePath + File.separator + "controller" + File.separator + className + "Controller.java";
|
||||
// }
|
||||
//
|
||||
// if ("Service".equals(templateName)) {
|
||||
// return packagePath + File.separator + "service" + File.separator + "I" + className + "Service.java";
|
||||
// }
|
||||
//
|
||||
// if ("ServiceImpl".equals(templateName)) {
|
||||
// return packagePath + File.separator + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java";
|
||||
// }
|
||||
//
|
||||
// if ("menu.sql".equals(templateName)) {
|
||||
// return packagePath + File.separator + className + ".sql";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if ("Mapper".equals(templateName)) {
|
||||
// return packagePath + File.separator + "mapper" + File.separator + className + "Mapper.java";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 定义前端文件路径以及名称
|
||||
// */
|
||||
// private static String getFrontFilePath(String templateName, GenConfig genConfig, String apiName) {
|
||||
// String path = genConfig.getPath();
|
||||
//
|
||||
// if ("api".equals(templateName)) {
|
||||
// return path + File.separator + apiName + ".js";
|
||||
// }
|
||||
//
|
||||
// if ("index".equals(templateName)) {
|
||||
// return path + File.separator + apiName + File.separator + "index.vue";
|
||||
// }
|
||||
//
|
||||
// if ("eForm".equals(templateName)) {
|
||||
// return path + File.separator + apiName + File.separator + "components" + File.separator + "detail.vue";
|
||||
// }
|
||||
// if ("add".equals(templateName)) {
|
||||
// return path + File.separator + apiName + File.separator + File.separator + "add.vue";
|
||||
// }
|
||||
// if ("update".equals(templateName)) {
|
||||
// return path + File.separator + apiName + File.separator + File.separator + "update.vue";
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// /**
|
||||
// * 定义前端文件路径以及名称
|
||||
// */
|
||||
// private static String getFrontFilePath1(String templateName, GenConfig genConfig, String apiName) {
|
||||
// String path = genConfig.getPath();
|
||||
//
|
||||
// if ("api".equals(templateName)) {
|
||||
// return path + File.separator +"shop"+ File.separator+ apiName + ".text";
|
||||
// }
|
||||
//
|
||||
// if ("index".equals(templateName)) {
|
||||
// return path + File.separator +"shop"+ File.separator+ apiName + File.separator + "index.vue";
|
||||
// }
|
||||
//
|
||||
// if ("eForm".equals(templateName)) {
|
||||
// return path + File.separator +"shop"+ File.separator+ apiName + File.separator + "components" + File.separator + "reduction.less";
|
||||
// }
|
||||
// if ("add".equals(templateName)) {
|
||||
// return path + File.separator +"shop"+ File.separator+ apiName + File.separator + "components" + File.separator + "add.vue";
|
||||
// }
|
||||
// if ("update".equals(templateName)) {
|
||||
// return path + File.separator +"shop"+ File.separator+ apiName + File.separator + "components" + File.separator + "edit.vue";
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// private static void genFile(File file, Template template, Map<String, Object> map) throws IOException {
|
||||
// // 生成目标文件
|
||||
// Writer writer = null;
|
||||
// try {
|
||||
// System.out.println(file);
|
||||
// FileUtil.touch(file);
|
||||
// System.out.println(file.getName());
|
||||
// writer = new FileWriter(file);
|
||||
// template.render(map, writer);
|
||||
// } catch (TemplateException | IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// } finally {
|
||||
// assert writer != null;
|
||||
// writer.close();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
308
src/main/java/com/yxt/yythmall/mallplus/biz/util/GenUtils1.java
Normal file
308
src/main/java/com/yxt/yythmall/mallplus/biz/util/GenUtils1.java
Normal file
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
package com.zscat.mallplus.util;
|
||||
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.extra.template.*;
|
||||
import com.zscat.mallplus.bo.ColumnDO;
|
||||
import com.zscat.mallplus.bo.TableDO;
|
||||
import com.zscat.mallplus.config.Constant;
|
||||
import com.zscat.mallplus.exception.ApiMallPlusException;
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
*/
|
||||
/**
|
||||
* 代码生成器 工具类
|
||||
* <p>
|
||||
* 生成代码
|
||||
* <p>
|
||||
* 列名转换成Java属性名
|
||||
* <p>
|
||||
* 表名转换成Java类名
|
||||
* <p>
|
||||
* 获取配置信息
|
||||
* <p>
|
||||
* 获取文件名
|
||||
* <p>
|
||||
* 生成代码
|
||||
* <p>
|
||||
* 列名转换成Java属性名
|
||||
* <p>
|
||||
* 表名转换成Java类名
|
||||
* <p>
|
||||
* 获取配置信息
|
||||
* <p>
|
||||
* 获取文件名
|
||||
* <p>
|
||||
* 生成代码
|
||||
* <p>
|
||||
* 列名转换成Java属性名
|
||||
* <p>
|
||||
* 表名转换成Java类名
|
||||
* <p>
|
||||
* 获取配置信息
|
||||
* <p>
|
||||
* 获取文件名
|
||||
* <p>
|
||||
* 生成代码
|
||||
* <p>
|
||||
* 列名转换成Java属性名
|
||||
* <p>
|
||||
* 表名转换成Java类名
|
||||
* <p>
|
||||
* 获取配置信息
|
||||
* <p>
|
||||
* 获取文件名
|
||||
*//*
|
||||
|
||||
public class GenUtils1 {
|
||||
|
||||
|
||||
public static List<String> getTemplates() {
|
||||
List<String> templates = new ArrayList<String>();
|
||||
templates.add("common/generator/domain.java.ftl");
|
||||
templates.add("common/generator/Dao.java.ftl");
|
||||
//templates.add("common/generator/Mapper.java.vm");
|
||||
// templates.add("common/generator/Mapper.xml.vm");
|
||||
templates.add("common/generator/Service.java.ftl");
|
||||
templates.add("common/generator/ServiceImpl.java.ftl");
|
||||
templates.add("common/generator/Controller.java.ftl");
|
||||
templates.add("common/generator/add.vue.ftl");
|
||||
templates.add("common/generator/index.vue.ftl");
|
||||
templates.add("common/generator/api.js.ftl");
|
||||
templates.add("common/generator/path.js.ftl");
|
||||
templates.add("common/generator/update.vue.ftl");
|
||||
|
||||
templates.add("common/generator/BrandDetail.vue.ftl");
|
||||
templates.add("common/generator/menu.sql.ftl");
|
||||
return templates;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 生成代码
|
||||
*//*
|
||||
|
||||
|
||||
|
||||
public static void generatorCode(Map<String, String> table,
|
||||
List<Map<String, String>> columns, ZipOutputStream zip) {
|
||||
//配置信息
|
||||
Configuration config = getConfig();
|
||||
//表信息
|
||||
TableDO tableDO = new TableDO();
|
||||
tableDO.setTableName(table.get("tableName"));
|
||||
tableDO.setComments(table.get("tableComment"));
|
||||
//表名转换成Java类名
|
||||
String className = tableToJava(tableDO.getTableName(), config.getString("tablePrefix"), config.getString("autoRemovePre"));
|
||||
tableDO.setClassName(className);
|
||||
tableDO.setClassname(StringUtils.uncapitalize(className));
|
||||
|
||||
//列信息
|
||||
List<ColumnDO> columsList = new ArrayList<>();
|
||||
for (Map<String, String> column : columns) {
|
||||
ColumnDO columnDO = new ColumnDO();
|
||||
columnDO.setColumnName(column.get("columnName"));
|
||||
columnDO.setDataType(column.get("dataType"));
|
||||
columnDO.setComments(column.get("columnComment"));
|
||||
columnDO.setExtra(column.get("extra"));
|
||||
|
||||
//列名转换成Java属性名
|
||||
String attrName = columnToJava(columnDO.getColumnName());
|
||||
columnDO.setAttrName(attrName);
|
||||
columnDO.setAttrname(StringUtils.uncapitalize(attrName));
|
||||
|
||||
//列的数据类型,转换成Java类型
|
||||
String attrType = config.getString(columnDO.getDataType(), "unknowType");
|
||||
columnDO.setAttrType(attrType);
|
||||
|
||||
//是否主键
|
||||
if ("PRI".equalsIgnoreCase(column.get("columnKey")) && tableDO.getPk() == null) {
|
||||
tableDO.setPk(columnDO);
|
||||
}
|
||||
|
||||
columsList.add(columnDO);
|
||||
}
|
||||
tableDO.setColumns(columsList);
|
||||
|
||||
//没主键,则第一个字段为主键
|
||||
if (tableDO.getPk() == null) {
|
||||
tableDO.setPk(tableDO.getColumns().get(0));
|
||||
}
|
||||
|
||||
//设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||
Velocity.init(prop);
|
||||
|
||||
String packages = "com.zscat.mallplus";
|
||||
String Module = tableDO.getTableName().split("_")[0].substring(0, 1).toUpperCase() + tableDO.getTableName().split("_")[0].substring(1).toLowerCase();
|
||||
//封装模板数据
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("tableName", tableDO.getTableName());
|
||||
map.put("comments", tableDO.getComments());
|
||||
map.put("pk", tableDO.getPk());
|
||||
map.put("module", tableDO.getTableName().split("_")[0]);
|
||||
map.put("Module", Module);
|
||||
map.put("className", tableDO.getClassName());
|
||||
map.put("classname", tableDO.getClassname());
|
||||
map.put("pathName", packages.substring(packages.lastIndexOf(".") + 1));
|
||||
map.put("columns", tableDO.getColumns());
|
||||
map.put("package", packages);
|
||||
map.put("author", config.getString("author"));
|
||||
map.put("email", config.getString("email"));
|
||||
map.put("datetime", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
|
||||
map.put("date", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
|
||||
|
||||
System.out.println(map.toString());
|
||||
//获取模板列表
|
||||
List<String> templates = getTemplates();
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("templates", TemplateConfig.ResourceMode.CLASSPATH));
|
||||
|
||||
for (String templateName : templates) {
|
||||
//渲染模板
|
||||
|
||||
Template template = engine.getTemplate(templateName);
|
||||
|
||||
try {
|
||||
String filePath = getFileName(
|
||||
tableDO.getTableName().split("_")[0], templateName, tableDO.getClassname(), tableDO.getClassName(), packages.substring(packages.lastIndexOf(".")+ 1), Module);
|
||||
//添加到zip
|
||||
assert filePath != null;
|
||||
File file = new File(filePath);
|
||||
|
||||
|
||||
// 生成代码
|
||||
genFile(file, template, map);
|
||||
} catch (IOException e) {
|
||||
throw new ApiMallPlusException("渲染模板失败,表名:" + tableDO.getTableName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void genFile(File file, Template template, Map<String, Object> map) throws IOException {
|
||||
// 生成目标文件
|
||||
Writer writer = null;
|
||||
try {
|
||||
FileUtil.touch(file);
|
||||
writer = new FileWriter(file);
|
||||
template.render(map, writer);
|
||||
} catch (TemplateException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
assert writer != null;
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 列名转换成Java属性名
|
||||
*//*
|
||||
|
||||
public static String columnToJava(String columnName) {
|
||||
return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 表名转换成Java类名
|
||||
*//*
|
||||
|
||||
public static String tableToJava(String tableName, String tablePrefix, String autoRemovePre) {
|
||||
if (Constant.AUTO_REOMVE_PRE.equals(autoRemovePre)) {
|
||||
tableName = tableName.substring(tableName.indexOf("_") + 1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tablePrefix)) {
|
||||
tableName = tableName.replace(tablePrefix, "");
|
||||
}
|
||||
|
||||
return columnToJava(tableName);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 获取配置信息
|
||||
*//*
|
||||
|
||||
public static Configuration getConfig() {
|
||||
try {
|
||||
return new PropertiesConfiguration("generator.properties");
|
||||
} catch (org.apache.commons.configuration.ConfigurationException e) {
|
||||
throw new ApiMallPlusException("获取配置文件失败,", e);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 获取文件名
|
||||
*//*
|
||||
|
||||
public static String getFileName(String module, String template, String classname, String className, String packageName, String Module) {
|
||||
String packagePath = "main" + File.separator + "java" + File.separator;
|
||||
//String modulesname=config.getString("packageName");
|
||||
if (StringUtils.isNotBlank(packageName)) {
|
||||
packagePath += packageName.replace(".", File.separator) + File.separator;
|
||||
}
|
||||
|
||||
if (template.contains("domain.java.ftl")) {
|
||||
return Module + className + ".java";
|
||||
}
|
||||
|
||||
if (template.contains("Dao.java.ftl")) {
|
||||
return Module + className + "Mapper.java";
|
||||
}
|
||||
|
||||
// if(template.contains("Mapper.java.vm")){
|
||||
// return packagePath + "dao" + File.separator + className + "Mapper.java";
|
||||
// }
|
||||
// templates.add("common/generator/menu.sql.ftl");
|
||||
if (template.contains("menu.sql.ftl")) {
|
||||
return Module + className + "menu.sql";
|
||||
}
|
||||
if (template.contains("Service.java.ftl")) {
|
||||
return "I" + Module + className + "Service.java";
|
||||
}
|
||||
|
||||
if (template.contains("ServiceImpl.java.ftl")) {
|
||||
return Module + className + "ServiceImpl.java";
|
||||
}
|
||||
|
||||
if (template.contains("Controller.java.ftl")) {
|
||||
return Module + className + "Controller.java";
|
||||
}
|
||||
|
||||
if (template.contains("Mapper.xml.vm")) {
|
||||
return Module + className + "Mapper.xml";
|
||||
}
|
||||
if (template.contains("api.js.ftl")) {
|
||||
return classname + ".js";
|
||||
}
|
||||
if (template.contains("path.js.ftl")) {
|
||||
return classname + "path" + ".js";
|
||||
}
|
||||
if (template.contains("add.vue.ftl")) {
|
||||
return classname + File.separator + "add.vue";
|
||||
}
|
||||
|
||||
if (template.contains("index.vue.ftl")) {
|
||||
return classname + File.separator + "index.vue";
|
||||
}
|
||||
if (template.contains("update.vue.ftl")) {
|
||||
return classname + File.separator + "update.vue";
|
||||
}
|
||||
if (template.contains("BrandDetail.vue.ftl")) {
|
||||
return classname + File.separator + "components" + File.separator + className + "Detail.vue";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* IP地址工具类定义
|
||||
*
|
||||
* @author mallplus
|
||||
*/
|
||||
public class IpAddressUtil {
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
String ipAddress = request.getHeader("x-forwarded-for");
|
||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = request.getRemoteAddr();
|
||||
if (ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) {
|
||||
//根据网卡取本机配置的IP
|
||||
InetAddress inet = null;
|
||||
try {
|
||||
inet = InetAddress.getLocalHost();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ipAddress = inet.getHostAddress();
|
||||
}
|
||||
}
|
||||
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
|
||||
if (ipAddress != null && ipAddress.length() > 15) { //"***.***.***.***".length() = 15
|
||||
if (ipAddress.indexOf(",") > 0) {
|
||||
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
|
||||
}
|
||||
}
|
||||
return ipAddress;
|
||||
}
|
||||
}
|
||||
401
src/main/java/com/yxt/yythmall/mallplus/biz/util/JsonUtil.java
Normal file
401
src/main/java/com/yxt/yythmall/mallplus/biz/util/JsonUtil.java
Normal file
@@ -0,0 +1,401 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.ser.FilterProvider;
|
||||
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
|
||||
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
//import net.sf.json.JsonConfig;
|
||||
//import net.sf.json.util.PropertyFilter;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Jackson json序列化和反序列化工具类
|
||||
* https://github.com/shenzhuan/mallplus on 2018/4/28.
|
||||
*/
|
||||
@Slf4j
|
||||
public class JsonUtil {
|
||||
|
||||
// 定义jackson对象
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
private static ObjectMapper objectMapper = null;
|
||||
|
||||
static {
|
||||
objectMapper = new ObjectMapper();
|
||||
// 设置默认日期格式
|
||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
// 提供其它默认设置
|
||||
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
|
||||
objectMapper.setFilters(new SimpleFilterProvider()
|
||||
.setFailOnUnknownId(false));
|
||||
objectMapper.registerModule(new MyModule());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串格式(默认将转换所有的属性)
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String toJsonStr(Object value) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(value);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串格式
|
||||
*
|
||||
* @param value 需要转换的对象
|
||||
* @param properties 需要转换的属性
|
||||
*/
|
||||
public static String toJsonStr(Object value, String[] properties) {
|
||||
try {
|
||||
SimpleBeanPropertyFilter sbp = SimpleBeanPropertyFilter
|
||||
.filterOutAllExcept(properties);
|
||||
FilterProvider filterProvider = new SimpleFilterProvider()
|
||||
.addFilter("propertyFilterMixIn", sbp);
|
||||
return objectMapper.writer(filterProvider)
|
||||
.writeValueAsString(value);
|
||||
} catch (Exception e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串格式
|
||||
*
|
||||
* @param value 需要转换的对象
|
||||
* @param properties2Exclude 需要排除的属性
|
||||
*/
|
||||
public static String toJsonStrWithExcludeProperties(Object value,
|
||||
String[] properties2Exclude) {
|
||||
try {
|
||||
SimpleBeanPropertyFilter sbp = SimpleBeanPropertyFilter
|
||||
.serializeAllExcept(properties2Exclude);
|
||||
FilterProvider filterProvider = new SimpleFilterProvider()
|
||||
.addFilter("propertyFilterMixIn", sbp);
|
||||
return objectMapper.writer(filterProvider)
|
||||
.writeValueAsString(value);
|
||||
} catch (Exception e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象json格式直接写出到流对象中(默认将转换所有的属性)
|
||||
*
|
||||
* @param out
|
||||
* @return
|
||||
*/
|
||||
public static void writeJsonStr(OutputStream out, Object value) {
|
||||
try {
|
||||
objectMapper.writeValue(out, value);
|
||||
} catch (Exception e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象json格式直接写出到流对象中
|
||||
*
|
||||
* @param value 需要转换的对象(注意,需要在要转换的对象中定义JsonFilter注解)
|
||||
* @param properties 需要转换的属性
|
||||
*/
|
||||
public static void writeJsonStr(OutputStream out, Object value,
|
||||
String[] properties) {
|
||||
|
||||
try {
|
||||
objectMapper.writer(
|
||||
new SimpleFilterProvider().addFilter(
|
||||
AnnotationUtils
|
||||
.getValue(
|
||||
AnnotationUtils.findAnnotation(
|
||||
value.getClass(),
|
||||
JsonFilter.class))
|
||||
.toString(), SimpleBeanPropertyFilter
|
||||
.filterOutAllExcept(properties)))
|
||||
.writeValue(out, value);
|
||||
} catch (Exception e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串格式
|
||||
*
|
||||
* @param value 需要转换的对象
|
||||
* @param properties2Exclude 需要排除的属性(注意,需要在要转换的对象中定义JsonFilter注解)
|
||||
*/
|
||||
public static void writeJsonStrWithExcludeProperties(OutputStream out,
|
||||
Object value, String[] properties2Exclude) {
|
||||
try {
|
||||
objectMapper.writer(
|
||||
new SimpleFilterProvider().addFilter(
|
||||
AnnotationUtils
|
||||
.getValue(
|
||||
AnnotationUtils.findAnnotation(
|
||||
value.getClass(),
|
||||
JsonFilter.class))
|
||||
.toString(), SimpleBeanPropertyFilter
|
||||
.serializeAllExcept(properties2Exclude)))
|
||||
.writeValue(out, value);
|
||||
} catch (Exception e) {
|
||||
log.error("Json转换失败", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化POJO或简单Collection如List<String>.
|
||||
* <p>
|
||||
* 如果JSON字符串为Null或"null"字符串, 返回Null. 如果JSON字符串为"[]", 返回空集合.
|
||||
* <p>
|
||||
* 如需反序列化复杂Collection如List<MyBean>, 请使用fromJson(String, JavaType)
|
||||
*/
|
||||
public static <T> T fromJson(String jsonString, Class<T> clazz) {
|
||||
if (StringUtils.isEmpty(jsonString)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return objectMapper.readValue(jsonString, clazz);
|
||||
} catch (IOException e) {
|
||||
log.warn("parse json string error:" + jsonString, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "unused"})
|
||||
public static List<Object> readJsonList(String jsondata, Object object) {
|
||||
try {
|
||||
List<LinkedHashMap<String, Object>> list = objectMapper.readValue(
|
||||
jsondata, List.class);
|
||||
|
||||
List<Object> objects = Lists.newArrayList();
|
||||
System.out.println(list.size());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String, Object> map = list.get(i);
|
||||
Set<String> set = map.keySet();
|
||||
for (Iterator<String> it = set.iterator(); it.hasNext(); ) {
|
||||
String key = it.next();
|
||||
System.out.println(key + ":" + map.get(key));
|
||||
}
|
||||
}
|
||||
} catch (JsonParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单独解析某一个json的key值
|
||||
*
|
||||
* @param @param jsonText
|
||||
* @param @param key
|
||||
* @param @return 设定文件
|
||||
* @return JsonNode 返回类型
|
||||
* @throws
|
||||
* @Title: getjsonvalue
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
*/
|
||||
public static JsonNode getjsonvalue(String jsonText, String key) {
|
||||
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode rootNode = mapper.readTree(jsonText); // 读取Json
|
||||
|
||||
return rootNode.path(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static JavaType getCollectionType(Class<?> collectionClass, Class<?>... elementClasses) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.getTypeFactory().constructParametricType(collectionClass, elementClasses);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析json属性,放到实体里面去
|
||||
*
|
||||
* @param @param jsondata
|
||||
* @param @param collectionClass
|
||||
* @param @return 设定文件
|
||||
* @return List<SpecVO> 返回类型
|
||||
* @throws
|
||||
* @Title: readJsonList
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<Object> readJsonList(String jsondata, Class<?> collectionClass) {
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JavaType javaType = getCollectionType(ArrayList.class, collectionClass);
|
||||
List<Object> lst = (List<Object>) mapper.readValue(jsondata, javaType);
|
||||
|
||||
return lst;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* json 转map
|
||||
*
|
||||
* @param @param jsondata
|
||||
* @param @return 设定文件
|
||||
* @return Map<String, Map < String, Object>> 返回类型
|
||||
* @throws
|
||||
* @Title: readJsonMap
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<String, Object> readJsonToMap(String jsondata) {
|
||||
try {
|
||||
Map<String, Object> maps = objectMapper.readValue(jsondata, Map.class);
|
||||
//System.out.println(maps);
|
||||
return maps;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Map<String, Object> readJsonToMap1(String jsondata) {
|
||||
try {
|
||||
Map<String, Object> maps = objectMapper.readValue(jsondata, Map.class);
|
||||
//System.out.println(maps);
|
||||
return maps;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置过滤值为空的属性,使得生成的 json 字符串只包含非空的值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// public static JsonConfig getJsonConfig() {
|
||||
// JsonConfig jsonConfig = new JsonConfig();
|
||||
// jsonConfig.registerJsonValueProcessor(java.sql.Timestamp.class, new JsonValueProcessorImpl());
|
||||
// jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
|
||||
// @Override
|
||||
// public boolean apply(Object source, String name, Object value) {
|
||||
// return value == null;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// jsonConfig.setIgnoreDefaultExcludes(false); // 设置默认忽略
|
||||
// jsonConfig.setExcludes(new String[]{"dbName", "isDel"}); // 此处是亮点,只要将所需忽略字段加到数组中即可,在实际测试中,我发现在所返回数组中,存在大量无用属性,
|
||||
//
|
||||
// return jsonConfig;
|
||||
// }
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<String, Object> userData = Maps.newHashMap();
|
||||
Map<String, Object> nameStruct = Maps.newHashMap();
|
||||
nameStruct.put("firstName", "张三");
|
||||
nameStruct.put("lastName", "你大爷");
|
||||
|
||||
System.out.println(JsonUtil.toJsonStr(nameStruct));
|
||||
userData.put("name", nameStruct);
|
||||
userData.put("age", 20);
|
||||
List<String> stringList = Lists.newArrayList("A", "B", "C");
|
||||
System.out.println(JsonUtil.toJsonStr(userData));
|
||||
System.out.println(JsonUtil.toJsonStr(stringList));
|
||||
// String[] arr = {"37","38","41","42","43","44","45","1693","1694","1695","1696"};
|
||||
// System.out.println(toJsonStr(arr));
|
||||
|
||||
String ss = "{\"address\": \"address2\",\"name\":\"haha2\"}";
|
||||
|
||||
Map<String, Object> map = readJsonToMap(ss);
|
||||
|
||||
if (map != null) {
|
||||
System.out.println(map.get("address"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串。
|
||||
*/
|
||||
public static String objectToJson(Object data) {
|
||||
try {
|
||||
String string = MAPPER.writeValueAsString(data);
|
||||
return string;
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将json结果集转化为对象
|
||||
*
|
||||
* @param jsonData json数据
|
||||
* @param beanType 对象中的object类型
|
||||
*/
|
||||
public static <T> T jsonToPojo(String jsonData, Class<T> beanType) {
|
||||
try {
|
||||
T t = MAPPER.readValue(jsonData, beanType);
|
||||
return t;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将json数据转换成pojo对象list
|
||||
*/
|
||||
public static <T> List<T> jsonToList(String jsonData, Class<T> beanType) {
|
||||
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
|
||||
try {
|
||||
List<T> list = MAPPER.readValue(jsonData, javaType);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
///**
|
||||
// *
|
||||
// */
|
||||
//package com.zscat.mallplus.util;
|
||||
//
|
||||
//
|
||||
//import net.sf.json.JsonConfig;
|
||||
//import net.sf.json.processors.JsonValueProcessor;
|
||||
//
|
||||
//import java.text.SimpleDateFormat;
|
||||
//import java.util.Date;
|
||||
//
|
||||
///**
|
||||
// * <p>Title: JsonValueProcessorImpl.java</p>
|
||||
// * <p>Description: net.js.json 特殊值处理</p>
|
||||
// * <p>Copyright: Copyright (c) 2014-2018</p>
|
||||
// * <p>Company: leimingtech.com</p>
|
||||
// *
|
||||
// * @author linjm
|
||||
// * @version 1.0
|
||||
// * @date 2015年7月17日
|
||||
// */
|
||||
//public class JsonValueProcessorImpl implements JsonValueProcessor {
|
||||
//
|
||||
// private String format = "yyyy-MM-dd HH:mm:ss";
|
||||
//
|
||||
// @Override
|
||||
// public Object processArrayValue(Object value, JsonConfig jsonConfig) {
|
||||
// String[] obj = {};
|
||||
// if (value instanceof Date[]) {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
// Date[] date = (Date[]) value;
|
||||
// for (int i = 0; i < date.length; i++) {
|
||||
// obj[i] = sdf.format(date[i]);
|
||||
// }
|
||||
// }
|
||||
// return obj;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
|
||||
// if (value instanceof Date) {
|
||||
// String str = new SimpleDateFormat(format).format(value);
|
||||
// return str;
|
||||
// }
|
||||
// return value.toString();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
//import io.jsonwebtoken.Claims;
|
||||
//import io.jsonwebtoken.Jwts;
|
||||
//import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* JwtToken生成的工具类
|
||||
* JWT token的格式:header.payload.signature
|
||||
* header的格式(算法、token的类型):
|
||||
* {"alg": "HS512","typ": "JWT"}
|
||||
* payload的格式(用户名、创建时间、生成时间):
|
||||
* {"sub":"wang","created":1489079981393,"exp":1489684781}
|
||||
* signature的生成算法:
|
||||
* HMACSHA256(base64UrlEncode(header) + "." +base64UrlEncode(payload),secret)
|
||||
* https://github.com/shenzhuan/mallplus on 2018/4/28.
|
||||
*/
|
||||
@Component
|
||||
public class JwtTokenUtil {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JwtTokenUtil.class);
|
||||
private static final String CLAIM_KEY_USERNAME = "sub";
|
||||
private static final String CLAIM_KEY_CREATED = "created";
|
||||
// @Value("${jwt.secret}")
|
||||
// private String secret;
|
||||
// @Value("${jwt.expiration}")
|
||||
// private Long expiration;
|
||||
|
||||
/**
|
||||
* 根据负责生成JWT的token
|
||||
*/
|
||||
// private String generateToken(Map<String, Object> claims) {
|
||||
// return Jwts.builder()
|
||||
// .setClaims(claims)
|
||||
// .setExpiration(generateExpirationDate())
|
||||
// .signWith(SignatureAlgorithm.HS512, secret)
|
||||
// .compact();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从token中获取JWT中的负载
|
||||
*/
|
||||
// private Claims getClaimsFromToken(String token) {
|
||||
// Claims claims = null;
|
||||
// try {
|
||||
// claims = Jwts.parser()
|
||||
// .setSigningKey(secret)
|
||||
// .parseClaimsJws(token)
|
||||
// .getBody();
|
||||
// } catch (Exception e) {
|
||||
// LOGGER.error("JWT格式验证失败:{}", token);
|
||||
// }
|
||||
// return claims;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 生成token的过期时间
|
||||
*/
|
||||
// private Date generateExpirationDate() {
|
||||
// return new Date(System.currentTimeMillis() + expiration * 1000);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从token中获取登录用户名
|
||||
*/
|
||||
// public String getUserNameFromToken(String token) {
|
||||
// String username;
|
||||
// try {
|
||||
// Claims claims = getClaimsFromToken(token);
|
||||
// username = claims.getSubject();
|
||||
// } catch (Exception e) {
|
||||
// username = null;
|
||||
// }
|
||||
// return username;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 验证token是否还有效
|
||||
*
|
||||
* @param token 客户端传入的token
|
||||
* @param userDetails 从数据库中查询出来的用户信息
|
||||
*/
|
||||
// public boolean validateToken(String token, UserDetails userDetails) {
|
||||
// String username = getUserNameFromToken(token);
|
||||
// return username.equals(userDetails.getUsername()) && !isTokenExpired(token);
|
||||
// }
|
||||
// public boolean validateTokenByUserName(String token) {
|
||||
// return !isTokenExpired(token);
|
||||
// }
|
||||
/**
|
||||
* 判断token是否已经失效
|
||||
*/
|
||||
// public boolean isTokenExpired(String token) {
|
||||
// Date expiredDate = getExpiredDateFromToken(token);
|
||||
// return expiredDate.before(new Date());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从token中获取过期时间
|
||||
*/
|
||||
// public Date getExpiredDateFromToken(String token) {
|
||||
// Claims claims = getClaimsFromToken(token);
|
||||
// return claims.getExpiration();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据用户信息生成token
|
||||
*/
|
||||
// public String generateToken(UserDetails userDetails) {
|
||||
// Map<String, Object> claims = new HashMap<>();
|
||||
// claims.put(CLAIM_KEY_USERNAME, userDetails.getUsername());
|
||||
// claims.put(CLAIM_KEY_CREATED, new Date());
|
||||
// return generateToken(claims);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 判断token是否可以被刷新
|
||||
*/
|
||||
// public boolean canRefresh(String token) {
|
||||
// return !isTokenExpired(token);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
// public String refreshToken(String token) {
|
||||
// Claims claims = getClaimsFromToken(token);
|
||||
// claims.put(CLAIM_KEY_CREATED, new Date());
|
||||
// return generateToken(claims);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 二维码的生成需要借助MatrixToImageWriter类,该类是由Google提供的,可以将该类直接拷贝到源码中使用
|
||||
*/
|
||||
public class MatrixToImageWriter {
|
||||
private static final int BLACK = 0xFF000000;
|
||||
private static final int WHITE = 0xFFFFFFFF;
|
||||
|
||||
private MatrixToImageWriter() {
|
||||
}
|
||||
|
||||
private static BufferedImage toBufferedImage(BitMatrix matrix, String words) {
|
||||
int width = matrix.getWidth();
|
||||
int height = matrix.getHeight();
|
||||
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
|
||||
}
|
||||
}
|
||||
Graphics2D outg = image.createGraphics();
|
||||
setGraphics2D(outg);
|
||||
// 画二维码到新的面板
|
||||
outg.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
|
||||
// 画文字到新的面板
|
||||
//Color color=new Color(183,183,183);
|
||||
outg.setColor(Color.BLACK);
|
||||
// 字体、字型、字号
|
||||
outg.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
||||
//文字长度
|
||||
int strWidth = outg.getFontMetrics().stringWidth(words);
|
||||
//总长度减去文字长度的一半 (居中显示)
|
||||
int wordStartX = (width - strWidth) / 2;
|
||||
//height + (outImage.getHeight() - height) / 2 + 12
|
||||
int wordStartY = height - 20;
|
||||
// 画文字
|
||||
outg.drawString(words, wordStartX, wordStartY);
|
||||
outg.dispose();
|
||||
image.flush();
|
||||
return image;
|
||||
}
|
||||
|
||||
private static void setGraphics2D(Graphics2D graphics2D) {
|
||||
graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
|
||||
Stroke s = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);
|
||||
graphics2D.setStroke(s);
|
||||
}
|
||||
|
||||
static void writeToFile(BitMatrix matrix, String format, File file, String words) throws IOException {
|
||||
BufferedImage image = toBufferedImage(matrix, words);
|
||||
if (!ImageIO.write(image, format, file)) {
|
||||
throw new IOException("Could not write an image of format " + format + " to " + file);
|
||||
}
|
||||
}
|
||||
|
||||
static void writeToStream(BitMatrix matrix, String format, OutputStream stream, String words) throws IOException {
|
||||
BufferedImage image = toBufferedImage(matrix, words);
|
||||
if (!ImageIO.write(image, format, stream)) {
|
||||
throw new IOException("Could not write an image of format " + format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ByteArrayResource createQrCode(String url, String words) {
|
||||
try {
|
||||
Map<EncodeHintType, String> hints = new HashMap<>();
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 400, 400, hints);
|
||||
//=======================生成文件 可以放在本地======================
|
||||
//File file = new File(path, fileName);
|
||||
//if (file.exists() || ((file.getParentFile().exists() || file.getParentFile().mkdirs()) && file.createNewFile())) {
|
||||
// writeToFile(bitMatrix, "jpg", file);
|
||||
// System.out.println("搞定:" + file);
|
||||
//}
|
||||
//=============此处生成流因为后面要上传到文件系统中,所以直接通过流上传===========
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
writeToStream(bitMatrix, "jpg", outputStream, words);
|
||||
//==============生成输入流========================
|
||||
//ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
ByteArrayResource arrayResource = new ByteArrayResource(outputStream.toByteArray()) {
|
||||
@Override
|
||||
public String getFilename() throws IllegalStateException {
|
||||
return System.currentTimeMillis() + "";
|
||||
}
|
||||
};
|
||||
return arrayResource;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String text = "http://www.baidu.com"; // 二维码内容
|
||||
int width = 300; // 二维码图片宽度
|
||||
int height = 300; // 二维码图片高度
|
||||
String format = "jpg";// 二维码的图片格式
|
||||
|
||||
Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); // 内容所使用字符集编码
|
||||
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(text,
|
||||
BarcodeFormat.QR_CODE, width, height, hints);
|
||||
// 生成二维码
|
||||
File outputFile = new File("d:" + File.separator + "new.jpg");
|
||||
MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile, "123");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
|
||||
public class MyModule extends SimpleModule {
|
||||
@Override
|
||||
public void setupModule(SetupContext context) {
|
||||
context.setMixInAnnotations(Object.class, PropertyFilterMixIn.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分页工具
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-10
|
||||
*/
|
||||
public class PageUtil extends cn.hutool.core.util.PageUtil {
|
||||
|
||||
/**
|
||||
* List 分页
|
||||
*/
|
||||
public static List toPage(int page, int size, List list) {
|
||||
int fromIndex = page * size;
|
||||
int toIndex = page * size + size;
|
||||
|
||||
if (fromIndex > list.size()) {
|
||||
return new ArrayList();
|
||||
} else if (toIndex >= list.size()) {
|
||||
return list.subList(fromIndex, list.size());
|
||||
} else {
|
||||
return list.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Page 数据处理,预防redis反序列化报错
|
||||
*/
|
||||
public static Map<String, Object> toPage(Page page) {
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content", page.getContent());
|
||||
map.put("totalElements", page.getTotalElements());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*/
|
||||
public static Map<String, Object> toPage(Object object, Object totalElements) {
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content", object);
|
||||
map.put("totalElements", totalElements);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||
|
||||
@JsonFilter("propertyFilterMixIn")
|
||||
public class PropertyFilterMixIn {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
//import com.qiniu.storage.Region;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 七牛云存储工具类
|
||||
*
|
||||
* @author mallplus
|
||||
* @date 2018-12-31
|
||||
*/
|
||||
public class QiNiuUtil {
|
||||
|
||||
private static final String HUAD = "华东";
|
||||
|
||||
private static final String HUAB = "华北";
|
||||
|
||||
private static final String HUAN = "华南";
|
||||
|
||||
private static final String BEIM = "北美";
|
||||
|
||||
/**
|
||||
* 得到机房的对应关系
|
||||
*
|
||||
* @param zone 机房名称
|
||||
* @return Region
|
||||
*/
|
||||
// public static Region getRegion(String zone) {
|
||||
//
|
||||
// if (HUAD.equals(zone)) {
|
||||
// return Region.huadong();
|
||||
// } else if (HUAB.equals(zone)) {
|
||||
// return Region.huabei();
|
||||
// } else if (HUAN.equals(zone)) {
|
||||
// return Region.huanan();
|
||||
// } else if (BEIM.equals(zone)) {
|
||||
// return Region.beimei();
|
||||
// // 否则就是东南亚
|
||||
// } else {
|
||||
// return Region.qvmHuadong();
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 默认不指定key的情况下,以文件内容的hash值作为文件名
|
||||
*
|
||||
* @param file 文件名
|
||||
* @return String
|
||||
*/
|
||||
// public static String getKey(String file) {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// Date date = new Date();
|
||||
// return FileUtil.getFileNameNoEx(file) + "-" +
|
||||
// sdf.format(date) +
|
||||
// "." +
|
||||
// FileUtil.getExtensionName(file);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* request工具类
|
||||
* https://github.com/shenzhuan/mallplus on 2018/4/28.
|
||||
*/
|
||||
public class RequestUtil {
|
||||
|
||||
/**
|
||||
* 获取请求basePath
|
||||
*/
|
||||
public static String getBasePath(HttpServletRequest request) {
|
||||
StringBuffer basePath = new StringBuffer();
|
||||
String scheme = request.getScheme();
|
||||
String domain = request.getServerName();
|
||||
int port = request.getServerPort();
|
||||
basePath.append(scheme);
|
||||
basePath.append("://");
|
||||
basePath.append(domain);
|
||||
if ("http".equalsIgnoreCase(scheme) && 80 != port) {
|
||||
basePath.append(":").append(String.valueOf(port));
|
||||
} else if ("https".equalsIgnoreCase(scheme) && port != 443) {
|
||||
basePath.append(":").append(String.valueOf(port));
|
||||
}
|
||||
return basePath.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求中参数转Map<String, String>,for支付宝异步回调,平时建议直接使用request.getParameterMap(),返回Map<String, String[]>
|
||||
*/
|
||||
public static Map<String, String> getParameterMap(HttpServletRequest request) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
Enumeration parameterNames = request.getParameterNames();
|
||||
while (parameterNames.hasMoreElements()) {
|
||||
String parameterName = (String) parameterNames.nextElement();
|
||||
result.put(parameterName, request.getParameter(parameterName));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除request指定参数
|
||||
*/
|
||||
public String removeParam(HttpServletRequest request, String paramName) {
|
||||
String queryString = "";
|
||||
Enumeration keys = request.getParameterNames();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = (String) keys.nextElement();
|
||||
if (key.equals(paramName)) {
|
||||
continue;
|
||||
}
|
||||
if ("".equals(queryString)) {
|
||||
queryString = key + "=" + request.getParameter(key);
|
||||
} else {
|
||||
queryString += "&" + key + "=" + request.getParameter(key);
|
||||
}
|
||||
}
|
||||
return queryString;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字符串工具类, 继承org.apache.commons.lang3.StringUtils类
|
||||
*/
|
||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
|
||||
private static final char SEPARATOR = '_';
|
||||
|
||||
/**
|
||||
* 驼峰命名法工具
|
||||
*
|
||||
* @return toCamelCase(" hello_world ") == "helloWorld"
|
||||
* toCapitalizeCamelCase("hello_world") == "HelloWorld"
|
||||
* toUnderScoreCase("helloWorld") = "hello_world"
|
||||
*/
|
||||
public static String toCamelCase(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
s = s.toLowerCase();
|
||||
|
||||
StringBuilder sb = new StringBuilder(s.length());
|
||||
boolean upperCase = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
if (c == SEPARATOR) {
|
||||
upperCase = true;
|
||||
} else if (upperCase) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperCase = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰命名法工具
|
||||
*
|
||||
* @return toCamelCase(" hello_world ") == "helloWorld"
|
||||
* toCapitalizeCamelCase("hello_world") == "HelloWorld"
|
||||
* toUnderScoreCase("helloWorld") = "hello_world"
|
||||
*/
|
||||
public static String toCapitalizeCamelCase(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
s = toCamelCase(s);
|
||||
return s.substring(0, 1).toUpperCase() + s.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰命名法工具
|
||||
*
|
||||
* @return toCamelCase(" hello_world ") == "helloWorld"
|
||||
* toCapitalizeCamelCase("hello_world") == "HelloWorld"
|
||||
* toUnderScoreCase("helloWorld") = "hello_world"
|
||||
*/
|
||||
static String toUnderScoreCase(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperCase = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
boolean nextUpperCase = true;
|
||||
|
||||
if (i < (s.length() - 1)) {
|
||||
nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
|
||||
}
|
||||
|
||||
if ((i > 0) && Character.isUpperCase(c)) {
|
||||
if (!upperCase || !nextUpperCase) {
|
||||
sb.append(SEPARATOR);
|
||||
}
|
||||
upperCase = true;
|
||||
} else {
|
||||
upperCase = false;
|
||||
}
|
||||
|
||||
sb.append(Character.toLowerCase(c));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ip地址
|
||||
*/
|
||||
public static String getIp(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
if (ip.contains(",")) {
|
||||
ip = ip.split(",")[0];
|
||||
}
|
||||
if ("127.0.0.1".equals(ip)) {
|
||||
// 获取本机真正的ip地址
|
||||
try {
|
||||
ip = InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得当天是周几
|
||||
*/
|
||||
public static String getWeekDay() {
|
||||
String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (w < 0) {
|
||||
w = 0;
|
||||
}
|
||||
return weekDays[w];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yxt.yythmall.mallplus.biz.util;
|
||||
|
||||
//import com.zscat.mallplus.bo.AdminUserDetails;
|
||||
//import com.zscat.mallplus.sys.entity.SysUser;
|
||||
//import org.springframework.security.core.Authentication;
|
||||
//import org.springframework.security.core.context.SecurityContext;
|
||||
//import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
/**
|
||||
* @Auther: shenzhuan
|
||||
* @Date: 2019/3/30 16:26
|
||||
* @Description:
|
||||
*/
|
||||
public class UserUtils {
|
||||
// public static SysUser getCurrentMember() {
|
||||
// try {
|
||||
// SecurityContext ctx = SecurityContextHolder.getContext();
|
||||
// Authentication auth = ctx.getAuthentication();
|
||||
// AdminUserDetails memberDetails = (AdminUserDetails) auth.getPrincipal();
|
||||
// return memberDetails.getUmsAdmin();
|
||||
// } catch (Exception e) {
|
||||
// return new SysUser();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 优选专区和产品关系表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@TableName("cms_prefrence_area_product_relation")
|
||||
public class CmsPrefrenceAreaProductRelation extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("prefrence_area_id")
|
||||
private Long prefrenceAreaId;
|
||||
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getPrefrenceAreaId() {
|
||||
return prefrenceAreaId;
|
||||
}
|
||||
|
||||
public void setPrefrenceAreaId(Long prefrenceAreaId) {
|
||||
this.prefrenceAreaId = prefrenceAreaId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 专题商品关系表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-17
|
||||
*/
|
||||
@TableName("cms_subject_product_relation")
|
||||
public class CmsSubjectProductRelation extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("subject_id")
|
||||
private Long subjectId;
|
||||
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getSubjectId() {
|
||||
return subjectId;
|
||||
}
|
||||
|
||||
public void setSubjectId(Long subjectId) {
|
||||
this.subjectId = subjectId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CmsSubjectProductRelation{" +
|
||||
", id=" + id +
|
||||
", subjectId=" + subjectId +
|
||||
", productId=" + productId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @author meizhuang team
|
||||
* @since 2019-04-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("es_shop_goods_group_map")
|
||||
public class EsShopGoodsGroupMap implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@TableField("goods_id")
|
||||
private Long goodsId;
|
||||
@TableField("group_id")
|
||||
private Long groupId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 相册表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Data
|
||||
@TableName("pms_album")
|
||||
public class PmsAlbum extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String pic;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 画册图片表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@TableName("pms_album_pic")
|
||||
public class PmsAlbumPic extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@TableField("album_id")
|
||||
private Long albumId;
|
||||
|
||||
private String pic;
|
||||
|
||||
private String type;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 品牌表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@TableName("pms_brand")
|
||||
public class PmsBrand extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 首字母
|
||||
*/
|
||||
@TableField("first_letter")
|
||||
private String firstLetter;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否为品牌制造商:0->不是;1->是
|
||||
*/
|
||||
@TableField("factory_status")
|
||||
private Integer factoryStatus;
|
||||
|
||||
@TableField("show_status")
|
||||
private Integer showStatus;
|
||||
|
||||
/**
|
||||
* 产品数量
|
||||
*/
|
||||
@TableField("product_count")
|
||||
private Integer productCount;
|
||||
|
||||
/**
|
||||
* 产品评论数量
|
||||
*/
|
||||
@TableField("product_comment_count")
|
||||
private Integer productCommentCount;
|
||||
|
||||
/**
|
||||
* 品牌logo
|
||||
*/
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 专区大图
|
||||
*/
|
||||
@TableField("big_pic")
|
||||
private String bigPic;
|
||||
|
||||
/**
|
||||
* 品牌故事
|
||||
*/
|
||||
@TableField("brand_story")
|
||||
private String brandStory;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFirstLetter() {
|
||||
return firstLetter;
|
||||
}
|
||||
|
||||
public void setFirstLetter(String firstLetter) {
|
||||
this.firstLetter = firstLetter;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getFactoryStatus() {
|
||||
return factoryStatus;
|
||||
}
|
||||
|
||||
public void setFactoryStatus(Integer factoryStatus) {
|
||||
this.factoryStatus = factoryStatus;
|
||||
}
|
||||
|
||||
public Integer getShowStatus() {
|
||||
return showStatus;
|
||||
}
|
||||
|
||||
public void setShowStatus(Integer showStatus) {
|
||||
this.showStatus = showStatus;
|
||||
}
|
||||
|
||||
public Integer getProductCount() {
|
||||
return productCount;
|
||||
}
|
||||
|
||||
public void setProductCount(Integer productCount) {
|
||||
this.productCount = productCount;
|
||||
}
|
||||
|
||||
public Integer getProductCommentCount() {
|
||||
return productCommentCount;
|
||||
}
|
||||
|
||||
public void setProductCommentCount(Integer productCommentCount) {
|
||||
this.productCommentCount = productCommentCount;
|
||||
}
|
||||
|
||||
public String getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(String logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
public String getBigPic() {
|
||||
return bigPic;
|
||||
}
|
||||
|
||||
public void setBigPic(String bigPic) {
|
||||
this.bigPic = bigPic;
|
||||
}
|
||||
|
||||
public String getBrandStory() {
|
||||
return brandStory;
|
||||
}
|
||||
|
||||
public void setBrandStory(String brandStory) {
|
||||
this.brandStory = brandStory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PmsBrand{" +
|
||||
", id=" + id +
|
||||
", name=" + name +
|
||||
", firstLetter=" + firstLetter +
|
||||
", sort=" + sort +
|
||||
", factoryStatus=" + factoryStatus +
|
||||
", showStatus=" + showStatus +
|
||||
", productCount=" + productCount +
|
||||
", productCommentCount=" + productCommentCount +
|
||||
", logo=" + logo +
|
||||
", bigPic=" + bigPic +
|
||||
", brandStory=" + brandStory +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品评价表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@TableName("pms_comment")
|
||||
public class PmsComment extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("product_id")
|
||||
private Long productId;
|
||||
|
||||
@TableField("member_nick_name")
|
||||
private String memberNickName;
|
||||
|
||||
@TableField("product_name")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 评价星数:0->5
|
||||
*/
|
||||
private Integer star;
|
||||
|
||||
/**
|
||||
* 评价的ip
|
||||
*/
|
||||
@TableField("member_ip")
|
||||
private String memberIp;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("show_status")
|
||||
private Integer showStatus;
|
||||
|
||||
/**
|
||||
* 购买时的商品属性
|
||||
*/
|
||||
@TableField("product_attribute")
|
||||
private String productAttribute;
|
||||
|
||||
@TableField("collect_couont")
|
||||
private Integer collectCouont;
|
||||
|
||||
@TableField("read_count")
|
||||
private Integer readCount;
|
||||
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 上传图片地址,以逗号隔开
|
||||
*/
|
||||
private String pics;
|
||||
|
||||
/**
|
||||
* 评论用户头像
|
||||
*/
|
||||
@TableField("member_icon")
|
||||
private String memberIcon;
|
||||
|
||||
@TableField("replay_count")
|
||||
private Integer replayCount;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getMemberNickName() {
|
||||
return memberNickName;
|
||||
}
|
||||
|
||||
public void setMemberNickName(String memberNickName) {
|
||||
this.memberNickName = memberNickName;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public Integer getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(Integer star) {
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public String getMemberIp() {
|
||||
return memberIp;
|
||||
}
|
||||
|
||||
public void setMemberIp(String memberIp) {
|
||||
this.memberIp = memberIp;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getShowStatus() {
|
||||
return showStatus;
|
||||
}
|
||||
|
||||
public void setShowStatus(Integer showStatus) {
|
||||
this.showStatus = showStatus;
|
||||
}
|
||||
|
||||
public String getProductAttribute() {
|
||||
return productAttribute;
|
||||
}
|
||||
|
||||
public void setProductAttribute(String productAttribute) {
|
||||
this.productAttribute = productAttribute;
|
||||
}
|
||||
|
||||
public Integer getCollectCouont() {
|
||||
return collectCouont;
|
||||
}
|
||||
|
||||
public void setCollectCouont(Integer collectCouont) {
|
||||
this.collectCouont = collectCouont;
|
||||
}
|
||||
|
||||
public Integer getReadCount() {
|
||||
return readCount;
|
||||
}
|
||||
|
||||
public void setReadCount(Integer readCount) {
|
||||
this.readCount = readCount;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getPics() {
|
||||
return pics;
|
||||
}
|
||||
|
||||
public void setPics(String pics) {
|
||||
this.pics = pics;
|
||||
}
|
||||
|
||||
public String getMemberIcon() {
|
||||
return memberIcon;
|
||||
}
|
||||
|
||||
public void setMemberIcon(String memberIcon) {
|
||||
this.memberIcon = memberIcon;
|
||||
}
|
||||
|
||||
public Integer getReplayCount() {
|
||||
return replayCount;
|
||||
}
|
||||
|
||||
public void setReplayCount(Integer replayCount) {
|
||||
this.replayCount = replayCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PmsComment{" +
|
||||
", id=" + id +
|
||||
", productId=" + productId +
|
||||
", memberNickName=" + memberNickName +
|
||||
", productName=" + productName +
|
||||
", star=" + star +
|
||||
", memberIp=" + memberIp +
|
||||
", createTime=" + createTime +
|
||||
", showStatus=" + showStatus +
|
||||
", productAttribute=" + productAttribute +
|
||||
", collectCouont=" + collectCouont +
|
||||
", readCount=" + readCount +
|
||||
", content=" + content +
|
||||
", pics=" + pics +
|
||||
", memberIcon=" + memberIcon +
|
||||
", replayCount=" + replayCount +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品评价回复表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@TableName("pms_comment_replay")
|
||||
public class PmsCommentReplay extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField("comment_id")
|
||||
private Long commentId;
|
||||
|
||||
@TableField("member_nick_name")
|
||||
private String memberNickName;
|
||||
|
||||
@TableField("member_icon")
|
||||
private String memberIcon;
|
||||
|
||||
private String content;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 评论人员类型;0->会员;1->管理员
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getCommentId() {
|
||||
return commentId;
|
||||
}
|
||||
|
||||
public void setCommentId(Long commentId) {
|
||||
this.commentId = commentId;
|
||||
}
|
||||
|
||||
public String getMemberNickName() {
|
||||
return memberNickName;
|
||||
}
|
||||
|
||||
public void setMemberNickName(String memberNickName) {
|
||||
this.memberNickName = memberNickName;
|
||||
}
|
||||
|
||||
public String getMemberIcon() {
|
||||
return memberIcon;
|
||||
}
|
||||
|
||||
public void setMemberIcon(String memberIcon) {
|
||||
this.memberIcon = memberIcon;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PmsCommentReplay{" +
|
||||
", id=" + id +
|
||||
", commentId=" + commentId +
|
||||
", memberNickName=" + memberNickName +
|
||||
", memberIcon=" + memberIcon +
|
||||
", content=" + content +
|
||||
", createTime=" + createTime +
|
||||
", type=" + type +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-06-15
|
||||
*/
|
||||
@Data
|
||||
@TableName("pms_favorite")
|
||||
public class PmsFavorite extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("add_time")
|
||||
private Date addTime;
|
||||
|
||||
/**
|
||||
* 1 商品 2 文章 3 店铺 4 及赠品 7 学校
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
@TableField("obj_id")
|
||||
private Long objId;
|
||||
|
||||
|
||||
@TableField("member_id")
|
||||
private Long memberId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String meno1;
|
||||
|
||||
private String meno2;
|
||||
|
||||
private String meno3;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 运费模版
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-04-19
|
||||
*/
|
||||
@Data
|
||||
@TableName("pms_feight_template")
|
||||
public class PmsFeightTemplate extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 计费类型:0->按重量;1->按件数
|
||||
*/
|
||||
@TableField("charge_type")
|
||||
private Integer chargeType;
|
||||
|
||||
/**
|
||||
* 首重kg
|
||||
*/
|
||||
@TableField("first_weight")
|
||||
private BigDecimal firstWeight;
|
||||
|
||||
/**
|
||||
* 首费(元)
|
||||
*/
|
||||
@TableField("first_fee")
|
||||
private BigDecimal firstFee;
|
||||
|
||||
@TableField("continue_weight")
|
||||
private BigDecimal continueWeight;
|
||||
|
||||
@TableField("continme_fee")
|
||||
private BigDecimal continmeFee;
|
||||
|
||||
/**
|
||||
* 目的地(省、市)
|
||||
*/
|
||||
private String dest;
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.yxt.yythmall.mallplus.mbg.pms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 帮助表
|
||||
* </p>
|
||||
*
|
||||
* @author zscat
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Data
|
||||
@TableName("pms_gifts")
|
||||
public class PmsGifts extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类别
|
||||
*/
|
||||
@TableField("category_id")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField("show_status")
|
||||
private Integer showStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
private Integer stock;
|
||||
|
||||
/**
|
||||
* 1 赠品 2 活动商品
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user