解决分销绑定问题
This commit is contained in:
parent
b427daab02
commit
e73d189022
@ -1,6 +1,5 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -75,21 +74,16 @@ public class GoodsBuyerController {
|
||||
@ApiOperation(value = "通过id获取商品信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "skuId", value = "skuId", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "distributionId", value = "分销员ID", dataType = "String", paramType = "query")
|
||||
@ApiImplicitParam(name = "skuId", value = "skuId", required = true, paramType = "path")
|
||||
})
|
||||
@GetMapping(value = "/sku/{goodsId}/{skuId}")
|
||||
@PageViewPoint(type = PageViewEnum.SKU, id = "#id")
|
||||
public ResultMessage<Map<String, Object>> getSku(@NotNull(message = "商品ID不能为空") @PathVariable("goodsId") String goodsId,
|
||||
@NotNull(message = "SKU ID不能为空") @PathVariable("skuId") String skuId,
|
||||
String distributionId) {
|
||||
@NotNull(message = "SKU ID不能为空") @PathVariable("skuId") String skuId) {
|
||||
|
||||
Map<String, Object> map = goodsSkuService.getGoodsSkuDetail(goodsId, skuId);
|
||||
|
||||
//判断如果传递分销员则进行记录
|
||||
if (CharSequenceUtil.isNotEmpty(distributionId)) {
|
||||
distributionService.bindingDistribution(distributionId);
|
||||
}
|
||||
|
||||
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.lili.controller.other.distribution;
|
||||
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.distribution.entity.dos.Distribution;
|
||||
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
|
||||
@ -65,4 +65,12 @@ public class DistributionBuyerController {
|
||||
|
||||
return ResultUtil.data(distributionService.getDistribution());
|
||||
}
|
||||
|
||||
//申请分销员
|
||||
@ApiOperation(value = "绑定分销员")
|
||||
@ApiImplicitParam(name = "distributionId", value = "分销员ID", required = true, paramType = "path")
|
||||
@GetMapping("/bindingDistribution/{distributionId}")
|
||||
public void bindingDistribution(@PathVariable String distributionId){
|
||||
distributionService.bindingDistribution(distributionId);
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,11 @@ public class DistributionServiceImpl extends ServiceImpl<DistributionMapper, Dis
|
||||
|
||||
@Override
|
||||
public void bindingDistribution(String distributionId) {
|
||||
|
||||
//判断用户是否登录,未登录不能进行绑定
|
||||
if(UserContext.getCurrentUser()==null){
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
//储存分销关系为3天
|
||||
Distribution distribution = this.getById(distributionId);
|
||||
if (distribution!=null) {
|
||||
|
@ -59,7 +59,6 @@ public class AppVersionDO{
|
||||
@ApiModelProperty(value = "版本名称")
|
||||
private String versionName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "更新内容")
|
||||
private String content;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
@ -45,8 +47,11 @@ public class AppVersionManagerController {
|
||||
|
||||
@ApiOperation(value = "添加app版本信息", response = AppVersionDO.class)
|
||||
@PostMapping
|
||||
public ResultMessage<Boolean> add(@Valid AppVersionDO appVersionDO) {
|
||||
return ResultUtil.data(this.appVersionService.save(appVersionDO));
|
||||
public ResultMessage<Object> add(@Valid AppVersionDO appVersionDO) {
|
||||
if(this.appVersionService.save(appVersionDO)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@ -55,10 +60,10 @@ public class AppVersionManagerController {
|
||||
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> edit(@Valid AppVersionDO appVersionDO, @PathVariable String id) {
|
||||
if (appVersionService.getById(id) != null) {
|
||||
return ResultUtil.data(this.appVersionService.updateById(appVersionDO));
|
||||
if(this.appVersionService.updateById(appVersionDO)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
return ResultUtil.data(false);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@ -67,10 +72,10 @@ public class AppVersionManagerController {
|
||||
@ApiImplicitParam(name = "id", value = "要删除的app版本主键", required = true, dataType = "String", paramType = "path")
|
||||
})
|
||||
public ResultMessage<Boolean> delete(@PathVariable String id) {
|
||||
if (appVersionService.getById(id) != null) {
|
||||
return ResultUtil.data(this.appVersionService.removeById(id));
|
||||
if(this.appVersionService.removeById(id)){
|
||||
return ResultUtil.success();
|
||||
}
|
||||
return ResultUtil.data(true);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user