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
24181a36
Commit
24181a36
authored
May 20, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码修改
parent
652b4e9c
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
240 additions
and
90 deletions
+240
-90
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderLogController.java
+10
-60
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderRefundController.java
+20
-2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
+8
-0
ruoyi-admin/src/main/resources/application.yml
+1
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+1
-1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
+39
-24
ruoyi-system/src/main/java/com/ruoyi/system/domain/Goods.java
+29
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderRefund.java
+10
-0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ShopGoodsSkuMapper.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderRefundService.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/IShopService.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsCategoryServiceImpl.java
+19
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
+9
-1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderRefundServiceImpl.java
+15
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ShopServiceImpl.java
+29
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SpecServiceImpl.java
+8
-0
ruoyi-system/src/main/resources/mapper/system/OrderMapper.xml
+27
-0
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+9
-0
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
+0
-1
ruoyi-system/src/main/resources/mapper/system/SpecRuleMapper.xml
+0
-1
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderLogController.java
View file @
24181a36
...
@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.coffee;
...
@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.coffee;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.system.domain.OrderOperationLog
;
import
com.ruoyi.system.service.IOrderOperationLogService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -32,73 +35,20 @@ import com.ruoyi.common.core.page.TableDataInfo;
...
@@ -32,73 +35,20 @@ import com.ruoyi.common.core.page.TableDataInfo;
public
class
OrderLogController
extends
BaseController
public
class
OrderLogController
extends
BaseController
{
{
@Autowired
@Autowired
private
IOrderLogService
orderLogService
;
private
IOrder
Operation
LogService
orderLogService
;
/**
/**
* 查询订单日志列表
* 查询订单日志列表
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
OrderLog
orderLog
)
{
startPage
();
List
<
OrderLog
>
list
=
orderLogService
.
selectOrderLogList
(
orderLog
);
return
getDataTable
(
list
);
}
/**
@GetMapping
(
"/list"
)
* 导出订单日志列表
public
AjaxResult
list
(
String
orderId
)
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:export')"
)
@Log
(
title
=
"订单日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
OrderLog
orderLog
)
{
List
<
OrderLog
>
list
=
orderLogService
.
selectOrderLogList
(
orderLog
);
ExcelUtil
<
OrderLog
>
util
=
new
ExcelUtil
<
OrderLog
>(
OrderLog
.
class
);
util
.
exportExcel
(
response
,
list
,
"订单日志数据"
);
}
/**
* 获取订单日志详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
AjaxResult
.
success
(
orderLogService
.
selectOrderLogById
(
id
));
}
/**
* 新增订单日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:add')"
)
@Log
(
title
=
"订单日志"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
OrderLog
orderLog
)
{
{
return
toAjax
(
orderLogService
.
insertOrderLog
(
orderLog
));
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
orderId
);
List
<
OrderOperationLog
>
orderOperationLogs
=
orderLogService
.
selectOrderOperationLogList
(
orderOperationLog
);
return
AjaxResult
.
success
(
orderOperationLogs
);
}
}
/**
* 修改订单日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:edit')"
)
@Log
(
title
=
"订单日志"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
OrderLog
orderLog
)
{
return
toAjax
(
orderLogService
.
updateOrderLog
(
orderLog
));
}
/**
* 删除订单日志
*/
@PreAuthorize
(
"@ss.hasPermi('system:log:remove')"
)
@Log
(
title
=
"订单日志"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
orderLogService
.
deleteOrderLogByIds
(
ids
));
}
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/OrderRefundController.java
View file @
24181a36
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
com.ruoyi.framework.web.service.WeixinServiceImpl
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -32,6 +35,8 @@ public class OrderRefundController extends BaseController
...
@@ -32,6 +35,8 @@ public class OrderRefundController extends BaseController
{
{
@Autowired
@Autowired
private
IOrderRefundService
orderRefundService
;
private
IOrderRefundService
orderRefundService
;
@Autowired
private
WeixinServiceImpl
weixinService
;
/**
/**
* 查询订单退款列表
* 查询订单退款列表
...
@@ -65,12 +70,25 @@ public class OrderRefundController extends BaseController
...
@@ -65,12 +70,25 @@ public class OrderRefundController extends BaseController
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
if
(
obejct
!=
null
&&
obejct
instanceof
OrderRefund
){
if
(
obejct
!=
null
&&
obejct
instanceof
OrderRefund
){
OrderRefund
orderRefund1
=
(
OrderRefund
)
obejct
;
int
totalFee
=
orderRefund1
.
getTotalFee
().
movePointRight
(
2
).
intValue
();
int
refundAmount
=
orderRefund1
.
getRefundAmount
().
movePointRight
(
2
).
intValue
();
weixinService
.
refund
(
orderRefund1
.
getRefundNo
(),
orderRefund1
.
getOrderNo
(),
totalFee
,
refundAmount
);
orderRefund1
.
setState
(
"1"
);
orderRefundService
.
updateOrderRefund
(
orderRefund1
);
}
}
return
ajaxResult
;
return
ajaxResult
;
}
}
@GetMapping
(
"/refund"
)
public
AjaxResult
refund
(
String
id
){
OrderRefund
orderRefund
=
orderRefundService
.
getOrderRefund
(
id
);
int
totalFee
=
orderRefund
.
getTotalFee
().
movePointRight
(
2
).
intValue
();
int
refundAmount
=
orderRefund
.
getRefundAmount
().
movePointRight
(
2
).
intValue
();
orderRefund
.
setState
(
"1"
);
weixinService
.
refund
(
orderRefund
.
getRefundNo
(),
orderRefund
.
getOrderNo
(),
totalFee
,
refundAmount
);
return
AjaxResult
.
success
(
orderRefundService
.
updateOrderRefund
(
orderRefund
));
}
// public void refund(HttpServletRequest request,
// public void refund(HttpServletRequest request,
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
View file @
24181a36
...
@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.coffee;
...
@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.coffee;
import
java.util.List
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -106,6 +108,12 @@ public class ShopController extends BaseController
...
@@ -106,6 +108,12 @@ public class ShopController extends BaseController
{
{
return
AjaxResult
.
success
(
shopService
.
addGoods
(
shopId
,
goodsIds
));
return
AjaxResult
.
success
(
shopService
.
addGoods
(
shopId
,
goodsIds
));
}
}
@PostMapping
(
value
=
"/offGoods"
)
public
AjaxResult
offGoods
(
@RequestBody
String
body
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
body
);
return
AjaxResult
.
success
(
shopService
.
offGoods
(
jsonObject
));
}
/**
/**
* 获取店铺里面的商品信息,分类展示
* 获取店铺里面的商品信息,分类展示
*/
*/
...
...
ruoyi-admin/src/main/resources/application.yml
View file @
24181a36
...
@@ -140,6 +140,7 @@ weixin:
...
@@ -140,6 +140,7 @@ weixin:
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
:
classpath:apiclient_cert.p12
cert-path
:
classpath:apiclient_cert.p12
refund-url
:
http://114.115.234.81:8080/weixin/refundNotify
#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-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
View file @
24181a36
...
@@ -101,7 +101,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -101,7 +101,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
// 过滤请求
.
authorizeRequests
()
.
authorizeRequests
()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
,
"/weixin/**"
,
"/application/**"
,
"/v1/**"
,
"/tool/**"
).
anonymous
()
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
,
"/weixin/**"
,
"/application/**"
,
"/v1/**"
,
"/tool/**"
,
"/system/**"
).
anonymous
()
.
antMatchers
(
.
antMatchers
(
HttpMethod
.
GET
,
HttpMethod
.
GET
,
"/"
,
"/"
,
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
View file @
24181a36
...
@@ -11,12 +11,9 @@ import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
...
@@ -11,12 +11,9 @@ import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import
com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult
;
import
com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult
;
import
com.github.binarywang.wxpay.exception.WxPayException
;
import
com.github.binarywang.wxpay.exception.WxPayException
;
import
com.github.binarywang.wxpay.service.WxPayService
;
import
com.github.binarywang.wxpay.service.WxPayService
;
import
com.github.binarywang.wxpay.util.SignUtils
;
import
com.github.wxpay.sdk.WXPay
;
import
com.github.wxpay.sdk.WXPayConfig
;
import
com.github.wxpay.sdk.WXPayConstants
;
import
com.github.wxpay.sdk.WXPayUtil
;
import
com.github.wxpay.sdk.WXPayUtil
;
import
com.google.gson.Gson
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
...
@@ -28,31 +25,21 @@ import com.ruoyi.framework.web.domain.server.Sys;
...
@@ -28,31 +25,21 @@ import com.ruoyi.framework.web.domain.server.Sys;
import
com.ruoyi.system.domain.Customer
;
import
com.ruoyi.system.domain.Customer
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.domain.OrderOperationLog
;
import
com.ruoyi.system.domain.OrderOperationLog
;
import
com.ruoyi.system.domain.OrderRefund
;
import
com.ruoyi.system.mapper.CustomerMapper
;
import
com.ruoyi.system.mapper.CustomerMapper
;
import
com.ruoyi.system.mapper.OrderMapper
;
import
com.ruoyi.system.mapper.OrderMapper
;
import
com.ruoyi.system.mapper.OrderRefundMapper
;
import
com.ruoyi.system.service.impl.MachineApiServiceImpl
;
import
com.ruoyi.system.service.impl.MachineApiServiceImpl
;
import
com.ruoyi.system.service.impl.OrderOperationLogServiceImpl
;
import
com.ruoyi.system.service.impl.OrderOperationLogServiceImpl
;
import
com.ruoyi.system.weixin.entity.OrderInfo
;
import
com.ruoyi.system.weixin.entity.OrderInfo
;
import
com.ruoyi.system.weixin.entity.OrderReturnInfo
;
import
com.ruoyi.system.weixin.entity.QueryReturnInfo
;
import
com.ruoyi.system.weixin.entity.QueryReturnInfo
;
import
com.ruoyi.system.weixin.entity.SignInfo
;
import
com.ruoyi.system.weixin.util.PayUtil
;
import
com.ruoyi.system.weixin.util.RandomStringGenerator
;
import
com.ruoyi.system.weixin.util.RandomStringGenerator
;
import
com.ruoyi.system.weixin.util.Signature
;
import
com.ruoyi.system.weixin.util.Signature
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.XStream
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.ssl.SSLContexts
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.poi.ooxml.util.DocumentHelper
;
import
org.aspectj.weaver.ast.Or
;
import
org.jdom2.Document
;
import
org.jdom2.Element
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -101,6 +88,8 @@ public class WeixinServiceImpl {
...
@@ -101,6 +88,8 @@ public class WeixinServiceImpl {
private
OrderOperationLogServiceImpl
orderOperationLogService
;
private
OrderOperationLogServiceImpl
orderOperationLogService
;
@Autowired
@Autowired
private
MachineApiServiceImpl
machineApiService
;
private
MachineApiServiceImpl
machineApiService
;
@Autowired
private
OrderRefundMapper
orderRefundMapper
;
private
final
ReentrantLock
lock
=
new
ReentrantLock
();
private
final
ReentrantLock
lock
=
new
ReentrantLock
();
...
@@ -125,6 +114,8 @@ public class WeixinServiceImpl {
...
@@ -125,6 +114,8 @@ public class WeixinServiceImpl {
@Value
(
"${weixin.cert-path}"
)
@Value
(
"${weixin.cert-path}"
)
private
String
certPath
;
private
String
certPath
;
@Value
(
"${weixin.refund-url}"
)
private
String
refundUrl
;
public
String
getSessionKeyOrOpenId
(
String
code
)
{
public
String
getSessionKeyOrOpenId
(
String
code
)
{
String
url
=
"https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"
;
String
url
=
"https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"
;
...
@@ -270,11 +261,11 @@ public class WeixinServiceImpl {
...
@@ -270,11 +261,11 @@ public class WeixinServiceImpl {
//退款订单号
//退款订单号
.
outRefundNo
(
refundNo
)
.
outRefundNo
(
refundNo
)
//金额
//金额
.
totalFee
(
1
)
.
totalFee
(
totalFee
)
//退款金额
//退款金额
.
refundFee
(
1
)
.
refundFee
(
refundFee
)
//todo 回调地址
//todo 回调地址
.
notifyUrl
(
"http://我们系统的域名/api/client/refund/refundNotify"
)
.
notifyUrl
(
refundUrl
)
.
build
();
.
build
();
WxPayRefundResult
wxPayRefundResult
;
WxPayRefundResult
wxPayRefundResult
;
try
{
try
{
...
@@ -288,6 +279,7 @@ public class WeixinServiceImpl {
...
@@ -288,6 +279,7 @@ public class WeixinServiceImpl {
}
}
}
catch
(
WxPayException
e
)
{
}
catch
(
WxPayException
e
)
{
log
.
error
(
"微信退款接口错误信息= {}"
,
e
);
log
.
error
(
"微信退款接口错误信息= {}"
,
e
);
throw
new
ServiceException
(
"微信退款失败"
);
}
}
return
"退款失败"
;
return
"退款失败"
;
...
@@ -487,7 +479,30 @@ public class WeixinServiceImpl {
...
@@ -487,7 +479,30 @@ public class WeixinServiceImpl {
//判断你返回状态信息是否正确
//判断你返回状态信息是否正确
if
(
"SUCCESS"
.
equals
(
wxPayRefundNotifyResult
.
getReturnCode
()))
{
if
(
"SUCCESS"
.
equals
(
wxPayRefundNotifyResult
.
getReturnCode
()))
{
WxPayRefundNotifyResult
.
ReqInfo
reqInfo
=
wxPayRefundNotifyResult
.
getReqInfo
();
WxPayRefundNotifyResult
.
ReqInfo
reqInfo
=
wxPayRefundNotifyResult
.
getReqInfo
();
reqInfo
.
getOutRefundNo
();
String
outRefundNo
=
reqInfo
.
getOutRefundNo
();
OrderRefund
orderRefund
=
new
OrderRefund
();
orderRefund
.
setRefundNo
(
outRefundNo
);
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectOrderRefundList
(
orderRefund
);
if
(
orderRefunds
.
isEmpty
()){
log
.
error
(
"找不到该退款订单:【{}】"
,
outRefundNo
);
return
WxPayNotifyResponse
.
fail
(
"退款失败"
);
}
OrderRefund
orderRefund1
=
orderRefunds
.
get
(
0
);
if
(
"1"
.
equals
(
orderRefund1
.
getState
())){
orderRefund1
.
setState
(
"2"
);
orderRefundMapper
.
updateOrderRefund
(
orderRefund1
);
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
String
.
valueOf
(
orderRefund1
.
getOrderId
()));
orderOperationLog
.
setOperation
(
"退款"
);
orderOperationLog
.
setOperationUser
(
"自动退款"
);
orderOperationLog
.
setCreateAt
(
new
Date
());
orderOperationLog
.
setContent
(
"退款成功"
);
orderOperationLog
.
setStatus
(
"退款"
);
orderOperationLogService
.
insertOrderOperationLog
(
orderOperationLog
);
return
WxPayNotifyResponse
.
success
(
"退款成功!"
);
}
//判断退款状态
//判断退款状态
// if (REFUND_SUCCESS.equals(reqInfo.getRefundStatus())) {
// if (REFUND_SUCCESS.equals(reqInfo.getRefundStatus())) {
// //内部订单号
// //内部订单号
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/Goods.java
View file @
24181a36
...
@@ -27,10 +27,20 @@ public class Goods extends BaseEntity
...
@@ -27,10 +27,20 @@ public class Goods extends BaseEntity
@Excel
(
name
=
"商品名称"
)
@Excel
(
name
=
"商品名称"
)
private
String
name
;
private
String
name
;
public
String
getCategoryName
()
{
return
categoryName
;
}
public
void
setCategoryName
(
String
categoryName
)
{
this
.
categoryName
=
categoryName
;
}
/** 商品分类 */
/** 商品分类 */
@Excel
(
name
=
"商品分类"
)
@Excel
(
name
=
"商品分类"
)
private
String
category
;
private
String
category
;
private
String
categoryName
;
/** 原售价 */
/** 原售价 */
@Excel
(
name
=
"原售价"
)
@Excel
(
name
=
"原售价"
)
private
BigDecimal
price
;
private
BigDecimal
price
;
...
@@ -101,6 +111,25 @@ public class Goods extends BaseEntity
...
@@ -101,6 +111,25 @@ public class Goods extends BaseEntity
this
.
salesVolume
=
salesVolume
;
this
.
salesVolume
=
salesVolume
;
}
}
public
String
getRecommend
()
{
return
recommend
;
}
public
void
setRecommend
(
String
recommend
)
{
this
.
recommend
=
recommend
;
}
public
String
getPreferential
()
{
return
preferential
;
}
public
void
setPreferential
(
String
preferential
)
{
this
.
preferential
=
preferential
;
}
private
String
recommend
;
private
String
preferential
;
/**
/**
* 总销量
* 总销量
*/
*/
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/OrderRefund.java
View file @
24181a36
...
@@ -67,6 +67,16 @@ public class OrderRefund extends BaseEntity
...
@@ -67,6 +67,16 @@ public class OrderRefund extends BaseEntity
private
String
orderNo
;
private
String
orderNo
;
public
BigDecimal
getTotalFee
()
{
return
totalFee
;
}
public
void
setTotalFee
(
BigDecimal
totalFee
)
{
this
.
totalFee
=
totalFee
;
}
private
BigDecimal
totalFee
;
public
Order
getOrder
()
{
public
Order
getOrder
()
{
return
order
;
return
order
;
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ShopGoodsSkuMapper.java
View file @
24181a36
...
@@ -70,4 +70,6 @@ public interface ShopGoodsSkuMapper
...
@@ -70,4 +70,6 @@ public interface ShopGoodsSkuMapper
void
deleteShopGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
Long
goodsId
);
void
deleteShopGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
Long
goodsId
);
int
updateSkuStatus
(
@Param
(
"skuIds"
)
List
<
String
>
skuIds
,
@Param
(
"machineCode"
)
String
robotID
,
@Param
(
"shopId"
)
String
shopID
,
@Param
(
"status"
)
String
status
);
int
updateSkuStatus
(
@Param
(
"skuIds"
)
List
<
String
>
skuIds
,
@Param
(
"machineCode"
)
String
robotID
,
@Param
(
"shopId"
)
String
shopID
,
@Param
(
"status"
)
String
status
);
void
deleteByGoodsIds
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsIds"
)
List
<
String
>
goodsIds
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderRefundService.java
View file @
24181a36
...
@@ -60,4 +60,6 @@ public interface IOrderRefundService
...
@@ -60,4 +60,6 @@ public interface IOrderRefundService
* @return 结果
* @return 结果
*/
*/
public
int
deleteOrderRefundById
(
String
id
);
public
int
deleteOrderRefundById
(
String
id
);
OrderRefund
getOrderRefund
(
String
id
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IShopService.java
View file @
24181a36
...
@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
...
@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import
java.util.List
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.system.domain.GoodsCategory
;
import
com.ruoyi.system.domain.GoodsCategory
;
import
com.ruoyi.system.domain.GoodsSku
;
import
com.ruoyi.system.domain.GoodsSku
;
import
com.ruoyi.system.domain.Shop
;
import
com.ruoyi.system.domain.Shop
;
...
@@ -73,4 +74,5 @@ public interface IShopService
...
@@ -73,4 +74,5 @@ public interface IShopService
List
<
String
>
getShopCity
();
List
<
String
>
getShopCity
();
String
offGoods
(
JSONObject
body
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsCategoryServiceImpl.java
View file @
24181a36
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
...
@@ -3,6 +3,7 @@ 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.exception.ServiceException
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.system.domain.Goods
;
import
com.ruoyi.system.domain.Goods
;
import
com.ruoyi.system.service.IGoodsCategoryService
;
import
com.ruoyi.system.service.IGoodsCategoryService
;
...
@@ -79,6 +80,15 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
...
@@ -79,6 +80,15 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
@Override
@Override
public
int
updateGoodsCategory
(
GoodsCategory
goodsCategory
)
public
int
updateGoodsCategory
(
GoodsCategory
goodsCategory
)
{
{
if
(
"2"
.
equals
(
goodsCategory
.
getState
())){
Goods
goods
=
new
Goods
();
goods
.
setCategory
(
goodsCategory
.
getId
());
goods
.
setIsDeleted
(
0L
);
int
size
=
goodsMapper
.
selectGoodsList
(
goods
).
size
();
if
(
size
>
0
){
throw
new
ServiceException
(
"有商品还在使用,请先删除商品"
);
}
}
return
goodsCategoryMapper
.
updateGoodsCategory
(
goodsCategory
);
return
goodsCategoryMapper
.
updateGoodsCategory
(
goodsCategory
);
}
}
...
@@ -91,6 +101,15 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
...
@@ -91,6 +101,15 @@ public class GoodsCategoryServiceImpl implements IGoodsCategoryService
@Override
@Override
public
int
deleteGoodsCategoryByIds
(
String
[]
ids
)
public
int
deleteGoodsCategoryByIds
(
String
[]
ids
)
{
{
for
(
String
id
:
ids
)
{
Goods
goods
=
new
Goods
();
goods
.
setCategory
(
id
);
goods
.
setIsDeleted
(
0L
);
int
size
=
goodsMapper
.
selectGoodsList
(
goods
).
size
();
if
(
size
>
0
){
throw
new
ServiceException
(
"有商品还在使用,请先删除商品"
);
}
}
return
goodsCategoryMapper
.
deleteGoodsCategoryByIds
(
ids
);
return
goodsCategoryMapper
.
deleteGoodsCategoryByIds
(
ids
);
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
View file @
24181a36
...
@@ -40,6 +40,8 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -40,6 +40,8 @@ public class GoodsServiceImpl implements IGoodsService
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
@Autowired
@Autowired
private
OrderMapper
orderMapper
;
private
OrderMapper
orderMapper
;
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
/**
/**
* 查询商品
* 查询商品
...
@@ -68,7 +70,10 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -68,7 +70,10 @@ public class GoodsServiceImpl implements IGoodsService
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
)
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
)
{
{
List
<
Goods
>
goodsList
=
goodsMapper
.
selectGoodsList
(
goods
);
List
<
Goods
>
goodsList
=
goodsMapper
.
selectGoodsList
(
goods
);
for
(
Goods
goods1
:
goodsList
)
{
for
(
Goods
goods1
:
goodsList
)
{
GoodsCategory
goodsCategory
=
goodsCategoryMapper
.
selectGoodsCategoryById
(
goods1
.
getCategory
());
goods1
.
setCategoryName
(
goodsCategory
.
getName
());
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
goods1
.
setSalesVolume
(
count
);
goods1
.
setSalesVolume
(
count
);
}
}
...
@@ -87,11 +92,14 @@ public class GoodsServiceImpl implements IGoodsService
...
@@ -87,11 +92,14 @@ public class GoodsServiceImpl implements IGoodsService
@Transactional
@Transactional
public
int
insertGoods
(
Goods
goods
)
public
int
insertGoods
(
Goods
goods
)
{
{
if
(
goods
.
getDiscount
().
compareTo
(
goods
.
getPrice
())>
0
){
throw
new
ServiceException
(
"折扣价不能大于等于原价"
);
}
goods
.
setCode
(
GenerateCode
.
getCode
(
"G"
));
goods
.
setCode
(
GenerateCode
.
getCode
(
"G"
));
goods
.
setCreatedAt
(
new
Date
());
goods
.
setCreatedAt
(
new
Date
());
goods
.
setUpdatedAt
(
new
Date
());
goods
.
setUpdatedAt
(
new
Date
());
goods
.
setIsDeleted
(
0L
);
goods
.
setIsDeleted
(
0L
);
goods
.
setState
(
"
2
"
);
goods
.
setState
(
"
1
"
);
goodsMapper
.
insertGoods
(
goods
);
goodsMapper
.
insertGoods
(
goods
);
insertgoodsExt
(
goods
);
insertgoodsExt
(
goods
);
return
1
;
return
1
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderRefundServiceImpl.java
View file @
24181a36
...
@@ -4,6 +4,7 @@ import java.util.Date;
...
@@ -4,6 +4,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.mapper.OrderMapper
;
import
com.ruoyi.system.mapper.OrderMapper
;
...
@@ -89,6 +90,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -89,6 +90,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
orderRefund
.
setState
(
"0"
);
orderRefund
.
setState
(
"0"
);
orderRefund
.
setOrderNo
(
order
.
getOrderNo
());
orderRefund
.
setOrderNo
(
order
.
getOrderNo
());
orderRefund
.
setRefundNo
(
GenerateCode
.
getCode
(
"R"
,
"%09d"
));
orderRefund
.
setRefundNo
(
GenerateCode
.
getCode
(
"R"
,
"%09d"
));
orderRefund
.
setTotalFee
(
order
.
getAmount
());
int
i
=
orderRefundMapper
.
insertOrderRefund
(
orderRefund
);
int
i
=
orderRefundMapper
.
insertOrderRefund
(
orderRefund
);
return
AjaxResult
.
success
(
orderRefund
);
return
AjaxResult
.
success
(
orderRefund
);
}
}
...
@@ -128,4 +130,17 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -128,4 +130,17 @@ public class OrderRefundServiceImpl implements IOrderRefundService
{
{
return
orderRefundMapper
.
deleteOrderRefundById
(
id
);
return
orderRefundMapper
.
deleteOrderRefundById
(
id
);
}
}
@Override
public
OrderRefund
getOrderRefund
(
String
id
)
{
OrderRefund
orderRefund
=
orderRefundMapper
.
selectOrderRefundById
(
id
);
if
(
"0"
.
equals
(
orderRefund
.
getState
())
||
"3"
.
equals
(
orderRefund
.
getState
())){
}
else
{
throw
new
ServiceException
(
"该状态不允许退款"
);
}
Order
order
=
orderMapper
.
selectOrderById
(
orderRefund
.
getOrderId
());
orderRefund
.
setTotalFee
(
order
.
getAmount
());
return
orderRefund
;
}
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ShopServiceImpl.java
View file @
24181a36
...
@@ -4,6 +4,7 @@ import java.util.Date;
...
@@ -4,6 +4,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
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.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
...
@@ -40,6 +41,8 @@ public class ShopServiceImpl implements IShopService
...
@@ -40,6 +41,8 @@ public class ShopServiceImpl implements IShopService
private
OrderMapper
orderMapper
;
private
OrderMapper
orderMapper
;
@Autowired
@Autowired
private
GoodsMapper
goodsMapper
;
private
GoodsMapper
goodsMapper
;
@Autowired
private
ShopRecommendMapper
shopRecommendMapper
;
...
@@ -191,7 +194,23 @@ public class ShopServiceImpl implements IShopService
...
@@ -191,7 +194,23 @@ public class ShopServiceImpl implements IShopService
List
<
GoodsCategory
>
shopCategories
=
goodsCategoryMapper
.
selectByShopId
(
shopId
);
List
<
GoodsCategory
>
shopCategories
=
goodsCategoryMapper
.
selectByShopId
(
shopId
);
for
(
GoodsCategory
category
:
shopCategories
)
{
for
(
GoodsCategory
category
:
shopCategories
)
{
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopCategoryGoodsByCategoryId
(
shopId
,
category
.
getId
());
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopCategoryGoodsByCategoryId
(
shopId
,
category
.
getId
());
for
(
Goods
goods
:
goodsList
)
{
for
(
Goods
goods
:
goodsList
)
{
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
shopRecommend
.
setGoodsId
(
String
.
valueOf
(
goods
.
getId
()));
shopRecommend
.
setType
(
"1"
);
goods
.
setPreferential
(
"1"
);
goods
.
setRecommend
(
"1"
);
List
<
ShopRecommend
>
shopRecommends
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
);
if
(
shopRecommends
.
size
()>
0
){
goods
.
setPreferential
(
"0"
);
}
shopRecommend
.
setType
(
"2"
);
shopRecommends
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
);
if
(
shopRecommends
.
size
()>
0
){
goods
.
setRecommend
(
"0"
);
}
goods
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shopId
,
goods
.
getId
()));
goods
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shopId
,
goods
.
getId
()));
}
}
category
.
setGoodsList
(
goodsList
);
category
.
setGoodsList
(
goodsList
);
...
@@ -228,6 +247,16 @@ public class ShopServiceImpl implements IShopService
...
@@ -228,6 +247,16 @@ public class ShopServiceImpl implements IShopService
return
collect
;
return
collect
;
}
}
@Override
public
String
offGoods
(
JSONObject
body
)
{
Long
shopId
=
body
.
getLong
(
"shopId"
);
String
string
=
body
.
getString
(
"goodsIds"
);
List
<
String
>
goodsIds
=
JSONObject
.
parseArray
(
string
,
String
.
class
);
shopGoodsSkuMapper
.
deleteByGoodsIds
(
shopId
,
goodsIds
);
return
null
;
}
public
AjaxResult
checkSku
(
String
shopId
,
String
skuId
,
String
machineCode
)
{
public
AjaxResult
checkSku
(
String
shopId
,
String
skuId
,
String
machineCode
)
{
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SpecServiceImpl.java
View file @
24181a36
...
@@ -139,6 +139,14 @@ public class SpecServiceImpl implements ISpecService
...
@@ -139,6 +139,14 @@ public class SpecServiceImpl implements ISpecService
@Override
@Override
public
int
updateSpec
(
Spec
spec
)
public
int
updateSpec
(
Spec
spec
)
{
{
if
(
2
==
spec
.
getState
()){
String
query
=
"\"specId\": "
+
spec
.
getId
();
List
<
GoodsSku
>
goodsSkus
=
goodsSkuMapper
.
selectSpec
(
query
);
if
(!
goodsSkus
.
isEmpty
()){
throw
new
ServiceException
(
"当前还有商品使用,请先删除商品"
);
}
}
specRuleMapper
.
deleteSpecRuleBySpecId
(
spec
.
getId
());
specRuleMapper
.
deleteSpecRuleBySpecId
(
spec
.
getId
());
specRuleMaterialMapper
.
deleteSpecRuleMaterialBySpecId
(
spec
.
getId
());
specRuleMaterialMapper
.
deleteSpecRuleMaterialBySpecId
(
spec
.
getId
());
spec
.
setIsDeleted
(
0
);
spec
.
setIsDeleted
(
0
);
...
...
ruoyi-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
24181a36
...
@@ -168,6 +168,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -168,6 +168,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"orderNo!=null "
>
<if
test=
"orderNo!=null "
>
and order_no =#{orderNo}
and order_no =#{orderNo}
</if>
</if>
<if
test=
"orderNum!=null "
>
and order_num =#{orderNum}
</if>
<if
test=
"userName!=null"
>
and user_name like concat('%', #{userName}, '%')
</if>
<if
test=
"shopId!=null "
>
and shop_id =#{shopId}
</if>
<if
test=
"state!=null "
>
and shop_id =#{shopId}
</if>
<if
test=
"createAtStart!=null "
>
<![CDATA[ and create_at >= to_date(#{createAtStart,jdbcType=DATE},'yyyy-MM-dd hh24:mi:ss')]]>
</if>
<if
test=
"createAtEnd!=null "
>
<![CDATA[ and create_at <= to_date(#{createAtEnd,jdbcType=DATE},'yyyy-MM-dd hh24:mi:ss')]]>
</if>
<if
test=
"payAtStart!=null "
>
<![CDATA[ and pay_time >= to_date(#{payAtStart,jdbcType=DATE},'yyyy-MM-dd hh24:mi:ss')]]>
</if>
<if
test=
"payAtEnd!=null "
>
<![CDATA[ and pay_time <= to_date(#{payAtEnd,jdbcType=DATE},'yyyy-MM-dd hh24:mi:ss')]]>
</if>
</where>
</where>
</select>
</select>
<select
id=
"selectOrder"
resultMap=
"OrderResult"
>
<select
id=
"selectOrder"
resultMap=
"OrderResult"
>
...
...
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
24181a36
...
@@ -125,4 +125,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -125,4 +125,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</where>
</where>
</update>
</update>
<delete
id=
"deleteByGoodsIds"
>
delete shop_goods_sku where shop_id=#{shopId}
and goods_id in
<foreach
collection=
"goodsIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</delete>
</mapper>
</mapper>
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
View file @
24181a36
...
@@ -141,7 +141,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -141,7 +141,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.pics,
g.pics,
g.`desc`,
g.`desc`,
g.remarks,
g.remarks,
sg.state,
g.code
g.code
from
from
shop s ,
shop s ,
...
...
ruoyi-system/src/main/resources/mapper/system/SpecRuleMapper.xml
View file @
24181a36
...
@@ -24,7 +24,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -24,7 +24,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectSpecRuleList"
parameterType=
"SpecRule"
resultMap=
"SpecRuleResult"
>
<select
id=
"selectSpecRuleList"
parameterType=
"SpecRule"
resultMap=
"SpecRuleResult"
>
<include
refid=
"selectSpecRuleVo"
/>
<include
refid=
"selectSpecRuleVo"
/>
<where>
<where>
and is_deleted = 0
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"specId != null and specId != ''"
>
and spec_id = #{specId}
</if>
<if
test=
"specId != null and specId != ''"
>
and spec_id = #{specId}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
...
...
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