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
652b4e9c
Commit
652b4e9c
authored
May 19, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码修改
parent
d83dc360
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
121 additions
and
32 deletions
+121
-32
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
+5
-5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
+1
-1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopRecommendController.java
+1
-1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/SpecController.java
+1
-1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+5
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/GlobalExceptionHandlerFilter.java
+52
-0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
+1
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/Goods.java
+3
-3
ruoyi-system/src/main/java/com/ruoyi/system/domain/SpecRuleMaterial.java
+11
-11
ruoyi-system/src/main/java/com/ruoyi/system/mapper/GoodsSkuMapper.java
+2
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
+6
-3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineServiceImpl.java
+13
-1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SpecServiceImpl.java
+10
-0
ruoyi-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+5
-0
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
+5
-6
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ApplicationController.java
View file @
652b4e9c
package
com
.
ruoyi
.
web
.
controller
.
coffee
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.uuid.UUID
;
import
com.ruoyi.system.domain.Machine
;
import
com.ruoyi.system.domain.vo.PushBean
;
...
...
@@ -60,11 +61,10 @@ public class ApplicationController {
@RequestMapping
(
"/jgRegister"
)
public
AjaxResult
jgRegister
(
@RequestParam
String
machineCode
,
@RequestParam
String
registerId
){
Machine
machine
=
new
Machine
();
machine
.
setId
(
machineCode
);
List
<
Machine
>
machines
=
machineService
.
selectMachineList
(
machine
);
if
(
machines
==
null
||
machines
.
isEmpty
()){
return
AjaxResult
.
error
(
"该机器未绑定店铺,请先绑定店铺"
);
Machine
machine
=
machineService
.
selectMachineById
(
machineCode
);
if
(
machine
==
null
){
throw
new
ServiceException
(
"该机器未绑定店铺,请先绑定店铺"
);
}
machine
.
setRegister
(
registerId
);
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopController.java
View file @
652b4e9c
...
...
@@ -102,7 +102,7 @@ public class ShopController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:addGoods')"
)
@GetMapping
(
value
=
"/addGoods"
)
public
AjaxResult
addGoods
(
l
ong
shopId
,
String
goodsIds
)
public
AjaxResult
addGoods
(
L
ong
shopId
,
String
goodsIds
)
{
return
AjaxResult
.
success
(
shopService
.
addGoods
(
shopId
,
goodsIds
));
}
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/ShopRecommendController.java
View file @
652b4e9c
...
...
@@ -38,7 +38,7 @@ public class ShopRecommendController extends BaseController
/**
* 查询推荐和今日特惠列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:recommend:list')"
)
//
@PreAuthorize("@ss.hasPermi('system:recommend:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
ShopRecommend
shopRecommend
)
{
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/coffee/SpecController.java
View file @
652b4e9c
...
...
@@ -82,7 +82,7 @@ public class SpecController extends BaseController
/**
* 删除规格
*/
@PreAuthorize
(
"@ss.hasPermi('system:spec:remove')"
)
//
@PreAuthorize("@ss.hasPermi('system:spec:remove')")
@Log
(
title
=
"规格"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
remove
(
@PathVariable
String
id
)
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
View file @
652b4e9c
package
com
.
ruoyi
.
framework
.
config
;
import
com.ruoyi.framework.interceptor.GlobalExceptionHandlerFilter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.http.HttpMethod
;
...
...
@@ -11,6 +12,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.web.access.channel.ChannelProcessingFilter
;
import
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
;
import
org.springframework.security.web.authentication.logout.LogoutFilter
;
import
org.springframework.web.filter.CorsFilter
;
...
...
@@ -55,6 +57,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
@Autowired
private
CorsFilter
corsFilter
;
@Autowired
private
GlobalExceptionHandlerFilter
globalExceptionHandlerFilter
;
/**
* 解决 无法直接注入 AuthenticationManager
...
...
@@ -122,6 +126,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 添加CORS filter
httpSecurity
.
addFilterBefore
(
corsFilter
,
JwtAuthenticationTokenFilter
.
class
);
httpSecurity
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
httpSecurity
.
addFilterBefore
(
globalExceptionHandlerFilter
,
ChannelProcessingFilter
.
class
);
}
/**
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/GlobalExceptionHandlerFilter.java
0 → 100644
View file @
652b4e9c
package
com
.
ruoyi
.
framework
.
interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.ServiceException
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.util.NestedServletException
;
import
javax.servlet.*
;
import
java.io.IOException
;
import
java.sql.SQLIntegrityConstraintViolationException
;
@Component
public
class
GlobalExceptionHandlerFilter
implements
Filter
{
@Override
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
try
{
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
}
catch
(
Exception
e
){
/**
* 捕捉出现的异常,根据自己的需求进行处理
* ResultEntity 自定义的响应结果封装类
* SCSException 自定义异常
*/
servletResponse
.
setCharacterEncoding
(
"UTF-8"
);
AjaxResult
ajaxResult
=
null
;
Throwable
throwable
;
if
(
e
instanceof
NestedServletException
){
throwable
=
e
.
getCause
();
}
else
{
throwable
=
e
;
}
/**
* 重复数据异常
*/
if
(
throwable
instanceof
DuplicateKeyException
){
ajaxResult
=
AjaxResult
.
error
(
"该数据已经存在"
);
}
else
if
(
throwable
instanceof
SQLIntegrityConstraintViolationException
){
ajaxResult
=
AjaxResult
.
error
(
"该数据已经存在"
);
}
else
if
(
throwable
instanceof
ServiceException
){
ajaxResult
=
AjaxResult
.
error
(
e
.
getMessage
());
}
else
{
throw
e
;
}
servletResponse
.
getWriter
().
write
(
JSONObject
.
toJSONString
(
ajaxResult
));
}
}
}
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/WeixinServiceImpl.java
View file @
652b4e9c
...
...
@@ -147,6 +147,7 @@ public class WeixinServiceImpl {
customer
.
setId
(
cutomerId
);
customer
.
setHeadSculpturePath
(
encDataInf
.
getString
(
"avatarUrl"
));
customer
.
setUserName
(
encDataInf
.
getString
(
"nickName"
));
customer
.
setPhone
(
encDataInf
.
getString
(
"phoneNumber"
));
customer
.
setCreateTime
(
new
Date
());
if
(
StringUtils
.
isNotEmpty
(
source
)){
customer
.
setSoucre
(
source
);
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/Goods.java
View file @
652b4e9c
...
...
@@ -110,14 +110,14 @@ public class Goods extends BaseEntity
@Excel
(
name
=
"商品编码"
)
private
String
code
;
private
List
<
GoodsTa
g
>
goodsTagList
;
private
List
<
Strin
g
>
goodsTagList
;
public
List
<
GoodsTa
g
>
getGoodsTagList
()
{
public
List
<
Strin
g
>
getGoodsTagList
()
{
return
goodsTagList
;
}
public
void
setGoodsTagList
(
List
<
GoodsTa
g
>
goodsTagList
)
{
public
void
setGoodsTagList
(
List
<
Strin
g
>
goodsTagList
)
{
this
.
goodsTagList
=
goodsTagList
;
}
public
void
setId
(
long
id
)
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/SpecRuleMaterial.java
View file @
652b4e9c
...
...
@@ -18,7 +18,7 @@ public class SpecRuleMaterial extends BaseEntity
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
l
ong
id
;
private
L
ong
id
;
/** 规则名称 */
@Excel
(
name
=
"规则名称"
)
...
...
@@ -26,15 +26,15 @@ public class SpecRuleMaterial extends BaseEntity
/** 规格ID */
@Excel
(
name
=
"规格ID"
)
private
l
ong
specId
;
private
L
ong
specId
;
/** 选项ID */
@Excel
(
name
=
"选项ID"
)
private
l
ong
ruleId
;
private
L
ong
ruleId
;
/** 原料ID */
@Excel
(
name
=
"原料ID"
)
private
l
ong
materialId
;
private
L
ong
materialId
;
/** 原料名称 */
@Excel
(
name
=
"原料名称"
)
...
...
@@ -62,12 +62,12 @@ public class SpecRuleMaterial extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
public
void
setId
(
l
ong
id
)
public
void
setId
(
L
ong
id
)
{
this
.
id
=
id
;
}
public
l
ong
getId
()
public
L
ong
getId
()
{
return
id
;
}
...
...
@@ -80,12 +80,12 @@ public class SpecRuleMaterial extends BaseEntity
{
return
name
;
}
public
void
setSpecId
(
l
ong
specId
)
public
void
setSpecId
(
L
ong
specId
)
{
this
.
specId
=
specId
;
}
public
l
ong
getSpecId
()
public
L
ong
getSpecId
()
{
return
specId
;
}
...
...
@@ -94,16 +94,16 @@ public class SpecRuleMaterial extends BaseEntity
this
.
ruleId
=
ruleId
;
}
public
l
ong
getRuleId
()
public
L
ong
getRuleId
()
{
return
ruleId
;
}
public
void
setMaterialId
(
l
ong
materialId
)
public
void
setMaterialId
(
L
ong
materialId
)
{
this
.
materialId
=
materialId
;
}
public
l
ong
getMaterialId
()
public
L
ong
getMaterialId
()
{
return
materialId
;
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/GoodsSkuMapper.java
View file @
652b4e9c
...
...
@@ -61,4 +61,6 @@ public interface GoodsSkuMapper
public
int
deleteGoodsSkuByIds
(
String
[]
ids
);
void
deleteGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
String
id
);
List
<
GoodsSku
>
selectSpec
(
String
query
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/GoodsServiceImpl.java
View file @
652b4e9c
...
...
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONArray
;
import
com.ruoyi.common.exception.ServiceException
;
...
...
@@ -52,7 +53,7 @@ public class GoodsServiceImpl implements IGoodsService
Goods
goods
=
goodsMapper
.
selectGoodsById
(
id
);
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setGoodsId
(
goods
.
getId
());
goods
.
setGoodsTagList
(
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
));
goods
.
setGoodsTagList
(
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
)
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
())
);
return
goods
;
}
...
...
@@ -124,12 +125,14 @@ public class GoodsServiceImpl implements IGoodsService
}
createSku
(
ruleNodeList
,
goodsId
,
goods
.
getDiscount
(),
goods
.
getPrice
());
}
List
<
GoodsTa
g
>
goodsTagList
=
goods
.
getGoodsTagList
();
List
<
Strin
g
>
goodsTagList
=
goods
.
getGoodsTagList
();
if
(
goodsTagList
!=
null
&&!
goodsTagList
.
isEmpty
()){
for
(
GoodsTag
goodsTag
:
goodsTagList
)
{
for
(
String
tagName
:
goodsTagList
)
{
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setGoodsId
(
goodsId
);
goodsTag
.
setState
(
"1"
);
goodsTag
.
setCreatedAt
(
new
Date
());
goodsTag
.
setTag
(
tagName
);
goodsTagMapper
.
insertGoodsTag
(
goodsTag
);
}
}
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MachineServiceImpl.java
View file @
652b4e9c
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import
java.util.Date
;
import
java.util.List
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.system.service.IMachineService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -95,10 +96,21 @@ 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
.
setShopId
(
shopId
);
machine
.
setBindTime
(
new
Date
());
machine
.
setCreatedAt
(
new
Date
());
machine
.
setUpdatedAt
(
new
Date
());
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SpecServiceImpl.java
View file @
652b4e9c
...
...
@@ -3,9 +3,12 @@ package com.ruoyi.system.service.impl;
import
java.util.Date
;
import
java.util.List
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.GenerateCode
;
import
com.ruoyi.system.domain.GoodsSku
;
import
com.ruoyi.system.domain.SpecRule
;
import
com.ruoyi.system.domain.SpecRuleMaterial
;
import
com.ruoyi.system.mapper.GoodsSkuMapper
;
import
com.ruoyi.system.service.ISpecService
;
import
com.ruoyi.system.mapper.SpecRuleMapper
;
import
com.ruoyi.system.mapper.SpecRuleMaterialMapper
;
...
...
@@ -30,6 +33,8 @@ public class SpecServiceImpl implements ISpecService
private
SpecRuleMapper
specRuleMapper
;
@Autowired
private
SpecRuleMaterialMapper
specRuleMaterialMapper
;
@Autowired
private
GoodsSkuMapper
goodsSkuMapper
;
/**
* 查询规格
...
...
@@ -190,6 +195,11 @@ public class SpecServiceImpl implements ISpecService
@Override
public
int
deleteSpecById
(
String
id
)
{
String
query
=
"\"specId\": "
+
id
;
List
<
GoodsSku
>
goodsSkus
=
goodsSkuMapper
.
selectSpec
(
query
);
if
(!
goodsSkus
.
isEmpty
()){
throw
new
ServiceException
(
"当前还有商品使用,请先删除商品"
);
}
long
specId
=
Long
.
parseLong
(
id
);
specRuleMapper
.
deleteSpecRuleBySpecId
(
specId
);
specRuleMaterialMapper
.
deleteSpecRuleMaterialBySpecId
(
specId
);
...
...
ruoyi-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
652b4e9c
...
...
@@ -87,4 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update
id=
"deleteGoodsSkuByGoodsId"
>
update goods_sku set is_deleted ='1' where goods_id=#{goodsId}
</update>
<select
id=
"selectSpec"
resultMap=
"GoodsSkuResult"
>
<include
refid=
"selectGoodsSkuVo"
/>
where rule_list like concat('%',#{query},'%')
</select>
</mapper>
\ No newline at end of file
ruoyi-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
View file @
652b4e9c
...
...
@@ -144,16 +144,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sg.state,
g.code
from
shop s ,
shop_recommend sr,
shop_goods sg,
goods g
where
sr.
goods_id = sg.goods_id
and
g.id = sg.goods_id
and
g.state = '3'
sr.
shop_id = #{shopId}
and
type = #{type}
and
sr.shop_id = s.id
and g.is_deleted = 0
and sr.`type` = #{type}
and sr.shop_id = #{shopId}
and g.id = sr.goods_id
order by
sr.turn
</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