mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
!212 adding filter coupon logic
Merge pull request !212 from Admin/sit-Carl
This commit is contained in:
commit
835a389654
@ -473,32 +473,27 @@ export const goodsmessage = (productCode) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//优惠券的查询
|
//优惠券的查询
|
||||||
export const getdiscount = (memberId,channelSecurity,mobile) => {
|
export const getdiscount = (memberId,channelSecurity,mobile) => {
|
||||||
var data = {
|
var data = {
|
||||||
memberId:memberId,
|
memberId:memberId,
|
||||||
mobile:mobile
|
mobile:mobile
|
||||||
}
|
}
|
||||||
return fetch('memberAddress?type=getAll', data, 'POST' )
|
return fetch('memberAddress?type=getAll', data, 'POST' )
|
||||||
}
|
}
|
||||||
|
|
||||||
//可用的优惠券
|
//可用的优惠券
|
||||||
export const alldiscount = (memberId,channelSecurity,mobile) => {
|
export const alldiscount = (paramsObj) => {
|
||||||
var data = {
|
var data = paramsObj;
|
||||||
memberId:memberId,
|
return fetch('couponConfig?type=getAll', data, 'POST' )
|
||||||
}
|
}
|
||||||
return fetch('couponConfig?type=getAll', data, 'POST' )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//用户领取的优惠券
|
//用户领取的优惠券
|
||||||
export const getdraw = (mobile,states) => {
|
export const getdraw = (paramsObj) => {
|
||||||
var data = {
|
var data = paramsObj;
|
||||||
mobile:mobile,
|
return fetch('coupon?type=getAll', data, 'POST' )
|
||||||
status:states
|
}
|
||||||
}
|
|
||||||
return fetch('coupon?type=getAll', data, 'POST' )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//微信支付
|
//微信支付
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</swiper-slide>
|
</swiper-slide>
|
||||||
|
<!--
|
||||||
<swiper-slide>
|
<swiper-slide>
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<picture>
|
<picture>
|
||||||
@ -45,6 +45,7 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
</swiper-slide>
|
</swiper-slide>
|
||||||
|
-->
|
||||||
</swiper>
|
</swiper>
|
||||||
<div
|
<div
|
||||||
id="homeBannerSwiperPagnation"
|
id="homeBannerSwiperPagnation"
|
||||||
|
@ -141,8 +141,14 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["changemessage","checkIsLogin"]),
|
...mapMutations(["changemessage","checkIsLogin"]),
|
||||||
//获取用户领取的优惠券
|
//获取用户领取的优惠券
|
||||||
async userdraw(mobile,states) {
|
async userdraw(mobile) {
|
||||||
let data = await getdraw(mobile,states);
|
//let curDate = new Date();
|
||||||
|
let paramsToAPI = {
|
||||||
|
mobile : mobile,
|
||||||
|
//useStartDate : curDate.getYear()+'-'+curDate.getMonth()+'-'+curDate.getDate(),
|
||||||
|
//productCodes : ''
|
||||||
|
};
|
||||||
|
let data = await getdraw(paramsToAPI);
|
||||||
let _self = this;
|
let _self = this;
|
||||||
if(data){
|
if(data){
|
||||||
let list = [];
|
let list = [];
|
||||||
@ -211,10 +217,16 @@ export default {
|
|||||||
if(coupon.fValidTo) {
|
if(coupon.fValidTo) {
|
||||||
valDateToTime = new Date(coupon.fValidTo).getTime();
|
valDateToTime = new Date(coupon.fValidTo).getTime();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(valDateFromTime && valDateToTime && curTime >= valDateFromTime && curTime <= valDateToTime && coupon.status == 0) {
|
if(valDateFromTime && valDateToTime && curTime >= valDateFromTime && curTime <= valDateToTime && coupon.status == 0) {
|
||||||
coupon.canUse=true;
|
coupon.canUse=true;
|
||||||
this.newlist.push(coupon);
|
this.newlist.push(coupon);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if(valDateToTime && curTime <= valDateToTime && coupon.status == 0) {
|
||||||
|
coupon.canUse=true;
|
||||||
|
this.newlist.push(coupon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case USED:
|
case USED:
|
||||||
if(coupon.status == 1) {
|
if(coupon.status == 1) {
|
||||||
|
@ -388,27 +388,47 @@ export default {
|
|||||||
},
|
},
|
||||||
//获取用户领取的优惠券
|
//获取用户领取的优惠券
|
||||||
async userdraw(mobile) {
|
async userdraw(mobile) {
|
||||||
let data = await getdraw(mobile);
|
let curDate = new Date();
|
||||||
let _self = this;
|
let productCodes = [];
|
||||||
let curTime = new Date().getTime();
|
for(let itemInCart of this.goldmedal) {
|
||||||
let valDateFromTime=0;
|
productCodes.push(itemInCart.productCode);
|
||||||
let valDateToTime=0;
|
}
|
||||||
let dateChecked=true;
|
let paramsToAPI = {
|
||||||
let avaliableCouponNum = 0;
|
mobile : mobile,
|
||||||
|
useStartDate : curDate.getFullYear()+'-'+(curDate.getMonth()+1)+'-'+curDate.getDate(),
|
||||||
|
};
|
||||||
|
if(productCodes)
|
||||||
|
paramsToAPI.productCodes = productCodes.join(',');
|
||||||
|
let data = await getdraw(paramsToAPI);
|
||||||
|
let _self = this;
|
||||||
|
let curTime = new Date().getTime();
|
||||||
|
let valDateFromTime=0;
|
||||||
|
let valDateToTime=0;
|
||||||
|
let dateChecked=true;
|
||||||
|
let avaliableCouponNum = 0;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.drawlist=[];
|
this.drawlist=[];
|
||||||
|
avaliableCouponNum = data.length;
|
||||||
|
this.drawlist = data.data;
|
||||||
|
/*
|
||||||
for(let itemInCart of this.goldmedal) {
|
for(let itemInCart of this.goldmedal) {
|
||||||
let tmpIndex=0;
|
let tmpIndex=0;
|
||||||
for(let myCoupon of data.data) {
|
for(let myCoupon of data.data) {
|
||||||
valDateFromTime=0;
|
valDateFromTime=0;
|
||||||
valDateToTime=0;
|
valDateToTime=0;
|
||||||
dateChecked=true;
|
dateChecked=true;
|
||||||
|
|
||||||
if(myCoupon.fValidFrom) {
|
if(myCoupon.fValidFrom) {
|
||||||
|
//Fix ios date issue
|
||||||
|
myCoupon.fValidFrom = myCoupon.fValidFrom.replace(/-/g, '/');
|
||||||
valDateFromTime = new Date(myCoupon.fValidFrom).getTime();
|
valDateFromTime = new Date(myCoupon.fValidFrom).getTime();
|
||||||
}
|
}
|
||||||
if(myCoupon.fValidTo) {
|
if(myCoupon.fValidTo) {
|
||||||
|
//Fix ios date issue
|
||||||
|
myCoupon.fValidTo = myCoupon.fValidTo.replace(/-/g, '/');
|
||||||
valDateToTime = new Date(myCoupon.fValidTo).getTime();
|
valDateToTime = new Date(myCoupon.fValidTo).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(valDateFromTime && curTime < valDateFromTime) {
|
if(valDateFromTime && curTime < valDateFromTime) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
@ -433,6 +453,7 @@ export default {
|
|||||||
tmpIndex++;
|
tmpIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if(avaliableCouponNum > 0) {
|
if(avaliableCouponNum > 0) {
|
||||||
this.curCoupon.couponName = '有 '+avaliableCouponNum+' 张优惠券可以使用';
|
this.curCoupon.couponName = '有 '+avaliableCouponNum+' 张优惠券可以使用';
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ export default {
|
|||||||
this.curItem.curGoodUrl = this.curItem.goodUrl.pc;
|
this.curItem.curGoodUrl = this.curItem.goodUrl.pc;
|
||||||
}
|
}
|
||||||
this.usermessage = this.$store.state.userInfo;
|
this.usermessage = this.$store.state.userInfo;
|
||||||
if (this.usermessage !== "" || this.usermessage.data !== undefined) {
|
//if (this.usermessage !== "" || this.usermessage.data !== undefined) {
|
||||||
this.productCode = this.$route.query.productCode;
|
this.productCode = this.$route.query.productCode;
|
||||||
_hmt.push([
|
_hmt.push([
|
||||||
"_trackCustomEvent",
|
"_trackCustomEvent",
|
||||||
@ -483,7 +483,7 @@ export default {
|
|||||||
"product_name": this.curItem.productName,
|
"product_name": this.curItem.productName,
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
}
|
//}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["changemessage","checkIsLogin"]),
|
...mapMutations(["changemessage","checkIsLogin"]),
|
||||||
@ -562,8 +562,19 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//获取所有的优惠券
|
//获取所有的优惠券
|
||||||
async alldrawlist(memberId) {
|
async alldrawlist() {
|
||||||
let data = await alldiscount(memberId);
|
this.checkIsLogin();
|
||||||
|
this.usermessage = this.$store.state.userInfo;
|
||||||
|
let storeCode = '';
|
||||||
|
if(this.usermessage && this.usermessage.data && this.usermessage.data.storeCode) {
|
||||||
|
storeCode = this.usermessage.data.storeCode
|
||||||
|
}
|
||||||
|
let paramsToAPI={
|
||||||
|
productCode:this.curItem.productCode,
|
||||||
|
};
|
||||||
|
if(storeCode)
|
||||||
|
paramsToAPI.stroeCode = stroeCode;
|
||||||
|
let data = await alldiscount(paramsToAPI);
|
||||||
let userlist = [];
|
let userlist = [];
|
||||||
let menulsit = [];
|
let menulsit = [];
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -574,9 +585,6 @@ export default {
|
|||||||
this.userlist.forEach((element, index) => {
|
this.userlist.forEach((element, index) => {
|
||||||
if (typeof element.productCodes == "string" || !element.productCodes) {
|
if (typeof element.productCodes == "string" || !element.productCodes) {
|
||||||
userlist.push(element);
|
userlist.push(element);
|
||||||
// let s=element.productCodes.split(',');
|
|
||||||
// console.log(s.indexOf(this.productCode) != -1 )
|
|
||||||
// console.log('这是字符串')
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let menualist = [];
|
let menualist = [];
|
||||||
@ -585,21 +593,37 @@ export default {
|
|||||||
let valDateToTime=0;
|
let valDateToTime=0;
|
||||||
let curTime = new Date().getTime();
|
let curTime = new Date().getTime();
|
||||||
let dateChecked=true;
|
let dateChecked=true;
|
||||||
|
/*
|
||||||
|
if(item.publishFrom && curTime < item.publishFrom) {
|
||||||
|
dateChecked=false;
|
||||||
|
}
|
||||||
|
if(item.publishTo && curTime > item.publishTo) {
|
||||||
|
dateChecked=false;
|
||||||
|
}
|
||||||
|
|
||||||
if(item.fValidFrom) {
|
if(item.fValidFrom) {
|
||||||
|
//Fix ios date issue
|
||||||
|
item.fValidFrom = item.fValidFrom.replace(/-/g, '/');
|
||||||
valDateFromTime = new Date(item.fValidFrom).getTime();
|
valDateFromTime = new Date(item.fValidFrom).getTime();
|
||||||
}
|
}
|
||||||
if(item.fValidTo) {
|
if(item.fValidTo) {
|
||||||
|
//Fix ios date issue
|
||||||
|
item.fValidTo = item.fValidTo.replace(/-/g, '/');
|
||||||
valDateToTime = new Date(item.fValidTo).getTime();
|
valDateToTime = new Date(item.fValidTo).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(valDateFromTime && curTime < valDateFromTime) {
|
if(valDateFromTime && curTime < valDateFromTime) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
if(valDateToTime && curTime > valDateToTime) {
|
if(valDateToTime && curTime > valDateToTime) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item.packageTypeIds!='1') {
|
if(item.packageTypeIds!='1') {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(this.mainProduct && this.mainProduct.petType && item.petCategoryIds) {
|
if(this.mainProduct && this.mainProduct.petType && item.petCategoryIds) {
|
||||||
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
|
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
@ -611,7 +635,7 @@ export default {
|
|||||||
if(item.petAgeTypeIds!=productToCouponAgeId)
|
if(item.petAgeTypeIds!=productToCouponAgeId)
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(dateChecked && item.activityId!=10) {
|
if(dateChecked && item.activityId!=10) {
|
||||||
if(!item.productCodes) {
|
if(!item.productCodes) {
|
||||||
menualist.push(item);
|
menualist.push(item);
|
||||||
@ -626,6 +650,12 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
//Expired coupons
|
//Expired coupons
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if(dateChecked) {
|
||||||
|
menualist.push(item);
|
||||||
|
} else {
|
||||||
|
//Expired coupons
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.usernewlist = menualist;
|
this.usernewlist = menualist;
|
||||||
}
|
}
|
||||||
@ -741,7 +771,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//this.userdraw(this.usermessage.data.mobile);
|
//this.userdraw(this.usermessage.data.mobile);
|
||||||
this.alldrawlist(this.usermessage.data.id);
|
this.alldrawlist();
|
||||||
this.dialogInfo1 = true;
|
this.dialogInfo1 = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6,10 +6,15 @@ import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
|||||||
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigFindAllEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigFindAllEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
|
||||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||||
|
import net.lab1024.smartadmin.util.SmartDateUtil;
|
||||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -24,8 +29,15 @@ public class CouponConfigService {
|
|||||||
return SmartHttpUtil.sendPostForm(url+"get",paramMap,null);
|
return SmartHttpUtil.sendPostForm(url+"get",paramMap,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String couponConfigFindAll(CouponConfigFindAllEntity couponConfigFindAllEntity) throws Exception{
|
public String couponConfigFindAll(CouponConfigFindAllEntity couponConfigFindAllEntity){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date currentDate = SmartDateUtil.parseYMD(sdf.format(new Date()));
|
||||||
|
|
||||||
|
String storeCode = couponConfigFindAllEntity.getStoreCode();
|
||||||
|
String[] productCode = couponConfigFindAllEntity.getProductCode().split(",");
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponConfigFindAllEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponConfigFindAllEntity);
|
||||||
|
paramMap.remove("storeCode");
|
||||||
|
paramMap.remove("productCode");
|
||||||
paramMap.put("memberTagId",StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()));
|
paramMap.put("memberTagId",StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberTagId()));
|
||||||
paramMap.put("memberId",StringUtil.toString(couponConfigFindAllEntity.getMemberId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberId()));
|
paramMap.put("memberId",StringUtil.toString(couponConfigFindAllEntity.getMemberId()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getMemberId()));
|
||||||
paramMap.put("rows",StringUtil.toString(couponConfigFindAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getRows()));
|
paramMap.put("rows",StringUtil.toString(couponConfigFindAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponConfigFindAllEntity.getRows()));
|
||||||
@ -39,9 +51,20 @@ public class CouponConfigService {
|
|||||||
com.alibaba.fastjson.JSONArray afterFilterArrary = new JSONArray();
|
com.alibaba.fastjson.JSONArray afterFilterArrary = new JSONArray();
|
||||||
for(int i = 0;i < jsonArray.size();i ++){
|
for(int i = 0;i < jsonArray.size();i ++){
|
||||||
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
||||||
if(jsonResult.getString("udf2") != null) {
|
if(jsonResult.getString("udf2") != null&& !"0".equals(jsonResult.getString("leftAllotment"))) {
|
||||||
if (jsonResult.getString("udf2").equals("H5")) {
|
Date compareDate = SmartDateUtil.parseYMD(jsonResult.get("fPublishTo").toString());
|
||||||
afterFilterArrary.add(jsonResult);
|
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(storeCode)&&!"".equals(productCode)) {
|
||||||
|
for(int g = 0 ;g<productCode.length;g++) {
|
||||||
|
if (((jsonResult.get("productCodes")!=null?jsonResult.get("productCodes").toString().indexOf(productCode[g]):"".indexOf(productCode[g])) != -1||jsonResult.get("productCodes")==null)&&compareDate.compareTo(currentDate)>=0) {
|
||||||
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(storeCode)&&!"".equals(productCode)){
|
||||||
|
for(int g = 0 ;g<productCode.length;g++) {
|
||||||
|
if (((jsonResult.get("productCodes")!=null?jsonResult.get("productCodes").toString().indexOf(productCode[g]):"".indexOf(productCode[g])) != -1 ||jsonResult.get("productCodes")==null)&& couponConfigFindAllEntity.getStoreCode().equals(jsonResult.get("storeCodes")!=null ?jsonResult.get("storeCodes").toString():"")&&compareDate.compareTo(currentDate)>=0) {
|
||||||
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,4 +75,16 @@ public class CouponConfigService {
|
|||||||
return JSONResult.toJSONString();
|
return JSONResult.toJSONString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// String spStr = "8110000807,811000080123";
|
||||||
|
// String str = "8110000807,81100008012,81100008024,8111000807,81110008012,81110008024,8112001007,8112001012,8112001024,8113001007,8113001012,8113001024,80230008F07,80240008F07,80250008F07,8023450008F07,8023450008F12,8026780008F07,8026780008F12,8023450008F24,8026780008F24,81220020F03,80210020F03,81220020F06,80210020F06,81220020F12,81220020F24,80210020F12,80260008F07,80270008F07,80280008F07,80290008F07,80230008F12,80240008F12,80250008F12,80230008F24,80240008F24,80250008F24,80260008F12,80270008F12,80280008F12,80290008F12,80260008F24,80270008F24,80280008F24,80290008F24,81350008F07,80330008F07,80310008F07,81350008F12,80330008F12,80310008F12";
|
||||||
|
// String[] splitStr =spStr.split(",");
|
||||||
|
// for(int i = 0 ;i < splitStr.length;i++){
|
||||||
|
// System.out.println(str.indexOf(splitStr[i]));>SmartDateUtil.formatYMD(date)
|
||||||
|
// }
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date currentDate = SmartDateUtil.parseYMD(sdf.format(new Date()));
|
||||||
|
System.out.println(SmartDateUtil.parseYMD("2022-03-9").compareTo(currentDate)>=0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,9 @@ public class CouponService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String couponGetAll(CouponGetAllEntity couponGetAllEntity) throws Exception{
|
public String couponGetAll(CouponGetAllEntity couponGetAllEntity) throws Exception{
|
||||||
|
String productCode = couponGetAllEntity.getProductCodes();
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponGetAllEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(couponGetAllEntity);
|
||||||
|
paramMap.remove("productCode");
|
||||||
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
|
paramMap.put("status",StringUtil.toString(couponGetAllEntity.getStatus()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getStatus()));
|
||||||
paramMap.put("page",StringUtil.toString(couponGetAllEntity.getPage()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getPage()));
|
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("rows",StringUtil.toString(couponGetAllEntity.getRows()).equals("0")?null:StringUtil.toString(couponGetAllEntity.getRows()));
|
||||||
@ -52,8 +54,12 @@ public class CouponService {
|
|||||||
for(int i = 0;i < jsonArray.size();i ++){
|
for(int i = 0;i < jsonArray.size();i ++){
|
||||||
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
||||||
if(jsonResult.getString("udf2") != null) {
|
if(jsonResult.getString("udf2") != null) {
|
||||||
if (jsonResult.getString("udf2").equals("H5")) {
|
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(productCode)) {
|
||||||
afterFilterArrary.add(jsonResult);
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)){
|
||||||
|
if ((jsonResult.get("productCodes")!=null?jsonResult.get("productCodes").toString().indexOf(productCode):"".indexOf(productCode)) != -1 ||jsonResult.get("productCodes")==null){
|
||||||
|
afterFilterArrary.add(jsonResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,4 +108,8 @@ public class CouponGetAllEntity {
|
|||||||
|
|
||||||
@ApiModelProperty(example = "1")
|
@ApiModelProperty(example = "1")
|
||||||
private int page;
|
private int page;
|
||||||
|
|
||||||
|
|
||||||
|
private String productCodes = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,4 +46,8 @@ public class CouponConfigFindAllEntity {
|
|||||||
@ApiModelProperty(example = "1")
|
@ApiModelProperty(example = "1")
|
||||||
private int page;
|
private int page;
|
||||||
|
|
||||||
|
private String storeCode = "";
|
||||||
|
|
||||||
|
private String productCode = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,11 @@ public class OrderController {
|
|||||||
|
|
||||||
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
||||||
@PostMapping("royalcanin/generateOrderWX")
|
@PostMapping("royalcanin/generateOrderWX")
|
||||||
public ResponseDTO<Map<String, String>> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
|
public ResponseDTO<Map<String, String>> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList){
|
||||||
StringBuffer productId = new StringBuffer();
|
StringBuffer productId = new StringBuffer();
|
||||||
StringBuffer productName = new StringBuffer();
|
StringBuffer productName = new StringBuffer();
|
||||||
StringBuffer remark = new StringBuffer();
|
StringBuffer remark = new StringBuffer();
|
||||||
|
Map<String, String> resultMsg = new HashMap<>();
|
||||||
String memberId = "";
|
String memberId = "";
|
||||||
String mobile = "";
|
String mobile = "";
|
||||||
int buyCount = 0;
|
int buyCount = 0;
|
||||||
@ -73,7 +74,7 @@ public class OrderController {
|
|||||||
OrderAddress orderAddress = new OrderAddress();
|
OrderAddress orderAddress = new OrderAddress();
|
||||||
try {
|
try {
|
||||||
for (OrdersEntity ordersEntitys : ordersEntityList) {
|
for (OrdersEntity ordersEntitys : ordersEntityList) {
|
||||||
// System.out.println("ordersEntityList.size()"+ordersEntityList.size());
|
//删除购物车信息
|
||||||
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
|
cartService.cancelProduct(ordersEntitys.getMemberId(), ordersEntity.getProductCode());
|
||||||
//存储orderDetailList
|
//存储orderDetailList
|
||||||
OrderDatilListEntity orderDatilListEntity = new OrderDatilListEntity();
|
OrderDatilListEntity orderDatilListEntity = new OrderDatilListEntity();
|
||||||
@ -89,6 +90,9 @@ public class OrderController {
|
|||||||
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
||||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
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);
|
JSONObject jsonObjectData = (JSONObject) jsonArray.get(0);
|
||||||
if (jsonObjectData.getString("udf2") != null){
|
if (jsonObjectData.getString("udf2") != null){
|
||||||
if (!jsonObjectData.getString("udf2").equals("H5")){
|
if (!jsonObjectData.getString("udf2").equals("H5")){
|
||||||
@ -104,7 +108,6 @@ public class OrderController {
|
|||||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount();
|
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount();
|
||||||
}
|
}
|
||||||
basePoint = basePoint + ordersEntitys.getBasePoint();
|
basePoint = basePoint + ordersEntitys.getBasePoint();
|
||||||
// System.out.println("basePoint"+basePoint);
|
|
||||||
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
|
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
|
||||||
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
|
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
|
||||||
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
|
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
|
||||||
@ -129,9 +132,8 @@ public class OrderController {
|
|||||||
ordersEntity.setOrderStatus("0");
|
ordersEntity.setOrderStatus("0");
|
||||||
ordersEntity.setBasePoint(basePoint);
|
ordersEntity.setBasePoint(basePoint);
|
||||||
ordersEntity.setRemark(remark.substring(0,remark.length() - 1));
|
ordersEntity.setRemark(remark.substring(0,remark.length() - 1));
|
||||||
int result = orderService.generateOrder(ordersEntity, orderDatilListJson);
|
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
|
||||||
if (result == 1) {
|
if (resultMsg.get("code").equals("1")) {
|
||||||
System.out.println("orderService.generateOrder(ordersEntity, orderDatilListJson) == 1");
|
|
||||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||||
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());
|
||||||
@ -139,21 +141,26 @@ public class OrderController {
|
|||||||
returnMap.put("orderNumber", ordersEntity.getOrderNo());
|
returnMap.put("orderNumber", ordersEntity.getOrderNo());
|
||||||
returnMap.put("orderAmount", ordersEntity.getOrderAmount());
|
returnMap.put("orderAmount", ordersEntity.getOrderAmount());
|
||||||
return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity));
|
return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity));
|
||||||
}else if (result == 3){
|
}else if (resultMsg.get("code").equals("0")){
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED);
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("3")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("4")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL,resultMsg.get("msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "微信支付H5订单", notes = "生成H5订单")
|
@ApiOperation(value = "微信支付H5订单", notes = "生成H5订单")
|
||||||
@PostMapping("royalcanin/generateOrderWXH5")
|
@PostMapping("royalcanin/generateOrderWXH5")
|
||||||
public ResponseDTO<Map<String, String>> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
|
public ResponseDTO<Map<String, String>> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList){
|
||||||
StringBuffer productId = new StringBuffer();
|
StringBuffer productId = new StringBuffer();
|
||||||
StringBuffer productName = new StringBuffer();
|
StringBuffer productName = new StringBuffer();
|
||||||
|
Map<String, String> resultMsg = new HashMap<>();
|
||||||
String memberId = "";
|
String memberId = "";
|
||||||
String mobile = "";
|
String mobile = "";
|
||||||
int buyCount = 0;
|
int buyCount = 0;
|
||||||
@ -163,6 +170,7 @@ public class OrderController {
|
|||||||
JSONArray orderDatilListJson = new JSONArray();
|
JSONArray orderDatilListJson = new JSONArray();
|
||||||
OrdersEntity ordersEntity = new OrdersEntity();
|
OrdersEntity ordersEntity = new OrdersEntity();
|
||||||
OrderAddress orderAddress = new OrderAddress();
|
OrderAddress orderAddress = new OrderAddress();
|
||||||
|
try{
|
||||||
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
||||||
cartService.cancelProduct(ordersEntitys.getMemberId(),ordersEntity.getProductCode());
|
cartService.cancelProduct(ordersEntitys.getMemberId(),ordersEntity.getProductCode());
|
||||||
//存储orderDetailList
|
//存储orderDetailList
|
||||||
@ -179,7 +187,15 @@ public class OrderController {
|
|||||||
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
||||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
||||||
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
|
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.setCouponAmount(jsonObjectData.getString("couponAmount") == null ?jsonObjectData.getString("discount"):jsonObjectData.getString("couponAmount"));
|
||||||
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
||||||
@ -213,18 +229,26 @@ public class OrderController {
|
|||||||
ordersEntity.setOrderStatus("0");
|
ordersEntity.setOrderStatus("0");
|
||||||
ordersEntity.setBasePoint(basePoint);
|
ordersEntity.setBasePoint(basePoint);
|
||||||
ordersEntity.setPayType("3");
|
ordersEntity.setPayType("3");
|
||||||
|
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
|
||||||
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
if (resultMsg.get("code").equals("1")) {
|
||||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||||
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());
|
||||||
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
Map<String, String> returnMap = new HashMap<>();
|
returnMap.put("orderNumber", ordersEntity.getOrderNo());
|
||||||
returnMap.put("orderNumber",ordersEntity.getOrderNo());
|
returnMap.put("orderAmount", ordersEntity.getOrderAmount());
|
||||||
returnMap.put("orderAmount",ordersEntity.getOrderAmount());
|
return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrder(wxPayEntity));
|
||||||
return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrder(wxPayEntity));
|
}else if (resultMsg.get("code").equals("0")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("3")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("4")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL,resultMsg.get("msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "微信支付JSAPI订单", notes = "生成JSAPI订单")
|
@ApiOperation(value = "微信支付JSAPI订单", notes = "生成JSAPI订单")
|
||||||
@ -232,6 +256,7 @@ public class OrderController {
|
|||||||
public ResponseDTO<Map<String, String>> generateOrderWXJSAPI(@RequestBody List<OrdersEntity> ordersEntityList,String resp) throws Exception {
|
public ResponseDTO<Map<String, String>> generateOrderWXJSAPI(@RequestBody List<OrdersEntity> ordersEntityList,String resp) throws Exception {
|
||||||
StringBuffer productId = new StringBuffer();
|
StringBuffer productId = new StringBuffer();
|
||||||
StringBuffer productName = new StringBuffer();
|
StringBuffer productName = new StringBuffer();
|
||||||
|
Map<String, String> resultMsg = new HashMap<>();
|
||||||
String memberId = "";
|
String memberId = "";
|
||||||
String mobile = "";
|
String mobile = "";
|
||||||
int buyCount = 0;
|
int buyCount = 0;
|
||||||
@ -241,6 +266,7 @@ public class OrderController {
|
|||||||
JSONArray orderDatilListJson = new JSONArray();
|
JSONArray orderDatilListJson = new JSONArray();
|
||||||
OrdersEntity ordersEntity = new OrdersEntity();
|
OrdersEntity ordersEntity = new OrdersEntity();
|
||||||
OrderAddress orderAddress = new OrderAddress();
|
OrderAddress orderAddress = new OrderAddress();
|
||||||
|
try{
|
||||||
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
for (OrdersEntity ordersEntitys:ordersEntityList) {
|
||||||
cartService.cancelProduct(ordersEntitys.getMemberId(),ordersEntity.getProductCode());
|
cartService.cancelProduct(ordersEntitys.getMemberId(),ordersEntity.getProductCode());
|
||||||
//存储orderDetailList
|
//存储orderDetailList
|
||||||
@ -257,7 +283,15 @@ public class OrderController {
|
|||||||
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
||||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
||||||
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
|
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.setCouponAmount(jsonObjectData.getString("couponAmount") == null ?jsonObjectData.getString("discount"):jsonObjectData.getString("couponAmount"));
|
||||||
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
||||||
@ -291,18 +325,27 @@ public class OrderController {
|
|||||||
ordersEntity.setOrderStatus("0");
|
ordersEntity.setOrderStatus("0");
|
||||||
ordersEntity.setBasePoint(basePoint);
|
ordersEntity.setBasePoint(basePoint);
|
||||||
ordersEntity.setPayType("3");
|
ordersEntity.setPayType("3");
|
||||||
|
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
|
||||||
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
//判断订单生成状况
|
||||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
if (resultMsg.get("code").equals("1")) {
|
||||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||||
|
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||||
Map<String, String> returnMap = new HashMap<>();
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
returnMap.put("orderNumber",ordersEntity.getOrderNo());
|
returnMap.put("orderNumber", ordersEntity.getOrderNo());
|
||||||
returnMap.put("orderAmount",ordersEntity.getOrderAmount());
|
returnMap.put("orderAmount", ordersEntity.getOrderAmount());
|
||||||
return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrderJSAPI(wxPayEntity,resp));
|
return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity));
|
||||||
|
}else if (resultMsg.get("code").equals("0")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("3")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
|
||||||
|
}else if (resultMsg.get("code").equals("4")){
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL,resultMsg.get("msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,8 +52,9 @@ public class OrderService {
|
|||||||
private String url ;
|
private String url ;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public int generateOrder(OrdersEntity ordersEntity, JSONArray listJson) throws Exception {
|
public Map<String,String> generateOrder(OrdersEntity ordersEntity, JSONArray listJson) throws Exception {
|
||||||
AddOrSaveEntity addOrSaveEntity = new AddOrSaveEntity();
|
AddOrSaveEntity addOrSaveEntity = new AddOrSaveEntity();
|
||||||
|
Map<String, String>resultMap = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
if (ordersEntity.getCouponCode() != "" && null != ordersEntity.getCouponCode()) {
|
if (ordersEntity.getCouponCode() != "" && null != ordersEntity.getCouponCode()) {
|
||||||
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
|
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
|
||||||
@ -64,7 +65,9 @@ public class OrderService {
|
|||||||
couponCosumeEntity.setRealCouponAmount(realCouponAmount);
|
couponCosumeEntity.setRealCouponAmount(realCouponAmount);
|
||||||
JSONObject jsonObject = JSONObject.parseObject(couponService.couponCosume(couponCosumeEntity));
|
JSONObject jsonObject = JSONObject.parseObject(couponService.couponCosume(couponCosumeEntity));
|
||||||
if (!jsonObject.getString("code").equals("0")) {
|
if (!jsonObject.getString("code").equals("0")) {
|
||||||
return 3;
|
resultMap.put("code","4");
|
||||||
|
resultMap.put("msg",jsonObject.getString("msg"));
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
//coupon json化
|
//coupon json化
|
||||||
OrderCouponEntity orderCouponEntity = new OrderCouponEntity();
|
OrderCouponEntity orderCouponEntity = new OrderCouponEntity();
|
||||||
@ -99,34 +102,44 @@ public class OrderService {
|
|||||||
addOrSaveEntity.setAddressUserName(orderAddress.getAddressUserName());
|
addOrSaveEntity.setAddressUserName(orderAddress.getAddressUserName());
|
||||||
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;
|
resultMap.put("code",jsonObject.getString("code"));
|
||||||
else
|
resultMap.put("msg",jsonObject.getString("msg"));
|
||||||
return 0;
|
return resultMap;
|
||||||
|
}else{
|
||||||
|
resultMap.put("code",jsonObject.getString("code"));
|
||||||
|
resultMap.put("msg",jsonObject.getString("msg"));
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
resultMap.put("code","0");
|
||||||
|
resultMap.put("msg","订单生成有误,请联系管理员!");
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
System.out.println(e.getMessage()
|
System.out.println(e.getMessage());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return 0;
|
resultMap.put("code","0");
|
||||||
|
resultMap.put("msg","数据操作有误,请联系管理员!");
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkNotify(String orderNumber){
|
public int checkNotify(String orderNumber){
|
||||||
if(notifyService.findNotifyByOrderNumber(orderNumber) != null)
|
if(notifyService.findNotifyByOrderNumber(orderNumber) != null) {
|
||||||
return 1;
|
return 1;
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){
|
public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){
|
||||||
int result = ordersDao.updateOrderStatus(outTradeNo,totalFee);
|
int result = ordersDao.updateOrderStatus(outTradeNo,totalFee);
|
||||||
if(result == 1)
|
if(result == 1) {
|
||||||
return true;
|
return true;
|
||||||
else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -80,7 +80,7 @@ public class SmartJWTUtil {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String token = SmartJWTUtil.generateToken("884159");
|
String token = SmartJWTUtil.generateToken("884159");
|
||||||
System.out.println(token);
|
System.out.println(token);
|
||||||
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDE1OSIsImV4cCI6MTY0NjM4Mzk1NH0.-ilK-e-49c88IxdkSW1QMNZQ3P2LG7iIsQRXYlrXjjo"));
|
System.out.println(SmartJWTUtil.decodeToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijg4NDIzNCIsImV4cCI6MTY0ODI4MjAxNX0.itFA3bb0XNk2LSD3ey3_o33GYK3Rt0v9MXiRerhu-6A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1604,30 +1604,31 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_operate_log` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_good_orders`;
|
||||||
|
CREATE TABLE `t_good_orders` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`order_no` varchar(20) DEFAULT NULL COMMENT '订单号',
|
||||||
|
`order_status` varchar(20) DEFAULT NULL COMMENT '0:待付款,1:待收货,2:已完成,3:已取消,4:异常订单',
|
||||||
|
`order_amount` varchar(11) DEFAULT NULL COMMENT '订单金额',
|
||||||
|
`pay_amount` varchar(11) DEFAULT NULL COMMENT '实际支付金额',
|
||||||
|
`product_code` varchar(20) DEFAULT NULL COMMENT '产品表外键ID',
|
||||||
|
`coupon_code` varchar(20) DEFAULT NULL COMMENT '优惠券code',
|
||||||
|
`coupon_id` varchar(20) DEFAULT NULL COMMENT '优惠券ID',
|
||||||
|
`coupon_name` varchar(20) DEFAULT NULL COMMENT '优惠券名字',
|
||||||
|
`coupon_amount` varchar(20) DEFAULT NULL COMMENT '优惠券金额',
|
||||||
|
`product_name` varchar(50) DEFAULT NULL COMMENT '产品名字',
|
||||||
|
`member_id` varchar(20) DEFAULT NULL COMMENT '用户member',
|
||||||
|
`phone_number` varchar(20) DEFAULT NULL COMMENT '用户手机',
|
||||||
|
`buy_count` int(11) DEFAULT NULL COMMENT '产品购买的个数',
|
||||||
|
`base_point` int(11) DEFAULT NULL COMMENT '产品积分',
|
||||||
|
`pay_type` int(11) DEFAULT NULL COMMENT '支付方式 1:支付宝 2:微信',
|
||||||
|
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '订单创建时间',
|
||||||
|
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
|
||||||
|
`remark` varchar(20) DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
|
||||||
|
|
||||||
CREATE TABLE `t_good_orders` (
|
DROP TABLE IF EXISTS `t_good_goods`;
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`order_no` varchar(20) DEFAULT NULL COMMENT '订单号',
|
|
||||||
`order_status` varchar(20) DEFAULT NULL COMMENT '0:待付款,1:待收货,2:已完成,3:已取消,4:异常订单',
|
|
||||||
`order_amount` varchar(11) DEFAULT NULL COMMENT '订单金额',
|
|
||||||
`pay_amount` varchar(11) DEFAULT NULL COMMENT '实际支付金额',
|
|
||||||
`product_code` varchar(20) DEFAULT NULL COMMENT '产品表外键ID',
|
|
||||||
`coupon_code` varchar(20) DEFAULT NULL COMMENT '优惠券code',
|
|
||||||
`coupon_id` varchar(20) DEFAULT NULL COMMENT '优惠券ID',
|
|
||||||
`coupon_name` varchar(20) DEFAULT NULL COMMENT '优惠券名字',
|
|
||||||
`coupon_amount` varchar(20) DEFAULT NULL COMMENT '优惠券金额',
|
|
||||||
`product_name` varchar(50) DEFAULT NULL COMMENT '产品名字',
|
|
||||||
`member_id` varchar(20) DEFAULT NULL COMMENT '用户member',
|
|
||||||
`phone_number` varchar(20) DEFAULT NULL COMMENT '用户手机',
|
|
||||||
`buy_count` int(11) DEFAULT NULL COMMENT '产品购买的个数',
|
|
||||||
`base_point` int(11) DEFAULT NULL COMMENT '产品积分',
|
|
||||||
`pay_type` int(11) DEFAULT NULL COMMENT '支付方式 1:支付宝 2:微信',
|
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '订单创建时间',
|
|
||||||
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
|
|
||||||
`remark` varchar(20) DEFAULT NULL COMMENT '备注',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
|
|
||||||
|
|
||||||
CREATE TABLE `t_good_goods` (
|
CREATE TABLE `t_good_goods` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`product_code` VARCHAR(20) NOT NULL COMMENT '标品编码',
|
`product_code` VARCHAR(20) NOT NULL COMMENT '标品编码',
|
||||||
@ -1688,7 +1689,7 @@ CREATE TABLE IF NOT EXISTS `t_royalcanin_notify_operate_log` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_royalcanin_productsearchtag`;
|
||||||
CREATE TABLE `t_royalcanin_productsearchtag` (
|
CREATE TABLE `t_royalcanin_productsearchtag` (
|
||||||
`id` int(50) NOT NULL,
|
`id` int(50) NOT NULL,
|
||||||
`brand_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
`brand_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user