feat: 商城收件地址,查询自己的默认地址和自己的所有地址

This commit is contained in:
sdhkjh 2024-09-25 21:08:52 +08:00
parent 71254b020c
commit 6aa82c643f
8 changed files with 40 additions and 59 deletions

View file

@ -50,19 +50,19 @@ public class ShopMemberLevelController {
shopMemberLevelService.selectById(inputObject, outputObject);
}
@ApiOperation(id = "memberLevelListAllSimple",value = "获取精简的会员等级信息,主要用于下拉列表",method = "GET",allUse = "2")
@ApiOperation(id = "memberLevelListAllSimple", value = "获取精简的会员等级信息,主要用于下拉列表", method = "GET", allUse = "2")
@RequestMapping("/post/ShopMemberLevelController/memberLevelListAllSimple")
public void streamlineMemberLevelList(InputObject inputObject, OutputObject outputObject) {
shopMemberLevelService.streamlineMemberLevelList(inputObject,outputObject);
shopMemberLevelService.streamlineMemberLevelList(inputObject, outputObject);
}
@ApiOperation(id = "memberLevelList",value = "获得会员等级列表",method = "POST",allUse = "2")
@ApiOperation(id = "memberLevelList", value = "获得会员等级列表", method = "POST", allUse = "2")
@ApiImplicitParams({
@ApiImplicitParam(id = "name", name = "name", value = "等级名称"),
@ApiImplicitParam(id = "enabled", name = "enabled", value = "状态")})
@ApiImplicitParam(id = "name", name = "name", value = "等级名称"),
@ApiImplicitParam(id = "enabled", name = "enabled", value = "状态")})
@RequestMapping("/post/ShopMemberLevelController/memberLevelList")
public void memberLevelList(InputObject inputObject, OutputObject outputObject) {
shopMemberLevelService.memberLevelList(inputObject,outputObject);
shopMemberLevelService.memberLevelList(inputObject, outputObject);
}

View file

