Commit 8b4bd64b by XiaHou

权星相关接口修复

parent 013ce465
......@@ -67,7 +67,7 @@ public class PmsProductController {
@RequestMapping(value = "/getPageList", method = RequestMethod.POST)
public CommonResult<CommonPage<PmsProduct>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("模糊查询商品名称 ")@RequestParam("name") String name,
@ApiParam("审核状态 0待审核 1审核通过 2审核未通过 ")@RequestParam("auditStatus") Integer verifyStatus){
@ApiParam("审核状态 0待审核 1审核通过 2审核未通过 ")@RequestParam("verifyStatus") Integer verifyStatus){
return CommonResult.success(CommonPage.restPage(this.productService.getPageList(page,size,name,verifyStatus)));
}
......
......@@ -4,6 +4,7 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.model.dto.quanxing.PmsSupplierAuditRequest;
import com.macro.mall.service.quanxing.IPmsSupplierAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -23,9 +24,8 @@ public class PmsSupplierAuditController {
@ApiOperation("权星后台_审核申请供应商")
@ResponseBody
@RequestMapping(value = "/auditSupplier", method = RequestMethod.POST)
public CommonResult auditSupplier(@ApiParam("审核id") @RequestParam("id") Long id ,
@ApiParam("审核状态 0待审核 1审核通过 2审核不通过") @RequestParam("stauts") Integer stauts,@ApiParam("备注") @RequestParam("remarks") String remarks){
ResultMsg res = this.pmsSupplierAuditService.auditSupplier(id,stauts,remarks);
public CommonResult auditSupplier(@RequestBody PmsSupplierAuditRequest pmsSupplierAuditRequest){
ResultMsg res = this.pmsSupplierAuditService.auditSupplier(pmsSupplierAuditRequest);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
......
package com.macro.mall.model.dto.quanxing;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class PmsSupplierAuditRequest implements Serializable {
@ApiModelProperty(value = "审核id")
private Long id;
@ApiModelProperty(value = "审核状态 0待审核 1审核通过 2审核不通过")
private Integer status;
@ApiModelProperty(value = "备注")
private String remarks;
}
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.PmsProduct;
import com.macro.mall.service.product.PmsProductService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/pmsSupplierAudit")
@Api(tags = "权星小程序_商品相关接口", description = "商品控制器")
public class PmsProductController {
@Autowired
private PmsProductService pmsProductService;
@ApiOperation("权星小程序_商品分页查询")
@ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.POST)
public CommonResult<CommonPage<PmsProduct>> getPageList(@ApiParam("页数") @RequestParam("page")Integer page, @ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("模糊查询商品名称 ")@RequestParam("name") String name,
@ApiParam("是否新品 新品状态:0->不是新品;1->新品 ")@RequestParam("newStatus") Integer newStatus,
@ApiParam("供应商id")@RequestParam("mchtId") Long mchtId,
@ApiParam("排序:(例如根据价格降序 传入price DESC 根据价格升序传入price ASC) ")@RequestParam("orderBy") String orderBy){
return CommonResult.success(CommonPage.restPage(this.pmsProductService.getAppPageList(page,size,newStatus,mchtId,orderBy)));
}
}
......@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/pmsSupplierAudit")
@Api(tags = "申请供应商", description = "申请供应商控制器")
@Api(tags = "权星小程序_供应商相关接口", description = "申请供应商控制器")
public class PmsSupplierAuditController {
@Autowired
......
......@@ -197,4 +197,13 @@ public interface PmsProductService {
* @return
*/
ResultMsg batchOperationByPublishStatus(BatchOperationDto batchOperationDto);
/**
* 小程序获取分页数据
* @param pageNum
* @param pageSize
* @param newStatus
* @return
*/
List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,Integer newStatus,Long mchtId,String orderBy);
}
......@@ -787,6 +787,7 @@ public class PmsProductServiceImpl implements PmsProductService {
if(verifyStatus != null){
criteria.andVerifyStatusEqualTo(verifyStatus);
}
criteria.andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除(彻底删除)
return this.pmsProductMapper.selectByExample(example);
}
......@@ -825,13 +826,13 @@ public class PmsProductServiceImpl implements PmsProductService {
List idList = Arrays.asList(batchOperationDto.getIds().split(","));//根据逗号分隔转化为list
if(batchOperationDto.getIsDelete() == 1){//如果为真删除
idList.forEach(id ->{
this.pmsProductMapper.deleteByPrimaryKey((Long)id);
this.pmsProductMapper.deleteByPrimaryKey(Long.valueOf((String)id));
});
}else{//假删除 操作
PmsProduct pmsProduct = new PmsProduct();
pmsProduct.setDeleteStatus(batchOperationDto.getStatus());
idList.forEach(id ->{
pmsProduct.setId((Long)id);
pmsProduct.setId(Long.valueOf((String)id));
this.pmsProductMapper.updateByPrimaryKeySelective(pmsProduct);
});
}
......@@ -858,16 +859,45 @@ public class PmsProductServiceImpl implements PmsProductService {
List idList = Arrays.asList(batchOperationDto.getIds().split(","));//根据逗号分隔转化为list
if(batchOperationDto.getIsDelete() == 1){//如果为真删除
idList.forEach(id ->{
this.pmsProductMapper.deleteByPrimaryKey((Long)id);
this.pmsProductMapper.deleteByPrimaryKey(Long.valueOf((String)id));
});
}else{//假删除 操作
PmsProduct pmsProduct = new PmsProduct();
pmsProduct.setPublishStatus(batchOperationDto.getStatus());
idList.forEach(id ->{
pmsProduct.setId((Long)id);
pmsProduct.setId(Long.valueOf((String)id));
this.pmsProductMapper.updateByPrimaryKeySelective(pmsProduct);
});
}
return new ResultMsg(true,"操作成功");
}
/**
* 小程序商品分页查询
* @param pageNum
* @param pageSize
* @param newStatus
* @return
*/
@Override
public List<PmsProduct> getAppPageList(Integer pageNum,Integer pageSize,Integer newStatus,Long mchtId,String orderBy){
PageHelper.startPage(pageNum, pageSize);
PmsProductExample example = new PmsProductExample();
PmsProductExample.Criteria criteria = example.createCriteria();
if(newStatus != null){
criteria.andNewStatusEqualTo(newStatus);
}
if(mchtId != null){
criteria.andCreateByEqualTo(mchtId);
}
criteria.andVerifyStatusEqualTo(1);//审核状态:0->未审核;1->审核通过 2->驳回 3->审核失败
criteria.andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除(彻底删除)
criteria.andPublishStatusEqualTo(1);//上架状态:0->下架;1->上架
//注意:排序使用的是列名
example.setOrderByClause(orderBy);
return this.pmsProductMapper.selectByExample(example);
}
}
......@@ -3,6 +3,7 @@ package com.macro.mall.service.quanxing;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.model.dto.quanxing.PmsSupplierAuditRequest;
import java.util.List;
......@@ -19,7 +20,7 @@ public interface IPmsSupplierAuditService {
* 审核供应商
* @return
*/
ResultMsg auditSupplier(Long id ,Integer status,String remarks);
ResultMsg auditSupplier(PmsSupplierAuditRequest pmsSupplierAuditRequest);
/**
* 得到UUID 随机八位数
......
......@@ -12,6 +12,7 @@ import com.macro.mall.model.PmsSupplierAuditExample;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.model.dto.quanxing.PmsSupplierAuditRequest;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.quanxing.IPmsSupplierAuditService;
import org.springframework.beans.BeanUtils;
......@@ -43,27 +44,24 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
/**
* 审核供应商
* @param id
* @param status
* @param remarks
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ResultMsg auditSupplier(Long id ,Integer status,String remarks){
PmsSupplierAudit psa = this.pmsSupplierAuditMapper.selectByPrimaryKey(id);
public ResultMsg auditSupplier(PmsSupplierAuditRequest pmsSupplierAuditRequest){
PmsSupplierAudit psa = this.pmsSupplierAuditMapper.selectByPrimaryKey(pmsSupplierAuditRequest.getId());
if(psa == null ){
return new ResultMsg(false,"传入id 不存在对应的审核记录");
}
if(status == null ){
if(pmsSupplierAuditRequest.getStatus() == null ){
return new ResultMsg(false,"请传入对应的审核状态");
}
PmsSupplierAudit pmsSupplierAudit = new PmsSupplierAuditDto();
pmsSupplierAudit.setId(id);
pmsSupplierAudit.setStatus(status);
pmsSupplierAudit.setRemarks(remarks);
pmsSupplierAudit.setId(pmsSupplierAuditRequest.getId());
pmsSupplierAudit.setStatus(pmsSupplierAuditRequest.getStatus());
pmsSupplierAudit.setRemarks(pmsSupplierAuditRequest.getRemarks());
if(status == 1){//审核通过还需将信息写入会员表
if(pmsSupplierAuditRequest.getStatus() == 1){//审核通过还需将信息写入会员表
//补充会员信息
UmsMember umsMember = new UmsMember();
umsMember.setUsername(this.getUsername());//系统根据时间生成账号
......
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