记得上下班打卡 | git大法好,push需谨慎

Commit dfde97a2 authored by 胡佳晨's avatar 胡佳晨

order 下单接口修改

根据adcode 获取快递价格接口修改
parent b01285ef
...@@ -26,15 +26,10 @@ public class PayOrderParam { ...@@ -26,15 +26,10 @@ public class PayOrderParam {
@NotNull(message = "数量不能为空") @NotNull(message = "数量不能为空")
@Min(value = 1,message = "数量不能小于0") @Min(value = 1,message = "数量不能小于0")
private Integer number; private Integer number;
// @ApiModelProperty(value = "是否学生票")
// @NotNull(message = "必传")
// private Integer isStudent;
@ApiModelProperty(value = "是否电子票") @ApiModelProperty(value = "是否电子票")
private Integer isElectronic; private Integer isElectronic;
@ApiModelProperty(value = "是否快递票") @ApiModelProperty(value = "是否快递票")
private Integer isExpress; private Integer isExpress;
@ApiModelProperty(value = "收货地址id") @ApiModelProperty(value = "收货地址id")
private String addressId; private String addressId;
@ApiModelProperty(value = "入场人id数组") @ApiModelProperty(value = "入场人id数组")
...@@ -42,13 +37,9 @@ public class PayOrderParam { ...@@ -42,13 +37,9 @@ public class PayOrderParam {
@ApiModelProperty(value = "代理id") @ApiModelProperty(value = "代理id")
@NotNull(message = "代理ID不能为空") @NotNull(message = "代理ID不能为空")
private String agentId; private String agentId;
@ApiModelProperty(value = "快递类型 1寄付 2到付") @ApiModelProperty(value = "快递类型[0无类型|1寄付|2到付|3包邮]")
@NotNull(message = "快递方式不能为空") @NotNull(message = "快递方式不能为空")
@Max(value = 2, message = "快递方式无效")
@Min(value = 1, message = "快递方式无效")
private Integer expressType; private Integer expressType;
@ApiModelProperty(value = "支付类型") @ApiModelProperty(value = "支付类型")
@NotNull(message = "支付类型不能为空") @NotNull(message = "支付类型不能为空")
private String payType; private String payType;
...@@ -61,11 +52,14 @@ public class PayOrderParam { ...@@ -61,11 +52,14 @@ public class PayOrderParam {
private String showUrl; private String showUrl;
@ApiModelProperty(value = "returnUrl") @ApiModelProperty(value = "returnUrl")
private String returnUrl; private String returnUrl;
@ApiModelProperty(value = "优惠券类型") @ApiModelProperty(value = "优惠券类型")
private Integer voucherType; private Integer voucherType;
@ApiModelProperty(value = "优惠券码") @ApiModelProperty(value = "优惠券码")
private String voucherCode; private String voucherCode;
@ApiModelProperty(value = "会员提前券码") @ApiModelProperty(value = "会员提前券码")
private String advanceCode; private String advanceCode;
@ApiModelProperty(value = "收货地址adCode")
private String adCode;
@ApiModelProperty(value = "快递方式productCode")
private String productCode;
} }
package com.liquidnet.service.kylin.controller; package com.liquidnet.service.kylin.controller;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.common.cache.redis.util.RedisUtil; import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinRedisConst; import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.KylinFreightChargeDao; import com.liquidnet.service.kylin.dao.KylinFreightChargeDao;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -18,21 +18,19 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,21 +18,19 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
public class KylinGetShunFengPriceController { public class KylinGetShunFengPriceController {
@Autowired
private RedisDataSourceUtil redisDataSourceUtil;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@GetMapping("getPrice") @GetMapping("getPrice")
@ApiOperation("运费查询") @ApiOperation("运费查询")
public String getFreightCharge(String adcode,String expressType){ public ResponseDto<String> getFreightCharge(String adcode, String productCode) {
Object obj =redisUtil.get(KylinRedisConst.RETURN_ADDRESS_CODE+adcode+KylinRedisConst.EXPRESS_TYPE+expressType); Object obj = redisUtil.get(KylinRedisConst.RETURN_ADDRESS_CODE + adcode + KylinRedisConst.EXPRESS_TYPE + productCode);
if (obj != null){ if (obj != null) {
KylinFreightChargeDao k= (KylinFreightChargeDao)obj; KylinFreightChargeDao k = (KylinFreightChargeDao) obj;
return k.getPrice(); return ResponseDto.success(k.getPrice());
}else { } else {
return null; return ResponseDto.failure();
} }
} }
......
...@@ -146,6 +146,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -146,6 +146,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if (!checkAgent(payOrderParam.getAgentId(), ticketData)) { if (!checkAgent(payOrderParam.getAgentId(), ticketData)) {
return ResponseDto.failure(ErrorMapping.get("20008"));//无权购买 return ResponseDto.failure(ErrorMapping.get("20008"));//无权购买
} }
//校验快递相关参数
if (payOrderParam.getIsExpress() == 1) {
if (payOrderParam.getAdCode() == null || payOrderParam.getProductCode() == null) {
return ResponseDto.failure(ErrorMapping.get("20004"));//参数错误
}
}
String time1 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketData.getUseStart()), DateUtil.Formatter.MM_dd_zh); String time1 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketData.getUseStart()), DateUtil.Formatter.MM_dd_zh);
String time2 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketData.getUseEnd()), DateUtil.Formatter.MM_dd_zh); String time2 = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(ticketData.getUseEnd()), DateUtil.Formatter.MM_dd_zh);
...@@ -395,6 +401,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -395,6 +401,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTickets.setPrice(ticketData.getPrice()); orderTickets.setPrice(ticketData.getPrice());
orderTickets.setPriceMember(ticketData.getMemberPrice()); orderTickets.setPriceMember(ticketData.getMemberPrice());
BigDecimal priceExpress = BigDecimal.ZERO;
if (payOrderParam.getIsExpress() == 1) {
String productCode = payOrderParam.getProductCode();
String adCode = payOrderParam.getAdCode();
priceExpress = orderUtils.getExpressPrice(adCode, productCode);
}
if (payOrderParam.getVoucherType() != null) { if (payOrderParam.getVoucherType() != null) {
orderTickets.setCouponType(payOrderParam.getVoucherType().equals(3) ? "exchange" : "no"); orderTickets.setCouponType(payOrderParam.getVoucherType().equals(3) ? "exchange" : "no");
} else { } else {
...@@ -428,7 +441,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -428,7 +441,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} }
if (payOrderParam.getVoucherCode() != null) { if (payOrderParam.getVoucherCode() != null) {
HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal(), payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId()); HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal().subtract(priceExpress), payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId());
BigDecimal priceVoucher = (BigDecimal) hashMap.get("voucher"); BigDecimal priceVoucher = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type"); Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) { if (typeVoucher.equals(-1)) {
...@@ -455,7 +468,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -455,7 +468,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
BigDecimal finalPrice = orderTickets.getPriceTotal().subtract(orderTickets.getPriceVoucher()); BigDecimal finalPrice = orderTickets.getPriceTotal().subtract(orderTickets.getPriceVoucher());
orderTickets.setPriceActual(finalPrice.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : finalPrice); orderTickets.setPriceActual(finalPrice.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : finalPrice);
orderTickets.setPriceExpress(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : BigDecimal.valueOf(0)); orderTickets.setPriceExpress(priceExpress);
orderTickets.setPriceRefund(BigDecimal.valueOf(0.0)); orderTickets.setPriceRefund(BigDecimal.valueOf(0.0));
orderTickets.setRefundNumber(0); orderTickets.setRefundNumber(0);
orderTickets.setPayType(payOrderParam.getPayType()); orderTickets.setPayType(payOrderParam.getPayType());
......
...@@ -37,6 +37,8 @@ public class OrderUtils { ...@@ -37,6 +37,8 @@ public class OrderUtils {
private String candyUrl; private String candyUrl;
@Value("${liquidnet.service.stone.url}") @Value("${liquidnet.service.stone.url}")
private String stoneUrl; private String stoneUrl;
@Value("${liquidnet.service.kylin.url}")
private String kylinUrl;
public String judgeOrderLimit( public String judgeOrderLimit(
int type, int type,
...@@ -138,13 +140,13 @@ public class OrderUtils { ...@@ -138,13 +140,13 @@ public class OrderUtils {
return surplusGeneral; return surplusGeneral;
} }
public void doTask(String uid,String title,BigDecimal price) { public void doTask(String uid, String title, BigDecimal price) {
try { try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8"); header.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("score", price.intValue()+""); params.add("score", price.intValue() + "");
params.add("content", "购买演出:"+title); params.add("content", "购买演出:" + title);
params.add("uid", uid); params.add("uid", uid);
String resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header); String resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header);
} catch (Exception e) { } catch (Exception e) {
...@@ -153,7 +155,7 @@ public class OrderUtils { ...@@ -153,7 +155,7 @@ public class OrderUtils {
} }
} }
public AdamRscPolymer01Vo adamAddressEnterMember(String uid,String enterIds,String addressId) { public AdamRscPolymer01Vo adamAddressEnterMember(String uid, String enterIds, String addressId) {
try { try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8"); header.add("Accept", "application/json;charset=UTF-8");
...@@ -267,8 +269,8 @@ public class OrderUtils { ...@@ -267,8 +269,8 @@ public class OrderUtils {
hashMap.put("type", type); hashMap.put("type", type);
hashMap.put("voucher", voucher.setScale(2, BigDecimal.ROUND_HALF_UP)); hashMap.put("voucher", voucher.setScale(2, BigDecimal.ROUND_HALF_UP));
return hashMap; return hashMap;
}catch (Exception e){ } catch (Exception e) {
log.error("用券ERROR:{}",e); log.error("用券ERROR:{}", e);
hashMap.put("type", -1); hashMap.put("type", -1);
hashMap.put("voucher", -1); hashMap.put("voucher", -1);
return hashMap; return hashMap;
...@@ -294,8 +296,22 @@ public class OrderUtils { ...@@ -294,8 +296,22 @@ public class OrderUtils {
params.add(param); params.add(param);
String jsonString = JSON.toJSONString(params); String jsonString = JSON.toJSONString(params);
String returnData = HttpUtil.postRaw(candyUrl + "/candy-coupon/useBack", jsonString, header); String returnData = HttpUtil.postRaw(candyUrl + "/candy-coupon/useBack", jsonString, header);
}catch (Exception e){ } catch (Exception e) {
log.error("回退券ERROR:{}",e); log.error("回退券ERROR:{}", e);
}
}
public BigDecimal getExpressPrice(String adCode, String productCode) {
try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8");
String resultData = HttpUtil.get(kylinUrl + "/getShunFengPrice/getPrice?adcode=" + adCode + "&productCode=" + productCode, null, header);
ResponseDto<String> innerReturnVo = JsonUtils.fromJson(resultData, new TypeReference<ResponseDto<String>>() {
});
return BigDecimal.valueOf(Integer.parseInt(innerReturnVo.getData()));
} catch (Exception e) {
log.error("获取快递费失败:{}", e);
return BigDecimal.valueOf(23);
} }
} }
......
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