mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-01 17:56:39 +08:00
commit
9ddbeda2e5
@ -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:'未能使用该优惠券'};
|
||||
@ -356,10 +367,14 @@ export default {
|
||||
}
|
||||
//Into coupon discount calculation end
|
||||
}
|
||||
} else {
|
||||
if(skipQualifiedProductAmountCalculating && this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) {
|
||||
|
||||
} else {
|
||||
total += itemInCart.productPrice * itemInCart.buyCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return total;
|
||||
},
|
||||
arrSort(arr) {
|
||||
@ -408,6 +423,7 @@ export default {
|
||||
let paramsToAPI = {
|
||||
mobile : mobile,
|
||||
useStartDate : curDate.getFullYear()+'-'+(curDate.getMonth()+1)+'-'+curDate.getDate(),
|
||||
status:0
|
||||
};
|
||||
if(productCodes)
|
||||
paramsToAPI.productCodes = productCodes.join(',');
|
||||
@ -464,6 +480,7 @@ 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[tmpIndex]={};
|
||||
_self.drawlist.push(myCoupon);
|
||||
avaliableCouponNum++;
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.lab1024.smartadmin.common.anno.OperateLog;
|
||||
import net.lab1024.smartadmin.common.domain.ResponseDTO;
|
||||
import net.lab1024.smartadmin.common.heartbeat.IpUtil;
|
||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||
import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.coupon.*;
|
||||
@ -283,6 +284,8 @@ public class TransitionController {
|
||||
royalcaninOperateLogEntity.setMsg(jsonObject.getString("msg")== null ?"":jsonObject.getString("msg"));
|
||||
royalcaninOperateLogEntity.setParams(params);
|
||||
royalcaninOperateLogEntity.setAcceptTime(dateformat.format(acceptTime));
|
||||
royalcaninOperateLogEntity.setData(jsonObject.getString("data") == null?"" : jsonObject.getString("data"));
|
||||
royalcaninOperateLogEntity.setAccountIp(IpUtil.getLocalIP() == null ?"":IpUtil.getLocalIP());
|
||||
royalcaninOperateLogService.add(royalcaninOperateLogEntity);
|
||||
return ResponseDTO.succ();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class CouponGetAllEntity {
|
||||
* 0:未使用,1已使用,2已作废
|
||||
*/
|
||||
@ApiModelProperty(example = "1")
|
||||
private int status;
|
||||
private String status = "";
|
||||
|
||||
/**
|
||||
* 是否已经使用
|
||||
|
@ -31,4 +31,8 @@ public class RoyalcaninOperateLogEntity {
|
||||
private String code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private String accountIp;
|
||||
|
||||
private String data;
|
||||
}
|
||||
|
@ -2,11 +2,15 @@ package net.lab1024.smartadmin.module.system.royalcanin.good;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.lab1024.smartadmin.common.anno.OperateLog;
|
||||
import net.lab1024.smartadmin.common.constant.ResponseCodeConst;
|
||||
import net.lab1024.smartadmin.common.domain.ResponseDTO;
|
||||
import net.lab1024.smartadmin.common.heartbeat.IpUtil;
|
||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||
import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogEntity;
|
||||
@ -20,6 +24,7 @@ import net.lab1024.smartadmin.module.system.royalcanin.productSearchTag.service.
|
||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||
import net.lab1024.smartadmin.util.SmartJWTUtil;
|
||||
import net.lab1024.smartadmin.util.SmartStringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -124,7 +129,7 @@ public class GoodController {
|
||||
long acceptTime = System.currentTimeMillis() ;
|
||||
long elapsedTime = acceptTime - startTime;
|
||||
//记录服务响应时间
|
||||
addOperatreFullData("royalcanin/h5/product/query",result.length()+"", startTime,elapsedTime,acceptTime,result.length() >0 ?"1":"0",result.length() >0 ?"SUCCESS":"FAIL");
|
||||
addOperatreFullData("royalcanin/h5/product/query",result.length()+"", startTime,elapsedTime,acceptTime,result.length() >0 ?"1":"0",result.length() >0 ?"SUCCESS":"FAIL",result);
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
System.out.println(e.getMessage());
|
||||
@ -143,7 +148,7 @@ public class GoodController {
|
||||
long acceptTime = System.currentTimeMillis() ;
|
||||
long elapsedTime = acceptTime - startTime;
|
||||
//记录服务响应时间
|
||||
addOperatreFullData("royalcanin/h5/productMaster/query",result.length()+"", startTime,elapsedTime,acceptTime,result.length() >0 ?"1":"0",result.length() >0 ?"SUCCESS":"FAIL");
|
||||
addOperatreFullData("royalcanin/h5/productMaster/query",result.length()+"", startTime,elapsedTime,acceptTime,result.length() >0 ?"1":"0",result.length() >0 ?"SUCCESS":"FAIL",result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -158,7 +163,7 @@ public class GoodController {
|
||||
goodService.remoteGetProductSearchTagData();
|
||||
}
|
||||
|
||||
public ResponseDTO<String> addOperatreFullData(String type, String params, Long startTime, Long elapsedTime, Long acceptTime,String code,String msg)throws Exception{
|
||||
public ResponseDTO<String> addOperatreFullData(String type, String params, Long startTime, Long elapsedTime, Long acceptTime,String code,String msg,String result)throws Exception{
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
RoyalcaninOperateLogEntity royalcaninOperateLogEntity = new RoyalcaninOperateLogEntity();
|
||||
royalcaninOperateLogEntity.setElapsedTime(StringUtil.toString(elapsedTime));
|
||||
@ -168,6 +173,14 @@ public class GoodController {
|
||||
royalcaninOperateLogEntity.setMsg(msg);
|
||||
royalcaninOperateLogEntity.setParams(params);
|
||||
royalcaninOperateLogEntity.setAcceptTime(dateformat.format(acceptTime));
|
||||
String data = "";
|
||||
if(SmartStringUtil.isNotBlank(result)){
|
||||
JSONObject jsonObj = JSONObject.parseArray(result).getJSONObject(0);
|
||||
jsonObj.remove("productAttachmentList");
|
||||
data = jsonObj.toString();
|
||||
}
|
||||
royalcaninOperateLogEntity.setData(data);
|
||||
royalcaninOperateLogEntity.setAccountIp(IpUtil.getLocalIP() == null ?"":IpUtil.getLocalIP());
|
||||
royalcaninOperateLogService.add(royalcaninOperateLogEntity);
|
||||
return ResponseDTO.succ();
|
||||
}
|
||||
|
@ -66,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 ;
|
||||
@ -77,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
|
||||
@ -94,10 +96,30 @@ public class OrderController {
|
||||
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();
|
||||
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(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"));
|
||||
@ -115,23 +137,7 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
|
||||
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();
|
||||
}
|
||||
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() + ",");
|
||||
remark.append(ordersEntitys.getBuyCount() + ",");
|
||||
memberId = ordersEntitys.getMemberId();
|
||||
mobile = ordersEntitys.getPhoneNumber();
|
||||
buyCount = buyCount + ordersEntitys.getBuyCount();
|
||||
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
|
||||
@ -143,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());
|
||||
@ -173,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 ;
|
||||
@ -182,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
|
||||
@ -199,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"));
|
||||
@ -220,22 +247,7 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
|
||||
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();
|
||||
}
|
||||
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();
|
||||
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
|
||||
@ -276,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 ;
|
||||
@ -285,8 +296,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
|
||||
@ -302,10 +317,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"));
|
||||
@ -323,22 +356,7 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
|
||||
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();
|
||||
}
|
||||
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();
|
||||
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
ordersEntity.setProductCode(productId.substring(0,productId.length()-1));
|
||||
|
@ -3,6 +3,7 @@ package net.lab1024.smartadmin.module.system.royalcanin.good.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import net.lab1024.smartadmin.common.domain.ResponseDTO;
|
||||
import net.lab1024.smartadmin.common.heartbeat.IpUtil;
|
||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.CouponService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponCancelEntity;
|
||||
@ -293,12 +294,14 @@ public class OrderService {
|
||||
royalcaninOperateLogEntity.setMsg(jsonObject.getString("msg")== null ?"":jsonObject.getString("msg"));
|
||||
royalcaninOperateLogEntity.setParams(params);
|
||||
royalcaninOperateLogEntity.setAcceptTime(dateformat.format(acceptTime));
|
||||
royalcaninOperateLogEntity.setData(jsonObject.getString("data") == null?"" : jsonObject.getString("data"));
|
||||
royalcaninOperateLogEntity.setAccountIp(IpUtil.getLocalIP() == null ?"":IpUtil.getLocalIP());
|
||||
royalcaninOperateLogService.add(royalcaninOperateLogEntity);
|
||||
return ResponseDTO.succ();
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -306,22 +309,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;
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user