mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-03 10:46:38 +08:00
fix bugger
This commit is contained in:
parent
2a65781635
commit
7c44493aa3
@ -18,6 +18,8 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService
|
|||||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderDatilListEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderDatilListEntity;
|
||||||
import net.lab1024.smartadmin.module.system.wxpay.WxpayService;
|
import net.lab1024.smartadmin.module.system.wxpay.WxpayService;
|
||||||
import net.lab1024.smartadmin.module.system.wxpay.wxPayModel.WxPayEntity;
|
import net.lab1024.smartadmin.module.system.wxpay.wxPayModel.WxPayEntity;
|
||||||
|
import net.lab1024.smartadmin.util.GenerateSequenceUtil;
|
||||||
|
import net.sf.json.JSONArray;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ public class OrderController {
|
|||||||
int buyCount = 0;
|
int buyCount = 0;
|
||||||
double total_fee = 0 ;
|
double total_fee = 0 ;
|
||||||
WxPayEntity wxPayEntity = new WxPayEntity();
|
WxPayEntity wxPayEntity = new WxPayEntity();
|
||||||
List<OrderDatilListEntity> orderDatilListEntitiesList = new ArrayList<>();
|
JSONArray orderDatilListJson = new JSONArray();
|
||||||
OrdersEntity ordersEntity = new OrdersEntity();
|
OrdersEntity ordersEntity = new OrdersEntity();
|
||||||
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
||||||
//存储orderDetailList
|
//存储orderDetailList
|
||||||
@ -57,7 +59,9 @@ public class OrderController {
|
|||||||
orderDatilListEntity.setProductName(ordersEntitys.getProductName());
|
orderDatilListEntity.setProductName(ordersEntitys.getProductName());
|
||||||
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
|
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
|
||||||
orderDatilListEntity.setProductId(ordersEntitys.getProductId());
|
orderDatilListEntity.setProductId(ordersEntitys.getProductId());
|
||||||
orderDatilListEntitiesList.add(orderDatilListEntity);
|
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
||||||
|
orderDatilListJson.add(orderDatilListEntity);
|
||||||
|
// orderDatilListEntitiesList.add(orderDatilListEntity);
|
||||||
productId.append(ordersEntitys.getProductId()+",");
|
productId.append(ordersEntitys.getProductId()+",");
|
||||||
productName.append(ordersEntitys.getProductName()+",");
|
productName.append(ordersEntitys.getProductName()+",");
|
||||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount())*ordersEntitys.getBuyCount();
|
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount())*ordersEntitys.getBuyCount();
|
||||||
@ -71,7 +75,8 @@ public class OrderController {
|
|||||||
ordersEntity.setMemberId(memberId);
|
ordersEntity.setMemberId(memberId);
|
||||||
ordersEntity.setPhoneNumber(mobile);
|
ordersEntity.setPhoneNumber(mobile);
|
||||||
ordersEntity.setBuyCount(buyCount);
|
ordersEntity.setBuyCount(buyCount);
|
||||||
if(orderService.generateOrder(ordersEntity,orderDatilListEntitiesList) == 1){
|
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
||||||
|
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
||||||
wxPayEntity.setProduct_id(ordersEntity.getProductId());
|
wxPayEntity.setProduct_id(ordersEntity.getProductId());
|
||||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||||
@ -106,16 +111,17 @@ public class OrderController {
|
|||||||
double total_fee = 0 ;
|
double total_fee = 0 ;
|
||||||
AliPayEntity aliPayEntity = new AliPayEntity();
|
AliPayEntity aliPayEntity = new AliPayEntity();
|
||||||
OrdersEntity ordersEntity = new OrdersEntity();
|
OrdersEntity ordersEntity = new OrdersEntity();
|
||||||
|
JSONArray orderDatilListJson = new JSONArray();
|
||||||
List<OrderDatilListEntity> orderDatilListEntitiesList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
||||||
//存储orderDetailList
|
//存储orderDetailList
|
||||||
OrderDatilListEntity orderDatilListEntity= new OrderDatilListEntity();
|
OrderDatilListEntity orderDatilListEntity= new OrderDatilListEntity();
|
||||||
orderDatilListEntity.setProductName(ordersEntitys.getProductName());
|
orderDatilListEntity.setProductName(ordersEntitys.getProductName());
|
||||||
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
|
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
|
||||||
orderDatilListEntity.setProductId(ordersEntitys.getProductId());
|
orderDatilListEntity.setProductId(ordersEntitys.getProductId());
|
||||||
orderDatilListEntitiesList.add(orderDatilListEntity);
|
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
||||||
|
orderDatilListJson.add(orderDatilListEntity);
|
||||||
|
|
||||||
|
|
||||||
productId.append(ordersEntitys.getProductId()+",");
|
productId.append(ordersEntitys.getProductId()+",");
|
||||||
productName.append(ordersEntitys.getProductName()+",");
|
productName.append(ordersEntitys.getProductName()+",");
|
||||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount())*ordersEntitys.getBuyCount();
|
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount())*ordersEntitys.getBuyCount();
|
||||||
@ -130,7 +136,7 @@ public class OrderController {
|
|||||||
ordersEntity.setPhoneNumber(mobile);
|
ordersEntity.setPhoneNumber(mobile);
|
||||||
ordersEntity.setBuyCount(buyCount);
|
ordersEntity.setBuyCount(buyCount);
|
||||||
ordersEntity.setPayType("2");
|
ordersEntity.setPayType("2");
|
||||||
if(orderService.generateOrder(ordersEntity,orderDatilListEntitiesList) == 1){
|
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
||||||
aliPayEntity.setProduct_code(ordersEntity.getProductId());
|
aliPayEntity.setProduct_code(ordersEntity.getProductId());
|
||||||
aliPayEntity.setTotal_amount(StringUtil.toString(total_fee));
|
aliPayEntity.setTotal_amount(StringUtil.toString(total_fee));
|
||||||
aliPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
aliPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||||
|
@ -12,16 +12,14 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.dao.OrdersDao;
|
|||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrdersEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrdersEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderCouponEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderCouponEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.OrderDatilListEntity;
|
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
|
||||||
import net.lab1024.smartadmin.util.GenerateSequenceUtil;
|
|
||||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||||
|
import net.sf.json.JSONArray;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -36,10 +34,11 @@ public class OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrdersDao ordersDao;
|
private OrdersDao ordersDao;
|
||||||
|
|
||||||
private String url = "http://miniapp-test.royalcanin.com.cn:7080/crm/h5/orderMaster/";
|
private String url = "https://miniapp-test.royalcanin.com.cn/rcmini/h5/orderMaster/";
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public int generateOrder(OrdersEntity ordersEntity, List<OrderDatilListEntity> orderDatilListEntitiesList) throws Exception {
|
public int generateOrder(OrdersEntity ordersEntity, JSONArray listJson) throws Exception {
|
||||||
|
AddOrSaveEntity addOrSaveEntity = new AddOrSaveEntity();
|
||||||
if (ordersEntity.getCouponCode() != ""&& null != ordersEntity.getCouponCode()) {
|
if (ordersEntity.getCouponCode() != ""&& null != ordersEntity.getCouponCode()) {
|
||||||
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
|
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
|
||||||
couponCosumeEntity.setCouponCode(ordersEntity.getCouponCode());
|
couponCosumeEntity.setCouponCode(ordersEntity.getCouponCode());
|
||||||
@ -47,24 +46,29 @@ public class OrderService {
|
|||||||
if(!jsonObject.getString("code").equals("0")) {
|
if(!jsonObject.getString("code").equals("0")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
//coupon json化
|
||||||
if(ordersDao.insert(ordersEntity) == 1) {
|
|
||||||
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
|
||||||
ordersEntity.setOrderStatus("0");
|
|
||||||
AddOrSaveEntity addOrSaveEntity = new AddOrSaveEntity();
|
|
||||||
addOrSaveEntity.setPhoneNumber(ordersEntity.getPhoneNumber());
|
|
||||||
addOrSaveEntity.setStatus("0");
|
|
||||||
addOrSaveEntity.setOrderNumber(ordersEntity.getOrderNo());
|
|
||||||
addOrSaveEntity.setSalesAmount(ordersEntity.getOrderAmount());
|
|
||||||
OrderCouponEntity orderCouponEntity = new OrderCouponEntity();
|
OrderCouponEntity orderCouponEntity = new OrderCouponEntity();
|
||||||
orderCouponEntity.setCouponCode(ordersEntity.getCouponCode());
|
orderCouponEntity.setCouponCode(ordersEntity.getCouponCode());
|
||||||
orderCouponEntity.setCouponName(ordersEntity.getCouponName());
|
orderCouponEntity.setCouponName(ordersEntity.getCouponName());
|
||||||
orderCouponEntity.setCouponId(ordersEntity.getCouponId());
|
orderCouponEntity.setCouponId(ordersEntity.getCouponId());
|
||||||
addOrSaveEntity.setOrderDatilListEntity(orderDatilListEntitiesList);
|
Map<String, String> orderCouponParamMap = MapRemoveNullUtil.setConditionMap(orderCouponEntity);
|
||||||
addOrSaveEntity.setOrderCouponEntity(orderCouponEntity);
|
MapRemoveNullUtil.removeNullEntry(orderCouponParamMap);
|
||||||
|
net.sf.json.JSONObject orderCouponJson = net.sf.json.JSONObject.fromObject(orderCouponParamMap);
|
||||||
|
addOrSaveEntity.setOrderCoupon(orderCouponJson.toString());
|
||||||
|
}
|
||||||
|
if(ordersDao.insert(ordersEntity) == 1) {
|
||||||
|
ordersEntity.setOrderStatus("0");
|
||||||
|
addOrSaveEntity.setPhoneNumber(ordersEntity.getPhoneNumber());
|
||||||
|
addOrSaveEntity.setStatus("0");
|
||||||
|
addOrSaveEntity.setOrderNumber(ordersEntity.getOrderNo());
|
||||||
|
addOrSaveEntity.setSalesAmount(ordersEntity.getOrderAmount());
|
||||||
|
addOrSaveEntity.setOrderDetailList(listJson.toString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(addOrSave(addOrSaveEntity));
|
JSONObject jsonObject = JSONObject.parseObject(addOrSave(addOrSaveEntity));
|
||||||
if(jsonObject.getString("code").equals("1"))
|
if(jsonObject.getString("code").equals("1"))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
@ -104,13 +108,14 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String addOrSave(AddOrSaveEntity addOrSaveEntity)throws Exception{
|
public String addOrSave(AddOrSaveEntity addOrSaveEntity){
|
||||||
addOrSaveEntity.setChannelId("15");
|
|
||||||
addOrSaveEntity.setSecret("H5@2021");
|
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(addOrSaveEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(addOrSaveEntity);
|
||||||
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap);
|
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap);
|
||||||
|
jsonObject.remove("orderDetailList");
|
||||||
|
String detailList = addOrSaveEntity.getOrderDetailList();
|
||||||
|
jsonObject.put("orderDetailList",detailList);
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
String result = SmartHttpUtil.httpPostRaw(url+"addOrSave",jsonObject.toString(),null,"utf-8");
|
String result = SmartHttpUtil.httpPostRaw(url+"addOrSave?channelId=15&secret=H5@2021",jsonObject.toString(),null,"utf-8");
|
||||||
long acceptTime = System.currentTimeMillis() ;
|
long acceptTime = System.currentTimeMillis() ;
|
||||||
long elapsedTime = acceptTime - startTime;
|
long elapsedTime = acceptTime - startTime;
|
||||||
//记录服务响应时间
|
//记录服务响应时间
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.lab1024.smartadmin.module.system.royalcanin.orderMaster;
|
package net.lab1024.smartadmin.module.system.royalcanin.orderMaster;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.sf.json.JSONArray;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ public class AddOrSaveEntity {
|
|||||||
|
|
||||||
private String deliveryType;
|
private String deliveryType;
|
||||||
|
|
||||||
private List<OrderDatilListEntity> orderDatilListEntity;
|
private String orderDetailList;
|
||||||
|
|
||||||
private OrderCouponEntity orderCouponEntity;
|
private String orderCoupon;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1594,8 +1594,8 @@ INSERT INTO `t_user_operate_log` (`id`, `user_id`, `user_name`, `module`, `conte
|
|||||||
DROP TABLE IF EXISTS `t_royalcanin_operate_log`;
|
DROP TABLE IF EXISTS `t_royalcanin_operate_log`;
|
||||||
CREATE TABLE IF NOT EXISTS `t_royalcanin_operate_log` (
|
CREATE TABLE IF NOT EXISTS `t_royalcanin_operate_log` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
`method` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`method` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`params` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`params` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`start_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`start_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`elapsed_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`elapsed_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
`accept_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`accept_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user