Merge branch 'sit-Carl' into sit-Leung

# Conflicts:
#	rc-busness/pages/personal/userpay.vue
This commit is contained in:
Vion 2022-01-27 09:52:47 +08:00
commit 31fe06b2c2
20 changed files with 426 additions and 131 deletions

View File

@ -88,6 +88,9 @@
font-style: normal; font-style: normal;
font-size: 14px; font-size: 14px;
color: #e1001a; color: #e1001a;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
} }
.rc-userfont { .rc-userfont {
overflow: hidden; overflow: hidden;
@ -254,6 +257,9 @@ margin-top: 30px;
font-style: normal; font-style: normal;
font-size: 16px; font-size: 16px;
color: #e1001a; color: #e1001a;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
} }
.rc-userfont { .rc-userfont {
overflow: hidden; overflow: hidden;

View File

@ -62,15 +62,15 @@ input[type=checkbox]{
border:none; border:none;
//border: 1px solid #d7d7d7; //border: 1px solid #d7d7d7;
border-radius: 3px; border-radius: 3px;
width: 1.5rem; width: 1rem;
height: 1.5rem; height: 1rem;
-webkit-appearance:none; -webkit-appearance:none;
&:before { &:before {
top: 0; top: 0;
left: 0; left: 0;
content: ""; content: "";
width: 1.5rem; width: 1rem;
height: 1.5rem; height: 1rem;
position: absolute; position: absolute;
display: inline-block; display: inline-block;
background-color: #fff; background-color: #fff;
@ -83,7 +83,7 @@ input[type=checkbox]{
} }
label { label {
input[type=checkbox] { input[type=checkbox] {
top:.375rem; // top:.375rem;
} }
} }

View File

@ -14,6 +14,7 @@
} }
.usecheck label{ .usecheck label{
display:flex; display:flex;
align-items: center;
input{ input{
margin-right:.687rem; margin-right:.687rem;
} }
@ -48,10 +49,10 @@
.usecheck{ .usecheck{
display: flex; display: flex;
text-align: left; text-align: left;
width: 335px;
margin: 0 auto; margin: 0 auto;
align-items: center; align-items: center;
margin-top: 18px; margin-top: 18px;
border-bottom: 1px solid #d7d7d7;
} }
.container { .container {
@ -106,6 +107,20 @@
border: none; border: none;
outline: none; outline: none;
} }
.rc-one-column {
font-size: 12px;
strong{
font-size: 12px;
margin-left: 6px;
font-weight: bold;
}
i{
font-style: normal;
color: #E1001A;
font-weight: bold;
}
}
.rc-center { .rc-center {
font-size: 30px; font-size: 30px;
color: #333333; color: #333333;
@ -142,14 +157,50 @@
} }
// /* 最小768px最大1920 *pc端/ // /* 最小768px最大1920 *pc端/
@media screen and (min-width: 769px) { @media screen and (min-width: 769px) {
.rc-one-column{
display: flex;
align-items: center;
flex-direction: column;
.rc-one-column {
font-size: 12px;
.rc-text--left{
strong{
font-size: 12px;
margin-left: 6px;
font-weight: bold;
}
}
i{
font-style: normal;
color: #E1001A;
font-weight: bold;
}
}
}
.usecheck{ .usecheck{
display: flex; display: flex;
text-align: left; text-align: left;
width: 395px;
margin: 0 auto; margin: 0 auto;
align-items: center; align-items: center;
margin-top: 18px; margin-top: 18px;
border-bottom: 1px solid #d7d7d7
}
.usecheck label{
display: flex;
align-items: center;
i{
font-style: normal;
color: #E1001A;
font-weight: bold;
}
}
.rc-one-column strong{
font-size: 12px;
margin-left: 6px;
font-weight: bold;
} }
/deep/ /deep/
.van-field-one{ .van-field-one{

View File

@ -22019,9 +22019,6 @@ li:last-child .edge .rc-tab--view-control:focus,li:last-child
} }
@media (max-width: 1024px) { @media (max-width: 1024px) {
.rc-xl-up,.xl-up {
display: none !important;
}
.rc-flex-direction--reverse--xl-down { .rc-flex-direction--reverse--xl-down {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;

View File

@ -56,6 +56,8 @@
</span> </span>
</button> </button>
--> -->
<button data-js-trigger="search-bar" @click='searchturn' evt-name='页内弹窗' evt-cat='headerBtnClick' evt-val='全文搜索' class="rc-btn rc-btn--icon rc-icon rc-search--xs rc-iconography rc-interactive" aria-label="Search" role="menuitem" data-click-modifier=".rc-hidden"> <button data-js-trigger="search-bar" @click='searchturn' evt-name='页内弹窗' evt-cat='headerBtnClick' evt-val='全文搜索' class="rc-btn rc-btn--icon rc-icon rc-search--xs rc-iconography rc-interactive" aria-label="Search" role="menuitem" data-click-modifier=".rc-hidden">
<span class="rc-screen-reader-text">translations.feature.headerbar.search</span> <span class="rc-screen-reader-text">translations.feature.headerbar.search</span>
</button> </button>

View File

@ -2,4 +2,13 @@
module.exports={ module.exports={
//图片路径地址 //图片路径地址
rbs:'http://47.96.75.242:10086/royalcanin/', rbs:'http://47.96.75.242:10086/royalcanin/',
//成猫肝脏全价处方量
hotcat:'https://detail.tmall.com/item.htm?spm=a1z10.3-b-s.w4011-22642828081.211.262fb910fpPRF5&id=614604022166&rn=5eba1d0b816544b39888beddbf21d03a&abbucket=19&skuId=4624275223532',
//成猫优纤易消化全价处方粮
hotcat1:"https://detail.tmall.com/item.htm?spm=a1z10.3-b-s.w4011-22642828081.75.6070b910aVqaCe&id=614817599199&rn=7413968dc827a6cae94ffaf684c78384&abbucket=19&skuId=4798969553513",
//成猫肠道全价处方粮(适中能量)
hotcat2:'https://detail.tmall.com/item.htm?spm=a1z10.3-b-s.w4011-22642828081.150.6070b910aVqaCe&id=620738193181&rn=7413968dc827a6cae94ffaf684c78384&abbucket=19&skuId=4938650051548',
//成猫肠道全价处方粮
hotcat3:'https://detail.tmall.com/item.htm?spm=a1z10.3-b-s.w4011-22642828081.51.6070b910aVqaCe&id=618722103730&rn=7413968dc827a6cae94ffaf684c78384&abbucket=19&skuId=4910398135159',
} }

View File

@ -75,7 +75,7 @@
<!-- <h2>明星猫粮</h2> --> <!-- <h2>明星猫粮</h2> -->
<div class="pageFullScreen" id="xxxFullScreen" v-show="catproduct" ref="mingxing"> <div class="pageFullScreen" id="xxxFullScreen" v-show="catproduct" ref="mingxing">
<!-- 内容 --> <!-- 内容 -->
<div class="rc-full-width rc-padding-y--md" id="swiper1"> <div class="rc-full-width rc-padding-y--md" id="swiper1" :style="usermargin" >
<h2 class="rc-beta rc-text--center">{{usertitle}}</h2> <h2 class="rc-beta rc-text--center">{{usertitle}}</h2>
<!-- 轮播图 --> <!-- 轮播图 -->
<div class="ts-carousel-container"> <div class="ts-carousel-container">
@ -752,6 +752,7 @@
return{ return{
fixedHeader:false, fixedHeader:false,
dataLoaded:true, dataLoaded:true,
usermargin:{marginTop: '0'},
useraindex:0, useraindex:0,
mobileVideoPlaying:false, mobileVideoPlaying:false,
usertitle:'明星猫粮', usertitle:'明星猫粮',
@ -760,6 +761,7 @@
catshi:[], catshi:[],
userindex:0, userindex:0,
userstype:'', userstype:'',
usertop:true,
onemao:false, onemao:false,
twomao:false, twomao:false,
threemao:false, threemao:false,
@ -1204,10 +1206,13 @@
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
//console.log("") console.log("当前是电脑打开")
this.stypechange=false; this.stypechange=false;
//console.log(this.usertitle) //console.log(this.usertitle)
this.usermargin={
marginTop:'0',
}
this.usertop=false,
this.catproduct=true; this.catproduct=true;
this.onemao=false; this.onemao=false;
this.twomao=false; this.twomao=false;
@ -1220,12 +1225,13 @@
} }
else else
{ {
//console.log("") console.log("当前是手机打开")
this.showingBanners=this.banners.mobile; this.showingBanners=this.banners.mobile;
this.stypechange=true; this.stypechange=true;
this.onemao=true; this.onemao=true;
this.twomao=true; this.twomao=true;
this.threemao=true; this.threemao=true;
this.usertop=true,
this.fourmao=true; this.fourmao=true;
this.fivemao=true; this.fivemao=true;
this.dogshow=true; this.dogshow=true;
@ -1461,6 +1467,7 @@
this.fixedHeader=false; this.fixedHeader=false;
this.gotop = true this.gotop = true
this.searchBar=false this.searchBar=false
} }
else else
{ {
@ -1468,6 +1475,14 @@
this.gotop = false; this.gotop = false;
this.searchBar=true this.searchBar=true
} }
console.log(this.searchBar);
if(this.searchBar==false && this.usertop==true){
this.usermargin={marginTop: '270px'};
}else{
this.usermargin={marginTop: '0px'};
}
}, },
async courseId(item) { async courseId(item) {
this.dataLoaded=false; this.dataLoaded=false;

View File

@ -44,6 +44,7 @@
:class="activeIndex == index ? 'active' : ''" :class="activeIndex == index ? 'active' : ''"
v-if="(!disableAlipay || (disableAlipay && item.type!='alipay'))" v-if="(!disableAlipay || (disableAlipay && item.type!='alipay'))"
> >
<div style="display:flex;"> <div style="display:flex;">
<img :src="item.payimage" alt="" /> <img :src="item.payimage" alt="" />
<span>{{ item.paytype }}支付</span> <span>{{ item.paytype }}支付</span>
@ -53,6 +54,7 @@
</div> </div>
</div> </div>
<div class="payconfirm rc-padding-y--md" v-if="disableQrcode"> <div class="payconfirm rc-padding-y--md" v-if="disableQrcode">
<span class="ts-standard-btn ts-standard-btn--two center" @click="goPayH5"> <span class="ts-standard-btn ts-standard-btn--two center" @click="goPayH5">
确认支付 确认支付
@ -74,6 +76,7 @@
<div class="line_dashed"></div> <div class="line_dashed"></div>
<div class="userer"> <div class="userer">
<div class="qrcode"> <div class="qrcode">
<img src="/images/qrcode-wxgroup.jpg"> <img src="/images/qrcode-wxgroup.jpg">
</div> </div>
<p>微信扫一扫识别二维码</p> <p>微信扫一扫识别二维码</p>
@ -106,6 +109,7 @@ export default {
activeIndex: 0, activeIndex: 0,
paymentTimer:undefined, paymentTimer:undefined,
isSucess: false, isSucess: false,
dialogSuccess: false, dialogSuccess: false,
paytype: "微信", paytype: "微信",
userpaystype: [ userpaystype: [
@ -114,11 +118,13 @@ export default {
payimage: require("../../assets/pay/wx.png"), payimage: require("../../assets/pay/wx.png"),
type:'wechat' type:'wechat'
}, },
{ {
paytype: "支付宝", paytype: "支付宝",
payimage: require("../../assets/pay/zfb.png"), payimage: require("../../assets/pay/zfb.png"),
type:'alipay' type:'alipay'
}, },
], ],
dialogFail: false, dialogFail: false,
userPayData: {}, userPayData: {},
@ -128,14 +134,13 @@ export default {
disableQrcode:false, disableQrcode:false,
}; };
}, },
computed: {
},
created(){ created(){
}, },
mounted() { mounted() {
let stype=this.$route.query.stype; let stype=this.$route.query.stype;
this.userPayData = JSON.parse(this.$route.query.userPayData); this.userPayData = JSON.parse(this.$route.query.userPayData);
this.defaultHandlePayment(); this.defaultHandlePayment();
}, },
@ -193,6 +198,12 @@ export default {
// path: "/personal/useraddress", // path: "/personal/useraddress",
// }); // });
}, },
async selectGoods(item, index) {
this.activeIndex = index;
this.paytype = item.paytype;
if (index == 1) {
//
let res = await generateOrderAlipay(this.userPayData.orderId);
async selectGoods(item, index) { async selectGoods(item, index) {
this.activeIndex = index; this.activeIndex = index;
this.paytype = item.paytype; this.paytype = item.paytype;
@ -201,8 +212,10 @@ export default {
let res = await generateOrderAlipay(this.userPayData.orderId); let res = await generateOrderAlipay(this.userPayData.orderId);
this.qrtext = ''; this.qrtext = '';
if (res.success) { if (res.success) {
this.qrtext=res.data; this.qrtext=res.data;
} }
} else { } else {
this.userPayData = JSON.parse(this.$route.query.userPayData); this.userPayData = JSON.parse(this.$route.query.userPayData);
this.qrtext=this.userPayData.wxPay this.qrtext=this.userPayData.wxPay
@ -218,12 +231,14 @@ export default {
} else if (res.fail) { } else if (res.fail) {
this.dialogFail = true; this.dialogFail = true;
} else { } else {
let _self = this; let _self = this;
this.paymentTimer = setTimeout(function(){ this.paymentTimer = setTimeout(function(){
_self.payOrderWX() _self.payOrderWX()
},5000); },5000);
} }
} }
}, },
components: { components: {
@ -364,6 +379,7 @@ export default {
justify-content: left; justify-content: left;
&.active { &.active {
border: none; border: none;
border-bottom: 4px solid #e2001a; border-bottom: 4px solid #e2001a;
} }
} }

View File

@ -106,7 +106,13 @@
<div class="rc-productdetail" v-if="!userbuy"> <div class="rc-productdetail" v-if="!userbuy">
<i class="ts-row-title">所属分类</i> <i class="ts-row-title">所属分类</i>
<span>{{ curItem.categoryName }}</span> <span>{{ curItem.categoryName }}</span>
</div> </div>
<div class="rc-button ">
<span @click="chuafangbuy()">立即购买</span>
</div>
<div class="rc-productdetail" v-if="userbuy"> <div class="rc-productdetail" v-if="userbuy">
<i class="ts-row-title">商品价格</i> <i class="ts-row-title">商品价格</i>
<span class="ts-realprice">{{ curItem.ecPrice }}</span> <span class="ts-realprice">{{ curItem.ecPrice }}</span>
@ -196,6 +202,7 @@
<span @click="usertanchu(curItem, 0)">加入购物车</span> <span @click="usertanchu(curItem, 0)">加入购物车</span>
<span @click="usertanchu(curItem, 1)">立即购买</span> <span @click="usertanchu(curItem, 1)">立即购买</span>
</div> </div>
</div> </div>
<div class="online bold rc-md-down"></div> <div class="online bold rc-md-down"></div>
</div> </div>
@ -207,6 +214,7 @@
</div> </div>
<FixRight></FixRight> <FixRight></FixRight>
<Myfooter v-on:litentop="showmesg"></Myfooter> <Myfooter v-on:litentop="showmesg"></Myfooter>
</div> </div>
<el-dialog :visible.sync="dialogInfo1" @close="userclose" class="pop_coupon" :close-on-click-modal="false"> <el-dialog :visible.sync="dialogInfo1" @close="userclose" class="pop_coupon" :close-on-click-modal="false">
<div class="ts-no-data" v-if="usernewlist.length<=0">目前还没有可用的优惠券</div> <div class="ts-no-data" v-if="usernewlist.length<=0">目前还没有可用的优惠券</div>
@ -266,6 +274,8 @@
<span @click="usertanchu(curItem, 0)">加入购物车</span> <span @click="usertanchu(curItem, 0)">加入购物车</span>
<span @click="usertanchu(curItem, 1)">立即购买</span> <span @click="usertanchu(curItem, 1)">立即购买</span>
</div> </div>
</div> </div>
</template> </template>
@ -275,6 +285,8 @@ import tabs from "@/components/tabs.vue";
import FixRight from "~/components/fixed-right.vue"; import FixRight from "~/components/fixed-right.vue";
import unlogin from "~/components/unlogin.vue"; import unlogin from "~/components/unlogin.vue";
import Myfooter from "~/components/rc-footer.vue"; import Myfooter from "~/components/rc-footer.vue";
import { mapMutations } from "vuex";
const settings = require("@/config");
import { import {
goodsmessage, goodsmessage,
getConfig, getConfig,
@ -284,14 +296,14 @@ import {
oncequery, oncequery,
biaomessage biaomessage
} from "../../ajax/getData"; } from "../../ajax/getData";
import { mapMutations } from "vuex";
const settings = require("@/config");
export default { export default {
async asyncData (context) { async asyncData (context) {
let isRxGoods = context.route.query.isRxGoods; let isRxGoods = context.route.query.isRxGoods;
let userbuy = true; let userbuy = true;
let newlist = []; let newlist = [];
let curItem = {}; let curItem = {};
let chufang = {};
let productAttachmentList = []; let productAttachmentList = [];
let userlistmenu = []; let userlistmenu = [];
isRxGoods = (isRxGoods == '1'?true:false); isRxGoods = (isRxGoods == '1'?true:false);
@ -306,6 +318,8 @@ export default {
let data = await oncequery(mainProductCode); let data = await oncequery(mainProductCode);
let outputObj = {}; let outputObj = {};
if (data) { if (data) {
console.log(data);
chufang=data;
outputObj = data; outputObj = data;
outputObj.productName = data.name; outputObj.productName = data.name;
outputObj.picture = 'https://royalcanincn.escase.cn/jc/royalcanin/'+outputObj.picture; outputObj.picture = 'https://royalcanincn.escase.cn/jc/royalcanin/'+outputObj.picture;
@ -316,6 +330,9 @@ export default {
let insertTmpObj = {id:1, attachmentType:1, sort:1, attachmentPath:newlist[0].picture}; let insertTmpObj = {id:1, attachmentType:1, sort:1, attachmentPath:newlist[0].picture};
productAttachmentList = [insertTmpObj]; productAttachmentList = [insertTmpObj];
userbuy = false; userbuy = false;
console.log('这是处方量数据')
} else { } else {
let stopLeftAllotmentChecking = false; let stopLeftAllotmentChecking = false;
let stopIndex = 0; let stopIndex = 0;
@ -352,14 +369,12 @@ export default {
activeIndexa, activeIndexa,
curItem, curItem,
newlist, newlist,
chufang,
productAttachmentList, productAttachmentList,
userbuy userbuy
} }
}, },
// middleware: 'metaTitle', data() {
// // middleware: 'metaTitle',
// meta: {title: ''},
data() {
return { return {
tableLabelTest: [], tableLabelTest: [],
userimage: require("../../assets/image/unused.png"), userimage: require("../../assets/image/unused.png"),
@ -378,6 +393,7 @@ export default {
productlist: [], productlist: [],
userbuy: true, userbuy: true,
sales_num: 1, sales_num: 1,
productAttachmentList: [], productAttachmentList: [],
usernewlist: [ usernewlist: [
{ {
@ -427,6 +443,10 @@ export default {
Myfooter, Myfooter,
FixRight FixRight
}, },
// middleware: 'metaTitle',
// // middleware: 'metaTitle',
// meta: {title: ''},
mounted() { mounted() {
this.checkIsLogin(); this.checkIsLogin();
if (this.usermessage !== "" || this.usermessage.data !== undefined) { if (this.usermessage !== "" || this.usermessage.data !== undefined) {
@ -472,6 +492,10 @@ export default {
}); });
} }
}, },
//
chuafangbuy(){
window.location.href =this.chufang.goodUrl;
},
// changeName(newName){ // changeName(newName){
// this.name = newName; // this.name = newName;

View File

@ -75,14 +75,40 @@
<label> <label>
<input <input
type="checkbox" type="checkbox"
@click="checkBox()" @click="checkBox($event,2)"
style="width: 24px; height: 24px"
v-model="inRank" v-model="inRank"
/>使 />
<strong>本人已年满16周岁,同意并接受公司按<a href="https://royalcanin.com.cn/privacy"><i>隐私政策</i></a><a href="https://royalcanin.com.cn/declaration"><i>法律声明</i></a>的规定收集和处理我的个人信息
您可以就隐私问题通过隐私政策中的方式联系我们并行使您的个人信息权利</strong>
</label> </label>
</div> </div>
<div class="usecheck rc-column rc-text--left">
<label>
<input
type="checkbox"
@click="checkBox($event,3)"
v-model="inRanka"
/>
<strong>
我已阅读和了解皇家爱宠荟的<a href="https://royalcanin.com.cn/member-principle"><i>会员规则</i></a>并同意接受其中所有的条框</strong>
</label>
</div>
<div class="usecheck rc-column rc-text--left">
<label>
<input
type="checkbox"
@click="checkBox($event,1)"
v-model="allcheck"
/>
<i>
一键勾选
</i>
</label>
</div>
</div> </div>
<div class="rc-layout-container rc-two-column rc-button"> <!-- <div class="rc-layout-container rc-two-column rc-button">
<div class="rc-column rc-text--left"> <div class="rc-column rc-text--left">
<a href="https://royalcanin.com.cn/privacy" target="_blank" class="rc-styled-link"><span>隐私政策</span></a> <a href="https://royalcanin.com.cn/privacy" target="_blank" class="rc-styled-link"><span>隐私政策</span></a>
</div> </div>
@ -91,7 +117,7 @@
<span>注册账户</span> <span>注册账户</span>
</nuxt-link> </nuxt-link>
</div> </div>
</div> </div> -->
<div class="rc-layout-container rc-one-column"> <div class="rc-layout-container rc-one-column">
<div class="rc-column"> <div class="rc-column">
@ -126,8 +152,14 @@ export default {
layerMSg: "手机格式不对", layerMSg: "手机格式不对",
tel: "", tel: "",
password: "", password: "",
allcheck:false,
activeIndex: 0, activeIndex: 0,
tamp:'', tamp:'',
radioData: [
{ value: '全部' ,href:'https://royalcanin.com.cn/privacy' },
{ value: '部分' ,href:''},
{ value: '零散' }
],
hash:'', hash:'',
text: "", text: "",
sms: "", sms: "",
@ -141,6 +173,7 @@ export default {
ifpassword: false, ifpassword: false,
checked: false, checked: false,
inRank: false, inRank: false,
inRanka: false,
usercheckbox:false, usercheckbox:false,
swiperData: [ swiperData: [
@ -188,13 +221,20 @@ export default {
// console.log(this.inRank); // console.log(this.inRank);
// }, // },
methods: { methods: {
//
checkBoxa(e,order){
let checked=e.target.checked;
console.log(checked)
...mapMutations(["changeClod"]),
checkBox(){
console.log(event.target.checked)
this.usercheckbox=event.target.checked
}, },
checkBox(e,order){
console.log(e.target.checked)
this.usercheckbox=e.target.checked;
this.inRank= this.usercheckbox;
},
...mapMutations(["changeClod"]),
// //
async usermsg() { async usermsg() {
//console.log("-----"); //console.log("-----");

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,6 +1,5 @@
package net.lab1024.smartadmin.module.system.alipay; package net.lab1024.smartadmin.module.system.alipay;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient; import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient; import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradePrecreateModel; import com.alipay.api.domain.AlipayTradePrecreateModel;
@ -13,7 +12,6 @@ import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
@Service @Service

View File

@ -1,5 +1,6 @@
package net.lab1024.smartadmin.module.system.alipay; package net.lab1024.smartadmin.module.system.alipay;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException; import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient; import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient; import com.alipay.api.DefaultAlipayClient;
@ -10,10 +11,21 @@ import com.alipay.api.response.AlipayTradePrecreateResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.lab1024.smartadmin.common.anno.OperateLog; import net.lab1024.smartadmin.common.anno.OperateLog;
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
import net.lab1024.smartadmin.constant.SwaggerTagConst; import net.lab1024.smartadmin.constant.SwaggerTagConst;
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity; import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig; import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
import net.lab1024.smartadmin.module.system.qrcode.QRCodeUtil; import net.lab1024.smartadmin.module.system.qrcode.QRCodeUtil;
import net.lab1024.smartadmin.module.system.royalcanin.MemberAccountService;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQueryEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
import net.lab1024.smartadmin.module.system.royalcanin.memberAccount.MemberAccountChangeEntity;
import net.lab1024.smartadmin.module.system.royalcanin.notify.model.NotifyEntity;
import net.lab1024.smartadmin.module.system.royalcanin.notify.service.NotifyService;
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -23,7 +35,7 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_PAY_API}) @Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
@OperateLog @OperateLog
@Slf4j @Slf4j
@RestController @RestController
@ -32,6 +44,17 @@ public class AlipayController {
public static String notify_url = ""; public static String notify_url = "";
@Autowired
private OrderService orderService;
String url = "https://miniapp-test.royalcanin.com.cn/rcmini/h5/";
@Autowired
private MemberAccountService memberAccountService;
@Autowired
private NotifyService notifyService;
/** /**
* @Description: 前往支付宝第三方网关进行支付 * @Description: 前往支付宝第三方网关进行支付
*/ */
@ -65,47 +88,88 @@ public class AlipayController {
} }
//
// @RequestMapping("royalcanin/updateOrderAliPay")
// public String returnUrl(HttpServletRequest request) throws Exception {
// Map<String,String> params = new HashMap<String,String>();
// Map<String,String[]> requestParams = request.getParameterMap();
// for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();) {
// String name = (String) iter.next();
// String[] values = (String[]) requestParams.get(name);
// String valueStr = "";
// for (int i = 0; i < values.length; i++) {
// valueStr = (i == values.length - 1) ? valueStr + values[i]
// : valueStr + values[i] + ",";
// }
// //乱码解决这段代码在出现乱码时使用(如果感觉自己配置没问题然后验签一直失败就把这个注释掉试试反正我的是这个问题)
// //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
// params.put(name, valueStr);
// }
// System.out.println("params:"+params);
// boolean signVerified = AlipaySignature.rsaCheckV1(params,AlipayConfig.alipay_public_key,AlipayConfig.charset,AlipayConfig.sign_type); //调用SDK验证签名
// System.out.println(signVerified);
// //请在这里编写您的程序以下代码仅作参考
// if(signVerified) {
// // 更新订单状态
// //商户订单号
// String out_trade_no = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"),"UTF-8");
// //付款金额
// String total_amount = new String(request.getParameter("total_amount").getBytes("ISO-8859-1"),"UTF-8");
//
//
// //支付宝交易号
// String trade_no = new String(request.getParameter("trade_no").getBytes("ISO-8859-1"),"UTF-8");
// OrderEntity orderEntity = orderService.findByOrderId(out_trade_no);
// String[] products = orderEntity.getProductCode().split(",");
// ProductMasterQueryEntity productMasterQueryEntity = new ProductMasterQueryEntity();
// double basePoint = 0;
// //自动获取会员积分
// for (String product : products) {
// productMasterQueryEntity.setProductCode(product);
// Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productMasterQueryEntity);
// MapRemoveNullUtil.removeNullEntry(paramMap);
// paramMap.put("secret", "H5@2021");
// 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"));
// JSONObject jsonObjectData = (JSONObject) jsonArray.get(0);
// basePoint = basePoint + Double.parseDouble(jsonObjectData.getString("basePoint"));
// }
// MemberAccountChangeEntity memberAccountChangeEntity = new MemberAccountChangeEntity();
// memberAccountChangeEntity.setChangeTypeId("1");
// memberAccountChangeEntity.setChangeValue(StringUtil.toString(basePoint));
// memberAccountChangeEntity.setMemberId(orderEntity.getMemberId());
// memberAccountService.memberAccountChange(memberAccountChangeEntity);
// NotifyEntity notifyEntity = new NotifyEntity();
// notifyEntity.setAppId(AlipayConfig.app_id);
// notifyEntity.setMchId(request.getParameter("seller_id"));
// notifyEntity.setSign(request.getParameter("sign"));
// notifyEntity.setResultCode(request.getParameter("code"));
// notifyEntity.setOpenid(request.getParameter("merchant_order_no"));
// notifyEntity.setOutTradeNo(out_trade_no);
// notifyEntity.setTotalFee(total_amount);
// notifyEntity.setTradeType(request.getParameter("sub_code"));
// notifyEntity.setFeeType("CNY");
// notifyEntity.setNonceStr(trade_no);
// notifyService.insertNotify(notifyEntity);
//
//
//
//
//
//
// String trade_status= new String(request.getParameter("trade_status").getBytes("ISO-8859-1"),"UTF-8");
// System.out.println("trade_status"+trade_status);
// return "trade_no:"+trade_no+"<br/>out_trade_no:"+out_trade_no+"<br/>total_amount:"+total_amount;
// }else {
// return "验签失败";
// }
// }
@RequestMapping("royalcanin/updateOrderAliPay") @RequestMapping("royalcanin/updateOrderAliPay")
public String returnUrl(HttpServletRequest request) throws UnsupportedEncodingException, AlipayApiException{
Map<String,String> params = new HashMap<String,String>();
Map<String,String[]> requestParams = request.getParameterMap();
for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();) {
String name = (String) iter.next();
String[] values = (String[]) requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
//乱码解决这段代码在出现乱码时使用(如果感觉自己配置没问题然后验签一直失败就把这个注释掉试试反正我的是这个问题)
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
params.put(name, valueStr);
}
System.out.println("params:"+params);
boolean signVerified = AlipaySignature.rsaCheckV1(params,AlipayConfig.alipay_public_key,AlipayConfig.charset,AlipayConfig.sign_type); //调用SDK验证签名
System.out.println(signVerified);
//请在这里编写您的程序以下代码仅作参考
if(signVerified) {
//商户订单号
String out_trade_no = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"),"UTF-8");
//支付宝交易号
String trade_no = new String(request.getParameter("trade_no").getBytes("ISO-8859-1"),"UTF-8");
//付款金额
String total_amount = new String(request.getParameter("total_amount").getBytes("ISO-8859-1"),"UTF-8");
String trade_status= new String(request.getParameter("trade_status").getBytes("ISO-8859-1"),"UTF-8");
System.out.println("trade_status"+trade_status);
return "trade_no:"+trade_no+"<br/>out_trade_no:"+out_trade_no+"<br/>total_amount:"+total_amount;
}else {
return "验签失败";
}
}
@RequestMapping(value = "/alipayNotifyNotice")
@ResponseBody @ResponseBody
public String alipayNotifyNotice(HttpServletRequest request, HttpServletRequest response) throws Exception { public String alipayNotifyNotice(HttpServletRequest request, HttpServletRequest response) throws Exception {
@ -151,6 +215,7 @@ public class AlipayController {
String total_amount = new String(request.getParameter("total_amount").getBytes("ISO-8859-1"), "UTF-8"); String total_amount = new String(request.getParameter("total_amount").getBytes("ISO-8859-1"), "UTF-8");
if (trade_status.equals("TRADE_FINISHED")) { if (trade_status.equals("TRADE_FINISHED")) {
return "TRADE_FINISHED";
//判断该笔订单是否在商户网站中已经做过处理 //判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序 //如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理不执行商户的业务程序 //如果有做过处理不执行商户的业务程序
@ -167,23 +232,48 @@ public class AlipayController {
// 修改叮当状态改为 支付成功已付款; 同时新增支付流水 // 修改叮当状态改为 支付成功已付款; 同时新增支付流水
// ordersService.updateOrderStatus(out_trade_no, trade_no, total_amount); // ordersService.updateOrderStatus(out_trade_no, trade_no, total_amount);
//
// //这里不用 只是为了 看日志 查的方法应该卸载 同步回调 页面
// Orders order = ordersService.getOrderById(out_trade_no);
// Product product = productService.getProductById(order.getProductId());
//
// LOGGER.info("********************** 支付成功(支付宝异步通知)查询 只是为了 看日志 **********************");
// LOGGER.info("* 订单号: {}", out_trade_no);
// LOGGER.info("* 支付宝交易号: {}", trade_no);
// LOGGER.info("* 实付金额: {}", total_amount);
// LOGGER.info("* 购买产品: {}", product.getName());
// LOGGER.info("***************************************************************");
OrderEntity orderEntity = orderService.findByOrderId(out_trade_no);
String[] products = orderEntity.getProductCode().split(",");
ProductMasterQueryEntity productMasterQueryEntity = new ProductMasterQueryEntity();
double basePoint = 0;
//自动获取会员积分
for (String product : products) {
productMasterQueryEntity.setProductCode(product);
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(productMasterQueryEntity);
MapRemoveNullUtil.removeNullEntry(paramMap);
paramMap.put("secret", "H5@2021");
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"));
JSONObject jsonObjectData = (JSONObject) jsonArray.get(0);
basePoint = basePoint + Double.parseDouble(jsonObjectData.getString("basePoint"));
}
MemberAccountChangeEntity memberAccountChangeEntity = new MemberAccountChangeEntity();
memberAccountChangeEntity.setChangeTypeId("1");
memberAccountChangeEntity.setChangeValue(StringUtil.toString(basePoint));
memberAccountChangeEntity.setMemberId(orderEntity.getMemberId());
memberAccountService.memberAccountChange(memberAccountChangeEntity);
NotifyEntity notifyEntity = new NotifyEntity();
notifyEntity.setAppId(AlipayConfig.app_id);
notifyEntity.setMchId(request.getParameter("seller_id"));
notifyEntity.setSign(request.getParameter("sign"));
notifyEntity.setResultCode(request.getParameter("code"));
notifyEntity.setOpenid(request.getParameter("merchant_order_no"));
notifyEntity.setOutTradeNo(out_trade_no);
notifyEntity.setTotalFee(total_amount);
notifyEntity.setTradeType(request.getParameter("sub_code"));
notifyEntity.setFeeType("CNY");
notifyEntity.setNonceStr(trade_no);
notifyService.insertNotify(notifyEntity);
}else {
return "验签失败";
} }
// LOGGER.info("支付成功..."); // LOGGER.info("支付成功...");
} else {//验证失败 } else {//验证失败
// LOGGER.info("支付, 验签失败..."); // LOGGER.info("支付, 验签失败...");
return "支付, 验签失败";
} }
return "success"; return "success";

View File

@ -31,9 +31,10 @@ public class MemberService {
JSONObject json = JSONObject.parseObject(jsonObject.getString("data")); JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
String id = json.getString("id"); String id = json.getString("id");
jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id)); jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id));
jsonObject.put("type","1");
return jsonObject.toJSONString(); return jsonObject.toJSONString();
}else { }else {
return sb; return jsonObject.toJSONString();
} }
} }
public String memberCheck(MemberCheckEntity memberCheckEntity)throws Exception { public String memberCheck(MemberCheckEntity memberCheckEntity)throws Exception {
@ -42,7 +43,7 @@ public class MemberService {
return SmartHttpUtil.sendPostForm(url+"check",paramMap,null); return SmartHttpUtil.sendPostForm(url+"check",paramMap,null);
} }
public String memberAdd(MemberAddEntity memberAddEntity)throws Exception { public String memberAdd(MemberAddEntity memberAddEntity){
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberAddEntity); Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberAddEntity);
paramMap.put("cityId",StringUtil.toString(memberAddEntity.getCityId()).equals("0")?null:StringUtil.toString(memberAddEntity.getCityId())); paramMap.put("cityId",StringUtil.toString(memberAddEntity.getCityId()).equals("0")?null:StringUtil.toString(memberAddEntity.getCityId()));
paramMap.put("gender",StringUtil.toString(memberAddEntity.getGender()).equals("0")?null:StringUtil.toString(memberAddEntity.getGender())); paramMap.put("gender",StringUtil.toString(memberAddEntity.getGender()).equals("0")?null:StringUtil.toString(memberAddEntity.getGender()));
@ -50,7 +51,17 @@ public class MemberService {
paramMap.put("provinceId",StringUtil.toString(memberAddEntity.getProvinceId()).equals("0")?null:StringUtil.toString(memberAddEntity.getProvinceId())); paramMap.put("provinceId",StringUtil.toString(memberAddEntity.getProvinceId()).equals("0")?null:StringUtil.toString(memberAddEntity.getProvinceId()));
MapRemoveNullUtil.removeNullEntry(paramMap); MapRemoveNullUtil.removeNullEntry(paramMap);
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap); net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap);
return SmartHttpUtil.httpPostRaw(url+"add",jsonObject.toString(),null,"utf-8"); String sb = SmartHttpUtil.httpPostRaw(url+"add",jsonObject.toString(),null,"utf-8");
JSONObject jsonObjectResult = JSONObject.parseObject(sb);
if(jsonObjectResult.getString("code").equals("0")){
JSONObject json = JSONObject.parseObject(jsonObjectResult.getString("data"));
String id = json.getString("id");
jsonObjectResult.put("xaccessToken", SmartJWTUtil.generateToken(id));
jsonObject.put("type","2");
return jsonObjectResult.toJSONString();
}else {
return jsonObjectResult.toJSONString();
}
} }
public String memberUpdateMemberLevel(MemberUpdateMemberLevelEntity memberUpdateMemberLevelEntity)throws Exception { public String memberUpdateMemberLevel(MemberUpdateMemberLevelEntity memberUpdateMemberLevelEntity)throws Exception {

View File

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import net.lab1024.smartadmin.common.anno.OperateLog; import net.lab1024.smartadmin.common.anno.OperateLog;
import net.lab1024.smartadmin.common.constant.ResponseCodeConst; import net.lab1024.smartadmin.common.constant.ResponseCodeConst;
import net.lab1024.smartadmin.common.domain.ResponseDTO; import net.lab1024.smartadmin.common.domain.ResponseDTO;
@ -15,8 +14,6 @@ import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfig
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity; import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogEntity; import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogEntity;
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService; import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQueryEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService; import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService; import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
import net.lab1024.smartadmin.module.system.royalcanin.member.*; import net.lab1024.smartadmin.module.system.royalcanin.member.*;
@ -28,8 +25,6 @@ import net.lab1024.smartadmin.module.system.royalcanin.memberAddress.MemberAddre
import net.lab1024.smartadmin.module.system.royalcanin.memberAddress.MemberAddressUpdateEntity; import net.lab1024.smartadmin.module.system.royalcanin.memberAddress.MemberAddressUpdateEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity; import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity; import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartHttpUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -38,7 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Map;
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API}) @Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
@ -80,13 +74,13 @@ public class TransitionController {
switch (type) switch (type)
{ {
case "get": case "get":
result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class)); result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class)).toString();
break; break;
case "check": case "check":
result = memberService.memberCheck(objectMapper.convertValue(object,MemberCheckEntity.class)); result = memberService.memberCheck(objectMapper.convertValue(object,MemberCheckEntity.class));
break; break;
case "add": case "add":
result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class)); result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class)).toString();
break; break;
case "updateMemberLevel": case "updateMemberLevel":
result = memberService.memberUpdateMemberLevel(objectMapper.convertValue(object, MemberUpdateMemberLevelEntity.class)); result = memberService.memberUpdateMemberLevel(objectMapper.convertValue(object, MemberUpdateMemberLevelEntity.class));
@ -105,20 +99,20 @@ public class TransitionController {
@ApiOperation(value = "登录或注册", notes = "会员查询,登录注册") @ApiOperation(value = "登录或注册", notes = "会员查询,登录注册")
@PostMapping("royalcanin/regOrLogin") @PostMapping("royalcanin/regOrLogin")
public ResponseDTO<String> regOrLogin(@RequestParam String phoneNumber) throws Exception { public String regOrLogin(@RequestParam String phoneNumber) throws Exception {
MemberCheckEntity memberCheckEntity = new MemberCheckEntity(); MemberCheckEntity memberCheckEntity = new MemberCheckEntity();
memberCheckEntity.setMobile(phoneNumber); memberCheckEntity.setMobile(phoneNumber);
JSONObject jsonObject = JSONObject.parseObject(memberService.memberCheck(memberCheckEntity)); JSONObject jsonObject = JSONObject.parseObject(memberService.memberCheck(memberCheckEntity));
if(jsonObject.getString("code").equals("103")){ if(jsonObject.getString("code").equals("103")){
MemberGetEntity memberGetEntity = new MemberGetEntity (); MemberGetEntity memberGetEntity = new MemberGetEntity ();
memberGetEntity.setMobile(phoneNumber); memberGetEntity.setMobile(phoneNumber);
return ResponseDTO.succData(memberService.memberGet(memberGetEntity),"1"); return memberService.memberGet(memberGetEntity);
}else if(jsonObject.getString("code").equals("0")){ }else if(jsonObject.getString("code").equals("0")){
MemberAddEntity memberAddEntity = new MemberAddEntity(); MemberAddEntity memberAddEntity = new MemberAddEntity();
memberAddEntity.setMobile(phoneNumber); memberAddEntity.setMobile(phoneNumber);
return ResponseDTO.succData(memberService.memberAdd(memberAddEntity),"2"); return memberService.memberAdd(memberAddEntity);
}else{ }else{
return ResponseDTO.wrap(ResponseCodeConst.ERROR_PARAM); return null;
} }
} }

View File

@ -136,13 +136,14 @@ public class OrderController {
@ApiOperation(value = "微信支付H5订单", notes = "生成H5订单") @ApiOperation(value = "微信支付H5订单", notes = "生成H5订单")
@PostMapping("royalcanin/generateOrderWXH5") @PostMapping("royalcanin/generateOrderWXH5")
public Map<String, String> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception { public ResponseDTO<Map<String, String>> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
StringBuffer productId = new StringBuffer(); StringBuffer productId = new StringBuffer();
StringBuffer productName = new StringBuffer(); StringBuffer productName = new StringBuffer();
String memberId = ""; String memberId = "";
String mobile = ""; String mobile = "";
int buyCount = 0; int buyCount = 0;
double total_fee = 0 ; double total_fee = 0 ;
double basePoint = 0 ;
WxPayEntity wxPayEntity = new WxPayEntity(); WxPayEntity wxPayEntity = new WxPayEntity();
JSONArray orderDatilListJson = new JSONArray(); JSONArray orderDatilListJson = new JSONArray();
OrdersEntity ordersEntity = new OrdersEntity(); OrdersEntity ordersEntity = new OrdersEntity();
@ -157,14 +158,23 @@ public class OrderController {
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount()); orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
orderDatilListJson.add(orderDatilListEntity); orderDatilListJson.add(orderDatilListEntity);
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) { if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
ordersEntity.setCouponAmount(ordersEntitys.getCouponAmount()); CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity ();
ordersEntity.setCouponCode(ordersEntitys.getCouponCode()); couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
ordersEntity.setCouponName(ordersEntitys.getCouponName()); couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
ordersEntity.setCouponId(ordersEntitys.getCouponId()); String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
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"));
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount()); total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
}else{ }else{
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ; total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
} }
basePoint = basePoint + ordersEntitys.getBasePoint();
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());
@ -173,7 +183,6 @@ public class OrderController {
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName()); orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+","); productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+","); productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId(); memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber(); mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount(); buyCount = buyCount + ordersEntitys.getBuyCount();
@ -187,17 +196,23 @@ public class OrderController {
ordersEntity.setBuyCount(buyCount); ordersEntity.setBuyCount(buyCount);
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo()); ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
ordersEntity.setOrderStatus("0"); ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint);
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){ if(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());
return wxpayService.dounifiedOrder(wxPayEntity);
}else { Map<String, String> returnMap = new HashMap<>();
return null; returnMap.put("orderNumber",ordersEntity.getOrderNo());
returnMap.put("orderAmount",ordersEntity.getOrderAmount());
return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrder(wxPayEntity));
} }
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
} }
@ApiOperation(value = "重新支付", notes = "重新支付") @ApiOperation(value = "重新支付(二维码)", notes = "重新支付(二维码)")
@PostMapping("royalcanin/repayOrderWX") @PostMapping("royalcanin/repayOrderWX")
public ResponseDTO<String> repayOrderWX(String orderNo) throws Exception { public ResponseDTO<String> repayOrderWX(String orderNo) throws Exception {
OrderEntity ordersEntity = orderService.findByOrderId(orderNo); OrderEntity ordersEntity = orderService.findByOrderId(orderNo);
@ -212,7 +227,31 @@ public class OrderController {
wxPayEntity.setProduct_id(ordersEntity.getProductCode()); wxPayEntity.setProduct_id(ordersEntity.getProductCode());
wxPayEntity.setTotal_fee(jsonObject.getString("salesAmount")); wxPayEntity.setTotal_fee(jsonObject.getString("salesAmount"));
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo()); wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
return ResponseDTO.succData(orderInfo, wxpayService.generateQRCode(wxPayEntity)); return ResponseDTO.succData(orderNo, wxpayService.generateQRCode(wxPayEntity));
}else {
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,orderInfo);
}
}else {
return ResponseDTO.wrap(OrderResponseCodeConst.WITHOUT_ORDER);
}
}
@ApiOperation(value = "重新支付H5", notes = "重新支付H5")
@PostMapping("royalcanin/repayOrderWXH5")
public ResponseDTO<String> repayOrderWXH5(String orderNo) throws Exception {
OrderEntity ordersEntity = orderService.findByOrderId(orderNo);
if(ordersEntity != null){
QueryEntity queryEntity = new QueryEntity();
queryEntity.setOrderNumber(ordersEntity.getOrderNo());
String orderInfo = orderService.query(queryEntity);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(orderInfo);
JSONObject jsonObject = (JSONObject)jsonArray.get(0);
if(jsonObject.getString("status").equals("0")) {
WxPayEntity wxPayEntity = new WxPayEntity();
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
wxPayEntity.setTotal_fee(jsonObject.getString("salesAmount"));
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
return ResponseDTO.succData(orderNo,wxpayService.dounifiedOrder(wxPayEntity));
}else { }else {
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,orderInfo); return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,orderInfo);
} }
@ -239,11 +278,7 @@ public class OrderController {
return ResponseDTO.wrap(OrderResponseCodeConst.NOTIFY_ERROR); return ResponseDTO.wrap(OrderResponseCodeConst.NOTIFY_ERROR);
} }
@ApiOperation(value = "支付宝更新订单", notes = "支付宝更新订单")
@RequestMapping(value = "royalcanin/updateOrderAlipay")
public void updateOrderAlipay(HttpServletRequest request, HttpServletResponse response){
// aliPayService.orderCallBackAliPay(request,response);
}
@ApiOperation(value = "取消订单", notes = "取消订单") @ApiOperation(value = "取消订单", notes = "取消订单")
@RequestMapping(value = "royalcanin/cancelOrder",method = RequestMethod.POST) @RequestMapping(value = "royalcanin/cancelOrder",method = RequestMethod.POST)