@ -4,6 +4,6 @@ import com.skyeye.eve.dao.SkyeyeBaseMapper;
import com.skyeye.level.entity.ShopMemberLevel;
public interface ShopMemberLevelDao extends SkyeyeBaseMapper<ShopMemberLevel > {
public interface ShopMemberLevelDao extends SkyeyeBaseMapper<ShopMemberLevel> {
}

View file

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.skyeye.annotation.api.ApiModel;
import com.skyeye.annotation.api.ApiModelProperty;
import com.skyeye.annotation.unique.UniqueField;
import com.skyeye.common.entity.features.OperatorUserInfo;
import lombok.Data;

View file

@ -65,11 +65,10 @@ public class ShopAddressController {
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "queryMyShopAddress", value = "分页获取收件地址信息", method = "POST", allUse = "2")
@ApiImplicitParams(classBean = CommonPageInfo.class)
@ApiOperation(id = "queryMyShopAddress", value = "获取收件地址信息", method = "POST", allUse = "2")
@RequestMapping("/post/ShopAddressController/queryMyShopAddress")
public void queryMyShopAddress(InputObject inputObject, OutputObject outputObject) {
shopAddressService.queryPageList(inputObject, outputObject);
shopAddressService.queryList(inputObject, outputObject);
}
/**
@ -81,20 +80,6 @@ public class ShopAddressController {
@ApiOperation(id = "queryDefaultShopAddress", value = "获取默认收件地址信息", method = "POST", allUse = "2")
@RequestMapping("/post/ShopAddressController/queryDefaultShopAddress")
public void queryDefaultShopAddress(InputObject inputObject, OutputObject outputObject) {
shopAddressService.queryList(inputObject, outputObject);
}
/**
* 获取用户收件地址信息
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "queryShopAddressByCreateId", value = "获取用户收件地址信息", method = "POST", allUse = "2")
@ApiImplicitParams({
@ApiImplicitParam(id = "userId", name = "userId", value = "用户主键id", required = "required")})
@RequestMapping("/post/ShopAddressController/queryShopAddressByCreateId")
public void queryShopAddressByCreateId(InputObject inputObject, OutputObject outputObject) {
shopAddressService.queryShopAddressByCreateId(inputObject, outputObject);
shopAddressService.queryDefaultShopAddress(inputObject, outputObject);
}
}

View file

@ -11,7 +11,7 @@ import com.skyeye.annotation.api.ApiModel;
import com.skyeye.annotation.api.ApiModelProperty;
import com.skyeye.annotation.cache.RedisCacheField;
import com.skyeye.common.constans.RedisConstants;
import com.skyeye.common.entity.features.OperatorUserInfo;
import com.skyeye.common.entity.features.AreaInfo;
import lombok.Data;
/**
@ -26,7 +26,7 @@ import lombok.Data;
@RedisCacheField(name = "shop:address", cacheTime = RedisConstants.THIRTY_DAY_SECONDS)
@TableName(value = "shop_address")
@ApiModel("收件地址管理实体类")
public class ShopAddress extends OperatorUserInfo {
public class ShopAddress extends AreaInfo {
@TableId("id")
@ApiModelProperty("主键id。为空时新增不为空时编辑")
@ -40,22 +40,6 @@ public class ShopAddress extends OperatorUserInfo {
@ApiModelProperty(value = "手机号", required = "required")
private String mobile;
@TableField("province_id")
@ApiModelProperty(value = "")
private String provinceId;
@TableField("city_id")
@ApiModelProperty(value = "")
private String cityId;
@TableField("area_id")
@ApiModelProperty(value = "县区")
private String areaId;
@TableField("township_id")
@ApiModelProperty(value = "乡镇")
private String townshipId;
@TableField("absolute_address")
@ApiModelProperty(value = "详细地址")
private String absoluteAddress;

View file

@ -18,5 +18,5 @@ import com.skyeye.store.entity.ShopAddress;
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface ShopAddressService extends SkyeyeBusinessService<ShopAddress> {
void queryShopAddressByCreateId(InputObject inputObject, OutputObject outputObject);
void queryDefaultShopAddress(InputObject inputObject, OutputObject outputObject);
}

View file

@ -4,6 +4,7 @@
package com.skyeye.store.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -17,9 +18,12 @@ import com.skyeye.common.enumeration.WhetherEnum;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.entity.Member;
import com.skyeye.eve.service.IAreaService;
import com.skyeye.store.dao.ShopAddressDao;
import com.skyeye.store.entity.ShopAddress;
import com.skyeye.store.service.ShopAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@ -38,6 +42,9 @@ import java.util.Map;
@SkyeyeService(name = "收件地址管理", groupName = "收件地址管理")
public class ShopAddressServiceImpl extends SkyeyeBusinessServiceImpl<ShopAddressDao, ShopAddress> implements ShopAddressService {
@Autowired
private IAreaService iAreaService;
@Override
public void writePostpose(ShopAddress shopAddress, String userId) {
if (WhetherEnum.ENABLE_USING.getKey().equals(shopAddress.getIsDefault())) {
@ -63,12 +70,21 @@ public class ShopAddressServiceImpl extends SkyeyeBusinessServiceImpl<ShopAddres
}
@Override
public List<Map<String, Object>> queryPageDataList(InputObject inputObject) {
public void queryDefaultShopAddress(InputObject inputObject, OutputObject outputObject) {
String userId = InputObject.getLogParamsStatic().get("id").toString();
QueryWrapper<ShopAddress> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddress::getCreateId), userId);
List<ShopAddress> list = list(queryWrapper);
return JSONUtil.toList(JSONUtil.toJsonStr(list), null);
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddress::getIsDefault), WhetherEnum.ENABLE_USING.getKey());
ShopAddress one = getOne(queryWrapper);
if (ObjectUtil.isEmpty(one)) {
return;
}
iAreaService.setDataMation(one, ShopAddress::getProvinceId);
iAreaService.setDataMation(one, ShopAddress::getCityId);
iAreaService.setDataMation(one, ShopAddress::getAreaId);
iAreaService.setDataMation(one, ShopAddress::getTownshipId);
outputObject.setBean(one);
outputObject.settotal(CommonNumConstants.NUM_ONE);
}
@Override
@ -78,16 +94,13 @@ public class ShopAddressServiceImpl extends SkyeyeBusinessServiceImpl<ShopAddres
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddress::getCreateId), userId);
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddress::getIsDefault), CommonNumConstants.NUM_ONE);
List<ShopAddress> list = list(queryWrapper);
if (CollectionUtil.isEmpty(list)) {
return null;
}
iAreaService.setDataMation(list, ShopAddress::getProvinceId);
iAreaService.setDataMation(list, ShopAddress::getCityId);
iAreaService.setDataMation(list, ShopAddress::getAreaId);
iAreaService.setDataMation(list, ShopAddress::getTownshipId);
return JSONUtil.toList(JSONUtil.toJsonStr(list), null);
}
@Override
public void queryShopAddressByCreateId(InputObject inputObject, OutputObject outputObject) {
String userId = inputObject.getParams().get("userId").toString();
QueryWrapper<ShopAddress> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddress::getCreateId), userId);
List<ShopAddress> list = list(queryWrapper);
outputObject.setBeans(list);
outputObject.settotal(list.size());
}
}

View file

@ -23,7 +23,7 @@ import java.util.Map;
*/
@Data
@TableName(value = "shop_store_type")
@ApiModel("门店商品分类管理实体类")
@ApiModel(value = "门店商品分类管理实体类")
public class StoreType extends BaseGeneralInfo {
@TableField(value = "logo")