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
b76e343f
Commit
b76e343f
authored
May 16, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
c356a5a0
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
153 additions
and
367 deletions
+153
-367
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
+4
-3
soss-framework/src/main/java/com/soss/framework/config/JiGuangConfig.java
+26
-26
soss-system/pom.xml
+5
-5
soss-system/src/main/java/com/soss/system/jiguang/JiGuangPushService.java
+0
-16
soss-system/src/main/java/com/soss/system/jiguang/MyJiGuangPushService.java
+0
-17
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
+0
-148
soss-system/src/main/java/com/soss/system/jiguang/impl/MyJiGuangPushServiceImpl.java
+0
-125
soss-system/src/main/java/com/soss/system/push/PushService.java
+15
-0
soss-system/src/main/java/com/soss/system/push/impl/PushServiceImpl.java
+58
-0
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+25
-4
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
+4
-4
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+5
-6
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
+3
-4
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+4
-3
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
+4
-6
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
View file @
b76e343f
package
com
.
soss
.
web
.
controller
.
coffee
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.
jiguang.impl.JiGuang
PushServiceImpl
;
import
com.soss.system.
push.impl.
PushServiceImpl
;
import
com.soss.system.service.ICustomerService
;
import
com.soss.system.service.impl.MachineServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
...
...
@@ -30,7 +31,7 @@ public class ApplicationController {
@Autowired
MachineServiceImpl
machineService
;
@Autowired
JiGuangPushServiceImpl
jiGuangP
ushService
;
PushServiceImpl
p
ushService
;
@Autowired
OrderTakingServiceImpl
orderTakingService
;
@Autowired
...
...
@@ -89,7 +90,7 @@ public class ApplicationController {
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"seqNo"
,
redisKey
);
jgBody
.
put
(
"data"
,
data
);
jiGuangPushService
.
push
(
Integer
.
parseInt
(
machine
.
getId
()),
screenNo
,
jgBody
);
pushService
.
push
(
machine
.
getCode
(),
screenNo
,
JSON
.
toJSONString
(
jgBody
)
);
// stringRedisTemplate.delete(redisKey);
return
AjaxResult
.
success
(
"处理成功"
,
redisJson
.
toJSONString
());
}
...
...
soss-framework/src/main/java/com/soss/framework/config/JiGuangConfig.java
View file @
b76e343f
package
com
.
soss
.
framework
.
config
;
import
cn.jpush.api.JPushClient
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@ConfigurationProperties
public
class
JiGuangConfig
{
// 极光官网-个人管理中心-appkey
@Value
(
"${push.appkey}"
)
private
String
appkey
;
// 极光官网-个人管理中心-点击查看-secret
@Value
(
"${push.secret}"
)
private
String
secret
;
// 获取推送客户端
@Bean
public
JPushClient
getJPushClient
()
{
JPushClient
jPushClient
=
new
JPushClient
(
secret
,
appkey
);
return
jPushClient
;
}
}
\ No newline at end of file
//package com.soss.framework.config;
//
//import cn.jpush.api.JPushClient;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//@ConfigurationProperties
//public class JiGuangConfig {
// // 极光官网-个人管理中心-appkey
// @Value("${push.appkey}")
// private String appkey;
// // 极光官网-个人管理中心-点击查看-secret
// @Value("${push.secret}")
// private String secret;
//
// // 获取推送客户端
// @Bean
// public JPushClient getJPushClient() {
// JPushClient jPushClient = new JPushClient(secret, appkey);
// return jPushClient;
// }
//}
\ No newline at end of file
soss-system/pom.xml
View file @
b76e343f
...
...
@@ -75,11 +75,11 @@
<artifactId>
aliyun-java-sdk-dysmsapi
</artifactId>
<version>
1.1.0
</version>
</dependency>
<dependency
>
<groupId>
cn.jpush.api
</groupId
>
<artifactId>
jpush-client
</artifactId
>
<version>
3.2.9
</version
>
</dependency
>
<!-- <dependency>--
>
<!-- <groupId>cn.jpush.api</groupId>--
>
<!-- <artifactId>jpush-client</artifactId>--
>
<!-- <version>3.2.9</version>--
>
<!-- </dependency>--
>
<dependency>
<groupId>
com.github.binarywang
</groupId>
...
...
soss-system/src/main/java/com/soss/system/jiguang/JiGuangPushService.java
deleted
100644 → 0
View file @
c356a5a0
package
com
.
soss
.
system
.
jiguang
;
import
com.soss.system.domain.vo.PushBean
;
/**
* 推送服务
* 封装业务功能相关
*/
public
interface
JiGuangPushService
{
boolean
pushAll
(
PushBean
pushBean
);
boolean
pushIos
(
PushBean
pushBean
);
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
);
boolean
pushAndroid
(
PushBean
pushBean
);
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
);
String
[]
checkRegistids
(
String
[]
registids
);
}
soss-system/src/main/java/com/soss/system/jiguang/MyJiGuangPushService.java
deleted
100644 → 0
View file @
c356a5a0
package
com
.
soss
.
system
.
jiguang
;
import
cn.jpush.api.push.model.PushPayload
;
import
com.soss.system.domain.vo.PushBean
;
/**
* 极光推送
* 封装第三方api相关
*/
public
interface
MyJiGuangPushService
{
boolean
pushAll
(
PushBean
pushBean
);
boolean
pushIos
(
PushBean
pushBean
);
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
);
boolean
pushAndroid
(
PushBean
pushBean
);
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
);
boolean
sendPush
(
PushPayload
pushPayload
);
}
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
deleted
100644 → 0
View file @
c356a5a0
package
com
.
soss
.
system
.
jiguang
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.system.domain.vo.PushBean
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.jiguang.MyJiGuangPushService
;
import
com.soss.system.mapper.MachineMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 推送服务
* 封装业务功能相关
*/
@Service
@Slf4j
public
class
JiGuangPushServiceImpl
implements
JiGuangPushService
{
/** 一次推送最大数量 (极光限制1000) */
private
static
final
int
max_size
=
800
;
@Autowired
private
MyJiGuangPushService
jPushService
;
@Autowired
private
MachineMapper
machineMapper
;
/**
* 推送全部, 不支持附加信息
*
* @return
*/
@Override
public
boolean
pushAll
(
PushBean
pushBean
)
{
return
jPushService
.
pushAll
(
pushBean
);
}
/**
* 推送全部ios
*
* @return
*/
@Override
public
boolean
pushIos
(
PushBean
pushBean
)
{
return
jPushService
.
pushIos
(
pushBean
);
}
/**
* 推送ios 指定id
*
* @return
*/
@Override
public
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
)
{
registids
=
checkRegistids
(
registids
);
// 剔除无效registed
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
jPushService
.
pushIos
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
registids
=
Arrays
.
copyOfRange
(
registids
,
max_size
,
registids
.
length
);
}
return
jPushService
.
pushIos
(
pushBean
,
registids
);
}
/**
* 推送全部android
*
* @return
*/
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
)
{
return
jPushService
.
pushAndroid
(
pushBean
);
}
/**
* 推送android 指定id
*
* @return
*/
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
)
{
registids
=
checkRegistids
(
registids
);
// 剔除无效registedpush to
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
jPushService
.
pushAndroid
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
registids
=
Arrays
.
copyOfRange
(
registids
,
max_size
,
registids
.
length
);
}
return
jPushService
.
pushAndroid
(
pushBean
,
registids
);
}
/**
* 剔除无效registed
*
* @param registids
* @return
*/
@Override
public
String
[]
checkRegistids
(
String
[]
registids
)
{
List
<
String
>
regList
=
new
ArrayList
<
String
>(
registids
.
length
);
for
(
String
registid
:
registids
)
{
if
(
registid
!=
null
&&
!
""
.
equals
(
registid
.
trim
()))
{
regList
.
add
(
registid
);
}
}
return
regList
.
toArray
(
new
String
[
0
]);
}
public
void
push
(
Integer
machineId
,
Integer
screenNo
,
JSONObject
jsonObject
)
{
// String s = machineMapper.selectRegister(key);
String
[]
registerIds
=
machineMapper
.
selectRegister
(
machineId
,
screenNo
);
if
(
registerIds
!=
null
&&
registerIds
.
length
>
0
)
{
PushBean
pushBean
=
new
PushBean
();
pushBean
.
setMessageCount
(
jsonObject
);
pushAndroid
(
pushBean
,
registerIds
);
log
.
info
(
"pushto "
+
JSON
.
toJSONString
(
registerIds
)
+
", "
+
JSON
.
toJSONString
(
jsonObject
));
}
}
/*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());
}
}
public void pushOrderState(Order order) {
Machine machine = machineMapper.selectMachineById(order.getMachineId());
if(StringUtils.isNotEmpty(machine.getRegister())){
JSONObject jsonObject = new JSONObject();
jsonObject.put("action","ORDER_STATE_CHANGED");
jsonObject.put("timestamp",System.currentTimeMillis());
JSONObject data = new JSONObject();
data.put("orderId",order.getId());
data.put("orderNo",order.getOrderNo());
data.put("orderNumber",order.getOrderNum());
data.put("state",order.getState());
jsonObject.put("data",data);
PushBean pushBean = new PushBean();
pushBean.setMessageCount(jsonObject);
pushAndroid(pushBean,machine.getRegister());
}
}*/
}
soss-system/src/main/java/com/soss/system/jiguang/impl/MyJiGuangPushServiceImpl.java
deleted
100644 → 0
View file @
c356a5a0
package
com
.
soss
.
system
.
jiguang
.
impl
;
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.soss.system.domain.vo.PushBean
;
import
com.soss.system.jiguang.MyJiGuangPushService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 极光推送
* 封装第三方api相关
*/
@Service
@Slf4j
public
class
MyJiGuangPushServiceImpl
implements
MyJiGuangPushService
{
@Autowired
private
JPushClient
jPushClient
;
/**
* 广播 (所有平台,所有设备, 不支持附加信息)
* @param pushBean 推送内容
* @return
*/
@Override
public
boolean
pushAll
(
PushBean
pushBean
){
Message
build
=
new
Message
.
Builder
().
setMsgContent
(
pushBean
.
getMessageCount
().
toJSONString
()).
build
();
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
all
())
.
setAudience
(
Audience
.
all
())
.
setMessage
(
build
)
.
build
());
}
/**
* ios广播
* @param pushBean 推送内容
* @return
*/
@Override
public
boolean
pushIos
(
PushBean
pushBean
){
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
ios
())
.
setAudience
(
Audience
.
all
())
.
setNotification
(
Notification
.
ios
(
pushBean
.
getAlert
(),
pushBean
.
getExtras
()))
.
build
());
}
/**
* ios通过registid推送 (一次推送最多 1000 个)
* @param pushBean 推送内容
* @param registids 推送id
* @return
*/
@Override
public
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
){
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
ios
())
.
setAudience
(
Audience
.
registrationId
(
registids
))
.
setNotification
(
Notification
.
ios
(
pushBean
.
getAlert
(),
pushBean
.
getExtras
()))
.
build
());
}
/**
* android广播
* @param pushBean 推送内容
* @return
*/
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
){
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
android
())
.
setAudience
(
Audience
.
all
())
.
setNotification
(
Notification
.
android
(
pushBean
.
getAlert
(),
pushBean
.
getTitle
(),
pushBean
.
getExtras
()))
.
build
());
}
/**
* android通过registid推送 (一次推送最多 1000 个)
* @param pushBean 推送内容
* @param registids 推送id
* @return
*/
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
){
Message
build
=
new
Message
.
Builder
().
setMsgContent
(
pushBean
.
getMessageCount
().
toJSONString
()).
build
();
log
.
info
(
"极光推送的内容为:【{}】::[{}]"
,
registids
[
0
],
JSONObject
.
toJSONString
(
build
));
return
sendPush
(
PushPayload
.
newBuilder
()
.
setPlatform
(
Platform
.
android
())
.
setAudience
(
Audience
.
registrationId
(
registids
))
.
setMessage
(
build
)
//.setNotification(Notification.android(pushBean.getAlert(), pushBean.getTitle(), pushBean.getExtras()))
.
build
());
}
/**
* 调用api推送
* @param pushPayload 推送实体
* @return
*/
@Override
public
boolean
sendPush
(
PushPayload
pushPayload
){
log
.
info
(
"发送极光推送请求: {}"
,
pushPayload
);
PushResult
result
=
null
;
try
{
result
=
jPushClient
.
sendPush
(
pushPayload
);
}
catch
(
APIConnectionException
e
)
{
log
.
error
(
"极光推送连接异常: "
,
e
);
}
catch
(
APIRequestException
e
)
{
log
.
error
(
"极光推送请求异常: "
,
e
);
}
if
(
result
!=
null
&&
result
.
isResultOK
())
{
log
.
info
(
"极光推送请求成功: {}"
,
result
);
return
true
;
}
else
{
log
.
info
(
"极光推送请求失败: {}"
,
result
);
return
false
;
}
}
}
\ No newline at end of file
soss-system/src/main/java/com/soss/system/push/PushService.java
0 → 100644
View file @
b76e343f
package
com
.
soss
.
system
.
push
;
/**
* 推送服务
* 封装业务功能相关
*/
public
interface
PushService
{
boolean
pushAll
(
String
message
);
boolean
push
(
String
machineCode
,
Integer
screenNo
,
String
message
);
boolean
push
(
String
machineCode
,
String
message
);
boolean
sendPush
(
String
machineCode
,
Integer
screenNo
,
String
message
);
}
soss-system/src/main/java/com/soss/system/push/impl/PushServiceImpl.java
0 → 100644
View file @
b76e343f
package
com
.
soss
.
system
.
push
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.system.push.PushService
;
import
com.soss.system.service.impl.MachineApiServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
/**
* 推送服务
* 封装业务功能相关
*/
@Service
@Slf4j
public
class
PushServiceImpl
implements
PushService
{
@Autowired
@Lazy
private
MachineApiServiceImpl
machineApiService
;
/**
* 推送全部, 不支持附加信息
*
* @return
*/
@Override
public
boolean
pushAll
(
String
message
)
{
return
sendPush
(
null
,
null
,
message
);
}
/**
* 推送android 指定id
*
* @return
*/
@Override
public
boolean
push
(
String
machineCode
,
Integer
screenNo
,
String
message
)
{
return
sendPush
(
machineCode
,
screenNo
,
message
);
}
@Override
public
boolean
push
(
String
machineCode
,
String
message
)
{
push
(
machineCode
,
1
,
message
);
push
(
machineCode
,
2
,
message
);
return
true
;
}
@Override
public
boolean
sendPush
(
String
machineCode
,
Integer
screenNo
,
String
message
)
{
JSONObject
requestBody
=
new
JSONObject
();
requestBody
.
put
(
"machineCode"
,
machineCode
);
requestBody
.
put
(
"screenNo"
,
screenNo
);
requestBody
.
put
(
"message"
,
message
);
machineApiService
.
sendRequest
(
requestBody
.
toJSONString
(),
"/v1/push"
);
return
true
;
}
}
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
b76e343f
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.soss.common.enums.CouponCategoryType
;
import
com.soss.common.enums.CouponState
;
import
com.soss.common.enums.CouponUserType
;
...
...
@@ -22,6 +23,7 @@ import org.springframework.util.CollectionUtils;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -190,6 +192,9 @@ public class CouponUserServiceImpl implements ICouponUserService {
BigDecimal
orderTotalAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
orderTotalOrigDiscount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getOrigDiscount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
log
.
info
(
"orderTotalAmount:{}, orderTotalOrigDiscount:{}"
,
orderTotalAmount
,
orderTotalOrigDiscount
);
if
(!
CollectionUtils
.
isEmpty
(
couponVos
))
{
orderDetails
.
forEach
(
x
->
x
.
setAmountShould
(
x
.
getOrigDiscount
()));
}
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
forEach
(
couponVo
->
{
/** 可用饮品范围的判断 */
List
<
Long
>
fitCouponGoodsIdList
=
goods
.
stream
().
filter
(
good
->
...
...
@@ -206,15 +211,31 @@ public class CouponUserServiceImpl implements ICouponUserService {
}
/** 券价值的判断 */
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DEDUCTION
.
getType
()))
{
// 抵扣
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
orderTotal
Am
ount
)
>
0
)
{
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
orderTotal
OrigDisc
ount
)
>
0
)
{
couponVo
.
setNotFitableDesc
(
"未达到满减要求"
);
return
;
}
couponVo
.
setCouponAmount
(
couponVo
.
getPriceDiscount
().
min
(
orderTotalOrigDiscount
));
AtomicReference
<
Integer
>
nums
=
new
AtomicReference
<>(
0
);
orderDetails
.
forEach
(
x
->
nums
.
updateAndGet
(
v
->
v
+
x
.
getNum
()));
log
.
info
(
"nums:{}"
,
nums
);
if
(
nums
.
get
()
<=
1
)
{
OrderDetail
orderDetail
=
orderDetails
.
get
(
0
);
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmount
().
negate
());
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
}
else
{
orderDetails
.
forEach
(
orderDetail
->
{
BigDecimal
rate
=
orderDetail
.
getAmountShould
().
divide
(
orderTotalOrigDiscount
);
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmount
().
negate
().
multiply
(
rate
));
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
log
.
info
(
"rate:{},detail:{}"
,
rate
,
JSON
.
toJSON
(
orderDetail
));
});
}
}
else
{
List
<
OrderDetail
>
fitOrderDetails
=
orderDetails
.
stream
().
filter
(
orderDetail
->
fitCouponGoodsIdList
.
contains
(
orderDetail
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
BigDecimal
fitGoodsAmount
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsOrigDiscount
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getOrigDiscount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsAmount
=
fitOrderDetails
.
stream
().
map
(
x
->
x
.
getAmountShould
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsOrigDiscount
=
fitOrderDetails
.
stream
().
map
(
x
->
x
.
getOrigDiscount
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
log
.
info
(
"fitGoodsOrigDiscount:{}, fitGoodsAmount:{}"
,
fitGoodsOrigDiscount
,
fitGoodsAmount
);
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
fitGoodsAmount
)
>
0
)
{
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
...
...
@@ -261,7 +282,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
orderDetail
.
setOriAmount
(
skuNum
.
multiply
(
sku
.
getPrice
()));
orderDetail
.
setUnitPrice
(
sku
.
getDiscount
());
orderDetail
.
setAmountShould
(
skuNum
.
multiply
(
sku
.
getDiscount
()));
orderDetail
.
setOrigDiscount
(
sku
.
getOrigDiscount
(
));
orderDetail
.
setOrigDiscount
(
sku
Num
.
multiply
(
sku
.
getOrigDiscount
()
));
});
return
goodsSkus
;
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
View file @
b76e343f
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.enums.SkuDeleteState
;
...
...
@@ -7,7 +8,7 @@ import com.soss.common.exception.ServiceException;
import
com.soss.common.utils.GenerateCode
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.
jiguang.impl.JiGuang
PushServiceImpl
;
import
com.soss.system.
push.impl.
PushServiceImpl
;
import
com.soss.system.mapper.*
;
import
com.soss.system.service.IGoodsService
;
import
jodd.util.StringPool
;
...
...
@@ -55,7 +56,7 @@ public class GoodsServiceImpl implements IGoodsService {
@Autowired
private
MachineMapper
machineMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangP
ushService
;
private
PushServiceImpl
p
ushService
;
/**
* 查询商品
...
...
@@ -398,8 +399,7 @@ public class GoodsServiceImpl implements IGoodsService {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"GOODS_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
int
machineId
=
Integer
.
parseInt
(
machines
.
get
(
0
).
getId
());
jiGuangPushService
.
push
(
machineId
,
null
,
jsonObject
);
pushService
.
push
(
machines
.
get
(
0
).
getCode
(),
JSON
.
toJSONString
(
jsonObject
));
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
b76e343f
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.soss.common.exception.ServiceException
;
...
...
@@ -8,7 +9,7 @@ import com.soss.common.utils.StringUtils;
import
com.soss.system.constants.OrderStatusConstant
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.ResultVo
;
import
com.soss.system.
jiguang.impl.JiGuang
PushServiceImpl
;
import
com.soss.system.
push.impl.
PushServiceImpl
;
import
com.soss.system.mapper.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -46,7 +47,7 @@ public class MachineApiServiceImpl {
@Autowired
private
GoodsMapper
goodsMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangP
ushService
;
private
PushServiceImpl
p
ushService
;
@Autowired
private
OrderOperationLogServiceImpl
operationLogService
;
...
...
@@ -120,8 +121,7 @@ public class MachineApiServiceImpl {
data
.
put
(
"goodsId"
,
aLong
);
data
.
put
(
"skuIds"
,
map
.
get
(
aLong
));
data
.
put
(
"state"
,
status
);
int
machineId
=
Integer
.
parseInt
(
machine
.
getId
());
jiGuangPushService
.
push
(
machineId
,
null
,
jsonObject
);
pushService
.
push
(
machine
.
getCode
(),
JSON
.
toJSONString
(
jsonObject
));
}
}
...
...
@@ -214,11 +214,10 @@ public class MachineApiServiceImpl {
}
public
ResultVo
sendRequest
(
String
param
,
String
interfaceName
)
{
try
{
String
postUrl
=
url
+
interfaceName
;
log
.
info
(
"请求
订单
接口[{}]:【{}】"
,
postUrl
,
param
);
log
.
info
(
"请求
machine
接口[{}]:【{}】"
,
postUrl
,
param
);
HttpHeaders
requestHeaders
=
new
HttpHeaders
();
requestHeaders
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
HttpEntity
requestEntity
=
new
HttpEntity
(
param
,
requestHeaders
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
View file @
b76e343f
...
...
@@ -7,7 +7,7 @@ import com.soss.common.utils.StringUtils;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.ShopRecommend
;
import
com.soss.system.
jiguang.impl.JiGuang
PushServiceImpl
;
import
com.soss.system.
push.impl.
PushServiceImpl
;
import
com.soss.system.mapper.GoodsCategoryMapper
;
import
com.soss.system.mapper.MachineMapper
;
import
com.soss.system.mapper.OrderMapper
;
...
...
@@ -40,7 +40,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService {
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangP
ushService
;
private
PushServiceImpl
p
ushService
;
/**
* 查询推荐和今日特惠
...
...
@@ -113,8 +113,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"GOODS_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
int
machineId
=
Integer
.
parseInt
(
machines
.
get
(
0
).
getId
());
jiGuangPushService
.
push
(
machineId
,
null
,
jsonObject
);
pushService
.
push
(
machines
.
get
(
0
).
getCode
(),
JSON
.
toJSONString
(
jsonObject
));
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
b76e343f
...
...
@@ -12,7 +12,7 @@ import com.soss.common.utils.StringUtils;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.SkuCountVo
;
import
com.soss.system.domain.vo.orderTaking.*
;
import
com.soss.system.
jiguang.impl.JiGuang
PushServiceImpl
;
import
com.soss.system.
push.impl.
PushServiceImpl
;
import
com.soss.system.mapper.*
;
import
com.soss.system.service.IShopService
;
import
com.soss.system.utils.ArrayUtil
;
...
...
@@ -55,7 +55,7 @@ public class ShopServiceImpl implements IShopService {
@Autowired
private
ShopRecommendMapper
shopRecommendMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangP
ushService
;
private
PushServiceImpl
p
ushService
;
@Autowired
private
GoodsTagMapper
goodsTagMapper
;
@Autowired
...
...
@@ -276,10 +276,11 @@ public class ShopServiceImpl implements IShopService {
}
public
void
updateApplication
(
Integer
machineId
)
{
Machine
machine
=
machineMapper
.
selectMachineById
(
String
.
valueOf
(
machineId
));
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"GOODS_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
jiGuangPushService
.
push
(
machineId
,
null
,
jsonObject
);
pushService
.
push
(
machine
.
getCode
(),
JSON
.
toJSONString
(
jsonObject
)
);
}
@Override
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
View file @
b76e343f
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
...
...
@@ -8,8 +9,7 @@ import com.soss.system.domain.SysBanner;
import
com.soss.system.domain.po.BannerListPo
;
import
com.soss.system.domain.po.BannerPo
;
import
com.soss.system.domain.vo.BannerVo
;
import
com.soss.system.domain.vo.PushBean
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.push.PushService
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.mapper.SysBannerMapper
;
import
com.soss.system.service.ISysBannerService
;
...
...
@@ -42,7 +42,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
@Autowired
private
AreaUtil
areaUtil
;
@Autowired
private
JiGuangPushService
jiGuangP
ushService
;
private
PushService
p
ushService
;
@Override
public
List
<
SysBanner
>
selectBanner
(
BannerListPo
banner
)
{
...
...
@@ -128,9 +128,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"BANNER_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
PushBean
pushBean
=
new
PushBean
();
pushBean
.
setMessageCount
(
jsonObject
);
jiGuangPushService
.
pushAll
(
pushBean
);
pushService
.
pushAll
(
JSON
.
toJSONString
(
jsonObject
));
}
private
SysBanner
copyBanner
(
BannerPo
bannerPo
)
{
...
...
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