fixbug first
This commit is contained in:
@ -1,7 +1,3 @@
|
||||
/**
|
||||
* Alipay.com Inc.
|
||||
* Copyright (c) 2004-2024 All Rights Reserved.
|
||||
*/
|
||||
package com.sczx.pay.alipay.service;
|
||||
|
||||
import com.alipay.api.domain.AppxCategoryVO;
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/**
|
||||
* Alipay.com Inc.
|
||||
* Copyright (c) 2004-2024 All Rights Reserved.
|
||||
*/
|
||||
package com.sczx.pay.alipay.service.impl;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
|
||||
@ -10,22 +10,17 @@ 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.ItemService;
|
||||
import com.sczx.pay.alipay.vo.ItemCreateRequest;
|
||||
import com.sczx.pay.alipay.vo.OpenResponse;
|
||||
import com.sczx.pay.mapper.RentRuleItemMapper;
|
||||
import com.sczx.pay.utils.AlipayApiCallback;
|
||||
import com.sczx.pay.utils.AlipayApiTemplate;
|
||||
import com.sczx.pay.utils.AlipaySdkUtil;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -46,6 +41,9 @@ public class ItemServiceImpl implements ItemService {
|
||||
@Autowired
|
||||
private ImageUploadService imageUploadService;
|
||||
|
||||
@Autowired
|
||||
private RentRuleItemMapper rentRuleItemMapper;
|
||||
|
||||
@Override
|
||||
public OpenResponse<List<AppxCategoryVO>> getCategories(String itemType, String catStatus) {
|
||||
return AlipayApiTemplate.execute(new AlipayApiCallback<List<AppxCategoryVO>, AlipayOpenAppItemAllcategoryQueryResponse>() {
|
||||
@ -127,15 +125,18 @@ public class ItemServiceImpl implements ItemService {
|
||||
|
||||
@Override
|
||||
public AlipayOpenAppItemCreateResponse process() throws AlipayApiException {
|
||||
|
||||
RentRuleItem rentRuleItem = rentRuleItemMapper.selectByIds(param.getBatteryRuleId(), param.getCarRuleId(), param.getCarModelId(), param.getBrandId());
|
||||
|
||||
// 构造请求参数以调用接口
|
||||
AlipayOpenAppItemCreateRequest request = new AlipayOpenAppItemCreateRequest();
|
||||
AlipayOpenAppItemCreateModel model = getAlipayOpenAppItemCreateModel(param);
|
||||
AlipayOpenAppItemCreateModel model = getAlipayOpenAppItemCreateModel(rentRuleItem);
|
||||
|
||||
// 设置商品模版类型
|
||||
model.setItemType("2");
|
||||
|
||||
// 设置价格单元
|
||||
model.setPriceUnit("元/日");
|
||||
model.setPriceUnit("元");
|
||||
|
||||
// 设置属性列表
|
||||
model.setAttrs(getItemAttrs(param, model.getImageList(), model.getItemType()));
|
||||
@ -168,6 +169,8 @@ public class ItemServiceImpl implements ItemService {
|
||||
model.setDeliveryType("PICKUP");
|
||||
model.setDeliveryName("电动车租赁自提履约");
|
||||
|
||||
// 设置履约信息ID
|
||||
model.setDeliveryId("2025090124000116301610");
|
||||
|
||||
// 设置履约属性
|
||||
List<AppItemAttrVO> attrs = new ArrayList<AppItemAttrVO>();
|
||||
@ -232,7 +235,7 @@ public class ItemServiceImpl implements ItemService {
|
||||
AlipayOpenAppDeliveryTemplateQueryModel model = new AlipayOpenAppDeliveryTemplateQueryModel();
|
||||
// 设置履约类型
|
||||
model.setDeliveryType("PICKUP");
|
||||
|
||||
//ST1000000000000010
|
||||
request.setBizModel(model);
|
||||
return alipaySdkUtil.execute(request);
|
||||
}
|
||||
@ -329,36 +332,16 @@ public class ItemServiceImpl implements ItemService {
|
||||
// -----BEGIN 普通实物类商品可传入以下属性 -----
|
||||
case "delivery_info":
|
||||
// 商品履约信息
|
||||
// if (StringUtils.isEmpty(param.getDeliveryId())) {
|
||||
// break;
|
||||
// }
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("delivery_id", param.getDeliveryId());
|
||||
// jsonObject.put("shop_ids", param.getShopIds());
|
||||
// JSONArray jsonArray = new JSONArray();
|
||||
// jsonArray.add(jsonObject);
|
||||
// appItemAttrVO.setAttrValue(JSONArray.toJSONString(jsonArray));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("delivery_id", "2025090124000116301610");
|
||||
//jsonObject.put("shop_ids", param.getShopIds());
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(jsonObject);
|
||||
appItemAttrVO.setAttrValue(JSONArray.toJSONString(jsonArray));
|
||||
break;
|
||||
case "selling_point_tag":
|
||||
// 导购标签
|
||||
appItemAttrVO.setAttrValue("[\"鲜花\",\"盆栽\"]");
|
||||
break;
|
||||
case "white_ground_image":
|
||||
// 商品白底图
|
||||
JSONObject image = new JSONObject();
|
||||
image.put("url_list", imageList);
|
||||
appItemAttrVO.setAttrValue(image.toJSONString());
|
||||
break;
|
||||
case "shipping_time_limit":
|
||||
// 现货发货时效
|
||||
appItemAttrVO.setAttrValue("1");
|
||||
break;
|
||||
// -----END 普通实物类商品可传入以上属性 -----
|
||||
|
||||
// -----BEGIN 租赁类商品可传入以下属性 -----
|
||||
case "rent_from_numbers_of_day":
|
||||
// 起租天数
|
||||
appItemAttrVO.setAttrValue("3");
|
||||
appItemAttrVO.setAttrValue("1");
|
||||
break;
|
||||
case "item_fineness":
|
||||
// 商品成色
|
||||
@ -376,49 +359,6 @@ public class ItemServiceImpl implements ItemService {
|
||||
// 是否可买断
|
||||
appItemAttrVO.setAttrValue("1");
|
||||
break;
|
||||
// -----END 租赁类商品可传入以上属性 -----
|
||||
|
||||
// -----BEGIN 虚拟类(电影/演出/体育赛事/休闲娱乐/运动健身类目)商品可传入以下属性 -----
|
||||
case "sale_time":
|
||||
// 开售时间,明天16:00:00开始
|
||||
appItemAttrVO.setAttrValue(LocalDateTime.now()
|
||||
.plusDays(1)
|
||||
.withHour(16)
|
||||
.withMinute(0)
|
||||
.withSecond(0)
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
break;
|
||||
case "performance_date_range":
|
||||
// 演出日期
|
||||
JSONObject range = new JSONObject();
|
||||
LocalDateTime localDateTime = LocalDateTime.now()
|
||||
.plusMonths(1);
|
||||
// 一个月后开始
|
||||
range.put("start_date", localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
range.put("end_date", localDateTime
|
||||
.plusDays(1)
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
appItemAttrVO.setAttrValue(range.toJSONString());
|
||||
break;
|
||||
case "agent_type":
|
||||
// 票务代理类型
|
||||
appItemAttrVO.setAttrValue("1");
|
||||
break;
|
||||
case "performance_area":
|
||||
// 演出举办地区
|
||||
appItemAttrVO.setAttrValue("{\"city_code\":\"120100\"}");
|
||||
break;
|
||||
case "venue_name":
|
||||
// 演出场馆名称
|
||||
appItemAttrVO.setAttrValue("蚂蚁A空间");
|
||||
break;
|
||||
case "post_img":
|
||||
// 演出海报(图片)
|
||||
JSONObject image2 = new JSONObject();
|
||||
image2.put("url_list", imageList);
|
||||
appItemAttrVO.setAttrValue(image2.toJSONString());
|
||||
break;
|
||||
// -----END 虚拟类(电影/演出/体育赛事/休闲娱乐/运动健身类目)商品可传入以上属性 -----
|
||||
}
|
||||
if (!StringUtils.isEmpty(appItemAttrVO.getAttrValue())) {
|
||||
attrs.add(appItemAttrVO);
|
||||
|
||||
@ -21,7 +21,7 @@ public class AlipayConf {
|
||||
@Value("${ali.pay.app-id}")
|
||||
private String appId;
|
||||
|
||||
@Value("${alipay.gateway-url}")
|
||||
@Value("${ali.pay.gateway-url}")
|
||||
private String gatewayUrl;
|
||||
|
||||
@Value("${ali.pay.privateKey}")
|
||||
|
||||
@ -10,41 +10,46 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface RentRuleItemMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询车型租赁规则项
|
||||
* @param id 车型ID
|
||||
* @return 车型租赁规则项信息
|
||||
*/
|
||||
RentRuleItem selectById(@Param("id") Long id);
|
||||
|
||||
|
||||
RentRuleItem selectByIds(@Param("batteryRuleId") Long batteryRuleId, @Param("carRuleId") Long carRuleId, @Param("carModelId") Long carModelId,@Param("brandId") Long brandId);
|
||||
|
||||
RentRuleItem selectByAliId(@Param("aliItemId") String aliItemId);
|
||||
|
||||
RentRuleItem selectByItemId(@Param("outItemId") String outItemId);
|
||||
/**
|
||||
* 查询所有车型租赁规则项
|
||||
* @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 车型租赁规则项列表
|
||||
|
||||
Reference in New Issue
Block a user