履约模板
This commit is contained in:
@ -10,6 +10,7 @@ import com.alipay.api.response.AlipayOpenAppItemListQueryResponse;
|
|||||||
import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
|
import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
|
||||||
import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
|
import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.sczx.pay.alipay.po.RentRuleItem;
|
||||||
import com.sczx.pay.alipay.service.ItemService;
|
import com.sczx.pay.alipay.service.ItemService;
|
||||||
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
||||||
import com.sczx.pay.alipay.vo.OpenResponse;
|
import com.sczx.pay.alipay.vo.OpenResponse;
|
||||||
@ -59,15 +60,7 @@ public class ItemController {
|
|||||||
return itemService.queryTemplate(categoryId, itemType);
|
return itemService.queryTemplate(categoryId, itemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 售卖类(实物)商品创建
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "售卖类(实物)商品创建")
|
|
||||||
@ApiOperationSupport(order = 3)
|
|
||||||
@PostMapping(value = "/sale/create")
|
|
||||||
public OpenResponse<String> saleCreate(@RequestBody ItemCreateRequest request) {
|
|
||||||
return itemService.createSaleItem(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租赁类(实物)商品创建
|
* 租赁类(实物)商品创建
|
||||||
@ -75,55 +68,21 @@ public class ItemController {
|
|||||||
@ApiOperation(value = "租赁类(实物)商品创建")
|
@ApiOperation(value = "租赁类(实物)商品创建")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
@PostMapping(value = "/rent/create")
|
@PostMapping(value = "/rent/create")
|
||||||
public OpenResponse<String> rentCreate(@RequestBody ItemCreateRequest request) {
|
public OpenResponse<String> rentCreate(@RequestBody RentRuleItem request) {
|
||||||
return itemService.createRentItem(request);
|
return itemService.createRentItem(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 付费充值/兑换类(虚拟)商品创建
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "付费充值/兑换类(虚拟)商品创建", notes = "电影/演出/体育赛事票务类商品")
|
|
||||||
@ApiOperationSupport(order = 5)
|
|
||||||
@PostMapping(value = "/virtual/create")
|
|
||||||
public OpenResponse<String> virtualCreate(@RequestBody ItemCreateRequest request) {
|
|
||||||
return itemService.createVirtualItem(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售卖类(实物)商品更新
|
* 租赁类(实物)履约模板创建
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "商品更新")
|
@ApiOperation(value = "租赁类(实物)履约模板创建")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 4)
|
||||||
@PostMapping(value = "/update")
|
@PostMapping(value = "/template/create")
|
||||||
public OpenResponse<String> update(@RequestBody ItemCreateRequest request) {
|
public OpenResponse<String> templateCreate() {
|
||||||
return itemService.updateItem(request);
|
return itemService.syncDeliveryInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品详情查询
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "商品详情查询")
|
|
||||||
@ApiOperationSupport(order = 7)
|
|
||||||
@GetMapping(value = "/query")
|
|
||||||
public OpenResponse<AlipayOpenAppItemQueryResponse> query(@ApiParam(value = "支付平台侧商品ID") @RequestParam(required = false) String itemId,
|
|
||||||
@ApiParam(value = "商家侧商品ID") @RequestParam(required = false) String outItemId,
|
|
||||||
@ApiParam(value = "是否查询编辑版本,默认为0", defaultValue = "0") @RequestParam(required = false) String needEditSpu) {
|
|
||||||
return itemService.queryItemDetail(itemId, outItemId,
|
|
||||||
StringUtils.isNumeric(needEditSpu) ? Long.parseLong(needEditSpu) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询商品列表
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "分页查询商品列表")
|
|
||||||
@ApiOperationSupport(order = 8)
|
|
||||||
@GetMapping(value = "/list/query")
|
|
||||||
public OpenResponse<AlipayOpenAppItemListQueryResponse> queryList(@ApiParam(value = "支付平台侧商品ID") @RequestParam(required = false) String itemId,
|
|
||||||
@ApiParam(value = "商家侧商品ID") @RequestParam(required = false) String outItemId,
|
|
||||||
@ApiParam(value = "页码", defaultValue = "1") @RequestParam(required = false) String pageNum,
|
|
||||||
@ApiParam(value = "单页大小", defaultValue = "10") @RequestParam(required = false) String pageSize) {
|
|
||||||
return itemService.queryItemList(itemId, outItemId,
|
|
||||||
StringUtils.isNumeric(pageNum) ? Long.parseLong(pageNum) : 1,
|
|
||||||
StringUtils.isNumeric(pageSize) ? Long.parseLong(pageSize) : 10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
294
src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java
Normal file
294
src/main/java/com/sczx/pay/alipay/dto/RentItemCreateRequest.java
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
package com.sczx.pay.alipay.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实物租赁商品创建请求实体类
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "com.sczx.pay.alipay.dto.RentItemCreateRequest", description = "实物租赁商品创建请求参数")
|
||||||
|
public class RentItemCreateRequest implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
// 基本商品信息
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商家侧商品ID,要求APPID下全局唯一", required = true, example = "test20230021")
|
||||||
|
private String outItemId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品名称,最少不低于3个字,最长不超过60个字", required = true, example = "实物租赁商品创建示例")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品主图,图片宽高为750px*750px,宽高比1:1,800kb以内", required = true,
|
||||||
|
example = "A*pHfaSaEsF_0AAAAAAAAAAAAAATcnAQ")
|
||||||
|
private String headImg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "平台类目ID,多级类目只填最后一级", required = true, example = "C001375054")
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品类型,租赁类(实物): 2", required = true, example = "2")
|
||||||
|
private String itemType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品详情页URL,请填写您的小程序侧商品详情页链接")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品子图,作为平台详情页组件的轮播图,最多3张")
|
||||||
|
private List<String> imageList;
|
||||||
|
|
||||||
|
// SKU信息
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SKU数组")
|
||||||
|
private List<RentSkuRequest> skus;
|
||||||
|
|
||||||
|
// 商品属性
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品属性")
|
||||||
|
private List<ItemAttrRequest> attrs;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
|
||||||
|
public String getOutItemId() {
|
||||||
|
return outItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutItemId(String outItemId) {
|
||||||
|
this.outItemId = outItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeadImg() {
|
||||||
|
return headImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadImg(String headImg) {
|
||||||
|
this.headImg = headImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoryId() {
|
||||||
|
return categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryId(String categoryId) {
|
||||||
|
this.categoryId = categoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemType() {
|
||||||
|
return itemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemType(String itemType) {
|
||||||
|
this.itemType = itemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getImageList() {
|
||||||
|
return imageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageList(List<String> imageList) {
|
||||||
|
this.imageList = imageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RentSkuRequest> getSkus() {
|
||||||
|
return skus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkus(List<RentSkuRequest> skus) {
|
||||||
|
this.skus = skus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemAttrRequest> getAttrs() {
|
||||||
|
return attrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrs(List<ItemAttrRequest> attrs) {
|
||||||
|
this.attrs = attrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁SKU请求实体类
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "RentSkuRequest", description = "租赁SKU信息")
|
||||||
|
public static class RentSkuRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商家侧SKU ID,要求APPID下全局唯一", required = true)
|
||||||
|
private String outSkuId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "售卖状态")
|
||||||
|
private String saleStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品销售属性")
|
||||||
|
private List<SkuAttrRequest> skuAttrs;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SKU类型,枚举值:RENT(租赁sku)、SALE(售卖sku)", example = "RENT")
|
||||||
|
private String skuType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SKU售价,如果有起租天数总租金,该字段不用填写")
|
||||||
|
private Long salePrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SKU原价,如果有起租天数总租金,该字段不用填写")
|
||||||
|
private Long originalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SKU库存")
|
||||||
|
private Long stockNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "价格单元,租赁sku:元/日,售卖sku:元", example = "元/日")
|
||||||
|
private String priceUnit;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
|
||||||
|
public String getOutSkuId() {
|
||||||
|
return outSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutSkuId(String outSkuId) {
|
||||||
|
this.outSkuId = outSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSaleStatus() {
|
||||||
|
return saleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleStatus(String saleStatus) {
|
||||||
|
this.saleStatus = saleStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SkuAttrRequest> getSkuAttrs() {
|
||||||
|
return skuAttrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuAttrs(List<SkuAttrRequest> skuAttrs) {
|
||||||
|
this.skuAttrs = skuAttrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkuType() {
|
||||||
|
return skuType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkuType(String skuType) {
|
||||||
|
this.skuType = skuType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSalePrice() {
|
||||||
|
return salePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalePrice(Long salePrice) {
|
||||||
|
this.salePrice = salePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOriginalPrice() {
|
||||||
|
return originalPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalPrice(Long originalPrice) {
|
||||||
|
this.originalPrice = originalPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStockNum() {
|
||||||
|
return stockNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockNum(Long stockNum) {
|
||||||
|
this.stockNum = stockNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceUnit() {
|
||||||
|
return priceUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceUnit(String priceUnit) {
|
||||||
|
this.priceUnit = priceUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SKU属性请求实体类 (sku_attrs 销售属性)
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "SkuAttrRequest", description = "SKU销售属性信息")
|
||||||
|
public static class SkuAttrRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "销售属性key", required = true)
|
||||||
|
private String attrKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "销售属性类型,枚举值:spec(规格)、custom(自定义属性)", example = "custom")
|
||||||
|
private String attrType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "销售属性值", required = true)
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
|
||||||
|
public String getAttrKey() {
|
||||||
|
return attrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrKey(String attrKey) {
|
||||||
|
this.attrKey = attrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttrType() {
|
||||||
|
return attrType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrType(String attrType) {
|
||||||
|
this.attrType = attrType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttrValue() {
|
||||||
|
return attrValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrValue(String attrValue) {
|
||||||
|
this.attrValue = attrValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品属性请求实体类 (attrs 商品属性)
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "ItemAttrRequest", description = "商品属性信息")
|
||||||
|
public static class ItemAttrRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品属性key", required = true)
|
||||||
|
private String attrKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品属性值", required = true)
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
|
||||||
|
public String getAttrKey() {
|
||||||
|
return attrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrKey(String attrKey) {
|
||||||
|
this.attrKey = attrKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttrValue() {
|
||||||
|
return attrValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttrValue(String attrValue) {
|
||||||
|
this.attrValue = attrValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
189
src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java
Normal file
189
src/main/java/com/sczx/pay/alipay/po/RentRuleItem.java
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
package com.sczx.pay.alipay.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型租赁规则项实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RentRuleItem implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户商品ID
|
||||||
|
*/
|
||||||
|
private String outItemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里商品ID
|
||||||
|
*/
|
||||||
|
private String aliItemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌名称
|
||||||
|
*/
|
||||||
|
private String brandName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型名称
|
||||||
|
*/
|
||||||
|
private String modelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池类别名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典标签
|
||||||
|
*/
|
||||||
|
private String dictLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型照片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池规则ID
|
||||||
|
*/
|
||||||
|
private Long batteryRuleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆规则ID
|
||||||
|
*/
|
||||||
|
private Long carRuleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型ID
|
||||||
|
*/
|
||||||
|
private Long carModelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌ID
|
||||||
|
*/
|
||||||
|
private Long brandId;
|
||||||
|
|
||||||
|
private BigDecimal rentalPrice;
|
||||||
|
|
||||||
|
private Integer rentalDays;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutItemId() {
|
||||||
|
return outItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutItemId(String outItemId) {
|
||||||
|
this.outItemId = outItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAliItemId() {
|
||||||
|
return aliItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAliItemId(String aliItemId) {
|
||||||
|
this.aliItemId = aliItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBrandName() {
|
||||||
|
return brandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrandName(String brandName) {
|
||||||
|
this.brandName = brandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModelName() {
|
||||||
|
return modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelName(String modelName) {
|
||||||
|
this.modelName = modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoryName() {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryName(String categoryName) {
|
||||||
|
this.categoryName = categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDictLabel() {
|
||||||
|
return dictLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictLabel(String dictLabel) {
|
||||||
|
this.dictLabel = dictLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuleName() {
|
||||||
|
return ruleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleName(String ruleName) {
|
||||||
|
this.ruleName = ruleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBatteryRuleId() {
|
||||||
|
return batteryRuleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatteryRuleId(Long batteryRuleId) {
|
||||||
|
this.batteryRuleId = batteryRuleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCarRuleId() {
|
||||||
|
return carRuleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCarRuleId(Long carRuleId) {
|
||||||
|
this.carRuleId = carRuleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCarModelId() {
|
||||||
|
return carModelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCarModelId(Long carModelId) {
|
||||||
|
this.carModelId = carModelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBrandId() {
|
||||||
|
return brandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrandId(Long brandId) {
|
||||||
|
this.brandId = brandId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ import com.alipay.api.domain.AppxCategoryVO;
|
|||||||
import com.alipay.api.response.AlipayOpenAppItemListQueryResponse;
|
import com.alipay.api.response.AlipayOpenAppItemListQueryResponse;
|
||||||
import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
|
import com.alipay.api.response.AlipayOpenAppItemQueryResponse;
|
||||||
import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
|
import com.alipay.api.response.AlipayOpenAppItemTemplateQueryResponse;
|
||||||
|
import com.sczx.pay.alipay.po.RentRuleItem;
|
||||||
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
||||||
import com.sczx.pay.alipay.vo.OpenResponse;
|
import com.sczx.pay.alipay.vo.OpenResponse;
|
||||||
|
|
||||||
@ -28,33 +29,14 @@ public interface ItemService {
|
|||||||
*/
|
*/
|
||||||
OpenResponse<AlipayOpenAppItemTemplateQueryResponse> queryTemplate(String categoryId, String itemType);
|
OpenResponse<AlipayOpenAppItemTemplateQueryResponse> queryTemplate(String categoryId, String itemType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建售卖类(实物)商品
|
|
||||||
*/
|
|
||||||
OpenResponse<String> createSaleItem(ItemCreateRequest param);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建租赁类(实物)商品
|
* 创建租赁类(实物)商品
|
||||||
*/
|
*/
|
||||||
OpenResponse<String> createRentItem(ItemCreateRequest param);
|
OpenResponse<String> createRentItem(RentRuleItem param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建付费充值/兑换类(虚拟)商品
|
* 根据业务属性写死自提履约信息
|
||||||
*/
|
*/
|
||||||
OpenResponse<String> createVirtualItem(ItemCreateRequest param);
|
OpenResponse<String> syncDeliveryInfo();
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改售卖类(实物)商品
|
|
||||||
*/
|
|
||||||
OpenResponse<String> updateItem(ItemCreateRequest param);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询商品详情
|
|
||||||
*/
|
|
||||||
OpenResponse<AlipayOpenAppItemQueryResponse> queryItemDetail(String itemId, String outItemId, long needEditSpu);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询商品列表
|
|
||||||
*/
|
|
||||||
OpenResponse<AlipayOpenAppItemListQueryResponse> queryItemList(String itemId, String outItemId, long pageNum, long pageSize);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,8 +53,8 @@ public class ImageUploadServiceImpl implements ImageUploadService {
|
|||||||
|
|
||||||
// 设置图片内容
|
// 设置图片内容
|
||||||
try {
|
try {
|
||||||
byte[] bytes = IOUtils.toByteArray(this.getClass().getResourceAsStream("/" + imagePath));
|
String imageBase64 = getImageFromUrlAndConvertToBase64(imagePath);
|
||||||
FileItem imageContent = new FileItem(StringUtils.substringAfterLast(imagePath, "/"), bytes);
|
FileItem imageContent = new FileItem("imageContent.jpg",Base64.getDecoder().decode(imageBase64));
|
||||||
request.setImageContent(imageContent);
|
request.setImageContent(imageContent);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new AlipayApiException("alipay.marketing.image.enhance.upload调用失败:" + e);
|
throw new AlipayApiException("alipay.marketing.image.enhance.upload调用失败:" + e);
|
||||||
@ -298,4 +302,23 @@ public class ImageUploadServiceImpl implements ImageUploadService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getImageFromUrlAndConvertToBase64(String imageUrl) throws IOException {
|
||||||
|
if (StringUtils.isBlank(imageUrl)) {
|
||||||
|
throw new IllegalArgumentException("图片URL不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url = new URL(imageUrl);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setConnectTimeout(5000);
|
||||||
|
connection.setReadTimeout(5000);
|
||||||
|
|
||||||
|
try (InputStream inputStream = connection.getInputStream()) {
|
||||||
|
byte[] imageBytes = IOUtils.toByteArray(inputStream);
|
||||||
|
return Base64.getEncoder().encodeToString(imageBytes);
|
||||||
|
} finally {
|
||||||
|
connection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.alipay.api.domain.*;
|
|||||||
import com.alipay.api.internal.util.StringUtils;
|
import com.alipay.api.internal.util.StringUtils;
|
||||||
import com.alipay.api.request.*;
|
import com.alipay.api.request.*;
|
||||||
import com.alipay.api.response.*;
|
import com.alipay.api.response.*;
|
||||||
|
import com.sczx.pay.alipay.po.RentRuleItem;
|
||||||
import com.sczx.pay.alipay.service.ImageUploadService;
|
import com.sczx.pay.alipay.service.ImageUploadService;
|
||||||
import com.sczx.pay.alipay.service.ItemService;
|
import com.sczx.pay.alipay.service.ItemService;
|
||||||
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
||||||
@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@ -118,43 +120,9 @@ public class ItemServiceImpl implements ItemService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OpenResponse<String> createSaleItem(ItemCreateRequest param) {
|
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppItemCreateResponse>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AlipayOpenAppItemCreateResponse process() throws AlipayApiException {
|
|
||||||
// 构造请求参数以调用接口
|
|
||||||
AlipayOpenAppItemCreateRequest request = new AlipayOpenAppItemCreateRequest();
|
|
||||||
AlipayOpenAppItemCreateModel model = getAlipayOpenAppItemCreateModel(param);
|
|
||||||
|
|
||||||
// 设置商品模版类型
|
|
||||||
model.setItemType("1");
|
|
||||||
|
|
||||||
// 设置价格单元
|
|
||||||
model.setPriceUnit("元");
|
|
||||||
|
|
||||||
// 设置属性列表
|
|
||||||
model.setAttrs(getItemAttrs(param, model.getImageList(), model.getItemType()));
|
|
||||||
|
|
||||||
request.setBizModel(model);
|
|
||||||
return alipaySdkUtil.execute(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getData(AlipayOpenAppItemCreateResponse response) {
|
|
||||||
return response.getItemId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApiName() {
|
|
||||||
return "alipay.open.app.item.create";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpenResponse<String> createRentItem(ItemCreateRequest param) {
|
public OpenResponse<String> createRentItem(RentRuleItem param) {
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppItemCreateResponse>() {
|
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppItemCreateResponse>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,195 +157,87 @@ public class ItemServiceImpl implements ItemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpenResponse<String> createVirtualItem(ItemCreateRequest param) {
|
public OpenResponse<String> syncDeliveryInfo() {
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppItemCreateResponse>() {
|
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppDeliveryInfoSyncResponse>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlipayOpenAppItemCreateResponse process() throws AlipayApiException {
|
public AlipayOpenAppDeliveryInfoSyncResponse process() throws AlipayApiException {
|
||||||
// 构造请求参数以调用接口
|
// 构造请求参数以调用接口
|
||||||
AlipayOpenAppItemCreateRequest request = new AlipayOpenAppItemCreateRequest();
|
AlipayOpenAppDeliveryInfoSyncRequest request = new AlipayOpenAppDeliveryInfoSyncRequest();
|
||||||
AlipayOpenAppItemCreateModel model = getAlipayOpenAppItemCreateModel(param);
|
AlipayOpenAppDeliveryInfoSyncModel model = new AlipayOpenAppDeliveryInfoSyncModel();
|
||||||
|
// 设置履约类型
|
||||||
|
model.setDeliveryType("PICKUP");
|
||||||
|
model.setDeliveryName("电动车租赁自提履约");
|
||||||
|
|
||||||
// 设置商品模版类型
|
// 设置履约信息ID
|
||||||
model.setItemType("3");
|
model.setDeliveryId("20250901000800000001");
|
||||||
|
|
||||||
// 设置价格单元
|
// 设置履约属性
|
||||||
model.setPriceUnit("元");
|
List<AppItemAttrVO> attrs = new ArrayList<AppItemAttrVO>();
|
||||||
|
AppItemAttrVO attrs0 = new AppItemAttrVO();
|
||||||
// 设置属性列表
|
attrs0.setAttrKey("delivery_name");
|
||||||
model.setAttrs(getItemAttrs(param, model.getImageList(), model.getItemType()));
|
attrs0.setAttrValue("同城门店自提");
|
||||||
|
attrs.add(attrs0);
|
||||||
|
model.setAttrs(attrs);
|
||||||
|
|
||||||
request.setBizModel(model);
|
request.setBizModel(model);
|
||||||
return alipaySdkUtil.execute(request);
|
return alipaySdkUtil.execute(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getData(AlipayOpenAppItemCreateResponse response) {
|
public String getData(AlipayOpenAppDeliveryInfoSyncResponse response) {
|
||||||
return response.getItemId();
|
return response.getDeliveryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getApiName() {
|
public String getApiName() {
|
||||||
return "alipay.open.app.item.create";
|
return "alipay.open.app.delivery.info.sync";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OpenResponse<String> updateItem(ItemCreateRequest param) {
|
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<String, AlipayOpenAppItemModifyResponse>() {
|
|
||||||
|
|
||||||
@Override
|
private AlipayOpenAppItemCreateModel getAlipayOpenAppItemCreateModel(RentRuleItem rentRuleItem) throws AlipayApiException {
|
||||||
public AlipayOpenAppItemModifyResponse process() throws AlipayApiException {
|
|
||||||
// 构造请求参数以调用接口
|
|
||||||
AlipayOpenAppItemModifyRequest request = new AlipayOpenAppItemModifyRequest();
|
|
||||||
AlipayOpenAppItemCreateModel model = getAlipayOpenAppItemCreateModel(param);
|
|
||||||
|
|
||||||
// 设置商品模版类型
|
|
||||||
model.setItemType("1");
|
|
||||||
|
|
||||||
// 设置价格单元
|
|
||||||
model.setPriceUnit("元");
|
|
||||||
|
|
||||||
// 设置属性列表
|
|
||||||
model.setAttrs(getItemAttrs(param, model.getImageList(), model.getItemType()));
|
|
||||||
|
|
||||||
request.setBizModel(model);
|
|
||||||
return alipaySdkUtil.execute(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getData(AlipayOpenAppItemModifyResponse response) {
|
|
||||||
return response.getItemId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApiName() {
|
|
||||||
return "alipay.open.app.item.modify";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OpenResponse<AlipayOpenAppItemQueryResponse> queryItemDetail(String itemId, String outItemId, long needEditSpu) {
|
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<AlipayOpenAppItemQueryResponse, AlipayOpenAppItemQueryResponse>() {
|
|
||||||
@Override
|
|
||||||
public AlipayOpenAppItemQueryResponse process() throws AlipayApiException {
|
|
||||||
// 构造请求参数以调用接口
|
|
||||||
AlipayOpenAppItemQueryRequest request = new AlipayOpenAppItemQueryRequest();
|
|
||||||
AlipayOpenAppItemQueryModel model = new AlipayOpenAppItemQueryModel();
|
|
||||||
if (!StringUtils.isEmpty(itemId)) {
|
|
||||||
// 设置支付宝侧商品id
|
|
||||||
model.setItemId(itemId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(outItemId)) {
|
|
||||||
// 设置商家侧商品id
|
|
||||||
model.setOutItemId(outItemId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置是否查询编辑版本
|
|
||||||
model.setNeedEditSpu(needEditSpu);
|
|
||||||
|
|
||||||
request.setBizModel(model);
|
|
||||||
|
|
||||||
return alipaySdkUtil.execute(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AlipayOpenAppItemQueryResponse getData(AlipayOpenAppItemQueryResponse response) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApiName() {
|
|
||||||
return "alipay.open.app.item.query";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OpenResponse<AlipayOpenAppItemListQueryResponse> queryItemList(String itemId, String outItemId, long pageNum, long pageSize) {
|
|
||||||
return AlipayApiTemplate.execute(new AlipayApiCallback<AlipayOpenAppItemListQueryResponse, AlipayOpenAppItemListQueryResponse>() {
|
|
||||||
@Override
|
|
||||||
public AlipayOpenAppItemListQueryResponse process() throws AlipayApiException {
|
|
||||||
// 构造请求参数以调用接口
|
|
||||||
AlipayOpenAppItemListQueryRequest request = new AlipayOpenAppItemListQueryRequest();
|
|
||||||
AlipayOpenAppItemListQueryModel model = new AlipayOpenAppItemListQueryModel();
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(outItemId)) {
|
|
||||||
// 设置商家侧id列表
|
|
||||||
List<String> outItemIdList = new ArrayList<>();
|
|
||||||
outItemIdList.add(outItemId);
|
|
||||||
model.setOutItemIdList(outItemIdList);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(itemId)) {
|
|
||||||
// 设置平台侧商品id列表
|
|
||||||
List<String> itemIdList = new ArrayList<>();
|
|
||||||
itemIdList.add(itemId);
|
|
||||||
model.setItemIdList(itemIdList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置页码
|
|
||||||
model.setPageNum(pageNum);
|
|
||||||
// 设置单页大小
|
|
||||||
model.setPageSize(pageSize);
|
|
||||||
|
|
||||||
request.setBizModel(model);
|
|
||||||
|
|
||||||
return alipaySdkUtil.execute(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AlipayOpenAppItemListQueryResponse getData(AlipayOpenAppItemListQueryResponse response) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApiName() {
|
|
||||||
return "alipay.open.app.item.list.query";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private AlipayOpenAppItemCreateModel getAlipayOpenAppItemCreateModel(ItemCreateRequest param) throws AlipayApiException {
|
|
||||||
AlipayOpenAppItemCreateModel model = new AlipayOpenAppItemCreateModel();
|
AlipayOpenAppItemCreateModel model = new AlipayOpenAppItemCreateModel();
|
||||||
|
|
||||||
// 设置商家侧商品ID
|
// 设置商家侧商品ID
|
||||||
model.setOutItemId(param.getOutItemId());
|
model.setOutItemId(rentRuleItem.getOutItemId());
|
||||||
|
|
||||||
|
// 设置商品名称由品牌、型号、电池规格、租赁类型、套餐名称拼接
|
||||||
|
String title = rentRuleItem.getBrandName() + rentRuleItem.getModelName() +"_"+ rentRuleItem.getCategoryName() + "_" +rentRuleItem.getRentalDays()+ rentRuleItem.getDictLabel()+rentRuleItem.getRuleName();
|
||||||
// 设置商品名称
|
// 设置商品名称
|
||||||
model.setTitle(param.getProductName());
|
model.setTitle(title);
|
||||||
|
|
||||||
// 设置导购描述
|
// 设置导购描述
|
||||||
model.setDesc(param.getProductName());
|
model.setDesc(title);
|
||||||
|
|
||||||
// 设置商品主图
|
// 设置商品主图
|
||||||
model.setHeadImg(imageUploadService.uploadAndReturnId("file/head.jpg", "ITEM_HEAD_IMG"));
|
model.setHeadImg(imageUploadService.uploadAndReturnId(rentRuleItem.getImage(), "ITEM_HEAD_IMG"));
|
||||||
|
|
||||||
// 设置商品图片的文件id列表
|
// 设置商品图片的文件id列表
|
||||||
List<String> imageList = new ArrayList<>();
|
List<String> imageList = new ArrayList<>();
|
||||||
imageList.add(imageUploadService.uploadAndReturnId("file/head.jpg", "ITEM_IMAGE_LIST"));
|
imageList.add(imageUploadService.uploadAndReturnId("file/head.jpg", "ITEM_IMAGE_LIST"));
|
||||||
model.setImageList(imageList);
|
model.setImageList(imageList);
|
||||||
|
|
||||||
|
model.setItemDetailsPageModel("1");
|
||||||
|
|
||||||
// 设置商品详情页URL,需要先完成商品详情页组件开发接入
|
// 设置商品详情页URL,需要先完成商品详情页组件开发接入
|
||||||
try {
|
// try {
|
||||||
String url = "plugin-private://2021003177653028/pages/goodsDetail/goodsDetail?outItemId=" + param.getOutItemId();
|
// String url = "plugin-private://2021003177653028/pages/goodsDetail/goodsDetail?outItemId=" + param.getOutItemId();
|
||||||
model.setPath("alipays://platformapi/startApp?appId=" + alipaySdkUtil.getAppId()
|
// model.setPath("alipays://platformapi/startApp?appId=" + alipaySdkUtil.getAppId()
|
||||||
+ "&page=" + URLEncoder.encode(url, "utf-8"));
|
// + "&page=" + URLEncoder.encode(url, "utf-8"));
|
||||||
} catch (UnsupportedEncodingException e) {
|
// } catch (UnsupportedEncodingException e) {
|
||||||
throw new AlipayApiException("url解析失败");
|
// throw new AlipayApiException("url解析失败");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 设置类目ID
|
// 设置类目ID
|
||||||
model.setCategoryId(param.getCategoryId());
|
model.setCategoryId("C001684401");
|
||||||
|
|
||||||
// 设置商品售价
|
// 设置商品售价
|
||||||
model.setSalePrice(1L);
|
Long rentalPriceInCents = rentRuleItem.getRentalPrice().multiply(new BigDecimal(100)).setScale(0, java.math.RoundingMode.HALF_UP).longValue();
|
||||||
|
model.setSalePrice(rentalPriceInCents);
|
||||||
|
|
||||||
// 设置商品原价
|
// 设置商品原价
|
||||||
model.setOriginalPrice(1000L);
|
model.setOriginalPrice(rentalPriceInCents);
|
||||||
|
|
||||||
// 设置库存
|
// 设置库存
|
||||||
model.setStockNum(100L);
|
model.setStockNum(100L);
|
||||||
@ -401,8 +261,8 @@ public class ItemServiceImpl implements ItemService {
|
|||||||
return templateResponse.getData().getAttr().getItemAttrList();
|
return templateResponse.getData().getAttr().getItemAttrList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<AppItemAttrVO> getItemAttrs(ItemCreateRequest param, List<String> imageList, String itemType) throws AlipayApiException {
|
private List<AppItemAttrVO> getItemAttrs(RentRuleItem param, List<String> imageList, String itemType) throws AlipayApiException {
|
||||||
List<AttributeVO> attributes = getTemplateItemAttrs(param.getCategoryId(), itemType);
|
List<AttributeVO> attributes = getTemplateItemAttrs("C001684401", itemType);
|
||||||
if (CollectionUtils.isEmpty(attributes)) {
|
if (CollectionUtils.isEmpty(attributes)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -415,15 +275,15 @@ public class ItemServiceImpl implements ItemService {
|
|||||||
// -----BEGIN 普通实物类商品可传入以下属性 -----
|
// -----BEGIN 普通实物类商品可传入以下属性 -----
|
||||||
case "delivery_info":
|
case "delivery_info":
|
||||||
// 商品履约信息
|
// 商品履约信息
|
||||||
if (StringUtils.isEmpty(param.getDeliveryId())) {
|
// if (StringUtils.isEmpty(param.getDeliveryId())) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("delivery_id", param.getDeliveryId());
|
// jsonObject.put("delivery_id", param.getDeliveryId());
|
||||||
jsonObject.put("shop_ids", param.getShopIds());
|
// jsonObject.put("shop_ids", param.getShopIds());
|
||||||
JSONArray jsonArray = new JSONArray();
|
// JSONArray jsonArray = new JSONArray();
|
||||||
jsonArray.add(jsonObject);
|
// jsonArray.add(jsonObject);
|
||||||
appItemAttrVO.setAttrValue(JSONArray.toJSONString(jsonArray));
|
// appItemAttrVO.setAttrValue(JSONArray.toJSONString(jsonArray));
|
||||||
break;
|
break;
|
||||||
case "selling_point_tag":
|
case "selling_point_tag":
|
||||||
// 导购标签
|
// 导购标签
|
||||||
|
|||||||
54
src/main/java/com/sczx/pay/mapper/RentRuleItemMapper.java
Normal file
54
src/main/java/com/sczx/pay/mapper/RentRuleItemMapper.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package com.sczx.pay.mapper;
|
||||||
|
|
||||||
|
import com.sczx.pay.alipay.po.RentRuleItem;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型租赁规则项数据访问层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RentRuleItemMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询车型租赁规则项
|
||||||
|
* @param id 车型ID
|
||||||
|
* @return 车型租赁规则项信息
|
||||||
|
*/
|
||||||
|
RentRuleItem selectById(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有车型租赁规则项
|
||||||
|
* @return 车型租赁规则项列表
|
||||||
|
*/
|
||||||
|
List<RentRuleItem> selectAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车型租赁规则项
|
||||||
|
* @param zcRentRuleItem 车型租赁规则项信息
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insert(RentRuleItem zcRentRuleItem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新车型租赁规则项
|
||||||
|
* @param zcRentRuleItem 车型租赁规则项信息
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int update(RentRuleItem zcRentRuleItem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除车型租赁规则项
|
||||||
|
* @param id 车型ID
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int deleteById(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入车型租赁规则项
|
||||||
|
* @param list 车型租赁规则项列表
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insertBatch(@Param("list") List<RentRuleItem> list);
|
||||||
|
}
|
||||||
123
src/main/resources/mapper/RentRuleItemMapper.xml
Normal file
123
src/main/resources/mapper/RentRuleItemMapper.xml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.sczx.pay.mapper.RentRuleItemMapper">
|
||||||
|
|
||||||
|
<!-- 结果映射 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.sczx.pay.alipay.po.RentRuleItem">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="outItemId" column="out_item_id"/>
|
||||||
|
<result property="aliItemId" column="ali_item_id"/>
|
||||||
|
<result property="brandName" column="brand_name"/>
|
||||||
|
<result property="modelName" column="model_name"/>
|
||||||
|
<result property="categoryName" column="category_name"/>
|
||||||
|
<result property="dictLabel" column="dict_label"/>
|
||||||
|
<result property="ruleName" column="rule_name"/>
|
||||||
|
<result property="image" column="image"/>
|
||||||
|
<result property="batteryRuleId" column="battery_rule_id"/>
|
||||||
|
<result property="carRuleId" column="car_rule_id"/>
|
||||||
|
<result property="carModelId" column="car_model_id"/>
|
||||||
|
<result property="brandId" column="brand_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 字段列表 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, out_item_id, ali_item_id, brand_name, model_name, category_name,
|
||||||
|
dict_label, rule_name, image, battery_rule_id, car_rule_id, car_model_id, brand_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 查询所有 -->
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
SELECT <include refid="Base_Column_List"/>
|
||||||
|
FROM zc_rent_rule_item
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据ID查询 -->
|
||||||
|
<select id="selectById" parameterType="Long" resultMap="BaseResultMap">
|
||||||
|
SELECT <include refid="Base_Column_List"/>
|
||||||
|
FROM zc_rent_rule_item
|
||||||
|
WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 插入 -->
|
||||||
|
<insert id="insert" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||||
|
INSERT INTO zc_rent_rule_item (
|
||||||
|
id,
|
||||||
|
out_item_id,
|
||||||
|
ali_item_id,
|
||||||
|
brand_name,
|
||||||
|
model_name,
|
||||||
|
category_name,
|
||||||
|
dict_label,
|
||||||
|
rule_name,
|
||||||
|
image,
|
||||||
|
battery_rule_id,
|
||||||
|
car_rule_id,
|
||||||
|
car_model_id,
|
||||||
|
brand_id
|
||||||
|
) VALUES (
|
||||||
|
#{id},
|
||||||
|
#{outItemId},
|
||||||
|
#{aliItemId},
|
||||||
|
#{brandName},
|
||||||
|
#{modelName},
|
||||||
|
#{categoryName},
|
||||||
|
#{dictLabel},
|
||||||
|
#{ruleName},
|
||||||
|
#{image},
|
||||||
|
#{batteryRuleId},
|
||||||
|
#{carRuleId},
|
||||||
|
#{carModelId},
|
||||||
|
#{brandId}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 批量插入 -->
|
||||||
|
<insert id="insertBatch">
|
||||||
|
INSERT INTO zc_rent_rule_item (
|
||||||
|
id, out_item_id, ali_item_id, brand_name, model_name, category_name,
|
||||||
|
dict_label, rule_name, image, battery_rule_id, car_rule_id, car_model_id, brand_id
|
||||||
|
) VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.id},
|
||||||
|
#{item.outItemId},
|
||||||
|
#{item.aliItemId},
|
||||||
|
#{item.brandName},
|
||||||
|
#{item.modelName},
|
||||||
|
#{item.categoryName},
|
||||||
|
#{item.dictLabel},
|
||||||
|
#{item.ruleName},
|
||||||
|
#{item.image},
|
||||||
|
#{item.batteryRuleId},
|
||||||
|
#{item.carRuleId},
|
||||||
|
#{item.carModelId},
|
||||||
|
#{item.brandId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 更新 -->
|
||||||
|
<update id="update" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||||
|
UPDATE zc_rent_rule_item
|
||||||
|
<set>
|
||||||
|
<if test="outItemId != null and outItemId != ''">out_item_id = #{outItemId},</if>
|
||||||
|
<if test="aliItemId != null and aliItemId != ''">ali_item_id = #{aliItemId},</if>
|
||||||
|
<if test="brandName != null and brandName != ''">brand_name = #{brandName},</if>
|
||||||
|
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
|
||||||
|
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
|
||||||
|
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
|
||||||
|
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
|
||||||
|
<if test="image != null">image = #{image},</if>
|
||||||
|
<if test="batteryRuleId != null">battery_rule_id = #{batteryRuleId},</if>
|
||||||
|
<if test="carRuleId != null">car_rule_id = #{carRuleId},</if>
|
||||||
|
<if test="carModelId != null">car_model_id = #{carModelId},</if>
|
||||||
|
<if test="brandId != null">brand_id = #{brandId},</if>
|
||||||
|
</set>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 根据ID删除 -->
|
||||||
|
<delete id="deleteById" parameterType="Long">
|
||||||
|
DELETE FROM zc_rent_rule_item WHERE id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user