Merge branch 'sit-Carl' into LTL_20220314

# Conflicts:
#	smart-admin-service/smart-admin-api/src/main/java/net/lab1024/smartadmin/module/system/royalcanin/good/OrderController.java
This commit is contained in:
602090531@qq.com 2022-03-17 15:35:27 +08:00
commit 8f5ab606ce
7 changed files with 155 additions and 145 deletions

View File

@ -306,9 +306,17 @@ export default {
let total = 0;
let couponUsed = false;
let tmpShoppingCartList = this.arrSort(this.goldmedal);
let qualifiedProductAmount = 0;
let skipQualifiedProductAmountCalculating = false;
for(let itemInCart of tmpShoppingCartList) {
if((!this.curCoupon.productCodes || this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) && !couponUsed) {
if(this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
qualifiedProductAmount += (itemInCart.productPrice * itemInCart.buyCount);
}
}
for(let itemInCart of tmpShoppingCartList) {
if(this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1 && !couponUsed) {
if(this.curCoupon.minQuantity && this.curCoupon.minQuantity>itemInCart.buyCount) {
//Check minQuantity
total+=(itemInCart.buyCount * itemInCart.productPrice);
@ -319,6 +327,7 @@ export default {
//Into coupon discount calculation
switch(this.curCoupon.couponTypeId) {
case 1: //Amount deduct
/*
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount <= (itemInCart.productPrice * itemInCart.buyCount)) {
total = total + (itemInCart.productPrice * itemInCart.buyCount - this.curCoupon.couponAmount);
this.discountAmount = this.curCoupon.couponAmount;
@ -330,14 +339,16 @@ export default {
this.curCoupon = {couponName:'未能使用该优惠券'};
}
break;
*/
case 2: //Amount deduct with minPrice restriction
case 6:
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount <= (itemInCart.productPrice * itemInCart.buyCount)) {
total = total + (itemInCart.productPrice * itemInCart.buyCount) - this.curCoupon.couponAmount;
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount <= qualifiedProductAmount && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
total = total + qualifiedProductAmount - this.curCoupon.couponAmount;
this.discountAmount = this.curCoupon.couponAmount;
this.discountedProductCode = itemInCart.productCode;
skipQualifiedProductAmountCalculating = true;
couponUsed=true;
} else if(this.curCoupon.couponAmount && this.curCoupon.couponAmount > (itemInCart.productPrice * itemInCart.buyCount)) {
} else if(this.curCoupon.couponAmount && this.curCoupon.couponAmount > qualifiedProductAmount) {
total = total + itemInCart.productPrice * itemInCart.buyCount;
this.discountAmount = 0;
this.curCoupon = {couponName:'未能使用该优惠券'};
@ -357,7 +368,11 @@ export default {
//Into coupon discount calculation end
}
} else {
total += itemInCart.productPrice * itemInCart.buyCount;
if(skipQualifiedProductAmountCalculating && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
} else {
total += itemInCart.productPrice * itemInCart.buyCount;
}
}
}
return total;
@ -464,7 +479,8 @@ export default {
if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) {
//if(dateChecked) {
data.data.splice(tmpIndex,1);
//data.data.splice(tmpIndex,1);
data.data[tmpIndex]={};
_self.drawlist.push(myCoupon);
avaliableCouponNum++;
}

View File

@ -45,7 +45,7 @@ public class CouponService {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponGetAllEntity);
Date currentDate = SmartDateUtil.parseYMD(paramMap.get("useStartDate") == null ? "1990-01-01":paramMap.get("useStartDate"));
paramMap.remove("productCodes");
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
paramMap.put("page",StringUtil.toString(couponGetAllEntity.getPage()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getPage()));
paramMap.put("rows",StringUtil.toString(couponGetAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getRows()));
paramMap.put("usestartDate",paramMap.get("useStartDate"));

View File

@ -47,7 +47,7 @@ public class CouponGetAllEntity {
* 0:未使用,1已使用,2已作废
*/
@ApiModelProperty(example = "1")
private int status;
private String status = "";
/**
* 是否已经使用

View File

@ -13,7 +13,6 @@ import net.lab1024.smartadmin.module.system.alipay.AliPayService;
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
import net.lab1024.smartadmin.module.system.royalcanin.CouponService;
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponCosumeEntity;
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponGetAllEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
@ -67,9 +66,7 @@ public class OrderController {
public ResponseDTO<Map<String, String>> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList){
StringBuffer productId = new StringBuffer();
StringBuffer productName = new StringBuffer();
StringBuffer remark = new StringBuffer();
Map<String, String> resultMsg = new HashMap<>();
String memberId = "";
String mobile = "";
int buyCount = 0;
double total_fee = 0 ;
@ -78,8 +75,12 @@ public class OrderController {
JSONArray orderDatilListJson = new JSONArray();
OrdersEntity ordersEntity = new OrdersEntity();
OrderAddress orderAddress = new OrderAddress();
String memberId = "";
String couponCode = "";
try {
for (OrdersEntity ordersEntitys : ordersEntityList) {
//删除购物车信息
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
//存储orderDetailList
@ -95,38 +96,9 @@ public class OrderController {
orderDatilListEntity.setProductCode(goodsObject.getString("productCode"));
orderDatilListEntity.setEcPrice(goodsObject.getString("ecPrice"));
orderDatilListJson.add(orderDatilListEntity);
if (ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity();
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
if(jsonArray.size() == 0){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
JSONObject jsonObjectData = (JSONObject) jsonArray.get(0);
if (jsonObjectData.getString("udf2") != null){
if (!jsonObjectData.getString("udf2").equals("H5")){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
}
ordersEntity.setCouponAmount(jsonObjectData.getString("couponAmount") == null ? jsonObjectData.getString("discount") : jsonObjectData.getString("couponAmount"));
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = total_fee + orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), Double.parseDouble(goodsObject.getString("ecPrice")), ordersEntitys.getBuyCount());
} else {
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
}
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
@ -134,16 +106,42 @@ public class OrderController {
orderAddress.setAddressPhoneNumber(ordersEntitys.getOrderAddress().getAddressPhoneNumber());
orderAddress.setAddressUserName(ordersEntitys.getOrderAddress().getAddressUserName());
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode() + ",");
productName.append(ordersEntitys.getProductName() + ",");
remark.append(ordersEntitys.getBuyCount() + ",");
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
if (ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
couponCode = ordersEntitys.getCouponCode();
}
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
}
//验证优惠卷
if (couponCode != "" && couponCode != null) {
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity();
couponGetAllEntity.setMemberId(memberId);
couponGetAllEntity.setCouponCode(couponCode);
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
if(jsonArray.size() == 0){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
JSONObject jsonObjectData = (JSONObject) jsonArray.get(0);
if (jsonObjectData.getString("udf2") != null){
if (!jsonObjectData.getString("udf2").equals("H5")){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
}
ordersEntity.setCouponAmount(jsonObjectData.getString("couponAmount") == null ? jsonObjectData.getString("discount") : jsonObjectData.getString("couponAmount"));
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
}
ordersEntity.setOrderAddress(orderAddress);
ordersEntity.setProductCode(productId.substring(0, productId.length() - 1));
ordersEntity.setProductName(productName.substring(0, productName.length() - 1));
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
ordersEntity.setProductName(productName.substring(0,productName.length()-1));
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
ordersEntity.setMemberId(memberId);
ordersEntity.setPhoneNumber(mobile);
@ -151,7 +149,7 @@ public class OrderController {
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint);
ordersEntity.setRemark(remark.substring(0,remark.length() - 1));
ordersEntity.setPayType("3");
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
if (resultMsg.get("code").equals("1")) {
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
@ -181,7 +179,6 @@ public class OrderController {
StringBuffer productId = new StringBuffer();
StringBuffer productName = new StringBuffer();
Map<String, String> resultMsg = new HashMap<>();
String memberId = "";
String mobile = "";
int buyCount = 0;
double total_fee = 0 ;
@ -190,8 +187,12 @@ public class OrderController {
JSONArray orderDatilListJson = new JSONArray();
OrdersEntity ordersEntity = new OrdersEntity();
OrderAddress orderAddress = new OrderAddress();
String memberId = "";
String couponCode = "";
try {
for (OrdersEntity ordersEntitys : ordersEntityList) {
//删除购物车信息
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
//存储orderDetailList
@ -207,10 +208,28 @@ public class OrderController {
orderDatilListEntity.setProductCode(goodsObject.getString("productCode"));
orderDatilListEntity.setEcPrice(goodsObject.getString("ecPrice"));
orderDatilListJson.add(orderDatilListEntity);
if (ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
orderAddress.setAddressPhoneNumber(ordersEntitys.getOrderAddress().getAddressPhoneNumber());
orderAddress.setAddressUserName(ordersEntitys.getOrderAddress().getAddressUserName());
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
couponCode = ordersEntitys.getCouponCode();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
}
//验证优惠卷
if (couponCode != "" && couponCode != null) {
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity();
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
couponGetAllEntity.setMemberId(memberId);
couponGetAllEntity.setCouponCode(couponCode);
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
@ -228,31 +247,8 @@ public class OrderController {
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
//通过传优惠券码锁定优惠券
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = total_fee + orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), Double.parseDouble(goodsObject.getString("ecPrice")), ordersEntitys.getBuyCount());
} else {
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
}
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
orderAddress.setAddressPhoneNumber(ordersEntitys.getOrderAddress().getAddressPhoneNumber());
orderAddress.setAddressUserName(ordersEntitys.getOrderAddress().getAddressUserName());
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
}
ordersEntity.setOrderAddress(orderAddress);
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
ordersEntity.setProductName(productName.substring(0,productName.length()-1));
@ -292,7 +288,6 @@ public class OrderController {
StringBuffer productId = new StringBuffer();
StringBuffer productName = new StringBuffer();
Map<String, String> resultMsg = new HashMap<>();
String memberId = "";
String mobile = "";
int buyCount = 0;
double total_fee = 0 ;
@ -301,27 +296,49 @@ public class OrderController {
JSONArray orderDatilListJson = new JSONArray();
OrdersEntity ordersEntity = new OrdersEntity();
OrderAddress orderAddress = new OrderAddress();
try {
for (OrdersEntity ordersEntitys : ordersEntityList) {
//删除购物车信息
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
//存储orderDetailList
ProductMasterQueryEntity productMasterQueryEntity = new ProductMasterQueryEntity();
productMasterQueryEntity.setProductCode(ordersEntitys.getProductCode());
String goodsStr = goodService.productQuery(productMasterQueryEntity);
com.alibaba.fastjson.JSONArray jsonGoodsArray = JSONObject.parseArray(goodsStr);
JSONObject goodsObject = (JSONObject)jsonGoodsArray.get(0);
OrderDatilListEntity orderDatilListEntity = new OrderDatilListEntity();
orderDatilListEntity.setProductName(goodsObject.getString("productName"));
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
orderDatilListEntity.setProductCode(goodsObject.getString("productCode"));
orderDatilListEntity.setEcPrice(goodsObject.getString("ecPrice"));
orderDatilListJson.add(orderDatilListEntity);
if (ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
String memberId = "";
String couponCode = "";
try {
for (OrdersEntity ordersEntitys : ordersEntityList) {
//删除购物车信息
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
//存储orderDetailList
ProductMasterQueryEntity productMasterQueryEntity = new ProductMasterQueryEntity();
productMasterQueryEntity.setProductCode(ordersEntitys.getProductCode());
String goodsStr = goodService.productQuery(productMasterQueryEntity);
com.alibaba.fastjson.JSONArray jsonGoodsArray = JSONObject.parseArray(goodsStr);
JSONObject goodsObject = (JSONObject)jsonGoodsArray.get(0);
OrderDatilListEntity orderDatilListEntity = new OrderDatilListEntity();
orderDatilListEntity.setProductName(goodsObject.getString("productName"));
orderDatilListEntity.setPcs(ordersEntitys.getBuyCount());
orderDatilListEntity.setProductCode(goodsObject.getString("productCode"));
orderDatilListEntity.setEcPrice(goodsObject.getString("ecPrice"));
orderDatilListJson.add(orderDatilListEntity);
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
orderAddress.setAddressPhoneNumber(ordersEntitys.getOrderAddress().getAddressPhoneNumber());
orderAddress.setAddressUserName(ordersEntitys.getOrderAddress().getAddressUserName());
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
couponCode = ordersEntitys.getCouponCode();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
}
//验证优惠卷
if (couponCode != "" && couponCode != null) {
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity();
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
couponGetAllEntity.setMemberId(memberId);
couponGetAllEntity.setCouponCode(couponCode);
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
@ -339,41 +356,19 @@ public class OrderController {
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = total_fee + orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), Double.parseDouble(goodsObject.getString("ecPrice")), ordersEntitys.getBuyCount());
} else {
total_fee = total_fee + Double.parseDouble(goodsObject.getString("ecPrice")) * ordersEntitys.getBuyCount();
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
}
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
orderAddress.setAddressPhoneNumber(ordersEntitys.getOrderAddress().getAddressPhoneNumber());
orderAddress.setAddressUserName(ordersEntitys.getOrderAddress().getAddressUserName());
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
}
ordersEntity.setOrderAddress(orderAddress);
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
ordersEntity.setProductName(productName.substring(0,productName.length()-1));
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
ordersEntity.setMemberId(memberId);
ordersEntity.setPhoneNumber(mobile);
ordersEntity.setBuyCount(buyCount);
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint);
ordersEntity.setPayType("3");
ordersEntity.setOrderAddress(orderAddress);
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
ordersEntity.setProductName(productName.substring(0,productName.length()-1));
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
ordersEntity.setMemberId(memberId);
ordersEntity.setPhoneNumber(mobile);
ordersEntity.setBuyCount(buyCount);
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint);
ordersEntity.setPayType("3");
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
//判断订单生成状况
if (resultMsg.get("code").equals("1")) {

View File

@ -307,7 +307,7 @@ public class OrderService {
}
public double couponTotal(String couponTypeId,double discount,double total,int buyCount){
public double couponTotal(String couponTypeId,double discount,double total){
double endTotal = 0;
switch (couponTypeId)
{
@ -315,22 +315,19 @@ public class OrderService {
// endTotal = (total * (buyCount-1)) + (total * discount);
// break;
case "2":
endTotal = total * buyCount - discount;
endTotal = total - discount;
break;
case "3":
endTotal = (total * buyCount) * (1-discount);
endTotal = total * (1-discount);
break;
case "1" :
endTotal = total * buyCount - discount;
endTotal = total - discount;
break;
case "4" :
endTotal = (total * buyCount) * (1-discount);
endTotal = total * (1-discount);
break;
case "6" :
endTotal = total * buyCount - discount;
break;
case "0":
endTotal = total * buyCount;
endTotal = total - discount;
break;
}
return endTotal;

View File

@ -15,6 +15,7 @@ import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPay;
import net.lab1024.smartadmin.module.system.wxpay.sdk.WXPayUtil;
import net.lab1024.smartadmin.module.system.wxpay.wxPayModel.WxPayEntity;
import net.lab1024.smartadmin.util.AESUtil;
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartHttpUtil;
import net.lab1024.smartadmin.util.SmartIPUtil;
@ -111,7 +112,8 @@ public class WxpayService {
paramMap.put("channelId","15");
String sb = SmartHttpUtil.sendPostForm(url+"productMaster/query",paramMap,null);
JSONObject jsonObject = JSONObject.parseObject(sb);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
String result = AESUtil.decryptLinux(jsonObject.getString("data"), AESUtil.KEY);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(result);
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
basePoint = basePoint + Double.parseDouble(jsonObjectData.getString("basePoint"));
}

View File

@ -80,7 +80,7 @@ public class SmartJWTUtil {
public static void main(String[] args) {
String token = SmartJWTUtil.generateToken("884159");
System.out.println(token);
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDIzNCIsImV4cCI6MTY0ODI4MjAxNX0.itFA3bb0XNk2LSD3ey3_o33GYK3Rt0v9MXiRerhu-6A"));
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDEyNyIsImV4cCI6MTY0NTA5MTc5Nn0.UHEYiTkHtwQjTNjiAKg8CTP-Ab_KSfFzBiIip49gLUk"));
}
}