|
@@ -0,0 +1,122 @@
|
|
|
+package com.caimei.controller;
|
|
|
+
|
|
|
+import com.caimei.model.ResponseJson;
|
|
|
+import com.caimei.model.po.CmUserInvoiceInfoPo;
|
|
|
+import com.caimei.model.vo.AddressVo;
|
|
|
+import com.caimei.model.vo.ProvinceVo;
|
|
|
+import com.caimei.service.AddressService;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Description
|
|
|
+ *
|
|
|
+ * @author : plf
|
|
|
+ * @date : 2021/3/25
|
|
|
+ */
|
|
|
+@Api(tags = "地址发票")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/other")
|
|
|
+public class AddressApi {
|
|
|
+ private AddressService addressService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public void setAddressService(AddressService addressService) {
|
|
|
+ this.addressService = addressService;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户所有地址
|
|
|
+ */
|
|
|
+ @ApiOperation("查询用户所有地址")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "userId", required = true, value = "机构用户id"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
|
|
|
+ })
|
|
|
+ @GetMapping("/findAddress")
|
|
|
+ public ResponseJson<PageInfo<AddressVo>> findAddress(Integer userId, @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+ if (userId == null) {
|
|
|
+ return ResponseJson.error("参数异常", null);
|
|
|
+ }
|
|
|
+ return addressService.findAddress(userId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存或编辑地址
|
|
|
+ */
|
|
|
+ @ApiOperation("保存或编辑地址")
|
|
|
+ @PostMapping("/saveAddress")
|
|
|
+ public ResponseJson<AddressVo> saveAddress(@RequestBody AddressVo address) {
|
|
|
+ return addressService.saveAddress(address);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除地址
|
|
|
+ */
|
|
|
+ @ApiOperation("删除地址")
|
|
|
+ @ApiImplicitParam(name = "addressId", value = "地址id", required = true)
|
|
|
+ @GetMapping("/deleteAddress")
|
|
|
+ public ResponseJson<String> deleteAddress(Integer addressId) {
|
|
|
+ if (addressId == null) {
|
|
|
+ return ResponseJson.error("参数异常", null);
|
|
|
+ }
|
|
|
+ return addressService.deleteAddress(addressId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设为默认地址
|
|
|
+ */
|
|
|
+ @ApiOperation("设为默认地址")
|
|
|
+ @GetMapping("/defaultAddress")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "userId", required = true, value = "机构用户id"),
|
|
|
+ @ApiImplicitParam(name = "addressId", required = true, value = "地址id")
|
|
|
+ })
|
|
|
+ public ResponseJson<String> defaultAddress(Integer userId, Integer addressId) {
|
|
|
+ if (null == userId || null == addressId) {
|
|
|
+ return ResponseJson.error("参数异常", null);
|
|
|
+ }
|
|
|
+ return addressService.defaultAddress(userId, addressId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 地址管理:省市区
|
|
|
+ */
|
|
|
+ @ApiOperation("地址管理:省市区")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public ResponseJson<List<ProvinceVo>> address() {
|
|
|
+ return addressService.address();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存编辑发票信息
|
|
|
+ */
|
|
|
+ @ApiOperation("保存编辑发票信息")
|
|
|
+ @PostMapping("/invoice")
|
|
|
+ public ResponseJson<String> saveInvoice(@RequestBody CmUserInvoiceInfoPo invoice) {
|
|
|
+ return addressService.saveInvoice(invoice);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发票信息数据
|
|
|
+ */
|
|
|
+ @ApiOperation("发票信息数据")
|
|
|
+ @ApiImplicitParam(name = "userId", value = "机构用户id", required = true)
|
|
|
+ @GetMapping("/findInvoice")
|
|
|
+ public ResponseJson<CmUserInvoiceInfoPo> findInvoice(Integer userId) {
|
|
|
+ if (userId == null) {
|
|
|
+ return ResponseJson.error("参数异常", null);
|
|
|
+ }
|
|
|
+ return addressService.findInvoice(userId);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|