|
@@ -643,12 +643,12 @@ public class TOrderController {
|
|
|
*
|
|
|
* @param clientId 设备client id
|
|
|
* @param productName 商品名称
|
|
|
- * @param
|
|
|
+ * @param pri DIY花型价格
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "请求在线支付 二码合一")
|
|
|
@GetMapping("/twoPayCode")
|
|
|
- public Object twoPayCode(String code, String clientId, String productName) {
|
|
|
+ public Object twoPayCode(String code, String clientId, String productName, String pri) {
|
|
|
TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(clientId));
|
|
|
if(equipment==null||equipment.getId()==null){
|
|
|
return JsonMessage.error("找不到设备");
|
|
@@ -707,17 +707,27 @@ public class TOrderController {
|
|
|
|
|
|
Long equipmentId = equipment.getId();
|
|
|
//查找商品
|
|
|
- TProduct product = R.getDataIfSuccess(szwlFeign.getProduct(String.valueOf(equipmentId), productName));
|
|
|
- if (product == null) {
|
|
|
- return JsonMessage.error("找不到商品");
|
|
|
+ BigDecimal price;
|
|
|
+ Long productId = null;
|
|
|
+ // A99:DIY花型
|
|
|
+ String productNo = "A99";
|
|
|
+ if (StringUtils.isEmpty(pri)) {
|
|
|
+ TProduct product = R.getDataIfSuccess(szwlFeign.getProduct(String.valueOf(equipmentId), productName));
|
|
|
+ if (product == null) {
|
|
|
+ return JsonMessage.error("找不到商品");
|
|
|
+ }
|
|
|
+ price = product.getRmbPrice();
|
|
|
+ productId = product.getId();
|
|
|
+ productNo = product.getNo();
|
|
|
+ if (BigDecimal.ZERO.compareTo(price) >= 0) {
|
|
|
+ return JsonMessage.error("商品价格异常");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ price = new BigDecimal(pri);
|
|
|
}
|
|
|
- BigDecimal price = product.getRmbPrice();
|
|
|
if(StringUtils.isNotEmpty(code)){
|
|
|
BigDecimal discount = BigDecimal.valueOf(promoCode.getDiscount());
|
|
|
- price = product.getRmbPrice().multiply(discount).divide(new BigDecimal(10)).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
- }
|
|
|
- if (BigDecimal.ZERO.compareTo(price) >= 0) {
|
|
|
- return JsonMessage.error("商品价格异常");
|
|
|
+ price = price.multiply(discount).divide(new BigDecimal(10)).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
}
|
|
|
String sn1 = orderService.initSn(equipmentId);
|
|
|
String sn2 = orderService.initSn(equipmentId);
|
|
@@ -773,8 +783,8 @@ public class TOrderController {
|
|
|
order.setModifyDate(new Date());
|
|
|
order.setAdminId(admin.getId());
|
|
|
order.setSn(sn1);
|
|
|
- order.setProductId(product.getId());
|
|
|
- order.setProductNo(product.getNo());
|
|
|
+ order.setProductId(productId);
|
|
|
+ order.setProductNo(productNo);
|
|
|
order.setProductName(productName);
|
|
|
order.setProductNumber(productNumber);
|
|
|
order.setPrice(price);
|
|
@@ -817,8 +827,8 @@ public class TOrderController {
|
|
|
order2.setModifyDate(new Date());
|
|
|
order2.setAdminId(admin.getId());
|
|
|
order2.setSn(sn2);
|
|
|
- order2.setProductId(product.getId());
|
|
|
- order2.setProductNo(product.getNo());
|
|
|
+ order2.setProductId(productId);
|
|
|
+ order2.setProductNo(productNo);
|
|
|
order2.setProductName(productName);
|
|
|
order2.setProductNumber(productNumber);
|
|
|
order2.setPrice(price);
|
|
@@ -862,7 +872,7 @@ public class TOrderController {
|
|
|
orderDetails.setCreateDate(new Date());
|
|
|
orderDetails.setPrice(price);
|
|
|
orderDetails.setProductName(productName);
|
|
|
- orderDetails.setProductNo(product.getNo());
|
|
|
+ orderDetails.setProductNo(productNo);
|
|
|
orderDetails.setProductNumber(productNumber);
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setCompanyType(companyType);
|