Commit a5a3d57f authored by Shen's avatar Shen

1.用户地址 添加”我的地址“接口

2.用户地址 添加接口对创建日期添加
parent 47e0b594
......@@ -4,7 +4,7 @@ server:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 8080
port: 8088
connection-timeout: 5000ms
servlet:
context-path: /hmit-admin
......
......@@ -87,7 +87,6 @@ public class PensionConsigneeController {
return new Result();
}
@Deprecated
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody Long[] ids){
......@@ -109,18 +108,30 @@ public class PensionConsigneeController {
@Login
@GetMapping("findMyAddress")
@ApiOperation("查询本人收货地址")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
}) //TODO 分页
public Result<List<PensionConsigneeDTO>> findMyAddress(@ApiIgnore @LoginUser UserEntity user,
@ApiIgnore @RequestParam Map<String, Object> params){
public Result<List<PensionConsigneeDTO>> findMyAddress(@ApiIgnore @LoginUser UserEntity user){
List<PensionConsigneeDTO> pensionConsigneeDTOList = pensionConsigneeService.findByUserId(user.getId());
return new Result<List<PensionConsigneeDTO>>().ok(pensionConsigneeDTOList);
}
@Login
@PostMapping("addMyAddress")
@ApiOperation("添加我的收货地址")
@ApiImplicitParams({
@ApiImplicitParam(name = "username", value = "用户姓名", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "mobile", value = "用户手机号", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "province", value = "省份", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "city", value = "城市", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "district", value = "区县", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "address", value = "详细地址", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "zip", value = "邮编", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "ifDefault", value = "是否默认,传0则非默认,1则设为为默认,用户第一个地址传0或1均为即为默认地址", paramType = "query",required = true, dataType="int") ,
})
public Result addMyAddress(@ApiIgnore @LoginUser UserEntity user, @ApiIgnore @RequestParam Map<String, Object> params){
params.put("userId", user.getId());
pensionConsigneeService.addUserAddress(params);
return new Result();
}
@PostMapping("addUserAddress")
@ApiOperation("根据用户Id添加收货地址")
@ApiImplicitParams({
......
......@@ -13,6 +13,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -67,6 +68,7 @@ public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigne
params.get("address").toString(), params.get("zip").toString(), ifDefault, 1);
PensionConsigneeDTO pensionConsigneeDTO = new PensionConsigneeDTO();
BeanUtils.copyProperties(addressDTO, pensionConsigneeDTO);
pensionConsigneeDTO.setCreateDate(new Date());
save(pensionConsigneeDTO);
}
}
\ No newline at end of file
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