mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 18:26:38 +08:00
Merge branch 'sit-Carl' into sit-Leung
# Conflicts: # rc-busness/pages/personal/userpay.vue
This commit is contained in:
commit
31fe06b2c2
@ -88,6 +88,9 @@
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
color: #e1001a;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis
|
||||
}
|
||||
.rc-userfont {
|
||||
overflow: hidden;
|
||||
@ -254,6 +257,9 @@ margin-top: 30px;
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
color: #e1001a;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis
|
||||
}
|
||||
.rc-userfont {
|
||||
overflow: hidden;
|
||||
|
@ -62,15 +62,15 @@ input[type=checkbox]{
|
||||
border:none;
|
||||
//border: 1px solid #d7d7d7;
|
||||
border-radius: 3px;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
-webkit-appearance:none;
|
||||
&:before {
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: "";
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
background-color: #fff;
|
||||
@ -83,7 +83,7 @@ input[type=checkbox]{
|
||||
}
|
||||
label {
|
||||
input[type=checkbox] {
|
||||
top:.375rem;
|
||||
// top:.375rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
}
|
||||
.usecheck label{
|
||||
display:flex;
|
||||
align-items: center;
|
||||
input{
|
||||
margin-right:.687rem;
|
||||
}
|
||||
@ -48,10 +49,10 @@
|
||||
.usecheck{
|
||||
display: flex;
|
||||
text-align: left;
|
||||
width: 335px;
|
||||
margin: 0 auto;
|
||||
align-items: center;
|
||||
margin-top: 18px;
|
||||
border-bottom: 1px solid #d7d7d7;
|
||||
|
||||
}
|
||||
.container {
|
||||
@ -106,6 +107,20 @@
|
||||
border: 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 {
|
||||
font-size: 30px;
|
||||
color: #333333;
|
||||
@ -142,14 +157,50 @@
|
||||
}
|
||||
// /* 最小768px最大1920 *pc端/
|
||||
@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{
|
||||
display: flex;
|
||||
text-align: left;
|
||||
width: 395px;
|
||||
margin: 0 auto;
|
||||
align-items: center;
|
||||
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/
|
||||
.van-field-one{
|
||||
|
@ -22019,9 +22019,6 @@ li:last-child .edge .rc-tab--view-control:focus,li:last-child
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.rc-xl-up,.xl-up {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.rc-flex-direction--reverse--xl-down {
|
||||
-webkit-box-orient: vertical;
|
||||
|
@ -56,6 +56,8 @@
|
||||
</span>
|
||||
</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">
|
||||
<span class="rc-screen-reader-text">translations.feature.headerbar.search</span>
|
||||
</button>
|
||||
|
@ -2,4 +2,13 @@
|
||||
module.exports={
|
||||
//图片路径地址
|
||||
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',
|
||||
}
|
||||
|
@ -75,7 +75,7 @@
|
||||
<!-- <h2>明星猫粮</h2> -->
|
||||
<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>
|
||||
<!-- 轮播图 -->
|
||||
<div class="ts-carousel-container">
|
||||
@ -752,6 +752,7 @@
|
||||
return{
|
||||
fixedHeader:false,
|
||||
dataLoaded:true,
|
||||
usermargin:{marginTop: '0'},
|
||||
useraindex:0,
|
||||
mobileVideoPlaying:false,
|
||||
usertitle:'明星猫粮',
|
||||
@ -760,6 +761,7 @@
|
||||
catshi:[],
|
||||
userindex:0,
|
||||
userstype:'',
|
||||
usertop:true,
|
||||
onemao:false,
|
||||
twomao:false,
|
||||
threemao:false,
|
||||
@ -1204,10 +1206,13 @@
|
||||
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
||||
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
||||
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
|
||||
//console.log("当前是电脑打开")
|
||||
console.log("当前是电脑打开")
|
||||
this.stypechange=false;
|
||||
//console.log(this.usertitle)
|
||||
|
||||
this.usermargin={
|
||||
marginTop:'0',
|
||||
}
|
||||
this.usertop=false,
|
||||
this.catproduct=true;
|
||||
this.onemao=false;
|
||||
this.twomao=false;
|
||||
@ -1220,12 +1225,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
//console.log("当前是手机打开")
|
||||
console.log("当前是手机打开")
|
||||
this.showingBanners=this.banners.mobile;
|
||||
this.stypechange=true;
|
||||
this.onemao=true;
|
||||
this.twomao=true;
|
||||
this.threemao=true;
|
||||
this.usertop=true,
|
||||
this.fourmao=true;
|
||||
this.fivemao=true;
|
||||
this.dogshow=true;
|
||||
@ -1461,6 +1467,7 @@
|
||||
this.fixedHeader=false;
|
||||
this.gotop = true
|
||||
this.searchBar=false
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1468,6 +1475,14 @@
|
||||
this.gotop = false;
|
||||
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) {
|
||||
this.dataLoaded=false;
|
||||
|
@ -44,6 +44,7 @@
|
||||
:class="activeIndex == index ? 'active' : ''"
|
||||
v-if="(!disableAlipay || (disableAlipay && item.type!='alipay'))"
|
||||
>
|
||||
|
||||
<div style="display:flex;">
|
||||
<img :src="item.payimage" alt="" />
|
||||
<span>{{ item.paytype }}支付</span>
|
||||
@ -53,6 +54,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="payconfirm rc-padding-y--md" v-if="disableQrcode">
|
||||
<span class="ts-standard-btn ts-standard-btn--two center" @click="goPayH5">
|
||||
确认支付
|
||||
@ -74,6 +76,7 @@
|
||||
<div class="line_dashed"></div>
|
||||
<div class="userer">
|
||||
<div class="qrcode">
|
||||
|
||||
<img src="/images/qrcode-wxgroup.jpg">
|
||||
</div>
|
||||
<p>微信扫一扫,识别二维码</p>
|
||||
@ -106,6 +109,7 @@ export default {
|
||||
activeIndex: 0,
|
||||
paymentTimer:undefined,
|
||||
isSucess: false,
|
||||
|
||||
dialogSuccess: false,
|
||||
paytype: "微信",
|
||||
userpaystype: [
|
||||
@ -114,11 +118,13 @@ export default {
|
||||
payimage: require("../../assets/pay/wx.png"),
|
||||
type:'wechat'
|
||||
},
|
||||
|
||||
{
|
||||
paytype: "支付宝",
|
||||
payimage: require("../../assets/pay/zfb.png"),
|
||||
type:'alipay'
|
||||
},
|
||||
|
||||
],
|
||||
dialogFail: false,
|
||||
userPayData: {},
|
||||
@ -128,14 +134,13 @@ export default {
|
||||
disableQrcode:false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
created(){
|
||||
|
||||
},
|
||||
mounted() {
|
||||
let stype=this.$route.query.stype;
|
||||
|
||||
this.userPayData = JSON.parse(this.$route.query.userPayData);
|
||||
this.defaultHandlePayment();
|
||||
},
|
||||
@ -193,6 +198,12 @@ export default {
|
||||
// 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) {
|
||||
this.activeIndex = index;
|
||||
this.paytype = item.paytype;
|
||||
@ -201,8 +212,10 @@ export default {
|
||||
let res = await generateOrderAlipay(this.userPayData.orderId);
|
||||
this.qrtext = '';
|
||||
if (res.success) {
|
||||
|
||||
this.qrtext=res.data;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.userPayData = JSON.parse(this.$route.query.userPayData);
|
||||
this.qrtext=this.userPayData.wxPay
|
||||
@ -218,12 +231,14 @@ export default {
|
||||
|
||||
} else if (res.fail) {
|
||||
this.dialogFail = true;
|
||||
|
||||
} else {
|
||||
let _self = this;
|
||||
this.paymentTimer = setTimeout(function(){
|
||||
_self.payOrderWX()
|
||||
},5000);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@ -364,6 +379,7 @@ export default {
|
||||
justify-content: left;
|
||||
&.active {
|
||||
border: none;
|
||||
|
||||
border-bottom: 4px solid #e2001a;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,13 @@
|
||||
<div class="rc-productdetail" v-if="!userbuy">
|
||||
<i class="ts-row-title">所属分类:</i>
|
||||
<span>{{ curItem.categoryName }}</span>
|
||||
|
||||
</div>
|
||||
<div class="rc-button ">
|
||||
<span @click="chuafangbuy()">立即购买</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="rc-productdetail" v-if="userbuy">
|
||||
<i class="ts-row-title">商品价格:</i>
|
||||
<span class="ts-realprice">¥{{ curItem.ecPrice }}</span>
|
||||
@ -196,6 +202,7 @@
|
||||
<span @click="usertanchu(curItem, 0)">加入购物车</span>
|
||||
<span @click="usertanchu(curItem, 1)">立即购买</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="online bold rc-md-down"></div>
|
||||
</div>
|
||||
@ -207,6 +214,7 @@
|
||||
</div>
|
||||
<FixRight></FixRight>
|
||||
<Myfooter v-on:litentop="showmesg"></Myfooter>
|
||||
|
||||
</div>
|
||||
<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>
|
||||
@ -266,6 +274,8 @@
|
||||
<span @click="usertanchu(curItem, 0)">加入购物车</span>
|
||||
<span @click="usertanchu(curItem, 1)">立即购买</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -275,6 +285,8 @@ import tabs from "@/components/tabs.vue";
|
||||
import FixRight from "~/components/fixed-right.vue";
|
||||
import unlogin from "~/components/unlogin.vue";
|
||||
import Myfooter from "~/components/rc-footer.vue";
|
||||
import { mapMutations } from "vuex";
|
||||
const settings = require("@/config");
|
||||
import {
|
||||
goodsmessage,
|
||||
getConfig,
|
||||
@ -284,14 +296,14 @@ import {
|
||||
oncequery,
|
||||
biaomessage
|
||||
} from "../../ajax/getData";
|
||||
import { mapMutations } from "vuex";
|
||||
const settings = require("@/config");
|
||||
|
||||
export default {
|
||||
async asyncData (context) {
|
||||
let isRxGoods = context.route.query.isRxGoods;
|
||||
let userbuy = true;
|
||||
let newlist = [];
|
||||
let curItem = {};
|
||||
let chufang = {};
|
||||
let productAttachmentList = [];
|
||||
let userlistmenu = [];
|
||||
isRxGoods = (isRxGoods == '1'?true:false);
|
||||
@ -306,6 +318,8 @@ export default {
|
||||
let data = await oncequery(mainProductCode);
|
||||
let outputObj = {};
|
||||
if (data) {
|
||||
console.log(data);
|
||||
chufang=data;
|
||||
outputObj = data;
|
||||
outputObj.productName = data.name;
|
||||
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};
|
||||
productAttachmentList = [insertTmpObj];
|
||||
userbuy = false;
|
||||
console.log('这是处方量数据')
|
||||
|
||||
|
||||
} else {
|
||||
let stopLeftAllotmentChecking = false;
|
||||
let stopIndex = 0;
|
||||
@ -352,14 +369,12 @@ export default {
|
||||
activeIndexa,
|
||||
curItem,
|
||||
newlist,
|
||||
chufang,
|
||||
productAttachmentList,
|
||||
userbuy
|
||||
}
|
||||
},
|
||||
// middleware: 'metaTitle',
|
||||
// // middleware: 'metaTitle',
|
||||
// meta: {title: '产品详情'},
|
||||
data() {
|
||||
data() {
|
||||
return {
|
||||
tableLabelTest: [],
|
||||
userimage: require("../../assets/image/unused.png"),
|
||||
@ -378,6 +393,7 @@ export default {
|
||||
productlist: [],
|
||||
userbuy: true,
|
||||
sales_num: 1,
|
||||
|
||||
productAttachmentList: [],
|
||||
usernewlist: [
|
||||
{
|
||||
@ -427,6 +443,10 @@ export default {
|
||||
Myfooter,
|
||||
FixRight
|
||||
},
|
||||
// middleware: 'metaTitle',
|
||||
// // middleware: 'metaTitle',
|
||||
// meta: {title: '产品详情'},
|
||||
|
||||
mounted() {
|
||||
this.checkIsLogin();
|
||||
if (this.usermessage !== "" || this.usermessage.data !== undefined) {
|
||||
@ -472,6 +492,10 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
//处方用粮跳转
|
||||
chuafangbuy(){
|
||||
window.location.href =this.chufang.goodUrl;
|
||||
},
|
||||
|
||||
// changeName(newName){
|
||||
// this.name = newName;
|
||||
|
@ -75,14 +75,40 @@
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
@click="checkBox()"
|
||||
style="width: 24px; height: 24px"
|
||||
@click="checkBox($event,2)"
|
||||
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>
|
||||
</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 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">
|
||||
<a href="https://royalcanin.com.cn/privacy" target="_blank" class="rc-styled-link"><span>隐私政策</span></a>
|
||||
</div>
|
||||
@ -91,7 +117,7 @@
|
||||
<span>注册账户</span>
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="rc-layout-container rc-one-column">
|
||||
<div class="rc-column">
|
||||
@ -126,8 +152,14 @@ export default {
|
||||
layerMSg: "手机格式不对",
|
||||
tel: "",
|
||||
password: "",
|
||||
allcheck:false,
|
||||
activeIndex: 0,
|
||||
tamp:'',
|
||||
radioData: [
|
||||
{ value: '全部' ,href:'https://royalcanin.com.cn/privacy' },
|
||||
{ value: '部分' ,href:''},
|
||||
{ value: '零散' }
|
||||
],
|
||||
hash:'',
|
||||
text: "",
|
||||
sms: "",
|
||||
@ -141,6 +173,7 @@ export default {
|
||||
ifpassword: false,
|
||||
checked: false,
|
||||
inRank: false,
|
||||
inRanka: false,
|
||||
usercheckbox:false,
|
||||
|
||||
swiperData: [
|
||||
@ -188,13 +221,20 @@ export default {
|
||||
// console.log(this.inRank);
|
||||
// },
|
||||
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() {
|
||||
//console.log("-----");
|
||||
|
BIN
rc-busness/static/images/paysucess.jpg
Normal file
BIN
rc-busness/static/images/paysucess.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
File diff suppressed because one or more lines are too long
@ -1,6 +1,5 @@
|
||||
package net.lab1024.smartadmin.module.system.alipay;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
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.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.lab1024.smartadmin.module.system.alipay;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
@ -10,10 +11,21 @@ import com.alipay.api.response.AlipayTradePrecreateResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.smartadmin.common.anno.OperateLog;
|
||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||
import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
||||
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
|
||||
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -23,7 +35,7 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_PAY_API})
|
||||
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
|
||||
@OperateLog
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -32,6 +44,17 @@ public class AlipayController {
|
||||
|
||||
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: 前往支付宝第三方网关进行支付
|
||||
*/
|
||||
@ -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")
|
||||
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
|
||||
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");
|
||||
|
||||
if (trade_status.equals("TRADE_FINISHED")) {
|
||||
return "TRADE_FINISHED";
|
||||
//判断该笔订单是否在商户网站中已经做过处理
|
||||
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
|
||||
//如果有做过处理,不执行商户的业务程序
|
||||
@ -167,23 +232,48 @@ public class AlipayController {
|
||||
|
||||
// 修改叮当状态,改为 支付成功,已付款; 同时新增支付流水
|
||||
// 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("支付成功...");
|
||||
|
||||
} else {//验证失败
|
||||
// LOGGER.info("支付, 验签失败...");
|
||||
return "支付, 验签失败";
|
||||
}
|
||||
|
||||
return "success";
|
||||
|
@ -31,9 +31,10 @@ public class MemberService {
|
||||
JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
|
||||
String id = json.getString("id");
|
||||
jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id));
|
||||
jsonObject.put("type","1");
|
||||
return jsonObject.toJSONString();
|
||||
}else {
|
||||
return sb;
|
||||
return jsonObject.toJSONString();
|
||||
}
|
||||
}
|
||||
public String memberCheck(MemberCheckEntity memberCheckEntity)throws Exception {
|
||||
@ -42,7 +43,7 @@ public class MemberService {
|
||||
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);
|
||||
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()));
|
||||
@ -50,7 +51,17 @@ public class MemberService {
|
||||
paramMap.put("provinceId",StringUtil.toString(memberAddEntity.getProvinceId()).equals("0")?null:StringUtil.toString(memberAddEntity.getProvinceId()));
|
||||
MapRemoveNullUtil.removeNullEntry(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 {
|
||||
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.lab1024.smartadmin.common.anno.OperateLog;
|
||||
import net.lab1024.smartadmin.common.constant.ResponseCodeConst;
|
||||
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.domain.RoyalcaninOperateLogEntity;
|
||||
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.OrderService;
|
||||
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.orderMaster.AddOrSaveEntity;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -38,7 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
|
||||
@ -80,13 +74,13 @@ public class TransitionController {
|
||||
switch (type)
|
||||
{
|
||||
case "get":
|
||||
result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class));
|
||||
result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class)).toString();
|
||||
break;
|
||||
case "check":
|
||||
result = memberService.memberCheck(objectMapper.convertValue(object,MemberCheckEntity.class));
|
||||
break;
|
||||
case "add":
|
||||
result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class));
|
||||
result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class)).toString();
|
||||
break;
|
||||
case "updateMemberLevel":
|
||||
result = memberService.memberUpdateMemberLevel(objectMapper.convertValue(object, MemberUpdateMemberLevelEntity.class));
|
||||
@ -105,20 +99,20 @@ public class TransitionController {
|
||||
|
||||
@ApiOperation(value = "登录或注册", notes = "会员查询,登录注册")
|
||||
@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.setMobile(phoneNumber);
|
||||
JSONObject jsonObject = JSONObject.parseObject(memberService.memberCheck(memberCheckEntity));
|
||||
if(jsonObject.getString("code").equals("103")){
|
||||
MemberGetEntity memberGetEntity = new MemberGetEntity ();
|
||||
memberGetEntity.setMobile(phoneNumber);
|
||||
return ResponseDTO.succData(memberService.memberGet(memberGetEntity),"1");
|
||||
return memberService.memberGet(memberGetEntity);
|
||||
}else if(jsonObject.getString("code").equals("0")){
|
||||
MemberAddEntity memberAddEntity = new MemberAddEntity();
|
||||
memberAddEntity.setMobile(phoneNumber);
|
||||
return ResponseDTO.succData(memberService.memberAdd(memberAddEntity),"2");
|
||||
return memberService.memberAdd(memberAddEntity);
|
||||
}else{
|
||||
return ResponseDTO.wrap(ResponseCodeConst.ERROR_PARAM);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,13 +136,14 @@ public class OrderController {
|
||||
|
||||
@ApiOperation(value = "微信支付H5订单", notes = "生成H5订单")
|
||||
@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 productName = new StringBuffer();
|
||||
String memberId = "";
|
||||
String mobile = "";
|
||||
int buyCount = 0;
|
||||
double total_fee = 0 ;
|
||||
double basePoint = 0 ;
|
||||
WxPayEntity wxPayEntity = new WxPayEntity();
|
||||
JSONArray orderDatilListJson = new JSONArray();
|
||||
OrdersEntity ordersEntity = new OrdersEntity();
|
||||
@ -157,14 +158,23 @@ public class OrderController {
|
||||
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
||||
orderDatilListJson.add(orderDatilListEntity);
|
||||
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
|
||||
ordersEntity.setCouponAmount(ordersEntitys.getCouponAmount());
|
||||
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
|
||||
ordersEntity.setCouponName(ordersEntitys.getCouponName());
|
||||
ordersEntity.setCouponId(ordersEntitys.getCouponId());
|
||||
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity ();
|
||||
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
|
||||
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
|
||||
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
||||
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
||||
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());
|
||||
}else{
|
||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
|
||||
}
|
||||
basePoint = basePoint + ordersEntitys.getBasePoint();
|
||||
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
|
||||
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
|
||||
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
|
||||
@ -173,7 +183,6 @@ public class OrderController {
|
||||
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
|
||||
productId.append(ordersEntitys.getProductCode()+",");
|
||||
productName.append(ordersEntitys.getProductName()+",");
|
||||
|
||||
memberId = ordersEntitys.getMemberId();
|
||||
mobile = ordersEntitys.getPhoneNumber();
|
||||
buyCount = buyCount + ordersEntitys.getBuyCount();
|
||||
@ -187,17 +196,23 @@ public class OrderController {
|
||||
ordersEntity.setBuyCount(buyCount);
|
||||
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
||||
ordersEntity.setOrderStatus("0");
|
||||
ordersEntity.setBasePoint(basePoint);
|
||||
|
||||
|
||||
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||
return wxpayService.dounifiedOrder(wxPayEntity);
|
||||
}else {
|
||||
return null;
|
||||
|
||||
Map<String, String> returnMap = new HashMap<>();
|
||||
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")
|
||||
public ResponseDTO<String> repayOrderWX(String orderNo) throws Exception {
|
||||
OrderEntity ordersEntity = orderService.findByOrderId(orderNo);
|
||||
@ -212,7 +227,31 @@ public class OrderController {
|
||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||
wxPayEntity.setTotal_fee(jsonObject.getString("salesAmount"));
|
||||
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 {
|
||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,orderInfo);
|
||||
}
|
||||
@ -239,11 +278,7 @@ public class OrderController {
|
||||
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 = "取消订单")
|
||||
@RequestMapping(value = "royalcanin/cancelOrder",method = RequestMethod.POST)
|
||||
|
@ -226,9 +226,18 @@ public class OrderService {
|
||||
long elapsedTime = acceptTime - startTime;
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
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);
|
||||
return afterDecodeResult;
|
||||
|
||||
return jsonArray.toJSONString();
|
||||
}
|
||||
|
||||
public ResponseDTO<String> addOperatreFullData(String type, String params, String result, Long startTime, Long elapsedTime, Long acceptTime){
|
||||
|
@ -19,7 +19,7 @@ public class MyConfig implements WXPayConfig {
|
||||
public String notify_url = "https://royalcanincn.escase.cn/jc/royalcanin/royalcanin/updateOrderWX";
|
||||
|
||||
// 微信支付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";
|
||||
|
@ -68,7 +68,7 @@ public class WxpayService {
|
||||
try {
|
||||
Map<String, String> resp = wxpay.unifiedOrder(data);
|
||||
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) {
|
||||
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.setContentType("text/html");
|
||||
response.getWriter().println("SUCCESS");
|
||||
QueryEntity queryEntity = new QueryEntity();
|
||||
queryEntity.setOrderNumber(outTradeNo);
|
||||
String orderEntityJson = orderService.query(queryEntity);
|
||||
orderService.completeOrder(totalFee,orderEntityJson);
|
||||
}
|
||||
}else {
|
||||
// 未成功,就都处理为失败订单
|
||||
@ -168,7 +164,7 @@ public class WxpayService {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, String> dounifiedOrder(WxPayEntity wxPayEntity) throws Exception {
|
||||
public String dounifiedOrder(WxPayEntity wxPayEntity) throws Exception {
|
||||
//返回参数
|
||||
Map<String, String> returnMap = new HashMap<>();
|
||||
WXPay wxpay = new WXPay(config);
|
||||
@ -194,18 +190,20 @@ public class WxpayService {
|
||||
if (returnCode.equals("SUCCESS")) {
|
||||
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);
|
||||
return response.get("mweb_url") == null ? response.get("err_code_des"):returnMap.get("url");
|
||||
} else {
|
||||
returnMap.put("ok", "201");
|
||||
returnMap.put("url",null);
|
||||
return returnMap;
|
||||
return returnMap.get("url");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
return "Error";
|
||||
//系统等其他错误的时候
|
||||
}
|
||||
return returnMap;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user