View File

@ -226,9 +226,18 @@ public class OrderService {
long elapsedTime = acceptTime - startTime; long elapsedTime = acceptTime - startTime;
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
String afterDecodeResult = AESUtil.decryptLinux(jsonObject.getString("data"), AESUtil.KEY); String afterDecodeResult = AESUtil.decryptLinux(jsonObject.getString("data"), AESUtil.KEY);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(afterDecodeResult);
JSONObject jsonObjectResult = (JSONObject)jsonArray.get(0);
if (queryEntity.getOrderNumber() != null &&queryEntity.getOrderNumber() != "") {
OrderEntity orderEntity = ordersDao.findByOrderId(queryEntity.getOrderNumber());
//新增支付方式paytype
jsonObjectResult.put("paytype",orderEntity.getPayType());
}
//记录服务响应时间 //记录服务响应时间
addOperatreFullData(url+"orderMaster/query",queryEntity.toString(),result, startTime,elapsedTime,acceptTime); addOperatreFullData(url+"orderMaster/query",queryEntity.toString(),result, startTime,elapsedTime,acceptTime);
return afterDecodeResult;
return jsonArray.toJSONString();
} }
public ResponseDTO<String> addOperatreFullData(String type, String params, String result, Long startTime, Long elapsedTime, Long acceptTime){ public ResponseDTO<String> addOperatreFullData(String type, String params, String result, Long startTime, Long elapsedTime, Long acceptTime){

View File

@ -19,7 +19,7 @@ public class MyConfig implements WXPayConfig {
public String notify_url = "https://royalcanincn.escase.cn/jc/royalcanin/royalcanin/updateOrderWX"; public String notify_url = "https://royalcanincn.escase.cn/jc/royalcanin/royalcanin/updateOrderWX";
// 微信支付h5 回调地址 // 微信支付h5 回调地址
public static String NOTIFY_URL_H5 = "https://www.XXXXXX.com/server/weixin/WxQuery"; public static String NOTIFY_URL_H5 = "https://shop.royalcanin.com.cn/myorder/usertion?";
// 请求地址 // 请求地址
public static String UFDODER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder"; public static String UFDODER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";

View File

@ -68,7 +68,7 @@ public class WxpayService {
try { try {
Map<String, String> resp = wxpay.unifiedOrder(data); Map<String, String> resp = wxpay.unifiedOrder(data);
if (resp != null) { if (resp != null) {
return resp.get("code_url"); return resp.get("code_url") == null ?resp.get("err_code_des"):resp.get("code_url");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -141,10 +141,6 @@ public class WxpayService {
response.getWriter().println("<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>"); response.getWriter().println("<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>");
response.setContentType("text/html"); response.setContentType("text/html");
response.getWriter().println("SUCCESS"); response.getWriter().println("SUCCESS");
QueryEntity queryEntity = new QueryEntity();
queryEntity.setOrderNumber(outTradeNo);
String orderEntityJson = orderService.query(queryEntity);
orderService.completeOrder(totalFee,orderEntityJson);
} }
}else { }else {
// 未成功就都处理为失败订单 // 未成功就都处理为失败订单
@ -168,7 +164,7 @@ public class WxpayService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public Map<String, String> dounifiedOrder(WxPayEntity wxPayEntity) throws Exception { public String dounifiedOrder(WxPayEntity wxPayEntity) throws Exception {
//返回参数 //返回参数
Map<String, String> returnMap = new HashMap<>(); Map<String, String> returnMap = new HashMap<>();
WXPay wxpay = new WXPay(config); WXPay wxpay = new WXPay(config);
@ -194,18 +190,20 @@ public class WxpayService {
if (returnCode.equals("SUCCESS")) { if (returnCode.equals("SUCCESS")) {
returnMap.put("ok", "200"); returnMap.put("ok", "200");
//拼接返回跳转地址 //拼接返回跳转地址
String url= config.NOTIFY_URL_H5; String url= config.NOTIFY_URL_H5+"orderNumber="+wxPayEntity.getOut_trade_no() ;
returnMap.put("url", response.get("mweb_url")+"&redirect_url="+url); returnMap.put("url", response.get("mweb_url")+"&redirect_url="+url);
return response.get("mweb_url") == null ? response.get("err_code_des"):returnMap.get("url");
} else { } else {
returnMap.put("ok", "201"); returnMap.put("ok", "201");
returnMap.put("url",null); returnMap.put("url",null);
return returnMap; return returnMap.get("url");
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
return "Error";
//系统等其他错误的时候 //系统等其他错误的时候
} }
return returnMap;
} }