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
0c232214
Commit
0c232214
authored
May 21, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码修改
parent
f97c35be
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
289 additions
and
139 deletions
+289
-139
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
+10
-9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineApiController.java
+11
-2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineController.java
+1
-1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
+8
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/SpecController.java
+1
-1
ruoyi-admin/src/main/resources/application.yml
+2
-2
ruoyi-framework/src/main/java/com/ruoyi/framework/config/JiGuangConfig.java
+1
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/GlobalExceptionHandlerFilter.java
+1
-1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
+32
-23
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/PushBean.java
+12
-0
ruoyi-system/src/main/java/com/ruoyi/system/jiguang/impl/JiGuangPushServiceImpl.java
+14
-3
ruoyi-system/src/main/java/com/ruoyi/system/jiguang/impl/MyJiGuangPushServiceImpl.java
+11
-2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/MachineMapper.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ShopGoodsMapper.java
+3
-2
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderOperationLogService.java
+2
-2
ruoyi-system/src/main/java/com/ruoyi/system/service/IShopService.java
+4
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
+4
-2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineApiServiceImpl.java
+19
-1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineServiceImpl.java
+20
-15
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderOperationLogServiceImpl.java
+16
-2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
+5
-11
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderTakingServiceImpl.java
+59
-50
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ShopServiceImpl.java
+15
-1
ruoyi-system/src/main/resources/mapper/system/GoodsMapper.xml
+6
-1
ruoyi-system/src/main/resources/mapper/system/MachineMapper.xml
+8
-5
ruoyi-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
+20
-0
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+1
-2
ruoyi-system/src/main/resources/mapper/system/SpecRuleMapper.xml
+1
-1
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
View file @
0c232214
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.uuid.UUID
;
...
...
@@ -48,21 +49,21 @@ public class ApplicationController {
@RequestMapping
(
"/getData"
)
public
AjaxResult
getApplicationData
(
String
key
){
String
s
=
stringRedisTemplate
.
opsForValue
().
get
(
key
);
stringRedisTemplate
.
delete
(
key
);
String
[]
keys
=
key
.
split
(
"_"
);
//推送数据给安卓
PushBean
pushBean
=
new
PushBean
();
Map
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"type"
,
"1"
);
map
.
put
(
"code"
,
"200"
);
jiGuangPushService
.
push
(
keys
[
0
],
map
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"QRCODE_VISITED"
);
jsonObject
.
put
(
"timestamp"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"seqNo"
,
key
);
jsonObject
.
put
(
"data"
,
data
);
jiGuangPushService
.
push
(
keys
[
0
],
jsonObject
);
stringRedisTemplate
.
delete
(
key
);
return
AjaxResult
.
success
(
"处理成功"
,
s
);
}
@RequestMapping
(
"/jgRegister"
)
public
AjaxResult
jgRegister
(
@RequestParam
String
machineCode
,
@RequestParam
String
registerId
){
Machine
machine
=
machineService
.
selectMachineById
(
machineCode
);
Machine
machine
=
machineService
.
selectMachineByCode
(
machineCode
);
if
(
machine
==
null
){
throw
new
ServiceException
(
"该机器未绑定店铺,请先绑定店铺"
);
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineApiController.java
View file @
0c232214
...
...
@@ -18,13 +18,22 @@ public class MachineApiController {
public
ResultVo
shopGoodsUpdate
(
@RequestBody
String
body
){
log
.
info
(
"/down/material/update 请求内容为 【{}】"
,
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
return
ResultVo
.
success
(
machineApiService
.
shopGoodsUpdate
(
jsonObject
));
try
{
return
ResultVo
.
success
(
machineApiService
.
shopGoodsUpdate
(
jsonObject
));
}
catch
(
Exception
e
){
return
ResultVo
.
error
(
e
.
getMessage
());
}
}
@PostMapping
(
"/down/order/update"
)
public
ResultVo
updateOrder
(
@RequestBody
String
body
){
log
.
info
(
"/down/order/update 请求内容为 【{}】"
,
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
return
ResultVo
.
success
(
machineApiService
.
updateOrder
(
jsonObject
));
try
{
return
ResultVo
.
success
(
machineApiService
.
updateOrder
(
jsonObject
));
}
catch
(
Exception
e
){
return
ResultVo
.
error
(
e
.
getMessage
());
}
}
@PostMapping
(
"/down/robot/status"
)
public
ResultVo
robotUpdate
(
@RequestBody
String
body
){
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/MachineController.java
View file @
0c232214
...
...
@@ -34,7 +34,7 @@ public class MachineController extends BaseController
/**
* 查询机器列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:machine:list')"
)
//
@PreAuthorize("@ss.hasPermi('system:machine:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Machine
machine
)
{
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
View file @
0c232214
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.system.domain.Goods
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -141,6 +142,13 @@ public class ShopController extends BaseController
return
AjaxResult
.
success
(
shopService
.
getShopCity
());
}
@GetMapping
(
"/goodslist"
)
public
TableDataInfo
list
(
String
goodsName
,
String
category
,
Long
shopId
)
{
startPage
();
List
<
Goods
>
list
=
shopService
.
selectGoodsList
(
goodsName
,
category
,
shopId
);
return
getDataTable
(
list
);
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/SpecController.java
View file @
0c232214
...
...
@@ -60,7 +60,7 @@ public class SpecController extends BaseController
/**
* 新增规格
*/
@PreAuthorize
(
"@ss.hasPermi('system:spec:add')"
)
//
@PreAuthorize("@ss.hasPermi('system:spec:add')")
@Log
(
title
=
"规格"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Spec
spec
)
...
...
ruoyi-admin/src/main/resources/application.yml
View file @
0c232214
...
...
@@ -156,7 +156,7 @@ sms:
accessKeySecret
:
signName
:
push
:
appkey
:
123
secret
:
12
3
appkey
:
682a53c0cd0201792d45c469
secret
:
b58cb126f80ec9bf7577a21
3
machine
:
url
:
http://47.94.241.71:10003
ruoyi-framework/src/main/java/com/ruoyi/framework/config/JiGuangConfig.java
View file @
0c232214
...
...
@@ -19,6 +19,7 @@ public class JiGuangConfig {
private
String
secret
;
// 获取推送客户端
@Bean
public
JPushClient
getJPushClient
()
{
JPushClient
jPushClient
=
new
JPushClient
(
secret
,
appkey
);
return
jPushClient
;
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/GlobalExceptionHandlerFilter.java
View file @
0c232214
...
...
@@ -43,7 +43,7 @@ public class GlobalExceptionHandlerFilter implements Filter {
ajaxResult
=
AjaxResult
.
error
(
"该数据已经存在"
);
}
else
if
(
throwable
instanceof
ServiceException
){
ajaxResult
=
AjaxResult
.
error
(
e
.
getMessage
());
}
else
{
}
else
if
(
throwable
instanceof
ServiceException
)
{
throw
e
;
}
servletResponse
.
getWriter
().
write
(
JSONObject
.
toJSONString
(
ajaxResult
));
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
View file @
0c232214
...
...
@@ -26,8 +26,11 @@ import com.ruoyi.system.domain.Customer;
import
com.ruoyi.system.domain.Order
;
import
com.ruoyi.system.domain.OrderOperationLog
;
import
com.ruoyi.system.domain.OrderRefund
;
import
com.ruoyi.system.jiguang.JiGuangPushService
;
import
com.ruoyi.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.ruoyi.system.mapper.CustomerMapper
;
import
com.ruoyi.system.mapper.MachineMapper
;
import
com.ruoyi.system.mapper.OrderMapper
;
import
com.ruoyi.system.mapper.OrderRefundMapper
;
import
com.ruoyi.system.service.impl.MachineApiServiceImpl
;
...
...
@@ -90,6 +93,9 @@ public class WeixinServiceImpl {
private
MachineApiServiceImpl
machineApiService
;
@Autowired
private
OrderRefundMapper
orderRefundMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
private
final
ReentrantLock
lock
=
new
ReentrantLock
();
...
...
@@ -389,7 +395,15 @@ public class WeixinServiceImpl {
String
orderNo
=
notifyMap
.
get
(
"out_trade_no"
);
Order
order
=
new
Order
();
order
.
setOrderNo
(
orderNo
);
Order
order1
=
orderMapper
.
selectOrderList
(
order
).
get
(
0
);
List
<
Order
>
orders
=
orderMapper
.
selectOrderList
(
order
);
if
(
orders
.
isEmpty
()){
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_msg"
,
"没有该订单"
);
String
returnXml
=
WXPayUtil
.
mapToXml
(
returnMap
);
return
returnXml
;
}
order
=
orders
.
get
(
0
);
//并校验返回的订单金额是否与商户侧的订单金额一致
// if (order1 != null && order1.get() != Long.parseLong(notifyMap.get("total_fee"))) {
// log.error("金额校验失败");
...
...
@@ -405,27 +419,26 @@ public class WeixinServiceImpl {
try
{
//处理重复的通知
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
String
orderStatus
=
order
1
.
getState
();
String
orderStatus
=
order
.
getState
();
if
(
"1"
.
equals
(
orderStatus
)){
//更新订单状态
order
1
.
setPayTime
(
new
Date
());
order
1
.
setState
(
"2"
);
order
.
setPayTime
(
new
Date
());
order
.
setState
(
"2"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"orderId"
,
order
.
getId
());
jsonObject
.
put
(
"userId"
,
order
.
getUserId
());
order1
.
setPickCode
(
QRCodeUtil
.
getBase64QRCode
(
jsonObject
.
toJSONString
()));
orderMapper
.
updateOrder
(
order1
);
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()));
orderOperationLog
.
setOperation
(
"付款"
);
orderOperationLog
.
setOperationUser
(
order
.
getUserName
());
orderOperationLog
.
setCreateAt
(
new
Date
());
orderOperationLog
.
setContent
(
"付款成功"
);
orderOperationLog
.
setStatus
(
"付款"
);
orderOperationLogService
.
insertOrderOperationLog
(
orderOperationLog
);
machineApiService
.
updateOrder
(
order1
);
order
.
setPickCode
(
QRCodeUtil
.
getBase64QRCode
(
jsonObject
.
toJSONString
()));
orderMapper
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
"已付款"
,
order
.
getId
(),
"付款成功"
,
order
.
getUserName
(),
"付款"
);
machineApiService
.
updateOrder
(
order
);
//极光推送
String
machineId
=
order
.
getMachineId
();
Map
map
=
new
HashMap
();
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"orderId"
,
order
.
getId
());
map
.
put
(
"state"
,
order
.
getState
());
jiGuangPushService
.
pushMachine
(
machineId
,
map
);
}
}
finally
{
//要主动释放锁
...
...
@@ -493,12 +506,8 @@ public class WeixinServiceImpl {
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
);
orderOperationLogService
.
insertOrderOperationLog
(
"已退款"
,
Long
.
valueOf
(
orderRefund
.
getOrderId
()),
"用户退款成功,已到账"
,
"系统"
,
"退款"
);
return
WxPayNotifyResponse
.
success
(
"退款成功!"
);
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/PushBean.java
View file @
0c232214
package
com
.
ruoyi
.
system
.
domain
.
vo
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Map
;
public
class
PushBean
{
...
...
@@ -11,6 +13,16 @@ public class PushBean {
//android专用// 可选, 通知标题,如果指定了,则通知里原来展示 App名称的地方,将展示成这个字段。
private
String
title
;
public
JSONObject
getMessageCount
()
{
return
messageCount
;
}
public
void
setMessageCount
(
JSONObject
messageCount
)
{
this
.
messageCount
=
messageCount
;
}
private
JSONObject
messageCount
;
public
String
getAlert
()
{
return
alert
;
...
...
ruoyi-system/src/main/java/com/ruoyi/system/jiguang/impl/JiGuangPushServiceImpl.java
View file @
0c232214
package
com
.
ruoyi
.
system
.
jiguang
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.system.domain.Machine
;
import
com.ruoyi.system.domain.vo.PushBean
;
import
com.ruoyi.system.jiguang.JiGuangPushService
;
import
com.ruoyi.system.jiguang.MyJiGuangPushService
;
...
...
@@ -92,13 +94,22 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
return
regList
.
toArray
(
new
String
[
0
]);
}
public
void
push
(
String
key
,
Map
<
String
,
String
>
map
)
{
public
void
push
(
String
key
,
JSONObject
jsonObject
)
{
String
s
=
machineMapper
.
selectRegister
(
key
);
if
(
StringUtils
.
isNotEmpty
(
s
)){
PushBean
pushBean
=
new
PushBean
();
pushBean
.
set
Extras
(
map
);
pushAndroid
(
pushBean
,
key
);
pushBean
.
set
MessageCount
(
jsonObject
);
pushAndroid
(
pushBean
,
s
);
}
}
public
void
pushMachine
(
String
machineId
,
Map
<
String
,
String
>
map
)
{
Machine
machine
=
machineMapper
.
selectMachineById
(
machineId
);
if
(
StringUtils
.
isNotEmpty
(
machine
.
getRegister
())){
PushBean
pushBean
=
new
PushBean
();
pushBean
.
setExtras
(
map
);
pushBean
.
setAlert
(
"新消息"
);
pushAndroid
(
pushBean
,
machine
.
getRegister
());
}
}
}
ruoyi-system/src/main/java/com/ruoyi/system/jiguang/impl/MyJiGuangPushServiceImpl.java
View file @
0c232214
...
...
@@ -4,16 +4,22 @@ import cn.jpush.api.JPushClient;
import
cn.jpush.api.common.resp.APIConnectionException
;
import
cn.jpush.api.common.resp.APIRequestException
;
import
cn.jpush.api.push.PushResult
;
import
cn.jpush.api.push.model.Message
;
import
cn.jpush.api.push.model.Platform
;
import
cn.jpush.api.push.model.PushPayload
;
import
cn.jpush.api.push.model.audience.Audience
;
import
cn.jpush.api.push.model.notification.Notification
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.system.domain.Machine
;
import
com.ruoyi.system.domain.vo.PushBean
;
import
com.ruoyi.system.jiguang.MyJiGuangPushService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 极光推送
* 封装第三方api相关
...
...
@@ -21,7 +27,7 @@ import org.springframework.stereotype.Service;
@Service
@Slf4j
public
class
MyJiGuangPushServiceImpl
implements
MyJiGuangPushService
{
//
@Autowired
@Autowired
private
JPushClient
jPushClient
;
/**
* 广播 (所有平台,所有设备, 不支持附加信息)
...
...
@@ -84,10 +90,13 @@ public class MyJiGuangPushServiceImpl implements MyJiGuangPushService {
*/
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
){
Message
build
=
new
Message
.
Builder
().
setMsgContent
(
pushBean
.
getMessageCount
().
toJSONString
()).
build
();
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
android
())
.
setAudience
(
Audience
.
registrationId
(
registids
))
.
setNotification
(
Notification
.
android
(
pushBean
.
getAlert
(),
pushBean
.
getTitle
(),
pushBean
.
getExtras
()))
.
setMessage
(
build
)
//.setNotification(Notification.android(pushBean.getAlert(), pushBean.getTitle(), pushBean.getExtras()))
.
build
());
}
/**
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/MachineMapper.java
View file @
0c232214
...
...
@@ -19,6 +19,8 @@ public interface MachineMapper
*/
public
Machine
selectMachineById
(
String
id
);
public
Machine
selectMachineByCode
(
String
code
);
/**
* 查询机器列表
*
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ShopGoodsMapper.java
View file @
0c232214
package
com
.
ruoyi
.
system
.
mapper
;
import
java.util.List
;
import
java.util.Map
;
import
com.ruoyi.system.domain.Goods
;
import
com.ruoyi.system.domain.ShopGoods
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Param
;
/**
...
...
@@ -69,4 +67,7 @@ public interface ShopGoodsMapper
List
<
Goods
>
selectShopCategoryGoodsByCategoryId
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"categoryId"
)
String
categoryId
);
void
updateStatus
(
@Param
(
"shopID"
)
String
shopID
,
@Param
(
"goodsId"
)
Long
goodsId
,
@Param
(
"machineId"
)
String
robotID
,
@Param
(
"status"
)
String
s
);
List
<
Goods
>
selectShopNoAddGoods
(
@Param
(
"goodsName"
)
String
goodsName
,
@Param
(
"category"
)
String
category
,
@Param
(
"shopId"
)
Long
shopId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IOrderOperationLogService.java
View file @
0c232214
...
...
@@ -30,10 +30,10 @@ public interface IOrderOperationLogService
/**
* 新增【请填写功能名称】
*
* @param
orderOperationLog
【请填写功能名称】
* @param 【请填写功能名称】
* @return 结果
*/
public
int
insertOrderOperationLog
(
OrderOperationLog
orderOperationLog
);
int
insertOrderOperationLog
(
String
status
,
Long
orderId
,
String
content
,
String
operationUser
,
String
operation
);
/**
* 修改【请填写功能名称】
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/IShopService.java
View file @
0c232214
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.system.domain.Goods
;
import
com.ruoyi.system.domain.GoodsCategory
;
import
com.ruoyi.system.domain.GoodsSku
;
import
com.ruoyi.system.domain.Shop
;
...
...
@@ -75,4 +76,7 @@ public interface IShopService
String
offGoods
(
JSONObject
body
);
List
<
Goods
>
selectGoodsList
(
String
goodsName
,
String
category
,
Long
shopId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
View file @
0c232214
...
...
@@ -73,7 +73,9 @@ public class GoodsServiceImpl implements IGoodsService
for
(
Goods
goods1
:
goodsList
)
{
GoodsCategory
goodsCategory
=
goodsCategoryMapper
.
selectGoodsCategoryById
(
goods1
.
getCategory
());
goods1
.
setCategoryName
(
goodsCategory
.
getName
());
if
(
goodsCategory
!=
null
){
goods1
.
setCategoryName
(
goodsCategory
.
getName
());
}
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
goods1
.
setSalesVolume
(
count
);
}
...
...
@@ -255,7 +257,7 @@ public class GoodsServiceImpl implements IGoodsService
shop
.
setIsDefault
(
0L
);
List
<
Shop
>
shops
=
shopService
.
selectShopList
(
shop
);
for
(
Shop
shop1
:
shops
)
{
if
(
"3"
.
equals
(
shop1
.
getState
())){
if
(
!
"3"
.
equals
(
shop1
.
getState
())){
try
{
shopService
.
addGoods
(
shop1
.
getId
(),
goodsId
);
}
catch
(
ServiceException
serviceException
){
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineApiServiceImpl.java
View file @
0c232214
...
...
@@ -43,14 +43,32 @@ public class MachineApiServiceImpl {
List
<
String
>
skuIds
=
JSONObject
.
parseArray
(
skuIDs
,
String
.
class
);
String
robotID
=
jsonObject
.
getString
(
"robotId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
if
(
StringUtils
.
isEmpty
(
skuIDs
)){
throw
new
ServiceException
(
"sku不能为空"
);
}
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
shopGoodsSku
.
setShopId
(
Long
.
parseLong
(
shopID
));
for
(
String
skuId
:
skuIds
)
{
shopGoodsSku
.
setSkuId
(
Long
.
parseLong
(
skuId
));
List
<
ShopGoodsSku
>
shopGoodsSkus
=
shopGoodsSkuMapper
.
selectShopGoodsSkuList
(
shopGoodsSku
);
if
(
shopGoodsSkus
.
isEmpty
()){
throw
new
ServiceException
(
skuId
+
"不存在"
);
}
}
int
i
=
shopGoodsSkuMapper
.
updateSkuStatus
(
skuIds
,
robotID
,
shopID
,
status
);
return
""
+
i
;
}
public
String
updateOrder
(
JSONObject
jsonObject
)
{
l
ong
orderID
=
jsonObject
.
getLong
(
"orderId"
);
L
ong
orderID
=
jsonObject
.
getLong
(
"orderId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Order
order1
=
orderMapper
.
selectOrderById
(
String
.
valueOf
(
orderID
));
if
(
order1
==
null
){
throw
new
ServiceException
(
"该订单不存在"
);
}
Order
order
=
new
Order
();
order
.
setId
(
orderID
);
order
.
setState
(
status
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineServiceImpl.java
View file @
0c232214
...
...
@@ -96,31 +96,36 @@ public class MachineServiceImpl implements IMachineService
@Override
public
String
bindMachine
(
String
code
,
Long
shopId
)
{
Machine
machine1
=
machineMapper
.
selectMachineById
(
code
);
if
(
machine1
!=
null
){
throw
new
ServiceException
(
"该机器已经被绑定,请先解绑再绑定"
);
}
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(!
machines
.
isEmpty
()){
throw
new
ServiceException
(
"目前只允许一个店铺绑定一台机器"
);
}
machine
.
setId
(
code
);
machine
.
setCode
(
code
);
machine
.
setBindTime
(
new
Date
());
machine
.
setCreatedAt
(
new
Date
());
machine
.
setUpdatedAt
(
new
Date
());
machine
.
setState
(
"1"
);
machineMapper
.
insertMachine
(
machine
);
return
null
;
Machine
machine1
=
machineMapper
.
selectMachineByCode
(
code
);
if
(
machine1
==
null
){
machine
.
setCode
(
code
);
machine
.
setBindTime
(
new
Date
());
machine
.
setCreatedAt
(
new
Date
());
machine
.
setUpdatedAt
(
new
Date
());
machine
.
setState
(
"1"
);
return
machineMapper
.
insertMachine
(
machine
)+
""
;
}
if
(
machine1
.
getShopId
()!=
null
){
throw
new
ServiceException
(
"该机器已经被绑定,请先解绑再绑定"
);
}
machine1
.
setCode
(
code
);
machine1
.
setShopId
(
shopId
);
machineMapper
.
updateMachine
(
machine1
);
return
"1"
;
}
@Override
public
int
unbound
(
String
id
)
{
return
machineMapper
.
deleteMachineById
(
id
);
}
public
Machine
selectMachineByCode
(
String
machineCode
)
{
return
machineMapper
.
selectMachineByCode
(
machineCode
);
}
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderOperationLogServiceImpl.java
View file @
0c232214
package
com
.
ruoyi
.
system
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
com.ruoyi.common.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.system.mapper.OrderOperationLogMapper
;
...
...
@@ -50,9 +53,20 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
* @return 结果
*/
@Override
public
int
insertOrderOperationLog
(
OrderOperationLog
orderOperationLog
)
public
int
insertOrderOperationLog
(
String
status
,
Long
orderId
,
String
content
,
String
operationUser
,
String
operation
)
{
return
orderOperationLogMapper
.
insertOrderOperationLog
(
orderOperationLog
);
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
operationLog
.
setStatus
(
status
);
operationLog
.
setOrderId
(
String
.
valueOf
(
orderId
));
operationLog
.
setContent
(
content
);
operationLog
.
setCreateAt
(
new
Date
());
if
(
StringUtils
.
isEmpty
(
operationUser
)){
operationLog
.
setOperationUser
(
"接口"
);
}
if
(
StringUtils
.
isEmpty
(
operation
)){
operationLog
.
setOperation
(
"同步信息"
);
}
return
orderOperationLogMapper
.
insertOrderOperationLog
(
operationLog
);
}
/**
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
View file @
0c232214
...
...
@@ -112,8 +112,8 @@ public class OrderServiceImpl implements IOrderService
if
(!
"1"
.
equals
(
machine1
.
getState
())){
return
AjaxResult
.
error
(
"机器暂时不可用"
);
}
machineId
=
machine1
.
get
Code
();
order
.
setMachineId
(
machine
1
.
getCode
()
);
machineId
=
machine1
.
get
Id
();
order
.
setMachineId
(
machine
Id
);
}
else
{
return
AjaxResult
.
error
(
"该店铺暂无绑定机器"
);
}
...
...
@@ -124,20 +124,14 @@ public class OrderServiceImpl implements IOrderService
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
orderDetail
.
setOrderId
(
order
.
getId
());
orderDetail
.
setCreatedAt
(
new
Date
());
orderDetail
.
setMachineId
(
machineId
);
orderDetail
.
setUpdatedAt
(
new
Date
());
orderDetail
.
setMachineId
(
machineId
);
}
}
//发送数据给机器
machineApiService
.
createOrder
(
order
);
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()));
orderOperationLog
.
setOperation
(
"创建订单"
);
orderOperationLog
.
setOperationUser
(
order
.
getUserName
());
orderOperationLog
.
setCreateAt
(
new
Date
());
orderOperationLog
.
setContent
(
"创建了订单"
);
orderOperationLog
.
setStatus
(
"待付款"
);
orderOperationLogService
.
insertOrderOperationLog
(
orderOperationLog
);
orderOperationLogService
.
insertOrderOperationLog
(
"待付款"
,
order
.
getId
(),
"创建了订单"
,
order
.
getUserName
(),
"创建订单"
);
return
AjaxResult
.
success
(
order
.
getOrderNo
());
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderTakingServiceImpl.java
View file @
0c232214
...
...
@@ -8,6 +8,7 @@ import com.ruoyi.system.domain.vo.orderTaking.*;
import
com.ruoyi.system.mapper.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -41,14 +42,11 @@ public class OrderTakingServiceImpl {
*/
public
OrderTakingVo
getMachineInfo
(
String
machineCode
)
{
Machine
machine
=
new
Machine
();
machine
.
setCode
(
machineCode
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(
machines
==
null
&&
!
machines
.
isEmpty
()){
Machine
machine
=
machineMapper
.
selectMachineByCode
(
machineCode
);
if
(
machine
==
null
||
machine
.
getShopId
()
==
null
){
throw
new
ServiceException
(
"该机器没有绑定店铺"
);
}
Long
shopId
=
machines
.
get
(
0
).
getShopId
();
return
this
.
getOrderTakingInfo
(
shopId
);
return
this
.
getOrderTakingInfo
(
machine
.
getShopId
());
}
...
...
@@ -59,11 +57,11 @@ public class OrderTakingServiceImpl {
}
public
OrderTakingVo
getOrderTakingInfo
(
Long
shopId
){
OrderTakingVo
orderTakingVo
=
new
OrderTakingVo
();
Shop
shop
=
shopMapper
.
selectShopById
(
String
.
valueOf
(
shopId
));
if
(
shop
==
null
){
return
orderTakingVo
;
}
orderTakingVo
.
setShopState
(
shop
.
getState
());
ImagesVo
imagesVo
=
new
ImagesVo
();
orderTakingVo
.
setImages
(
imagesVo
);
...
...
@@ -79,48 +77,15 @@ public class OrderTakingServiceImpl {
//查询出该店铺今日特惠的商品
List
<
GoodsVo
>
goodsVos
=
shopRecommendMapper
.
selectShopGoodsByTyepe
(
"2"
,
shopId
);
preferentialCategoryVo
.
setGoods
(
goodsVos
);
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecString
()));
goodsVo
.
setSpecString
(
null
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
goodsVo
.
getPictures
()));
goodsVo
.
setPictures
(
null
);
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
goodsVo
.
setTags
(
tags
);
//获取产品信息
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsVo
.
getGoodsId
());
buildSkuRules
(
skuVos
);
goodsVo
.
setSkus
(
skuVos
);
}
//普通分类的产品
List
<
GoodsCategory
>
shopCategories
=
goodsCategoryMapper
.
selectByShopId
(
shopId
);
for
(
GoodsCategory
category
:
shopCategories
)
{
CategoryVo
categoryVo
=
new
CategoryVo
();
categoryVo
.
setId
(
Long
.
parseLong
(
category
.
getId
()));
categoryVo
.
setName
(
category
.
getName
());
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopCategoryGoodsByCategoryId
(
shopId
,
category
.
getId
());
List
<
GoodsVo
>
goodsVoList
=
new
ArrayList
<>();
categoryVo
.
setGoods
(
goodsVoList
);
for
(
Goods
good
:
goodsList
)
{
GoodsVo
goodsVo
=
new
GoodsVo
();
goodsVo
.
setGoodsId
(
String
.
valueOf
(
good
.
getId
()));
goodsVo
.
setName
(
good
.
getName
());
goodsVo
.
setDesc
(
good
.
getDesc
());
goodsVo
.
setDiscount
(
good
.
getDiscount
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPrice
(
good
.
getPrice
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
good
.
getPics
()));
goodsVo
.
setRemarks
(
good
.
getRemarks
());
goodsVo
.
setSpecs
(
buildGoodsSpec
(
good
.
getSpec
()));
goodsVo
.
setSpecString
(
null
);
if
(!
CollectionUtils
.
isEmpty
(
goodsVos
)){
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecString
()));
goodsVo
.
setSpecString
(
null
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
goodsVo
.
getPictures
()));
goodsVo
.
setPictures
(
null
);
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
goodsVo
.
setTags
(
tags
);
...
...
@@ -128,12 +93,53 @@ public class OrderTakingServiceImpl {
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsVo
.
getGoodsId
());
buildSkuRules
(
skuVos
);
goodsVo
.
setSkus
(
skuVos
);
goodsVoList
.
add
(
goodsVo
);
}
categoryVos
.
add
(
categoryVo
);
}
//普通分类的产品
List
<
GoodsCategory
>
shopCategories
=
goodsCategoryMapper
.
selectByShopId
(
shopId
);
if
(!
CollectionUtils
.
isEmpty
(
shopCategories
)){
for
(
GoodsCategory
category
:
shopCategories
)
{
CategoryVo
categoryVo
=
new
CategoryVo
();
categoryVo
.
setId
(
Long
.
parseLong
(
category
.
getId
()));
categoryVo
.
setName
(
category
.
getName
());
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopCategoryGoodsByCategoryId
(
shopId
,
category
.
getId
());
List
<
GoodsVo
>
goodsVoList
=
new
ArrayList
<>();
categoryVo
.
setGoods
(
goodsVoList
);
if
(!
CollectionUtils
.
isEmpty
(
goodsList
)){
for
(
Goods
good
:
goodsList
)
{
GoodsVo
goodsVo
=
new
GoodsVo
();
goodsVo
.
setGoodsId
(
String
.
valueOf
(
good
.
getId
()));
goodsVo
.
setName
(
good
.
getName
());
goodsVo
.
setDesc
(
good
.
getDesc
());
goodsVo
.
setDiscount
(
good
.
getDiscount
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPrice
(
good
.
getPrice
().
stripTrailingZeros
().
toPlainString
());
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
good
.
getPics
()));
goodsVo
.
setRemarks
(
good
.
getRemarks
());
goodsVo
.
setSpecs
(
buildGoodsSpec
(
good
.
getSpec
()));
goodsVo
.
setSpecString
(
null
);
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
goodsVo
.
setTags
(
tags
);
//获取产品信息
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsVo
.
getGoodsId
());
buildSkuRules
(
skuVos
);
goodsVo
.
setSkus
(
skuVos
);
goodsVoList
.
add
(
goodsVo
);
}
}
categoryVos
.
add
(
categoryVo
);
}
}
List
<
RecommendVo
>
recommendVos
=
new
ArrayList
<>();
List
<
GoodsVo
>
recommendGoods
=
shopRecommendMapper
.
selectShopGoodsByTyepe
(
"1"
,
shopId
);
for
(
GoodsVo
goodsVo
:
recommendGoods
)
{
RecommendVo
recommendVo
=
new
RecommendVo
();
recommendVos
.
add
(
recommendVo
);
...
...
@@ -168,6 +174,9 @@ public class OrderTakingServiceImpl {
}
private
void
buildSkuRules
(
List
<
SkuVo
>
skuVos
)
{
if
(
CollectionUtils
.
isEmpty
(
skuVos
)){
return
;
}
for
(
SkuVo
skuVo
:
skuVos
)
{
String
rules
=
skuVo
.
getRulesString
();
List
<
SpecRule
>
specRuleList
=
JSONObject
.
parseArray
(
rules
,
SpecRule
.
class
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ShopServiceImpl.java
View file @
0c232214
...
...
@@ -181,7 +181,6 @@ public class ShopServiceImpl implements IShopService
shopGoodsSku
.
setIsDeleted
(
"0"
);
shopGoodsSku
.
setCreatedAt
(
new
Date
());
shopGoodsSku
.
setUpdatedAt
(
new
Date
());
shopGoodsSku
.
setMachineId
(
machine1
.
getId
());
shopGoodsSkuMapper
.
insertShopGoodsSku
(
shopGoodsSku
);
}
}
...
...
@@ -257,6 +256,21 @@ public class ShopServiceImpl implements IShopService
return
null
;
}
@Override
public
List
<
Goods
>
selectGoodsList
(
String
goodsName
,
String
category
,
Long
shopId
)
{
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopNoAddGoods
(
goodsName
,
category
,
shopId
);
for
(
Goods
goods1
:
goodsList
)
{
GoodsCategory
goodsCategory
=
goodsCategoryMapper
.
selectGoodsCategoryById
(
goods1
.
getCategory
());
if
(
goodsCategory
!=
null
){
goods1
.
setCategoryName
(
goodsCategory
.
getName
());
}
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
goods1
.
setSalesVolume
(
count
);
}
return
goodsList
;
}
public
AjaxResult
checkSku
(
String
shopId
,
String
skuId
,
String
machineCode
)
{
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
...
...
ruoyi-system/src/main/resources/mapper/system/GoodsMapper.xml
View file @
0c232214
...
...
@@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"code"
column=
"code"
/>
<result
property=
"shelfAt"
column=
"shelf_at"
/>
</resultMap>
<sql
id=
"selectGoodsVo"
>
select id, name, category, price, discount, take_time, spec, pics, `desc`, remarks, state, is_deleted, created_at, updated_at, code from goods
select id, name, category, price, discount, take_time, spec, pics, `desc`, remarks, state, is_deleted, created_at, updated_at, code
,shelf_at
from goods
</sql>
<select
id=
"selectGoodsList"
parameterType=
"Goods"
resultMap=
"GoodsResult"
>
...
...
@@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"code != null and code != ''"
>
and code = #{code}
</if>
<if
test=
"shelfAt != null shelfAt code != ''"
>
and shelf_at = #{shelfAt}
</if>
</where>
</select>
...
...
@@ -68,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"code != null"
>
code,
</if>
<if
test=
"shelfAt != null"
>
shelf_at,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null and name != ''"
>
#{name},
</if>
...
...
@@ -84,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"code != null"
>
#{code},
</if>
<if
test=
"shelfAt != null"
>
#{shelfAt},
</if>
</trim>
</insert>
...
...
@@ -104,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
created_at = #{createdAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"code != null"
>
code = #{code},
</if>
<if
test=
"shelfAt != null"
>
shelf_at = #{shelfAt},
</if>
</trim>
where id = #{id}
</update>
...
...
ruoyi-system/src/main/resources/mapper/system/MachineMapper.xml
View file @
0c232214
...
...
@@ -36,11 +36,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectMachineVo"
/>
where id = #{id}
</select>
<select
id=
"selectMachineByCode"
parameterType=
"String"
resultMap=
"MachineResult"
>
<include
refid=
"selectMachineVo"
/>
where code = #{code}
</select>
<insert
id=
"insertMachine"
parameterType=
"Machine"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into machine
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null and id != ''"
>
id,
</if>
<if
test=
"shopId != null and shopId != ''"
>
shop_id,
</if>
<if
test=
"code != null and code != ''"
>
code,
</if>
<if
test=
"type != null and type != ''"
>
type,
</if>
...
...
@@ -50,7 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"updatedAt != null"
>
updated_at,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null and id != ''"
>
#{id},
</if>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
<if
test=
"code != null and code != ''"
>
#{code},
</if>
<if
test=
"type != null and type != ''"
>
#{type},
</if>
...
...
@@ -77,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete
id=
"deleteMachineById"
parameterType=
"String"
>
delete from machine
where id = #{id}
update machine set shop_id = null
where id = #{id}
</delete>
<delete
id=
"deleteMachineByIds"
parameterType=
"String"
>
...
...
@@ -87,9 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<update
id=
"unbound"
>
update machine set shopId =null where
id
=#{id}
update machine set shopId =null where
code
=#{id}
</update>
<select
id=
"selectRegister"
resultType=
"string"
>
select register from machine where
id
=#{id}
select register from machine where
code
=#{id}
</select>
</mapper>
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
View file @
0c232214
...
...
@@ -96,5 +96,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and shop_id =#{shopId} and category =#{categoryId}
order by sg.turn
</select>
<select
id=
"selectShopNoAddGoods"
resultType=
"com.ruoyi.system.domain.Goods"
>
select id, name, category, price, discount, take_time, spec, pics, `desc`, remarks, state, is_deleted, created_at, updated_at, code,shelf_at from goods
where
id not in (
SELECT
sg.goods_id
from
shop_goods sg
where
sg.shop_id = #{shopId})
and state ='3'
<if
test=
"goodsName!=null and goodsName!=''"
>
and name like concat('%', #{goodsName}, '%')
</if>
<if
test=
"category!=null and category!=''"
>
and category like concat('%', #{category}, '%')
</if>
</select>
</mapper>
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
0c232214
...
...
@@ -116,7 +116,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update shop_goods_sku set state =#{status}
<where>
and shop_id=#{shopId}
and machine_id=#{machineCode}
<if
test=
"skuIds!=null"
>
and sku_id in
<foreach
collection=
"skuIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
...
@@ -126,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</update>
<delete
id=
"deleteByGoodsIds"
>
delete shop_goods_sku where shop_id=#{shopId}
delete
from
shop_goods_sku where shop_id=#{shopId}
and goods_id in
<foreach
collection=
"goodsIds"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
...
ruoyi-system/src/main/resources/mapper/system/SpecRuleMapper.xml
View file @
0c232214
...
...
@@ -24,12 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectSpecRuleList"
parameterType=
"SpecRule"
resultMap=
"SpecRuleResult"
>
<include
refid=
"selectSpecRuleVo"
/>
<where>
and is_deleted = 0
<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=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"turn != null and turn != ''"
>
and turn = #{turn}
</if>
<if
test=
"isRecommend != null and isRecommend != ''"
>
and is_recommend = #{isRecommend}
</if>
<if
test=
"isDefault != null "
>
and is_default = #{isDefault}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
</where>
...
...
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