Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
87485666
Commit
87485666
authored
May 17, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
f6d7ceb5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
846 additions
and
153 deletions
+846
-153
doc/若依环境使用手册.docx
+0
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/AppController.java
+11
-4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
+10
-3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineApiController.java
+27
-10
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MaterialController.java
+1
-1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderController.java
+1
-1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderRefundController.java
+51
-22
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/WeixinController.java
+36
-11
ruoyi-admin/src/main/resources/apiclient_cert.p12
+0
-0
ruoyi-admin/src/main/resources/apiclient_cert.pem
+23
-0
ruoyi-admin/src/main/resources/apiclient_key.pem
+28
-0
ruoyi-admin/src/main/resources/application.yml
+2
-2
ruoyi-admin/src/main/resources/wxpay.properties
+24
-0
ruoyi-common/src/main/java/com/ruoyi/common/utils/GenerateCode.java
+8
-0
ruoyi-framework/pom.xml
+2
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/HttpClientUtils.java
+168
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
+0
-0
ruoyi-system/pom.xml
+9
-0
ruoyi-system/src/main/java/com/ruoyi/system/config/WeChatPayConfig.java
+55
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/GoodsSku.java
+10
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/Order.java
+12
-1
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderDetail.java
+2
-1
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderRefund.java
+30
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ResultVo.java
+25
-4
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/GoodsVo.java
+35
-10
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/ImagesVo.java
+5
-3
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/OrderTakingVo.java
+10
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/RecommendVo.java
+3
-3
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/SkuVo.java
+32
-5
ruoyi-system/src/main/java/com/ruoyi/system/mapper/GoodsMapper.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderRefundService.java
+3
-1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsCategoryServiceImpl.java
+1
-4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
+8
-6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineApiServiceImpl.java
+96
-20
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderRefundServiceImpl.java
+37
-3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
+12
-7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderTakingServiceImpl.java
+26
-10
ruoyi-system/src/main/java/com/ruoyi/system/utils/OrderLogUtils.java
+15
-0
ruoyi-system/src/main/resources/mapper/system/GoodsMapper.xml
+4
-0
ruoyi-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+6
-1
ruoyi-system/src/main/resources/mapper/system/OrderMapper.xml
+3
-8
ruoyi-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
+1
-1
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+2
-1
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
+10
-10
No files found.
doc/若依环境使用手册.docx
deleted
100644 → 0
View file @
f6d7ceb5
File deleted
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/AppController.java
View file @
87485666
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.framework.web.service.TokenService
;
import
com.ruoyi.framework.web.service.TokenService
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.service.impl.AppServiceImpl
;
import
com.ruoyi.system.service.impl.AppServiceImpl
;
import
com.ruoyi.system.service.impl.OrderServiceImpl
;
import
com.ruoyi.system.service.impl.OrderServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -10,10 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -10,10 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/app"
)
@RequestMapping
(
"/app"
)
public
class
AppController
{
public
class
AppController
extends
BaseController
{
@Autowired
@Autowired
private
TokenService
tokenService
;
private
TokenService
tokenService
;
@Autowired
@Autowired
...
@@ -24,13 +29,15 @@ public class AppController {
...
@@ -24,13 +29,15 @@ public class AppController {
@RequestMapping
(
"/getMyOrder"
)
@RequestMapping
(
"/getMyOrder"
)
public
AjaxResult
getMyOrder
(
HttpServletRequest
request
){
public
TableDataInfo
getMyOrder
(
HttpServletRequest
request
){
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
){
if
(
loginUser
==
null
){
return
AjaxResult
.
error
(
"请先登录"
);
throw
new
ServiceException
(
"请先登录"
);
}
}
String
openId
=
loginUser
.
getOpenId
();
String
openId
=
loginUser
.
getOpenId
();
return
AjaxResult
.
success
(
orderService
.
getMyOrder
(
openId
));
startPage
();
List
<
Order
>
myOrder
=
orderService
.
getMyOrder
(
openId
);
return
getDataTable
(
myOrder
);
}
}
@RequestMapping
(
"/refundOrder"
)
@RequestMapping
(
"/refundOrder"
)
public
AjaxResult
refundOrder
(
String
orderId
){
public
AjaxResult
refundOrder
(
String
orderId
){
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
View file @
87485666
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -41,7 +42,7 @@ public class ApplicationController {
...
@@ -41,7 +42,7 @@ public class ApplicationController {
String
key
=
machineCode
+
"_"
+
id
;
String
key
=
machineCode
+
"_"
+
id
;
stringRedisTemplate
.
opsForValue
().
set
(
key
,
body
);
stringRedisTemplate
.
opsForValue
().
set
(
key
,
body
);
stringRedisTemplate
.
expire
(
id
,
1
,
TimeUnit
.
HOURS
);
stringRedisTemplate
.
expire
(
id
,
1
,
TimeUnit
.
HOURS
);
return
AjaxResult
.
success
(
id
);
return
AjaxResult
.
success
(
"处理成功"
,
key
);
}
}
@RequestMapping
(
"/getData"
)
@RequestMapping
(
"/getData"
)
public
AjaxResult
getApplicationData
(
String
key
){
public
AjaxResult
getApplicationData
(
String
key
){
...
@@ -54,12 +55,18 @@ public class ApplicationController {
...
@@ -54,12 +55,18 @@ public class ApplicationController {
map
.
put
(
"type"
,
"1"
);
map
.
put
(
"type"
,
"1"
);
map
.
put
(
"code"
,
"200"
);
map
.
put
(
"code"
,
"200"
);
jiGuangPushService
.
push
(
keys
[
0
],
map
);
jiGuangPushService
.
push
(
keys
[
0
],
map
);
return
AjaxResult
.
success
(
s
);
return
AjaxResult
.
success
(
"处理成功"
,
s
);
}
}
@RequestMapping
(
"/jgRegister"
)
@RequestMapping
(
"/jgRegister"
)
public
AjaxResult
jgRegister
(
String
machineCode
,
String
registerId
){
public
AjaxResult
jgRegister
(
@RequestParam
String
machineCode
,
@RequestParam
String
registerId
){
Machine
machine
=
new
Machine
();
Machine
machine
=
new
Machine
();
machine
.
setId
(
machineCode
);
machine
.
setId
(
machineCode
);
List
<
Machine
>
machines
=
machineService
.
selectMachineList
(
machine
);
if
(
machines
==
null
||
machines
.
isEmpty
()){
return
AjaxResult
.
error
(
"该机器未绑定店铺,请先绑定店铺"
);
}
machine
.
setRegister
(
registerId
);
machine
.
setRegister
(
registerId
);
return
AjaxResult
.
success
(
machineService
.
updateMachine
(
machine
));
return
AjaxResult
.
success
(
machineService
.
updateMachine
(
machine
));
}
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineApiController.java
View file @
87485666
...
@@ -2,31 +2,48 @@ package com.ruoyi.web.controller.coffee;
...
@@ -2,31 +2,48 @@ package com.ruoyi.web.controller.coffee;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.domain.vo.ResultVo
;
import
com.ruoyi.system.service.impl.MachineApiServiceImpl
;
import
com.ruoyi.system.service.impl.MachineApiServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
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.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"/v1"
)
@RequestMapping
(
"/v1"
)
@Slf4j
public
class
MachineApiController
{
public
class
MachineApiController
{
@Autowired
@Autowired
private
MachineApiServiceImpl
machineApiService
;
private
MachineApiServiceImpl
machineApiService
;
@PostMapping
(
"/down/material/update"
)
@PostMapping
(
"/down/material/update"
)
public
AjaxResult
shopGoodsUpdate
(
@RequestBody
String
body
){
public
ResultVo
shopGoodsUpdate
(
@RequestBody
String
body
){
log
.
info
(
"/down/material/update 请求内容为 【{}】"
,
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
return
AjaxResult
.
success
(
machineApiService
.
shopGoodsUpdate
(
jsonObject
));
return
ResultVo
.
success
(
machineApiService
.
shopGoodsUpdate
(
jsonObject
));
}
}
@PostMapping
(
"/down/order/update"
)
@PostMapping
(
"/down/order/update"
)
public
AjaxResult
updateOrder
(
@RequestBody
String
body
){
public
ResultVo
updateOrder
(
@RequestBody
String
body
){
log
.
info
(
"/down/order/update 请求内容为 【{}】"
,
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
return
AjaxResult
.
success
(
machineApiService
.
updateOrder
(
jsonObject
));
return
ResultVo
.
success
(
machineApiService
.
updateOrder
(
jsonObject
));
}
}
@PostMapping
(
"/down/robot/status"
)
@PostMapping
(
"/down/robot/status"
)
public
AjaxResult
robotUpdate
(
@RequestBody
String
body
){
public
ResultVo
robotUpdate
(
@RequestBody
String
body
){
return
null
;
log
.
info
(
"/down/robot/status 请求内容为 【{}】"
,
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
try
{
return
ResultVo
.
success
(
machineApiService
.
robotUpdate
(
jsonObject
));
}
catch
(
Exception
e
){
return
ResultVo
.
error
(
e
.
getMessage
());
}
}
}
@GetMapping
(
"/testOrder"
)
public
void
testOrder
(
String
orderId
){
machineApiService
.
testOrder
(
orderId
);
}
@GetMapping
(
"/testOrderUpdate"
)
public
void
testOrderUpdate
(
String
orderId
){
machineApiService
.
testOrderUpdate
(
orderId
);
}
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MaterialController.java
View file @
87485666
...
@@ -77,7 +77,7 @@ public class MaterialController extends BaseController
...
@@ -77,7 +77,7 @@ public class MaterialController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:material:remove')"
)
@PreAuthorize
(
"@ss.hasPermi('system:material:remove')"
)
@Log
(
title
=
"原料"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"原料"
,
businessType
=
BusinessType
.
DELETE
)
@
DeleteMapping
(
"/{id}
"
)
@
RequestMapping
(
"/remove
"
)
public
AjaxResult
remove
(
@RequestParam
String
id
)
public
AjaxResult
remove
(
@RequestParam
String
id
)
{
{
return
materialService
.
deleteMaterialById
(
id
);
return
materialService
.
deleteMaterialById
(
id
);
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderController.java
View file @
87485666
...
@@ -88,7 +88,7 @@ public class OrderController extends BaseController
...
@@ -88,7 +88,7 @@ public class OrderController extends BaseController
return
ajaxResult
;
return
ajaxResult
;
}
}
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
Map
payInfo
=
weixinService
.
pay
ment
(
amount
,
order
.
getOrderDetails
().
get
(
0
).
getGoodsName
(),
order
.
getOrderNo
(),
loginUser
.
getOpenId
()
);
Map
payInfo
=
weixinService
.
pay
(
request
,
"hooloo"
,
order
.
getOrderNo
(),
order
.
getUserId
(),
amount
);
if
(
payInfo
!=
null
){
if
(
payInfo
!=
null
){
return
AjaxResult
.
success
(
payInfo
);
return
AjaxResult
.
success
(
payInfo
);
}
else
{
}
else
{
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderRefundController.java
View file @
87485666
...
@@ -58,33 +58,62 @@ public class OrderRefundController extends BaseController
...
@@ -58,33 +58,62 @@ public class OrderRefundController extends BaseController
/**
/**
* 新增订单退款
* 新增订单退款
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:refund:add')"
)
@Log
(
title
=
"订单退款"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"订单退款"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
OrderRefund
orderRefund
)
public
AjaxResult
add
(
@RequestBody
OrderRefund
orderRefund
)
{
{
return
toAjax
(
orderRefundService
.
insertOrderRefund
(
orderRefund
));
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
}
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
if
(
obejct
!=
null
&&
obejct
instanceof
OrderRefund
){
/**
* 修改订单退款
*/
@PreAuthorize
(
"@ss.hasPermi('system:refund:edit')"
)
@Log
(
title
=
"订单退款"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
OrderRefund
orderRefund
)
{
return
toAjax
(
orderRefundService
.
updateOrderRefund
(
orderRefund
));
}
/**
}
* 删除订单退款
*/
return
ajaxResult
;
@PreAuthorize
(
"@ss.hasPermi('system:refund:remove')"
)
@Log
(
title
=
"订单退款"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
orderRefundService
.
deleteOrderRefundByIds
(
ids
));
}
}
// public void refund(HttpServletRequest request,
// String openid,
// int activityid,
// int memberid) throws Exception {
// //先将订单信息查出来 这里的订单就是上边说的支付订单,我的是通过openid和一个activityid查出来的,自己可根据业务逻辑修改。
// QueryWrapper<Wxpaynotifyvo> wxPayNotifyVOQueryWrapper = new QueryWrapper<>();
// wxPayNotifyVOQueryWrapper.eq("openid", openid);
// wxPayNotifyVOQueryWrapper.eq("activityid", activityid);
// Wxpaynotifyvo wxPayNotifyVO = this.wxPayService.getBaseMapper().selectOne(wxPayNotifyVOQueryWrapper);
// //构建参数
// Map<String, String> dataMap = new HashMap<>();
// //小程序ID
// dataMap.put("appid", WechatConstant.APPID);
// //商户号
// dataMap.put("mch_id", WechatConstant.MCH_ID);
// //随机字符串
// dataMap.put("nonce_str", UUID.randomUUID().toString().replaceAll("-", ""));
// //微信订单号
// dataMap.put("transaction_id", wxPayNotifyVO.getTransactionid());
// //商户退款单号
// Date now = new Date();
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");//可以方便地修改日期格式
// String outRefundNo = "NO" + dateFormat.format(now);
// dataMap.put("out_refund_no", outRefundNo);
// //订单金额
// dataMap.put("total_fee", wxPayNotifyVO.getTotalfee());
//
// //退款金额
// dataMap.put("refund_fee", wxPayNotifyVO.getTotalfee());
// //商户证书密钥,生成签名
// String sign = WXPayUtil.generateSignature(dataMap, WechatConstant.KEY);
// dataMap.put("sign", sign);
// //这个是将报名表里的数据删除
// int i = applymanService.deleteApplyman(openid, activityid, memberid);
// //这个不是
// this.wxPayService.refound(dataMap);
// Res res = new Res();
// res.setCode(0);
// res.setMsg("退款成功!");
// return res;
// }
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/WeixinController.java
View file @
87485666
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse
;
import
com.github.wxpay.sdk.WXPayUtil
;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.framework.web.service.WeixinServiceImpl
;
import
com.ruoyi.framework.web.service.WeixinServiceImpl
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.mapper.GoodsSkuMapper
;
import
com.ruoyi.system.mapper.GoodsSkuMapper
;
import
com.ruoyi.system.mapper.OrderMapper
;
import
com.ruoyi.system.service.impl.AppServiceImpl
;
import
com.ruoyi.system.service.impl.AppServiceImpl
;
import
com.ruoyi.system.service.impl.GoodsServiceImpl
;
import
com.ruoyi.system.service.impl.GoodsServiceImpl
;
import
com.ruoyi.system.service.impl.OrderTakingServiceImpl
;
import
com.ruoyi.system.service.impl.OrderTakingServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
import
java.util.HashMap
;
import
java.util.Map
;
@RestController
@RestController
@RequestMapping
(
"/weixin"
)
@RequestMapping
(
"/weixin"
)
@Slf4j
public
class
WeixinController
{
public
class
WeixinController
{
@Autowired
@Autowired
...
@@ -26,7 +34,7 @@ public class WeixinController {
...
@@ -26,7 +34,7 @@ public class WeixinController {
@Autowired
@Autowired
private
OrderTakingServiceImpl
orderTakingService
;
private
OrderTakingServiceImpl
orderTakingService
;
@Autowired
@Autowired
private
GoodsServiceImpl
goodsService
;
private
OrderMapper
orderMapper
;
//这个就是那个使用传code进来的接口
//这个就是那个使用传code进来的接口
@PostMapping
(
"/login"
)
@PostMapping
(
"/login"
)
...
@@ -43,17 +51,22 @@ public class WeixinController {
...
@@ -43,17 +51,22 @@ public class WeixinController {
return
ajax
;
return
ajax
;
}
}
@RequestMapping
(
"/wxNotify"
)
/**
public
void
wxNotify
(
HttpServletRequest
request
,
HttpServletResponse
response
){
* 支付通知
try
{
* 微信支付通过支付通知接口将用户支付成功消息通知给商户
weixinService
.
wxNotify
(
request
,
response
);
*/
}
catch
(
Exception
e
){
@PostMapping
(
"/native/notify"
)
throw
new
ServiceException
(
"微信回调发生异常"
);
public
String
wxNotify
(
HttpServletRequest
request
)
throws
Exception
{
}
System
.
out
.
println
(
"微信发送的回调"
);
return
weixinService
.
wxNotify
(
request
);
}
}
@RequestMapping
(
"/test"
)
@RequestMapping
(
"/test"
)
public
String
test
(){
public
Map
<
String
,
String
>
test
(
HttpServletRequest
request
)
throws
Exception
{
return
goodsService
.
test
();
Order
order
=
orderMapper
.
selectOrderById
(
"8"
);
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
return
null
;
}
}
@RequestMapping
(
"/getShop"
)
@RequestMapping
(
"/getShop"
)
...
@@ -68,5 +81,17 @@ public class WeixinController {
...
@@ -68,5 +81,17 @@ public class WeixinController {
return
AjaxResult
.
success
(
orderTakingService
.
getInfoByShop
(
shopId
));
return
AjaxResult
.
success
(
orderTakingService
.
getInfoByShop
(
shopId
));
}
}
/**
* 退款回调
*
* @param xmlData
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/refundNotify"
)
public
String
refundNotify
(
@RequestBody
String
xmlData
)
{
// 实现自己的逻辑
//
// 必须要返回 SUCCESS 不过有 WxPayNotifyResponse 给整合成了 xml了
return
WxPayNotifyResponse
.
success
(
"成功"
);
}
}
}
ruoyi-admin/src/main/resources/apiclient_cert.p12
0 → 100644
View file @
87485666
File added
ruoyi-admin/src/main/resources/apiclient_cert.pem
0 → 100644
View file @
87485666
-----BEGIN CERTIFICATE-----
MIID6TCCAtGgAwIBAgIUY1A0gVLJqFAXYGiYwe6SS717wxMwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
Q0EwHhcNMjIwNTA3MDY1NDAzWhcNMjcwNTA2MDY1NDAzWjB7MRMwEQYDVQQDDAox
NjI1NTExMjU3MRswGQYDVQQKDBLlvq7kv6HllYbmiLfns7vnu58xJzAlBgNVBAsM
HuWMl+S6rOWlvemlruenkeaKgOaciemZkOWFrOWPuDELMAkGA1UEBgwCQ04xETAP
BgNVBAcMCFNoZW5aaGVuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
7pKD1B7URk6wzW06tWdtKynjuDF8GB+Q6DWUygziXONpjLyN9xkGeowC3dQvBQvH
4zhI5sYv2xUvBGhkgAUffimcsmVwZ/VP5o3ZThC0lYLkmqc4xl37cHMX8PbFUtmA
tlVg2UntiqP7K5qQev8+cULeWT0R5i48eIXv+vptzUbak/3s7mn/Bjlrl6n5l0kY
07XG8ycEbNp8dsD1dGQEfIx/RuMyHdWFSxBIXsTU4rjnVBkVbkb6mgqeNlWLHKp6
2zW9mh92vWXIRJNbaihn5KQq7JJODZUh5ba6PZFzxcySxGN5bpfcR7vNB32BvwQZ
xryP5oPRhcRoy6mwUY0g5wIDAQABo4GBMH8wCQYDVR0TBAIwADALBgNVHQ8EBAMC
BPAwZQYDVR0fBF4wXDBaoFigVoZUaHR0cDovL2V2Y2EuaXRydXMuY29tLmNuL3B1
YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRCMDZBRDM5NzU0OTg0NkMw
MUMzRThFQkQyMA0GCSqGSIb3DQEBCwUAA4IBAQCx7nNyOMU5pk8ks5L1d8tBl7Sb
b7avp5W3fR6LEtY7/JYJpH1SIyMGmFv0Qoq+sbnVzTzc3HMnE3yswKoT4J58MFuV
glvYTPuGIN7GUQ6xvGel1MG9zT6PfDJG5+yc8HeE6Z9kkYKSdbZD8vqeIgsJUO0u
LpFBx5FseR9wfe0x2xDk+mdrge+HR+VMUTHO5H8Awpi4IDNmLqU7RgNyLTSePV49
GvI1qk+g8iex+NftC8U/lj8AUEBoBGh+7e+zNHUirBJzbcVvHu8h9HBqwGPF2Zji
IU4S4joAZPpZVyqkg7yviAAOCsvRoAvEJxB1u8QGhJL0mvwrDk4eR5gpeDOc
-----END CERTIFICATE-----
ruoyi-admin/src/main/resources/apiclient_key.pem
0 → 100644
View file @
87485666
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDukoPUHtRGTrDN
bTq1Z20rKeO4MXwYH5DoNZTKDOJc42mMvI33GQZ6jALd1C8FC8fjOEjmxi/bFS8E
aGSABR9+KZyyZXBn9U/mjdlOELSVguSapzjGXftwcxfw9sVS2YC2VWDZSe2Ko/sr
mpB6/z5xQt5ZPRHmLjx4he/6+m3NRtqT/ezuaf8GOWuXqfmXSRjTtcbzJwRs2nx2
wPV0ZAR8jH9G4zId1YVLEEhexNTiuOdUGRVuRvqaCp42VYscqnrbNb2aH3a9ZchE
k1tqKGfkpCrskk4NlSHltro9kXPFzJLEY3lul9xHu80HfYG/BBnGvI/mg9GFxGjL
qbBRjSDnAgMBAAECggEALiMDf4gewSICqxeOnPpNcGV/dmWLfBbOrTl/drubIx+P
j/n+8mRSjmx5OXEJTs6Cb3y5DHgTVSj5mL6fgOp8tqdReGaJoHEebJXOCnzMj4Vq
tEXWgvY14/8+CAmRC36ol5pXSm4zk/Y2Yq5XdpHZ/4lQ+q0Gwx757szoJf88MNA9
Yv5YEkW4glGlZLeP1sJD0UXZJrkC0FidQas0VhD7LuPbvmn49+gSU8PqpOg8IHSq
LaVlesP/sMdBE0zVI3Q2Qa2Ilzre5GdTEWDHtWPD0i+9oHT/B4MfCl4cNfkKrPrr
3mv2knhQyQbPVvStU5s8s4cguvlQ3m12JHO9ljBEQQKBgQD9kxzEJnWbnbd2evk4
liZYViF37rM22ZoUdjMt7663mqr3xKmQmJyVe31wBk5a3LkJKE4yn90GYIJwrDuP
JeIBlXq0Az0gFQ4WbVYEdaAyRy02Blnjg6v7XTZgqN4KzPGoYsX4FiKpLAjb8uU+
QXXnWIcHqQSOki4aUoMmxHj9MQKBgQDw2qs09/3dsPABqx0CKM3dYlupnimFZcZ+
f3lWinVdsLyDI+b9YxsUAqv21EOOAZ7cOcdZP71oB3XMxp56zo9lzY1C8EuIFB6A
lPM6eK73fAY15ShO0M48CPusHJLBcUnpQ3EMOVVr9gQiNXAP7/NEB0eBAcnWuznI
zJL2v1YZlwKBgAiBJJfXil47vel1WmJxdrvDt7+j+9K9HZPOGw1RWpTB1TYWHHHD
DI1e5Oga7gnSGUqbVXQRNIKAPh+1RxIX/Sp8bu8WpLgsvJo39IiVwVeuV2/WarFc
uynlCGvZfgjysrApD+awJ11xIqLt1I5v95pYt76kBokZkf5EAi4MrNohAoGAA7RZ
TcdCsFY4Ws429AGMqQsKPeGg4dxe4TM0upAGnhpJy/qRYvRTRkuEOZeqMlT0DI8W
8dh5IVB8D1o+tcTXj8lJku3/O2iTz4Z69ztD9aqCrfGIXS34/hNlS5Bk8XS8nknb
Q0Tee3qdNal8v8IBC9rQzrsoT5UxnlUHLaRjvqECgYB576KkTxeFv1CpDWYx0xdh
fmT8dasjt0x2g4nbjtF7gYjsxyFpcsqp5BPb5CibveV0DRe4aiwow9vsF73GY+tB
EHcbEHtL/G05TRZU2Jlcl+Kp7G2Vw79XXHTOjaFG4c7kanQNEphiN/TxqcgsoBMs
c1aZ1izfTzyR4a2AWL5xeQ==
-----END PRIVATE KEY-----
ruoyi-admin/src/main/resources/application.yml
View file @
87485666
...
@@ -134,12 +134,12 @@ weixin:
...
@@ -134,12 +134,12 @@ weixin:
#商户支付密钥
#商户支付密钥
key
:
WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr
key
:
WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr
#微信回调地址
#微信回调地址
notify-url
:
http://1
27.0.0.1/weixin/wxN
otify
notify-url
:
http://1
14.115.234.81:8080/weixin/native/n
otify
#交易类型
#交易类型
trade-type
:
JSAPI
trade-type
:
JSAPI
url
:
https://api.mch.weixin.qq.com/pay/unifiedorder
url
:
https://api.mch.weixin.qq.com/pay/unifiedorder
query-url
:
https://api.mch.weixin.qq.com/pay/orderquery
query-url
:
https://api.mch.weixin.qq.com/pay/orderquery
cert-path
:
zzz
cert-path
:
classpath:apiclient_cert.p12
#mqtt:
#mqtt:
# url: tcp://iot-06z00dhgql5j8bw.mqtt.iothub.aliyuncs.com:1883
# url: tcp://iot-06z00dhgql5j8bw.mqtt.iothub.aliyuncs.com:1883
# clientId: h5kgirX6kNQ.XQ_000001A|securemode=2,signmethod=hmacsha256,timestamp=1651746531320|
# clientId: h5kgirX6kNQ.XQ_000001A|securemode=2,signmethod=hmacsha256,timestamp=1651746531320|
...
...
ruoyi-admin/src/main/resources/wxpay.properties
0 → 100644
View file @
87485666
wxpay.mch-id
=
1625511257
wxpay.mch-serial-no
=
da8a0b08436dd3ce560be429f14e768a
wxpay.private-key-path
=
apiclient_key.pem
wxpay.api-v3-key
=
xRu8KoCwVWbKZ8tlca3JfAZkMSV2p7tY
wxpay.appid
=
wx71aa3662dfd3227d
wxpay.domain
=
https://api.mch.weixin.qq.com
wxpay.notify-domain
=
https://500c-219-143-130-12.ngrok.io
wxpay.partnerKey
:
T6m9iK73b0kn9g5v426MKfHQH7X8rKwb
appid
:
wx71aa3662dfd3227d
secret
:
da8a0b08436dd3ce560be429f14e768a
mchid
:
1625511257
#??????
key
:
WcCsQZXavaPXQEKuTGJlGOkzzTPxTPsr
#??????
notify-url
:
http://127.0.0.1/weixin/wxNotify
#????
trade-type
:
JSAPI
url
:
https://api.mch.weixin.qq.com/pay/unifiedorder
query-url
:
https://api.mch.weixin.qq.com/pay/orderquery
cert-path
:
zzz
\ No newline at end of file
ruoyi-common/src/main/java/com/ruoyi/common/utils/GenerateCode.java
View file @
87485666
...
@@ -12,6 +12,14 @@ public class GenerateCode {
...
@@ -12,6 +12,14 @@ public class GenerateCode {
int
andIncrement
=
entityIdCounter
.
incrementAndGet
();
int
andIncrement
=
entityIdCounter
.
incrementAndGet
();
String
number
=
String
.
format
(
"%03d"
,
andIncrement
);
String
number
=
String
.
format
(
"%03d"
,
andIncrement
);
return
prefix
+
number
;
return
prefix
+
number
;
}
public
static
String
getCode
(
String
prefix
,
String
fromat
){
StringRedisTemplate
stringRedisTemplate
=
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
);
RedisAtomicInteger
entityIdCounter
=
new
RedisAtomicInteger
(
prefix
,
stringRedisTemplate
.
getConnectionFactory
());
int
andIncrement
=
entityIdCounter
.
incrementAndGet
();
String
number
=
String
.
format
(
fromat
,
andIncrement
);
return
prefix
+
number
;
}
}
}
}
ruoyi-framework/pom.xml
View file @
87485666
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/HttpClientUtils.java
0 → 100644
View file @
87485666
package
com
.
ruoyi
.
framework
.
web
.
service
;
import
org.apache.http.Consts
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.ClientProtocolException
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.*
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.conn.ssl.SSLContextBuilder
;
import
org.apache.http.conn.ssl.TrustStrategy
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.util.EntityUtils
;
import
javax.net.ssl.SSLContext
;
import
java.io.IOException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
/**
* http请求客户端
*/
public
class
HttpClientUtils
{
private
String
url
;
private
Map
<
String
,
String
>
param
;
private
int
statusCode
;
private
String
content
;
private
String
xmlParam
;
private
boolean
isHttps
;
public
boolean
isHttps
()
{
return
isHttps
;
}
public
void
setHttps
(
boolean
isHttps
)
{
this
.
isHttps
=
isHttps
;
}
public
String
getXmlParam
()
{
return
xmlParam
;
}
public
void
setXmlParam
(
String
xmlParam
)
{
this
.
xmlParam
=
xmlParam
;
}
public
HttpClientUtils
(
String
url
,
Map
<
String
,
String
>
param
)
{
this
.
url
=
url
;
this
.
param
=
param
;
}
public
HttpClientUtils
(
String
url
)
{
this
.
url
=
url
;
}
public
void
setParameter
(
Map
<
String
,
String
>
map
)
{
param
=
map
;
}
public
void
addParameter
(
String
key
,
String
value
)
{
if
(
param
==
null
)
param
=
new
HashMap
<
String
,
String
>();
param
.
put
(
key
,
value
);
}
public
void
post
()
throws
ClientProtocolException
,
IOException
{
HttpPost
http
=
new
HttpPost
(
url
);
setEntity
(
http
);
execute
(
http
);
}
public
void
put
()
throws
ClientProtocolException
,
IOException
{
HttpPut
http
=
new
HttpPut
(
url
);
setEntity
(
http
);
execute
(
http
);
}
public
void
get
()
throws
ClientProtocolException
,
IOException
{
if
(
param
!=
null
)
{
StringBuilder
url
=
new
StringBuilder
(
this
.
url
);
boolean
isFirst
=
true
;
for
(
String
key
:
param
.
keySet
())
{
if
(
isFirst
)
{
url
.
append
(
"?"
);
isFirst
=
false
;
}
else
{
url
.
append
(
"&"
);
}
url
.
append
(
key
).
append
(
"="
).
append
(
param
.
get
(
key
));
}
this
.
url
=
url
.
toString
();
}
HttpGet
http
=
new
HttpGet
(
url
);
execute
(
http
);
}
/**
* set http post,put param
*/
private
void
setEntity
(
HttpEntityEnclosingRequestBase
http
)
{
if
(
param
!=
null
)
{
List
<
NameValuePair
>
nvps
=
new
LinkedList
<
NameValuePair
>();
for
(
String
key
:
param
.
keySet
())
nvps
.
add
(
new
BasicNameValuePair
(
key
,
param
.
get
(
key
)));
// 参数
http
.
setEntity
(
new
UrlEncodedFormEntity
(
nvps
,
Consts
.
UTF_8
));
// 设置参数
}
if
(
xmlParam
!=
null
)
{
http
.
setEntity
(
new
StringEntity
(
xmlParam
,
Consts
.
UTF_8
));
}
}
private
void
execute
(
HttpUriRequest
http
)
throws
ClientProtocolException
,
IOException
{
CloseableHttpClient
httpClient
=
null
;
try
{
if
(
isHttps
)
{
SSLContext
sslContext
=
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
new
TrustStrategy
()
{
// 信任所有
public
boolean
isTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
return
true
;
}
}).
build
();
SSLConnectionSocketFactory
sslsf
=
new
SSLConnectionSocketFactory
(
sslContext
);
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
sslsf
)
.
build
();
}
else
{
httpClient
=
HttpClients
.
createDefault
();
}
CloseableHttpResponse
response
=
httpClient
.
execute
(
http
);
try
{
if
(
response
!=
null
)
{
if
(
response
.
getStatusLine
()
!=
null
)
statusCode
=
response
.
getStatusLine
().
getStatusCode
();
HttpEntity
entity
=
response
.
getEntity
();
// 响应内容
content
=
EntityUtils
.
toString
(
entity
,
Consts
.
UTF_8
);
}
}
finally
{
response
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
httpClient
.
close
();
}
}
public
int
getStatusCode
()
{
return
statusCode
;
}
public
String
getContent
()
throws
ParseException
,
IOException
{
return
content
;
}
}
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
View file @
87485666
This diff is collapsed.
Click to expand it.
ruoyi-system/pom.xml
View file @
87485666
...
@@ -80,6 +80,14 @@
...
@@ -80,6 +80,14 @@
<version>
3.2.9
</version>
<version>
3.2.9
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-pay
</artifactId>
<version>
4.1.0
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/config/WeChatPayConfig.java
0 → 100644
View file @
87485666
package
com
.
ruoyi
.
system
.
config
;
import
com.github.binarywang.wxpay.config.WxPayConfig
;
import
com.github.binarywang.wxpay.service.WxPayService
;
import
com.github.binarywang.wxpay.service.impl.WxPayServiceImpl
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Component
;
@Component
public
class
WeChatPayConfig
{
@Value
(
"${weixin.appid}"
)
private
String
appid
;
@Value
(
"${weixin.secret}"
)
private
String
secret
;
@Value
(
"${weixin.mchid}"
)
private
String
mchId
;
@Value
(
"${weixin.key}"
)
private
String
key
;
@Value
(
"${weixin.notify-url}"
)
private
String
notifyUrl
;
@Value
(
"${weixin.trade-type}"
)
private
String
tradeType
;
@Value
(
"${weixin.url}"
)
private
String
url
;
@Value
(
"${weixin.query-url}"
)
private
String
queryUrl
;
@Value
(
"${weixin.cert-path}"
)
private
String
certPath
;
@Bean
@ConditionalOnMissingBean
public
WxPayConfig
payConfig
()
{
WxPayConfig
payConfig
=
new
WxPayConfig
();
payConfig
.
setAppId
(
appid
);
payConfig
.
setMchId
(
mchId
);
payConfig
.
setMchKey
(
key
);
payConfig
.
setKeyPath
(
certPath
);
payConfig
.
setTradeType
(
"JSAPI"
);
payConfig
.
setNotifyUrl
(
notifyUrl
);
return
payConfig
;
}
@Bean
public
WxPayService
wxPayService
(
WxPayConfig
payConfig
)
{
WxPayService
wxPayService
=
new
WxPayServiceImpl
();
wxPayService
.
setConfig
(
payConfig
);
return
wxPayService
;
}
}
\ No newline at end of file
ruoyi-system/src/main/java/com/ruoyi/system/domain/GoodsSku.java
View file @
87485666
...
@@ -47,6 +47,16 @@ public class GoodsSku extends BaseEntity
...
@@ -47,6 +47,16 @@ public class GoodsSku extends BaseEntity
@Excel
(
name
=
"价格"
)
@Excel
(
name
=
"价格"
)
private
BigDecimal
price
;
private
BigDecimal
price
;
public
BigDecimal
getDiscount
()
{
return
discount
;
}
public
void
setDiscount
(
BigDecimal
discount
)
{
this
.
discount
=
discount
;
}
private
BigDecimal
discount
;
public
void
setId
(
long
id
)
public
void
setId
(
long
id
)
{
{
this
.
id
=
id
;
this
.
id
=
id
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/Order.java
View file @
87485666
package
com
.
ruoyi
.
system
.
domain
;
package
com
.
ruoyi
.
system
.
domain
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,7 +17,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
...
@@ -16,7 +17,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @author ruoyi
* @date 2022-04-28
* @date 2022-04-28
*/
*/
public
class
Order
extends
BaseEntity
public
class
Order
implements
Serializable
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -91,6 +92,16 @@ public class Order extends BaseEntity
...
@@ -91,6 +92,16 @@ public class Order extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Date
updatedAt
;
private
Shop
shop
;
public
Shop
getShop
()
{
return
shop
;
}
public
void
setShop
(
Shop
shop
)
{
this
.
shop
=
shop
;
}
private
List
<
OrderDetail
>
orderDetails
;
private
List
<
OrderDetail
>
orderDetails
;
public
List
<
OrderDetail
>
getOrderDetails
()
{
public
List
<
OrderDetail
>
getOrderDetails
()
{
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderDetail.java
View file @
87485666
package
com
.
ruoyi
.
system
.
domain
;
package
com
.
ruoyi
.
system
.
domain
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
@@ -14,7 +15,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
...
@@ -14,7 +15,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @author ruoyi
* @date 2022-04-28
* @date 2022-04-28
*/
*/
public
class
OrderDetail
extends
BaseEntity
public
class
OrderDetail
implements
Serializable
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderRefund.java
View file @
87485666
...
@@ -47,6 +47,36 @@ public class OrderRefund extends BaseEntity
...
@@ -47,6 +47,36 @@ public class OrderRefund extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Date
updatedAt
;
private
String
refundNo
;
public
String
getRefundNo
()
{
return
refundNo
;
}
public
void
setRefundNo
(
String
refundNo
)
{
this
.
refundNo
=
refundNo
;
}
public
String
getOrderNo
()
{
return
orderNo
;
}
public
void
setOrderNo
(
String
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
private
String
orderNo
;
public
Order
getOrder
()
{
return
order
;
}
public
void
setOrder
(
Order
order
)
{
this
.
order
=
order
;
}
private
Order
order
;
public
void
setId
(
String
id
)
public
void
setId
(
String
id
)
{
{
this
.
id
=
id
;
this
.
id
=
id
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ResultVo.java
View file @
87485666
...
@@ -2,12 +2,19 @@ package com.ruoyi.system.domain.vo;
...
@@ -2,12 +2,19 @@ package com.ruoyi.system.domain.vo;
public
class
ResultVo
{
public
class
ResultVo
<
T
>
{
private
String
code
;
private
String
code
;
private
String
message
;
private
String
message
;
public
static
ResultVo
error
(
String
message
)
{
ResultVo
resultVo
=
new
ResultVo
();
resultVo
.
setCode
(
"99"
);
resultVo
.
setMessage
(
message
);
return
resultVo
;
}
public
String
getCode
()
{
public
String
getCode
()
{
return
code
;
return
code
;
}
}
...
@@ -24,13 +31,27 @@ public class ResultVo {
...
@@ -24,13 +31,27 @@ public class ResultVo {
this
.
message
=
message
;
this
.
message
=
message
;
}
}
public
String
getData
()
{
public
T
getData
()
{
return
data
;
return
data
;
}
}
public
void
setData
(
String
data
)
{
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
this
.
data
=
data
;
}
}
private
String
data
;
private
T
data
;
public
static
ResultVo
success
(){
ResultVo
resultVo
=
new
ResultVo
();
resultVo
.
setCode
(
"0"
);
return
resultVo
;
}
public
static
<
T
>
ResultVo
success
(
T
t
){
ResultVo
resultVo
=
new
ResultVo
();
resultVo
.
setCode
(
"0"
);
resultVo
.
setData
(
t
);
return
resultVo
;
}
}
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/GoodsVo.java
View file @
87485666
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
import
java.util.List
;
...
@@ -78,27 +79,51 @@ public class GoodsVo {
...
@@ -78,27 +79,51 @@ public class GoodsVo {
this
.
tags
=
tags
;
this
.
tags
=
tags
;
}
}
public
JSONObject
getPics
()
{
return
pics
;
private
String
discount
;
private
String
pictures
;
private
JSONObject
pics
;
public
String
getPictures
()
{
return
pictures
;
}
}
public
void
setPic
s
(
JSONObject
pic
s
)
{
public
void
setPic
tures
(
String
picture
s
)
{
this
.
pic
s
=
pic
s
;
this
.
pic
tures
=
picture
s
;
}
}
public
String
getSpecs
()
{
public
JSONArray
getSpecs
()
{
return
specs
;
return
specs
;
}
}
public
void
setSpecs
(
String
specs
)
{
public
void
setSpecs
(
JSONArray
specs
)
{
this
.
specs
=
specs
;
this
.
specs
=
specs
;
}
}
private
String
discount
;
public
JSONObject
getPics
()
{
private
JSONObject
pics
;
return
pics
;
private
String
desc
;
}
public
String
getSpecString
()
{
return
specString
;
}
public
void
setSpecString
(
String
specString
)
{
this
.
specString
=
specString
;
}
public
void
setPics
(
JSONObject
pics
)
{
this
.
pics
=
pics
;
}
private
String
desc
;
private
String
remarks
;
private
String
remarks
;
private
List
<
String
>
tags
;
private
List
<
String
>
tags
;
private
String
specs
;
private
JSONArray
specs
;
private
String
specString
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/ImagesVo.java
View file @
87485666
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
import
com.alibaba.fastjson.JSONObject
;
public
class
ImagesVo
{
public
class
ImagesVo
{
private
String
left
;
private
String
left
;
...
@@ -12,13 +14,13 @@ public class ImagesVo {
...
@@ -12,13 +14,13 @@ public class ImagesVo {
this
.
left
=
left
;
this
.
left
=
left
;
}
}
public
String
getRight
()
{
public
JSONObject
getRight
()
{
return
right
;
return
right
;
}
}
public
void
setRight
(
String
right
)
{
public
void
setRight
(
JSONObject
right
)
{
this
.
right
=
right
;
this
.
right
=
right
;
}
}
private
String
right
;
private
JSONObject
right
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/OrderTakingVo.java
View file @
87485666
...
@@ -49,11 +49,21 @@ public class OrderTakingVo implements Serializable {
...
@@ -49,11 +49,21 @@ public class OrderTakingVo implements Serializable {
private
String
tips
;
private
String
tips
;
public
String
getShopState
()
{
return
shopState
;
}
public
void
setShopState
(
String
shopState
)
{
this
.
shopState
=
shopState
;
}
private
String
countOfOrder
;
private
String
countOfOrder
;
private
List
<
CategoryVo
>
categorys
;
private
List
<
CategoryVo
>
categorys
;
private
List
<
RecommendVo
>
recommends
;
private
List
<
RecommendVo
>
recommends
;
private
String
shopState
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/RecommendVo.java
View file @
87485666
...
@@ -32,14 +32,14 @@ public class RecommendVo implements Serializable {
...
@@ -32,14 +32,14 @@ public class RecommendVo implements Serializable {
this
.
desc
=
desc
;
this
.
desc
=
desc
;
}
}
public
List
<
GoodsVo
>
getGoods
()
{
public
GoodsVo
getGoods
()
{
return
goods
;
return
goods
;
}
}
public
void
setGoods
(
List
<
GoodsVo
>
goods
)
{
public
void
setGoods
(
GoodsVo
goods
)
{
this
.
goods
=
goods
;
this
.
goods
=
goods
;
}
}
private
String
desc
;
private
String
desc
;
private
List
<
GoodsVo
>
goods
;
private
GoodsVo
goods
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/orderTaking/SkuVo.java
View file @
87485666
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
package
com
.
ruoyi
.
system
.
domain
.
vo
.
orderTaking
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,9 +35,7 @@ public class SkuVo implements Serializable {
...
@@ -32,9 +35,7 @@ public class SkuVo implements Serializable {
this
.
price
=
price
;
this
.
price
=
price
;
}
}
public
String
getRules
()
{
return
rules
;
}
public
String
getIsDefault
()
{
public
String
getIsDefault
()
{
return
isDefault
;
return
isDefault
;
...
@@ -44,15 +45,41 @@ public class SkuVo implements Serializable {
...
@@ -44,15 +45,41 @@ public class SkuVo implements Serializable {
this
.
isDefault
=
isDefault
;
this
.
isDefault
=
isDefault
;
}
}
public
void
setRules
(
String
rules
)
{
public
JSONArray
getRules
()
{
return
rules
;
}
public
void
setRules
(
JSONArray
rules
)
{
this
.
rules
=
rules
;
this
.
rules
=
rules
;
}
}
private
String
price
;
private
String
price
;
private
String
rules
;
private
JSONArray
rules
;
public
String
getRulesString
()
{
return
rulesString
;
}
public
void
setRulesString
(
String
rulesString
)
{
this
.
rulesString
=
rulesString
;
}
public
String
getDisCount
()
{
return
discount
;
}
public
void
setDisCount
(
String
discount
)
{
this
.
discount
=
discount
;
}
/**
/**
* 0 默认
* 0 默认
*/
*/
private
String
isDefault
;
private
String
isDefault
;
private
String
rulesString
;
private
String
discount
;
}
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/GoodsMapper.java
View file @
87485666
...
@@ -58,4 +58,6 @@ public interface GoodsMapper
...
@@ -58,4 +58,6 @@ public interface GoodsMapper
* @return 结果
* @return 结果
*/
*/
public
int
deleteGoodsByIds
(
String
[]
ids
);
public
int
deleteGoodsByIds
(
String
[]
ids
);
Integer
selectCount
(
String
id
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderRefundService.java
View file @
87485666
package
com
.
ruoyi
.
system
.
service
;
package
com
.
ruoyi
.
system
.
service
;
import
java.util.List
;
import
java.util.List
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.domain.OrderRefund
;
import
com.ruoyi.system.domain.OrderRefund
;
/**
/**
...
@@ -33,7 +35,7 @@ public interface IOrderRefundService
...
@@ -33,7 +35,7 @@ public interface IOrderRefundService
* @param orderRefund 订单退款
* @param orderRefund 订单退款
* @return 结果
* @return 结果
*/
*/
public
in
t
insertOrderRefund
(
OrderRefund
orderRefund
);
public
AjaxResul
t
insertOrderRefund
(
OrderRefund
orderRefund
);
/**
/**
* 修改订单退款
* 修改订单退款
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsCategoryServiceImpl.java
View file @
87485666
...
@@ -49,10 +49,7 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
...
@@ -49,10 +49,7 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
{
{
List
<
GoodsCategory
>
goodsCategories
=
goodsCategoryMapper
.
selectGoodsCategoryList
(
goodsCategory
);
List
<
GoodsCategory
>
goodsCategories
=
goodsCategoryMapper
.
selectGoodsCategoryList
(
goodsCategory
);
for
(
GoodsCategory
category
:
goodsCategories
)
{
for
(
GoodsCategory
category
:
goodsCategories
)
{
Goods
goods
=
new
Goods
();
category
.
setGoodsCount
(
goodsMapper
.
selectCount
(
category
.
getId
()));
goods
.
setCategory
(
category
.
getId
());
goods
.
setIsDeleted
(
0L
);
category
.
setGoodsCount
(
goodsMapper
.
selectGoodsList
(
goods
).
size
());
}
}
return
goodsCategories
;
return
goodsCategories
;
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
View file @
87485666
...
@@ -6,7 +6,6 @@ import java.util.Date;
...
@@ -6,7 +6,6 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
...
@@ -123,7 +122,7 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -123,7 +122,7 @@ public class GoodsServiceImpl implements IGoodsService
}
}
}
}
}
}
createSku
(
ruleNodeList
,
goodsId
,
goods
.
getDiscount
());
createSku
(
ruleNodeList
,
goodsId
,
goods
.
getDiscount
()
,
goods
.
getPrice
()
);
}
}
List
<
GoodsTag
>
goodsTagList
=
goods
.
getGoodsTagList
();
List
<
GoodsTag
>
goodsTagList
=
goods
.
getGoodsTagList
();
if
(
goodsTagList
!=
null
&&!
goodsTagList
.
isEmpty
()){
if
(
goodsTagList
!=
null
&&!
goodsTagList
.
isEmpty
()){
...
@@ -136,15 +135,16 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -136,15 +135,16 @@ public class GoodsServiceImpl implements IGoodsService
}
}
}
}
private
void
createSku
(
List
<
RuleNode
>
ruleNodeList
,
long
goodsId
,
BigDecimal
price
)
{
private
void
createSku
(
List
<
RuleNode
>
ruleNodeList
,
long
goodsId
,
BigDecimal
discount
,
BigDecimal
price
)
{
for
(
RuleNode
<
SpecRule
>
ruleNode
:
ruleNodeList
)
{
for
(
RuleNode
<
SpecRule
>
ruleNode
:
ruleNodeList
)
{
List
<
SpecRule
>
specRuleList
=
new
ArrayList
<>();
List
<
SpecRule
>
specRuleList
=
new
ArrayList
<>();
BigDecimal
bigDecimal
=
new
BigDecimal
(
price
.
toString
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
price
.
toString
());
BigDecimal
disCount
=
new
BigDecimal
(
discount
.
toString
());
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleNode
.
getParentRuleNode
();
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleNode
.
getParentRuleNode
();
specRuleList
.
add
(
ruleNode
.
getRuleNode
());
specRuleList
.
add
(
ruleNode
.
getRuleNode
());
bigDecimal
=
bigDecimal
.
add
(
ruleNode
.
getRuleNode
().
getAmount
());
bigDecimal
=
bigDecimal
.
add
(
ruleNode
.
getRuleNode
().
getAmount
());
if
(
parentRuleNode
!=
null
){
if
(
parentRuleNode
!=
null
){
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
);
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
,
disCount
);
}
}
GoodsSku
goodsSku
=
new
GoodsSku
();
GoodsSku
goodsSku
=
new
GoodsSku
();
goodsSku
.
setGoodsId
(
goodsId
);
goodsSku
.
setGoodsId
(
goodsId
);
...
@@ -152,17 +152,19 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -152,17 +152,19 @@ public class GoodsServiceImpl implements IGoodsService
goodsSku
.
setIsDeleted
(
"0"
);
goodsSku
.
setIsDeleted
(
"0"
);
goodsSku
.
setUpdatedAt
(
new
Date
());
goodsSku
.
setUpdatedAt
(
new
Date
());
goodsSku
.
setPrice
(
bigDecimal
);
goodsSku
.
setPrice
(
bigDecimal
);
goodsSku
.
setDiscount
(
discount
);
goodsSku
.
setRuleList
(
JSONArray
.
toJSONString
(
specRuleList
));
goodsSku
.
setRuleList
(
JSONArray
.
toJSONString
(
specRuleList
));
goodsSkuMapper
.
insertGoodsSku
(
goodsSku
);
goodsSkuMapper
.
insertGoodsSku
(
goodsSku
);
}
}
}
}
private
void
findPartentRuleNode
(
RuleNode
<
SpecRule
>
ruleRuleNode
,
List
<
SpecRule
>
specRuleList
,
BigDecimal
bigDecimal
)
{
private
void
findPartentRuleNode
(
RuleNode
<
SpecRule
>
ruleRuleNode
,
List
<
SpecRule
>
specRuleList
,
BigDecimal
bigDecimal
,
BigDecimal
disCount
)
{
specRuleList
.
add
(
ruleRuleNode
.
getRuleNode
());
specRuleList
.
add
(
ruleRuleNode
.
getRuleNode
());
bigDecimal
=
bigDecimal
.
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
());
bigDecimal
=
bigDecimal
.
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
());
disCount
=
disCount
.
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
());
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleRuleNode
.
getParentRuleNode
();
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleRuleNode
.
getParentRuleNode
();
if
(
parentRuleNode
!=
null
){
if
(
parentRuleNode
!=
null
){
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
);
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
,
disCount
);
}
}
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineApiServiceImpl.java
View file @
87485666
package
com
.
ruoyi
.
system
.
service
.
impl
;
package
com
.
ruoyi
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.
system.domain.Order
;
import
com.ruoyi.
common.exception.ServiceException
;
import
com.ruoyi.
system.domain.ShopGood
s
;
import
com.ruoyi.
common.utils.StringUtil
s
;
import
com.ruoyi.system.domain.
ShopGoodsSku
;
import
com.ruoyi.system.domain.
*
;
import
com.ruoyi.system.
mapper.OrderMapper
;
import
com.ruoyi.system.
domain.vo.ResultVo
;
import
com.ruoyi.system.mapper.
ShopGoodsMapper
;
import
com.ruoyi.system.mapper.
*
;
import
com.ruoyi.system.mapper.ShopGoodsSkuMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
@Slf4j
public
class
MachineApiServiceImpl
{
public
class
MachineApiServiceImpl
{
@Autowired
@Autowired
private
ShopGoodsMapper
shopGoodsMapper
;
private
ShopGoodsMapper
shopGoodsMapper
;
...
@@ -20,31 +25,102 @@ public class MachineApiServiceImpl {
...
@@ -20,31 +25,102 @@ public class MachineApiServiceImpl {
private
OrderMapper
orderMapper
;
private
OrderMapper
orderMapper
;
@Autowired
@Autowired
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
@Autowired
private
OrderDetailMapper
orderDetailMapper
;
@Value
(
"machine.url"
)
private
String
url
;
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
private
MachineMapper
machineMapper
;
public
String
shopGoodsUpdate
(
JSONObject
jsonObject
)
{
public
String
shopGoodsUpdate
(
JSONObject
jsonObject
)
{
String
shopID
=
jsonObject
.
getString
(
"shopI
D
"
);
String
shopID
=
jsonObject
.
getString
(
"shopI
d
"
);
String
skuIDs
=
jsonObject
.
getString
(
"skuI
D
"
);
String
skuIDs
=
jsonObject
.
getString
(
"skuI
d
"
);
List
<
String
>
skuIds
=
JSONObject
.
parseArray
(
skuIDs
,
String
.
class
);
List
<
String
>
skuIds
=
JSONObject
.
parseArray
(
skuIDs
,
String
.
class
);
String
robotID
=
jsonObject
.
getString
(
"robotI
D
"
);
String
robotID
=
jsonObject
.
getString
(
"robotI
d
"
);
String
status
=
jsonObject
.
getString
(
"status"
);
String
status
=
jsonObject
.
getString
(
"status"
);
if
(
"11"
.
equals
(
status
)){
int
i
=
shopGoodsSkuMapper
.
updateSkuStatus
(
skuIds
,
robotID
,
shopID
,
status
);
status
=
"2"
;
return
""
+
i
;
}
else
{
status
=
"1"
;
}
shopGoodsSkuMapper
.
updateSkuStatus
(
skuIds
,
robotID
,
shopID
,
status
);
return
"0"
;
}
}
public
String
updateOrder
(
JSONObject
jsonObject
)
{
public
String
updateOrder
(
JSONObject
jsonObject
)
{
String
orderID
=
jsonObject
.
getString
(
"orderI
D
"
);
String
orderID
=
jsonObject
.
getString
(
"orderI
d
"
);
String
status
=
jsonObject
.
getString
(
"status"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setId
(
orderID
);
order
.
setId
(
orderID
);
order
.
setState
(
status
);
order
.
setState
(
status
);
orderMapper
.
updateOrder
(
order
);
int
i
=
orderMapper
.
updateOrder
(
order
);
return
"0"
;
return
i
+
""
;
}
public
void
testOrder
(
String
orderId
)
{
if
(
StringUtils
.
isEmpty
(
orderId
)){
orderId
=
"8"
;
}
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
order
.
setOrderDetails
(
orderDetails
);
String
orderInfo
=
JSONObject
.
toJSONString
(
order
);
ResultVo
resultVo
=
createOrder
(
orderInfo
,
"/v1/order"
);
String
code
=
resultVo
.
getCode
();
if
(
"2001"
.
equals
(
code
)){
throw
new
ServiceException
(
"库存不足"
);
}
else
if
(
"3001"
.
equals
(
code
)){
throw
new
ServiceException
(
"机器繁忙"
);
}
}
public
ResultVo
createOrder
(
String
param
,
String
interfaceName
){
try
{
String
postUrl
=
url
+
interfaceName
;
log
.
info
(
"请求创建订单接口:【{}】"
,
param
);
ResponseEntity
<
String
>
stringResponseEntity
=
restTemplate
.
postForEntity
(
postUrl
,
param
,
String
.
class
);
log
.
info
(
"请求创建订单接口返回结果为:【{}】"
,
stringResponseEntity
.
getBody
());
ResultVo
resultVo
=
JSONObject
.
parseObject
(
stringResponseEntity
.
getBody
(),
ResultVo
.
class
);
return
resultVo
;
}
catch
(
Exception
e
){
log
.
error
(
"请求发生异常:"
,
e
);
throw
new
ServiceException
(
"服务器繁忙,请重试"
);
}
}
public
void
testOrderUpdate
(
String
orderId
)
{
if
(
StringUtils
.
isEmpty
(
orderId
)){
orderId
=
"8"
;
}
JSONObject
param
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"state"
,
2
);
data
.
put
(
"payTime"
,
new
Date
());
param
.
put
(
"data"
,
data
);
param
.
put
(
"orderId"
,
orderId
);
createOrder
(
param
.
toJSONString
(),
"/v1/order/update"
);
}
public
Object
robotUpdate
(
JSONObject
jsonObject
)
{
String
robotID
=
jsonObject
.
getString
(
"robotID"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Long
shopID
=
jsonObject
.
getLong
(
"shopID"
);
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopID
);
machine
.
setId
(
robotID
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(
machines
.
isEmpty
()){
throw
new
ServiceException
(
"该机器未绑定店铺"
)
;
}
machine
.
setState
(
status
);
return
machineMapper
.
updateMachine
(
machine
);
}
}
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderRefundServiceImpl.java
View file @
87485666
...
@@ -2,6 +2,11 @@ package com.ruoyi.system.service.impl;
...
@@ -2,6 +2,11 @@ package com.ruoyi.system.service.impl;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.mapper.OrderMapper
;
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
com.ruoyi.system.mapper.OrderRefundMapper
;
import
com.ruoyi.system.mapper.OrderRefundMapper
;
...
@@ -19,6 +24,10 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -19,6 +24,10 @@ public class OrderRefundServiceImpl implements IOrderRefundService
{
{
@Autowired
@Autowired
private
OrderRefundMapper
orderRefundMapper
;
private
OrderRefundMapper
orderRefundMapper
;
@Autowired
private
OrderServiceImpl
orderService
;
@Autowired
private
OrderMapper
orderMapper
;
/**
/**
* 查询订单退款
* 查询订单退款
...
@@ -41,7 +50,13 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -41,7 +50,13 @@ public class OrderRefundServiceImpl implements IOrderRefundService
@Override
@Override
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderRefund
orderRefund
)
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderRefund
orderRefund
)
{
{
return
orderRefundMapper
.
selectOrderRefundList
(
orderRefund
);
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectOrderRefundList
(
orderRefund
);
for
(
OrderRefund
refund
:
orderRefunds
)
{
Order
order
=
orderService
.
selectOrderById
(
refund
.
getOrderId
());
refund
.
setOrder
(
order
);
}
return
orderRefunds
;
}
}
/**
/**
...
@@ -51,12 +66,31 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -51,12 +66,31 @@ public class OrderRefundServiceImpl implements IOrderRefundService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
in
t
insertOrderRefund
(
OrderRefund
orderRefund
)
public
AjaxResul
t
insertOrderRefund
(
OrderRefund
orderRefund
)
{
{
Order
order
=
orderMapper
.
selectOrderById
(
orderRefund
.
getOrderId
());
if
(
order
==
null
){
return
AjaxResult
.
error
(
"找不到该订单"
);
}
// 制作中、制作完成、聚餐中、已完成
String
state
=
order
.
getState
();
if
(
"2"
.
equals
(
state
)||
"3"
.
equals
(
state
)){
// 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成
}
else
if
(
"4"
.
equals
(
state
)||
"5"
.
equals
(
state
)||
"6"
.
equals
(
state
)||
"7"
.
equals
(
state
)){
}
else
{
return
AjaxResult
.
error
(
"该订单状态不允许退款"
);
}
orderRefund
.
setCreatedAt
(
new
Date
());
orderRefund
.
setCreatedAt
(
new
Date
());
orderRefund
.
setUpdatedAt
(
new
Date
());
orderRefund
.
setUpdatedAt
(
new
Date
());
orderRefund
.
setState
(
"0"
);
orderRefund
.
setState
(
"0"
);
return
orderRefundMapper
.
insertOrderRefund
(
orderRefund
);
orderRefund
.
setOrderNo
(
order
.
getOrderNo
());
orderRefund
.
setRefundNo
(
GenerateCode
.
getCode
(
"R"
,
"%09d"
));
int
i
=
orderRefundMapper
.
insertOrderRefund
(
orderRefund
);
return
AjaxResult
.
success
(
orderRefund
);
}
}
/**
/**
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
View file @
87485666
...
@@ -45,6 +45,8 @@ public class OrderServiceImpl implements IOrderService
...
@@ -45,6 +45,8 @@ public class OrderServiceImpl implements IOrderService
private
MachineMapper
machineMapper
;
private
MachineMapper
machineMapper
;
@Autowired
@Autowired
private
RobotServiceImpl
robotService
;
private
RobotServiceImpl
robotService
;
@Autowired
private
ShopMapper
shopMapper
;
...
@@ -108,7 +110,7 @@ public class OrderServiceImpl implements IOrderService
...
@@ -108,7 +110,7 @@ public class OrderServiceImpl implements IOrderService
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(
machines
!=
null
&&!
machines
.
isEmpty
()){
if
(
machines
!=
null
&&!
machines
.
isEmpty
()){
Machine
machine1
=
machines
.
get
(
0
);
Machine
machine1
=
machines
.
get
(
0
);
if
(!
"1"
.
equals
(
machine1
)){
if
(!
"1"
.
equals
(
machine1
.
getState
()
)){
return
AjaxResult
.
error
(
"机器暂时不可用"
);
return
AjaxResult
.
error
(
"机器暂时不可用"
);
}
}
machineId
=
machine1
.
getCode
();
machineId
=
machine1
.
getCode
();
...
@@ -128,7 +130,7 @@ public class OrderServiceImpl implements IOrderService
...
@@ -128,7 +130,7 @@ public class OrderServiceImpl implements IOrderService
}
}
}
}
//发送数据给机器
//发送数据给机器
robotService
.
createOrder
(
order
);
//
robotService.createOrder(order);
return
AjaxResult
.
success
(
order
.
getOrderNo
());
return
AjaxResult
.
success
(
order
.
getOrderNo
());
}
}
...
@@ -187,7 +189,7 @@ public class OrderServiceImpl implements IOrderService
...
@@ -187,7 +189,7 @@ public class OrderServiceImpl implements IOrderService
return
AjaxResult
.
error
(
"该商品已不存在:"
+
orderDetail
.
getGoodsName
());
return
AjaxResult
.
error
(
"该商品已不存在:"
+
orderDetail
.
getGoodsName
());
}
}
ShopGoodsSku
shopGoodsSku1
=
shopGoodsSkus
.
get
(
0
);
ShopGoodsSku
shopGoodsSku1
=
shopGoodsSkus
.
get
(
0
);
if
(!
"1"
.
equals
(
shopGoodsSku1
)){
if
(!
"1"
.
equals
(
shopGoodsSku1
.
getState
()
)){
return
AjaxResult
.
error
(
"该商品所选种类已经告罄,请重新进行选择:"
+
orderDetail
.
getGoodsName
());
return
AjaxResult
.
error
(
"该商品所选种类已经告罄,请重新进行选择:"
+
orderDetail
.
getGoodsName
());
}
}
}
}
...
@@ -198,6 +200,7 @@ public class OrderServiceImpl implements IOrderService
...
@@ -198,6 +200,7 @@ public class OrderServiceImpl implements IOrderService
public
List
<
Order
>
getMyOrder
(
String
openId
)
{
public
List
<
Order
>
getMyOrder
(
String
openId
)
{
List
<
Order
>
orders
=
orderMapper
.
selectByUserId
(
openId
);
List
<
Order
>
orders
=
orderMapper
.
selectByUserId
(
openId
);
for
(
Order
order
:
orders
)
{
for
(
Order
order
:
orders
)
{
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
OrderDetail
orderDetail
=
new
OrderDetail
();
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
order
.
getId
());
orderDetail
.
setOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
...
@@ -220,10 +223,12 @@ public class OrderServiceImpl implements IOrderService
...
@@ -220,10 +223,12 @@ public class OrderServiceImpl implements IOrderService
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
redisKey
=
"shopId"
+
format
+
shopId
;
String
redisKey
=
"shopId"
+
format
+
shopId
;
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
redisAtomicInteger
.
set
(
30
);
if
(
0
==
redisAtomicInteger
.
getAndIncrement
()){
redisAtomicInteger
.
set
(
30
);
}
redisAtomicInteger
.
expire
(
1
,
TimeUnit
.
DAYS
);
redisAtomicInteger
.
expire
(
1
,
TimeUnit
.
DAYS
);
int
andIncrement
=
redisAtomicInteger
.
getAndIncrement
();
int
andIncrement
=
redisAtomicInteger
.
getAndIncrement
();
return
key
+
andIncrement
;
return
key
+
String
.
format
(
"%03d"
,
andIncrement
)
;
}
}
//获取订单号
//获取订单号
private
String
getOrderNo
(
String
source
){
private
String
getOrderNo
(
String
source
){
...
@@ -231,11 +236,11 @@ public class OrderServiceImpl implements IOrderService
...
@@ -231,11 +236,11 @@ public class OrderServiceImpl implements IOrderService
if
(
StringUtils
.
isNotEmpty
(
source
)){
if
(
StringUtils
.
isNotEmpty
(
source
)){
if
(
"1"
.
equals
(
source
)){
if
(
"1"
.
equals
(
source
)){
channel
=
"A"
;
channel
=
"A"
;
}
else
{
}
else
if
(
"2"
.
equals
(
source
))
{
channel
=
"B"
;
channel
=
"B"
;
}
}
}
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd
HH"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
key
=
"orderNo"
;
String
key
=
"orderNo"
;
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
key
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
key
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderTakingServiceImpl.java
View file @
87485666
...
@@ -30,6 +30,8 @@ public class OrderTakingServiceImpl {
...
@@ -30,6 +30,8 @@ public class OrderTakingServiceImpl {
private
ShopGoodsMapper
shopGoodsMapper
;
private
ShopGoodsMapper
shopGoodsMapper
;
@Autowired
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
private
GoodsCategoryMapper
goodsCategoryMapper
;
@Autowired
private
ShopMapper
shopMapper
;
/**
/**
...
@@ -57,11 +59,16 @@ public class OrderTakingServiceImpl {
...
@@ -57,11 +59,16 @@ public class OrderTakingServiceImpl {
}
}
public
OrderTakingVo
getOrderTakingInfo
(
Long
shopId
){
public
OrderTakingVo
getOrderTakingInfo
(
Long
shopId
){
OrderTakingVo
orderTakingVo
=
new
OrderTakingVo
();
OrderTakingVo
orderTakingVo
=
new
OrderTakingVo
();
Shop
shop
=
shopMapper
.
selectShopById
(
String
.
valueOf
(
shopId
));
orderTakingVo
.
setShopState
(
shop
.
getState
());
ImagesVo
imagesVo
=
new
ImagesVo
();
ImagesVo
imagesVo
=
new
ImagesVo
();
orderTakingVo
.
setImages
(
imagesVo
);
orderTakingVo
.
setImages
(
imagesVo
);
imagesVo
.
setLeft
(
sysConfigService
.
selectConfigByKey
(
"menu.left"
));
imagesVo
.
setLeft
(
sysConfigService
.
selectConfigByKey
(
"menu.left"
));
imagesVo
.
setRight
(
sysConfigService
.
selectConfigByKey
(
"menu.right"
));
imagesVo
.
setRight
(
JSONObject
.
parseObject
(
sysConfigService
.
selectConfigByKey
(
"menu.right"
)
));
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
List
<
CategoryVo
>
categoryVos
=
new
ArrayList
<>();
List
<
CategoryVo
>
categoryVos
=
new
ArrayList
<>();
...
@@ -75,8 +82,12 @@ public class OrderTakingServiceImpl {
...
@@ -75,8 +82,12 @@ public class OrderTakingServiceImpl {
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
GoodsTag
goodsTag
=
new
GoodsTag
();
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsTag
.
setState
(
"1"
);
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecs
()));
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecString
()));
goodsVo
.
setSpecString
(
null
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
goodsVo
.
getPictures
()));
goodsVo
.
setPictures
(
null
);
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
goodsVo
.
setTags
(
tags
);
goodsVo
.
setTags
(
tags
);
...
@@ -104,8 +115,9 @@ public class OrderTakingServiceImpl {
...
@@ -104,8 +115,9 @@ public class OrderTakingServiceImpl {
goodsVo
.
setPrice
(
good
.
getPrice
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPrice
(
good
.
getPrice
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
good
.
getPics
()));
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
good
.
getPics
()));
goodsVo
.
setRemarks
(
good
.
getRemarks
());
goodsVo
.
setRemarks
(
good
.
getRemarks
());
goodsVo
.
setSpecs
(
good
.
getSpec
());
goodsVo
.
setSpecs
(
buildGoodsSpec
(
good
.
getSpec
()));
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecs
()));
goodsVo
.
setSpecString
(
null
);
GoodsTag
goodsTag
=
new
GoodsTag
();
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsTag
.
setState
(
"1"
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
...
@@ -133,8 +145,11 @@ public class OrderTakingServiceImpl {
...
@@ -133,8 +145,11 @@ public class OrderTakingServiceImpl {
recommendVo
.
setDesc
(
shopRecommend1
.
getDesc
());
recommendVo
.
setDesc
(
shopRecommend1
.
getDesc
());
recommendVo
.
setGoodsName
(
shopRecommend1
.
getGoodsName
());
recommendVo
.
setGoodsName
(
shopRecommend1
.
getGoodsName
());
recommendVo
.
setPic
(
shopRecommend1
.
getPic
());
recommendVo
.
setPic
(
shopRecommend1
.
getPic
());
recommendVo
.
setGoods
(
recommendGoods
);
recommendVo
.
setGoods
(
goodsVo
);
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecs
()));
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecString
()));
goodsVo
.
setSpecString
(
null
);
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
goodsVo
.
getPictures
()));
goodsVo
.
setPictures
(
null
);
GoodsTag
goodsTag
=
new
GoodsTag
();
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsTag
.
setState
(
"1"
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
...
@@ -154,7 +169,7 @@ public class OrderTakingServiceImpl {
...
@@ -154,7 +169,7 @@ public class OrderTakingServiceImpl {
private
void
buildSkuRules
(
List
<
SkuVo
>
skuVos
)
{
private
void
buildSkuRules
(
List
<
SkuVo
>
skuVos
)
{
for
(
SkuVo
skuVo
:
skuVos
)
{
for
(
SkuVo
skuVo
:
skuVos
)
{
String
rules
=
skuVo
.
getRules
();
String
rules
=
skuVo
.
getRules
String
();
List
<
SpecRule
>
specRuleList
=
JSONObject
.
parseArray
(
rules
,
SpecRule
.
class
);
List
<
SpecRule
>
specRuleList
=
JSONObject
.
parseArray
(
rules
,
SpecRule
.
class
);
boolean
boo
=
true
;
boolean
boo
=
true
;
List
<
SkuRuleVo
>
skuRuleVos
=
new
ArrayList
<>();
List
<
SkuRuleVo
>
skuRuleVos
=
new
ArrayList
<>();
...
@@ -172,13 +187,14 @@ public class OrderTakingServiceImpl {
...
@@ -172,13 +187,14 @@ public class OrderTakingServiceImpl {
if
(
boo
){
if
(
boo
){
skuVo
.
setIsDefault
(
"1"
);
skuVo
.
setIsDefault
(
"1"
);
}
}
skuVo
.
setRules
(
JSONObject
.
toJSONString
(
skuRuleVos
));
skuVo
.
setRules
(
JSONObject
.
parseArray
(
JSONObject
.
toJSONString
(
skuRuleVos
)));
skuVo
.
setRulesString
(
null
);
}
}
}
}
private
String
buildGoodsSpec
(
String
specs
)
{
private
JSONArray
buildGoodsSpec
(
String
specs
)
{
List
<
Spec
>
specList
=
JSONObject
.
parseArray
(
specs
,
Spec
.
class
);
List
<
Spec
>
specList
=
JSONObject
.
parseArray
(
specs
,
Spec
.
class
);
List
<
SpecVo
>
specVos
=
new
ArrayList
<>();
List
<
SpecVo
>
specVos
=
new
ArrayList
<>();
for
(
Spec
spec
:
specList
)
{
for
(
Spec
spec
:
specList
)
{
...
@@ -199,7 +215,7 @@ public class OrderTakingServiceImpl {
...
@@ -199,7 +215,7 @@ public class OrderTakingServiceImpl {
}
}
}
}
return
JSON
Object
.
toJSONString
(
specVos
);
return
JSON
Array
.
parseArray
(
JSONObject
.
toJSONString
(
specVos
)
);
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/utils/OrderLogUtils.java
0 → 100644
View file @
87485666
package
com
.
ruoyi
.
system
.
utils
;
import
com.ruoyi.common.utils.spring.SpringUtils
;
import
com.ruoyi.system.domain.OrderLog
;
import
com.ruoyi.system.mapper.OrderLogMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
public
class
OrderLogUtils
{
private
OrderLogMapper
orderLogMapper
=
SpringUtils
.
getBean
(
OrderLogMapper
.
class
);
public
void
insertLog
(
String
orderId
){
OrderLog
orderLog
=
new
OrderLog
();
}
}
ruoyi-system/src/main/resources/mapper/system/GoodsMapper.xml
View file @
87485666
...
@@ -118,4 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -118,4 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
#{id}
</foreach>
</foreach>
</delete>
</delete>
<select
id=
"selectCount"
resultType=
"integer"
>
select count(*) from goods where category=#{id}
</select>
</mapper>
</mapper>
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
87485666
...
@@ -12,10 +12,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -12,10 +12,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"discount"
column=
"discount"
/>
</resultMap>
</resultMap>
<sql
id=
"selectGoodsSkuVo"
>
<sql
id=
"selectGoodsSkuVo"
>
select id, goods_id, rule_list, is_deleted, created_at, updated_at, price from goods_sku
select id, goods_id, rule_list, is_deleted, created_at, updated_at, price
,discount
from goods_sku
</sql>
</sql>
<select
id=
"selectGoodsSkuList"
parameterType=
"GoodsSku"
resultMap=
"GoodsSkuResult"
>
<select
id=
"selectGoodsSkuList"
parameterType=
"GoodsSku"
resultMap=
"GoodsSkuResult"
>
...
@@ -28,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -28,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"price != null "
>
and price = #{price}
</if>
<if
test=
"price != null "
>
and price = #{price}
</if>
<if
test=
"discount != null "
>
and discount = #{discount}
</if>
</where>
</where>
</select>
</select>
...
@@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"price != null"
>
price,
</if>
<if
test=
"price != null"
>
price,
</if>
<if
test=
"discount != null"
>
discount,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"goodsId != null and goodsId != ''"
>
#{goodsId},
</if>
<if
test=
"goodsId != null and goodsId != ''"
>
#{goodsId},
</if>
...
@@ -53,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -53,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"price != null"
>
#{price},
</if>
<if
test=
"price != null"
>
#{price},
</if>
<if
test=
"discount != null"
>
#{discount},
</if>
</trim>
</trim>
</insert>
</insert>
...
@@ -65,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -65,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
created_at = #{createdAt},
</if>
<if
test=
"createdAt != null"
>
created_at = #{createdAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"price != null"
>
price = #{price},
</if>
<if
test=
"price != null"
>
price = #{price},
</if>
<if
test=
"discount != null"
>
price = #{discount},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
...
...
ruoyi-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
87485666
...
@@ -22,11 +22,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -22,11 +22,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"state"
column=
"state"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"shelfAt"
column=
"shelf_at"
></result>
</resultMap>
</resultMap>
<sql
id=
"selectOrderVo"
>
<sql
id=
"selectOrderVo"
>
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at
,shelf_at
from `order`
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at from `order`
</sql>
</sql>
<select
id=
"selectOrderList"
parameterType=
"Order"
resultMap=
"OrderResult"
>
<select
id=
"selectOrderList"
parameterType=
"Order"
resultMap=
"OrderResult"
>
...
@@ -48,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -48,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"shelf_at != null "
>
and shelf_at = #{shelfAt}
</if>
</where>
</where>
</select>
</select>
...
@@ -59,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -59,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
</select>
<insert
id=
"insertOrder"
parameterType=
"Order"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertOrder"
parameterType=
"Order"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into
order
insert into
`order`
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderNo != null and orderNo != ''"
>
order_no,
</if>
<if
test=
"orderNo != null and orderNo != ''"
>
order_no,
</if>
<if
test=
"orderNum != null and orderNum != ''"
>
order_num,
</if>
<if
test=
"orderNum != null and orderNum != ''"
>
order_num,
</if>
...
@@ -77,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -77,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"state != null and state != ''"
>
state,
</if>
<if
test=
"state != null and state != ''"
>
state,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"shelfAt != null"
>
shelf_at,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderNo != null and orderNo != ''"
>
#{orderNo},
</if>
<if
test=
"orderNo != null and orderNo != ''"
>
#{orderNo},
</if>
...
@@ -96,12 +93,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -96,12 +93,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"state != null and state != ''"
>
#{state},
</if>
<if
test=
"state != null and state != ''"
>
#{state},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"shelfAt != null"
>
#{shelfAt},
</if>
</trim>
</trim>
</insert>
</insert>
<update
id=
"updateOrder"
parameterType=
"Order"
>
<update
id=
"updateOrder"
parameterType=
"Order"
>
update
order
update
`order`
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"orderNo != null and orderNo != ''"
>
order_no = #{orderNo},
</if>
<if
test=
"orderNo != null and orderNo != ''"
>
order_no = #{orderNo},
</if>
<if
test=
"orderNum != null and orderNum != ''"
>
order_num = #{orderNum},
</if>
<if
test=
"orderNum != null and orderNum != ''"
>
order_num = #{orderNum},
</if>
...
@@ -119,7 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -119,7 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"state != null and state != ''"
>
state = #{state},
</if>
<if
test=
"state != null and state != ''"
>
state = #{state},
</if>
<if
test=
"createdAt != null"
>
created_at = #{createdAt},
</if>
<if
test=
"createdAt != null"
>
created_at = #{createdAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"shelfAt != null"
>
shelf_at = #{shelfAt},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
...
...
ruoyi-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
View file @
87485666
...
@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.remarks,
g.remarks,
sg.state,
sg.state,
g.code
g.code
from shop_goods sg ,goods g where sg.goods_id =g.id and g.state ='
1'
and g.is_deleted =0
from shop_goods sg ,goods g where sg.goods_id =g.id and g.state ='
3'
and g.is_deleted =0
and shop_id =#{shopId} and category =#{categoryId}
and shop_id =#{shopId} and category =#{categoryId}
order by sg.turn
order by sg.turn
</select>
</select>
...
...
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
87485666
...
@@ -100,7 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -100,7 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
gs.id as skuId,
gs.id as skuId,
sgs.state as state ,
sgs.state as state ,
gs.price as price,
gs.price as price,
gs.rule_list as rules
gs.discount as discount,
gs.rule_list as rulesString
from
from
goods_sku gs ,
goods_sku gs ,
shop_goods_sku sgs
shop_goods_sku sgs
...
...
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
View file @
87485666
...
@@ -114,8 +114,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -114,8 +114,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.name as name,
g.name as name,
g.price as price,
g.price as price,
g.discount as discount,
g.discount as discount,
g.pics ,
g.pics
as pictures
,
g.spec as spec
s
,
g.spec as spec
String
,
g.`desc`,
g.`desc`,
g.remarks
g.remarks
from
from
...
@@ -144,16 +144,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -144,16 +144,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sg.state,
sg.state,
g.code
g.code
from
from
shop_
goods sg
,
shop_
recommend sr
,
goods
g,
shop_goods s
g,
shop_recommend sr
goods g
where
where
sg.goods_id = g.id
sr.goods_id = sg.goods_id
and g.state = '1'
and g.id = sg.goods_id
and g.state = '3'
and g.is_deleted = 0
and g.is_deleted = 0
and sr.shop_id =sg.shop_id
and sr.`type` = #{type}
and sr.`type` =#{type}
and sr.shop_id = #{shopId}
and sr.shop_id =#{shopId}
order by
order by
sr.turn
sr.turn
</select>
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment