Commit 68176206 by XiaHou

权星相关接口修复

parent 8b4bd64b
package com.macro.mall.model.dto.quanxing;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class PmsSearchWordRequestParamDto implements Serializable {
@ApiModelProperty("需要删除的id集合,根据英文逗号分隔开")
private String ids;
}
...@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@Controller @Controller
@RequestMapping("/pmsSupplierAudit") @RequestMapping("/pmsProduct")
@Api(tags = "权星小程序_商品相关接口", description = "商品控制器") @Api(tags = "权星小程序_商品相关接口", description = "商品控制器")
public class PmsProductController { public class PmsProductController {
...@@ -26,13 +26,13 @@ public class PmsProductController { ...@@ -26,13 +26,13 @@ public class PmsProductController {
@ApiOperation("权星小程序_商品分页查询") @ApiOperation("权星小程序_商品分页查询")
@ResponseBody @ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.POST) @RequestMapping(value = "/getPageList", method = RequestMethod.GET)
public CommonResult<CommonPage<PmsProduct>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size, public CommonResult<CommonPage<PmsProduct>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("模糊查询商品名称 ")@RequestParam("name") String name, @ApiParam("模糊查询商品名称 ")@RequestParam("name") String name,
@ApiParam("是否新品 新品状态:0->不是新品;1->新品 ")@RequestParam("newStatus") Integer newStatus, @ApiParam("是否新品 新品状态:0->不是新品;1->新品 ")@RequestParam("newStatus") Integer newStatus,
@ApiParam("供应商id")@RequestParam("mchtId") Long mchtId, @ApiParam("供应商id")@RequestParam("mchtId") Long mchtId,
@ApiParam("排序:(例如根据价格降序 传入price DESC 根据价格升序传入price ASC) ")@RequestParam("orderBy") String orderBy){ @ApiParam("排序:(例如根据价格降序 传入price DESC 根据价格升序传入price ASC) ")@RequestParam("orderBy") String orderBy){
return CommonResult.success(CommonPage.restPage(this.pmsProductService.getAppPageList(page,size,newStatus,mchtId,orderBy))); return CommonResult.success(CommonPage.restPage(this.pmsProductService.getAppPageList(page,size,name,newStatus,mchtId,orderBy)));
} }
} }
package com.macro.mall.portal.controller.quanxing;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.PmsSearchWord;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.PmsSearchWordRequestParamDto;
import com.macro.mall.service.platform.PmsSearchWordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("/pmsSearchWord")
@Api(tags = "权星小程序_搜索字相关接口", description = "搜索内容控制器")
public class PmsSearchWordController {
@Autowired
private PmsSearchWordService pmsSearchWordService;
@ApiOperation("权星小程序_搜索词分页查询")
@ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.GET)
public CommonResult<CommonPage<PmsSearchWord>> getPageList(@ApiParam("页数") @RequestParam("pageNum")Integer pageNum, @ApiParam("每页大小")@RequestParam("pageSize")Integer pageSize){
return CommonResult.success(CommonPage.restPage(this.pmsSearchWordService.getPageList(pageNum,pageSize)));
}
@ApiOperation("权星小程序_搜索删除")
@ResponseBody
@RequestMapping(value = "/deleteByIds", method = RequestMethod.POST)
public CommonResult deleteByIds(@ApiParam("请求对象 如果ids为空 则删除当前会员下的所有搜索词") @RequestBody PmsSearchWordRequestParamDto pmsSearchWordRequestParamDto){
ResultMsg res = this.pmsSearchWordService.deleteSearchWords(pmsSearchWordRequestParamDto);
if(res.isFlag()){
return CommonResult.success(res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
}
...@@ -2,6 +2,9 @@ package com.macro.mall.service.platform; ...@@ -2,6 +2,9 @@ package com.macro.mall.service.platform;
import com.macro.mall.domain.dto.platform.SearchRecordParam; import com.macro.mall.domain.dto.platform.SearchRecordParam;
import com.macro.mall.domain.vo.platform.PmsSearchWordVo; import com.macro.mall.domain.vo.platform.PmsSearchWordVo;
import com.macro.mall.model.PmsSearchWord;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.PmsSearchWordRequestParamDto;
import java.util.List; import java.util.List;
...@@ -9,4 +12,19 @@ public interface PmsSearchWordService { ...@@ -9,4 +12,19 @@ public interface PmsSearchWordService {
void setWordConfig(String word, String ip, Long memberId); void setWordConfig(String word, String ip, Long memberId);
List<PmsSearchWordVo> queryList(SearchRecordParam param, Integer pageNum, Integer pageSize); List<PmsSearchWordVo> queryList(SearchRecordParam param, Integer pageNum, Integer pageSize);
/**
* 查询会员搜索词
* @param pageNum
* @param pageSize
* @return
*/
List<PmsSearchWord> getPageList(Integer pageNum,Integer pageSize);
/**
* 删除搜索词
* @param pmsSearchWordRequestParamDto
* @return
*/
ResultMsg deleteSearchWords(PmsSearchWordRequestParamDto pmsSearchWordRequestParamDto);
} }
...@@ -12,11 +12,16 @@ import com.macro.mall.model.PmsSearchWord; ...@@ -12,11 +12,16 @@ import com.macro.mall.model.PmsSearchWord;
import com.macro.mall.model.PmsSearchWordExample; import com.macro.mall.model.PmsSearchWordExample;
import com.macro.mall.model.PmsSearchWordRecord; import com.macro.mall.model.PmsSearchWordRecord;
import com.macro.mall.model.PmsSearchWordRecordExample; import com.macro.mall.model.PmsSearchWordRecordExample;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.PmsSearchWordRequestParamDto;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.platform.PmsSearchWordService; import com.macro.mall.service.platform.PmsSearchWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -28,6 +33,8 @@ public class PmsSearchWordServiceImpl implements PmsSearchWordService { ...@@ -28,6 +33,8 @@ public class PmsSearchWordServiceImpl implements PmsSearchWordService {
private PmsSearchWordDao searchWordDao; private PmsSearchWordDao searchWordDao;
@Resource @Resource
private PmsSearchWordRecordMapper searchWordRecordMapper; private PmsSearchWordRecordMapper searchWordRecordMapper;
@Autowired
private UmsMemberService umsMemberService;
@Override @Override
public List<PmsSearchWordVo> queryList(SearchRecordParam param, Integer pageNum, Integer pageSize) { public List<PmsSearchWordVo> queryList(SearchRecordParam param, Integer pageNum, Integer pageSize) {
...@@ -101,4 +108,41 @@ public class PmsSearchWordServiceImpl implements PmsSearchWordService { ...@@ -101,4 +108,41 @@ public class PmsSearchWordServiceImpl implements PmsSearchWordService {
record.setMemberId(memberId); record.setMemberId(memberId);
searchWordRecordMapper.insertSelective(record); searchWordRecordMapper.insertSelective(record);
} }
@Override
public List<PmsSearchWord> getPageList(Integer pageNum,Integer pageSize){
if(pageNum != null && pageSize != null){
PageHelper.startPage(pageNum, pageSize);
}
PmsSearchWordExample example = new PmsSearchWordExample();
PmsSearchWordExample.Criteria criteria = example.createCriteria();
//获取当前操作会员的id
Long memberId = umsMemberService.getCurrentMemberId();
criteria.andCreateByEqualTo(memberId);
return this.searchWordMapper.selectByExample(example);
}
/**
* 删除搜索词 如果ids为空 则根据会员id删除当前所有搜索词
* @param pmsSearchWordRequestParamDto
* @return
*/
@Override
@Transactional(rollbackFor=Exception.class)
public ResultMsg deleteSearchWords(PmsSearchWordRequestParamDto pmsSearchWordRequestParamDto){
if(pmsSearchWordRequestParamDto.getIds() != null && !"".equals(pmsSearchWordRequestParamDto.getIds())){//如果ids不为空 则根据传入的ids删除
List idList = Arrays.asList(pmsSearchWordRequestParamDto.getIds().split(","));//根据逗号分隔转化为list
idList.forEach(id ->{
this.searchWordMapper.deleteByPrimaryKey(Long.valueOf((String)id));
});
}else{//否则根据当前会员 删除会员下的搜索词
//获取当前操作会员的id
Long memberId = umsMemberService.getCurrentMemberId();
PmsSearchWordExample example = new PmsSearchWordExample();
PmsSearchWordExample.Criteria criteria = example.createCriteria();
criteria.andCreateByEqualTo(memberId);
this.searchWordMapper.deleteByExample(example);
}
return new ResultMsg(true,"操作成功");
}
} }
...@@ -205,5 +205,5 @@ public interface PmsProductService { ...@@ -205,5 +205,5 @@ public interface PmsProductService {
* @param newStatus * @param newStatus
* @return * @return
*/ */
List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,Integer newStatus,Long mchtId,String orderBy); List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,String name,Integer newStatus,Long mchtId,String orderBy);
} }
...@@ -3,6 +3,7 @@ package com.macro.mall.service.product.impl; ...@@ -3,6 +3,7 @@ package com.macro.mall.service.product.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.macro.mall.common.api.CommonResult; import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.api.StringUtils; import com.macro.mall.common.api.StringUtils;
import com.macro.mall.dao.platform.PmsSearchWordDao;
import com.macro.mall.dao.product.*; import com.macro.mall.dao.product.*;
import com.macro.mall.dao.quanxing.PmsProductSkuValueDao; import com.macro.mall.dao.quanxing.PmsProductSkuValueDao;
import com.macro.mall.domain.dto.MchtProductQueryParam; import com.macro.mall.domain.dto.MchtProductQueryParam;
...@@ -27,12 +28,14 @@ import com.macro.mall.security.util.AddressUtils; ...@@ -27,12 +28,14 @@ import com.macro.mall.security.util.AddressUtils;
import com.macro.mall.service.baiduyun.PmsProductPicService; import com.macro.mall.service.baiduyun.PmsProductPicService;
import com.macro.mall.service.coupon.SmsCouponService; import com.macro.mall.service.coupon.SmsCouponService;
import com.macro.mall.service.mcht.MchtShopInfoService; import com.macro.mall.service.mcht.MchtShopInfoService;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.product.PmsProductAttributeValueService; import com.macro.mall.service.product.PmsProductAttributeValueService;
import com.macro.mall.service.product.PmsProductParamInfoService; import com.macro.mall.service.product.PmsProductParamInfoService;
import com.macro.mall.service.product.PmsProductService; import com.macro.mall.service.product.PmsProductService;
import com.macro.mall.service.promotion.SmsFullReductionPromotionService; import com.macro.mall.service.promotion.SmsFullReductionPromotionService;
import com.macro.mall.service.promotion.SmsSeckillPromotionService; import com.macro.mall.service.promotion.SmsSeckillPromotionService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -117,6 +120,10 @@ public class PmsProductServiceImpl implements PmsProductService { ...@@ -117,6 +120,10 @@ public class PmsProductServiceImpl implements PmsProductService {
private PmsSkuStockDao pmsSkuStockDao; private PmsSkuStockDao pmsSkuStockDao;
@Resource @Resource
private PmsProductSkuValueDao pmsProductSkuValueDao; private PmsProductSkuValueDao pmsProductSkuValueDao;
@Autowired
private UmsMemberService umsMemberService;
@Resource
private PmsSearchWordMapper pmsSearchWordMapper;
/** /**
* 权星添加商品 * 权星添加商品
...@@ -881,11 +888,23 @@ public class PmsProductServiceImpl implements PmsProductService { ...@@ -881,11 +888,23 @@ public class PmsProductServiceImpl implements PmsProductService {
* @return * @return
*/ */
@Override @Override
public List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,Integer newStatus,Long mchtId,String orderBy){ public List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,String name,Integer newStatus,Long mchtId,String orderBy){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
PmsProductExample example = new PmsProductExample(); PmsProductExample example = new PmsProductExample();
PmsProductExample.Criteria criteria = example.createCriteria(); PmsProductExample.Criteria criteria = example.createCriteria();
if(name != null && ! "".equals(name)){//如果名字不为空 则添加模糊搜索
criteria.andNameLike("%"+"name"+"%");
//获取当前操作会员的id
Long memberId = umsMemberService.getCurrentMemberId();
//添加记录
PmsSearchWord pmsSearchWord = new PmsSearchWord();
pmsSearchWord.setWord(name);
pmsSearchWord.setCreateBy(memberId);
pmsSearchWord.setCreateDate(new Date());
pmsSearchWord.setUpdateDate(new Date());
pmsSearchWordMapper.insertSelective(pmsSearchWord);
}
if(newStatus != null){ if(newStatus != null){
criteria.andNewStatusEqualTo(newStatus); criteria.andNewStatusEqualTo(newStatus);
} }
...@@ -899,5 +918,4 @@ public class PmsProductServiceImpl implements PmsProductService { ...@@ -899,5 +918,4 @@ public class PmsProductServiceImpl implements PmsProductService {
example.setOrderByClause(orderBy); example.setOrderByClause(orderBy);
return this.pmsProductMapper.selectByExample(example); return this.pmsProductMapper.selectByExample(example);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment