Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
sibu-v-mall
/
sibu-v-mall-third-api
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
2f9b7006
由
wangzhiliang
编写于
2018-10-24 09:18:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
菠萝派接口分库分表
1 个父辈
a4fca648
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
879 行增加
和
107 行删除
com.sibu.orderHelper.common/src/main/enviroment/dev/dubbo-consumer-config.xml
com.sibu.orderHelper.common/src/main/enviroment/dev/dubbo.properties
com.sibu.orderHelper.common/src/main/enviroment/product/dubbo-consumer-config.xml
com.sibu.orderHelper.common/src/main/enviroment/product/dubbo.properties
com.sibu.orderHelper.common/src/main/enviroment/test/dubbo-consumer-config.xml
com.sibu.orderHelper.common/src/main/enviroment/test/dubbo.properties
com.sibu.orderHelper.common/src/main/enviroment/test/jdbc.properties
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/converter/UTF8StringHttpMessageConverter.java
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/json/response/UTF8StringHttpMessageConverter.java
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/util/BeanCopyUtils.java
com.sibu.orderHelper.dao/src/main/java/com/sibu/orderHelper/mall/member/read/MemberReadDao.java
com.sibu.orderHelper.integralMall/pom.xml
com.sibu.orderHelper.integralMall/src/main/resources/applicationContext.xml
com.sibu.orderHelper.integralMall/src/main/resources/mall-mapper/member/read/MemberReadMapper.xml
com.sibu.orderHelper.model/src/main/java/com/sibu/orderHelper/integral/model/GetRefundBean.java
com.sibu.orderHelper.service/pom.xml
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/CheckRefundStatusBizServiceImpl.java
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/GetOrderBizServiceImpl.java
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/GetRefundBizServiceImpl.java
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/PineappleSendBizServiceImpl.java
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/UpdateSellerMemoBizServiceImpl.java
pom.xml
com.sibu.orderHelper.common/src/main/enviroment/dev/dubbo-consumer-config.xml
0 → 100644
查看文件 @
2f9b700
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"
>
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"locations"
>
<list>
<value>
classpath:META-INF/conf/dubbo.properties
</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry
protocol=
"zookeeper"
address=
"${dubbo.registryAddress}"
/>
<!-- 远程服务代理接口 -->
<dubbo:annotation
package=
"com.sibu.mall.order"
/>
<!-- 关闭提供者的检索 -->
<dubbo:consumer
check=
"false"
group=
"${dubbo.consumer.group}"
version=
"${dubbo.consumerVersion}"
/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider
delay=
"-1"
timeout=
"${dubbo.connectTimeOut}"
retries=
"${dubbo.connectRetries}"
/>
<!-- 消费者名称 -->
<dubbo:application
name=
"${dubbo.applicationName}"
/>
</beans>
\ No newline at end of file
com.sibu.orderHelper.common/src/main/enviroment/dev/dubbo.properties
0 → 100644
查看文件 @
2f9b700
##################### dubbo begin #############################
dubbo.registryAddress
=
zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName
=
mall-third-consumer
dubbo.connectTimeOut
=
20000
dubbo.connectRetries
=
0
dubbo.consumer.group
=
dev.sso.qiujw
dubbo.consumerVersion
=
1.0
##################### dubbo end #############################
com.sibu.orderHelper.common/src/main/enviroment/product/dubbo-consumer-config.xml
0 → 100644
查看文件 @
2f9b700
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"
>
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"locations"
>
<list>
<value>
classpath:META-INF/conf/dubbo.properties
</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry
protocol=
"zookeeper"
address=
"${dubbo.registryAddress}"
/>
<!-- 远程服务代理接口 -->
<dubbo:annotation
package=
"com.sibu.mall.order"
/>
<!-- 关闭提供者的检索 -->
<dubbo:consumer
check=
"false"
group=
"${dubbo.consumer.group}"
version=
"${dubbo.consumerVersion}"
/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider
delay=
"-1"
timeout=
"${dubbo.connectTimeOut}"
retries=
"${dubbo.connectRetries}"
/>
<!-- 消费者名称 -->
<dubbo:application
name=
"${dubbo.applicationName}"
/>
</beans>
\ No newline at end of file
com.sibu.orderHelper.common/src/main/enviroment/product/dubbo.properties
0 → 100644
查看文件 @
2f9b700
##################### dubbo begin #############################
dubbo.registryAddress
=
zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName
=
mall-third-consumer
dubbo.connectTimeOut
=
20000
dubbo.connectRetries
=
0
dubbo.consumer.group
=
dev.sso.qiujw
dubbo.consumerVersion
=
1.0
##################### dubbo end #############################
com.sibu.orderHelper.common/src/main/enviroment/test/dubbo-consumer-config.xml
0 → 100644
查看文件 @
2f9b700
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"
>
<bean
id=
"propertyConfigurer"
class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
<property
name=
"locations"
>
<list>
<value>
classpath:META-INF/conf/dubbo.properties
</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry
protocol=
"zookeeper"
address=
"${dubbo.registryAddress}"
/>
<!-- 远程服务代理接口 -->
<dubbo:annotation
package=
"com.sibu.mall.order"
/>
<!-- 关闭提供者的检索 -->
<dubbo:consumer
check=
"false"
group=
"${dubbo.consumer.group}"
version=
"${dubbo.consumerVersion}"
/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider
delay=
"-1"
timeout=
"${dubbo.connectTimeOut}"
retries=
"${dubbo.connectRetries}"
/>
<!-- 消费者名称 -->
<dubbo:application
name=
"${dubbo.applicationName}"
/>
</beans>
\ No newline at end of file
com.sibu.orderHelper.common/src/main/enviroment/test/dubbo.properties
0 → 100644
查看文件 @
2f9b700
##################### dubbo begin #############################
dubbo.registryAddress
=
zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName
=
mall-third-consumer
dubbo.connectTimeOut
=
20000
dubbo.connectRetries
=
0
dubbo.consumer.group
=
dev.sso.qiujw
dubbo.consumerVersion
=
wangzhiliang2
##################### dubbo end #############################
com.sibu.orderHelper.common/src/main/enviroment/test/jdbc.properties
查看文件 @
2f9b700
...
...
@@ -7,18 +7,18 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE
jdbc.imtegralurl
=
jdbc:mysql://120.76.137.184/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8
sqlserverjdbc.url
=
jdbc
\:
jtds
\:
sqlserver
\:
//120.25.75.53
\:
1433;databaseName
\=
sibu_wesale_base_read_03
mall.write.url
=
jdbc:mysql://
39.108.19.165
:3306/ejavashop
mall.write.url
=
jdbc:mysql://
118.89.51.164
:3306/ejavashop
mall.write.username
=
sibu_wesale
mall.write.password
=
sibu123..
mall.read.url
=
jdbc:mysql://1
20.77.6.187
:3306/ejavashop
mall.write.password
=
6SvbL5+JhXQSpf+ASsQ0Rg==
mall.read.url
=
jdbc:mysql://1
11.231.243.221
:3306/ejavashop
mall.read.username
=
sibu_wesale
mall.read.password
=
sibu123..
mall.analysis.write.url
=
jdbc:mysql://
39.108.19.165:3306/ejavashop
mall.read.password
=
6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.write.url
=
jdbc:mysql://
118.89.51.164:3306/analysis
mall.analysis.write.username
=
sibu_wesale
mall.analysis.write.password
=
sibu123..
mall.analysis.read.url
=
jdbc:mysql://1
20.77.6.187:3306/ejavashop
mall.analysis.write.password
=
6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.read.url
=
jdbc:mysql://1
11.231.243.221:3306/analysis
mall.analysis.read.username
=
sibu_wesale
mall.analysis.read.password
=
sibu123..
mall.analysis.read.password
=
6SvbL5+JhXQSpf+ASsQ0Rg==
#数据库用户名
jdbc.username
=
root
...
...
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/converter/UTF8StringHttpMessageConverter.java
查看文件 @
2f9b700
...
...
@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private
Charset
getContentTypeCharset
(
MediaType
contentType
)
{
if
(
contentType
!=
null
&&
contentType
.
getChar
S
et
()
!=
null
)
{
return
contentType
.
getChar
S
et
();
if
(
contentType
!=
null
&&
contentType
.
getChar
s
et
()
!=
null
)
{
return
contentType
.
getChar
s
et
();
}
else
{
return
DEFAULT_CHARSET
;
...
...
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/json/response/UTF8StringHttpMessageConverter.java
查看文件 @
2f9b700
...
...
@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private
Charset
getContentTypeCharset
(
MediaType
contentType
)
{
if
(
contentType
!=
null
&&
contentType
.
getChar
S
et
()
!=
null
)
{
return
contentType
.
getChar
S
et
();
if
(
contentType
!=
null
&&
contentType
.
getChar
s
et
()
!=
null
)
{
return
contentType
.
getChar
s
et
();
}
else
{
return
DEFAULT_CHARSET
;
...
...
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/util/BeanCopyUtils.java
0 → 100644
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
common
.
util
;
import
net.sf.cglib.beans.BeanCopier
;
import
net.sf.cglib.beans.BeanMap
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.*
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.function.BiConsumer
;
import
java.util.function.Consumer
;
import
java.util.stream.Collector
;
import
java.util.stream.Stream
;
/**
* Description:bean 拷贝
* Author: wei
* Date:2017/12/13
*/
public
class
BeanCopyUtils
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
BeanCopyUtils
.
class
);
/**
* 拷贝list
* @param dest
* @param orig
* @param <T>
* @return
*/
public
static
<
T
>
List
<
T
>
copyList
(
Class
<
T
>
dest
,
List
orig
)
{
if
(
CollectionUtils
.
isEmpty
(
orig
))
{
return
new
ArrayList
<>();
}
BeanCopier
beanCopier
=
BeanCopier
.
create
(
orig
.
get
(
0
).
getClass
(),
dest
,
false
);
List
<
T
>
resultList
=
new
ArrayList
<>(
orig
.
size
());
try
{
for
(
Object
o
:
orig
)
{
if
(
o
==
null
)
{
continue
;}
T
destObject
=
dest
.
newInstance
();
beanCopier
.
copy
(
o
,
destObject
,
null
);
resultList
.
add
(
destObject
);
}
return
resultList
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyList error"
,
e
);
}
return
resultList
;
}
/**
* 拷贝list
* @param dest
* @param orig
* @return
*/
public
static
<
D
,
O
>
List
<
D
>
copyList
(
Class
<
D
>
dest
,
List
<
O
>
orig
,
Consumer
<
D
>
d
)
{
if
(
CollectionUtils
.
isEmpty
(
orig
))
{
return
new
ArrayList
<>();
}
BeanCopier
beanCopier
=
BeanCopier
.
create
(
orig
.
get
(
0
).
getClass
(),
dest
,
false
);
List
<
D
>
resultList
=
new
ArrayList
<>(
orig
.
size
());
try
{
for
(
Object
o
:
orig
)
{
if
(
o
==
null
)
{
continue
;}
D
destObject
=
dest
.
newInstance
();
beanCopier
.
copy
(
o
,
destObject
,
null
);
if
(
d
!=
null
){
d
.
accept
(
destObject
);
}
resultList
.
add
(
destObject
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyList error"
,
e
);
}
return
resultList
;
}
/**
* 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝)
* @param dest 目标
* @param orig 源
* @param transformKey 转换
* @param <T>
* @return
*/
public
static
<
T
>
List
<
T
>
copyListAndDetail
(
Class
<
T
>
dest
,
List
orig
,
Map
<
String
,
String
>
transformKey
)
{
return
copyListAndDetail
(
dest
,
orig
,
transformKey
,
null
);
}
/**
* 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝)
* @param dest
* @param orig
* @param transformKey
* @param consumer
* @return
*/
public
static
<
T
,
C
>
List
<
T
>
copyListAndDetail
(
Class
<
T
>
dest
,
List
orig
,
Map
<
String
,
String
>
transformKey
,
BiConsumer
<
T
,
C
>
consumer
)
{
try
{
List
<
T
>
resultList
=
new
ArrayList
<>();
if
(
orig
==
null
||
orig
.
size
()
<=
0
)
{
return
resultList
;
}
Field
[]
originFields
=
null
;
Field
[]
destFields
=
null
;
int
i
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
transformKey
)){
originFields
=
new
Field
[
transformKey
.
size
()];
destFields
=
new
Field
[
transformKey
.
size
()];
Class
origClass
=
orig
.
get
(
0
).
getClass
();
Set
<
Map
.
Entry
<
String
,
String
>>
entries
=
transformKey
.
entrySet
();
for
(
Iterator
<
Map
.
Entry
<
String
,
String
>>
iterator
=
entries
.
iterator
();
iterator
.
hasNext
();
i
++){
Map
.
Entry
<
String
,
String
>
entry
=
iterator
.
next
();
String
key
=
entry
.
getKey
();
//源
String
value
=
entry
.
getValue
();
//目标
originFields
[
i
]
=
origClass
.
getDeclaredField
(
key
);
destFields
[
i
]
=
dest
.
getDeclaredField
(
value
);
}
//私有属性 允许访问
AccessibleObject
.
setAccessible
(
originFields
,
true
);
AccessibleObject
.
setAccessible
(
destFields
,
true
);
}
for
(
Object
o
:
orig
)
{
T
destObject
=
dest
.
newInstance
();
if
(
o
==
null
)
{
continue
;
}
copyProperties
(
destObject
,
o
);
for
(
int
a
=
0
;
a
<
i
;
a
++){
//源字段
Field
originField
=
originFields
[
a
];
//源里面的值
List
o1
=
(
List
)
originField
.
get
(
o
);
//目标字段
Field
destField
=
destFields
[
a
];
Class
childClass
=
(
Class
)((
ParameterizedType
)
destField
.
getGenericType
()).
getActualTypeArguments
()[
0
];
List
destList
=
copyList
(
childClass
,
o1
,
destObject
,
consumer
);
destField
.
set
(
destObject
,
destList
);
}
resultList
.
add
(
destObject
);
}
if
(
originFields
!=
null
&&
destFields
!=
null
){
//私有属性 不允许访问
AccessibleObject
.
setAccessible
(
originFields
,
false
);
AccessibleObject
.
setAccessible
(
destFields
,
false
);
}
return
resultList
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyListAndDetail error"
,
e
);
return
null
;
}
}
/**
* 拷贝list
* @param dest
* @param orig
* @param out (相当于 一对多环境中的 一)
* @param consumer
* @param <T>
* @return
*/
private
static
<
T
,
O
>
List
<
T
>
copyList
(
Class
<
T
>
dest
,
List
orig
,
O
out
,
BiConsumer
<
O
,
T
>
consumer
)
{
if
(
CollectionUtils
.
isEmpty
(
orig
))
{
return
new
ArrayList
<>();
}
BeanCopier
beanCopier
=
BeanCopier
.
create
(
orig
.
get
(
0
).
getClass
(),
dest
,
false
);
List
<
T
>
resultList
=
new
ArrayList
<>(
orig
.
size
());
try
{
for
(
Object
o
:
orig
)
{
if
(
o
==
null
)
{
continue
;}
T
destObject
=
dest
.
newInstance
();
beanCopier
.
copy
(
o
,
destObject
,
null
);
resultList
.
add
(
destObject
);
if
(
out
!=
null
&&
consumer
!=
null
){
consumer
.
accept
(
out
,
destObject
);
}
}
return
resultList
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyList error"
,
e
);
}
return
resultList
;
}
/**
* 多个orig对象 属性 浅拷贝到 dest
*
* @param dest
* @param orig
* @param <T>
* @return
*/
public
static
<
T
>
T
copyProperties
(
Class
<
T
>
dest
,
Object
...
orig
)
{
if
(
orig
==
null
)
{
return
null
;
}
try
{
T
destObject
=
dest
.
newInstance
();
for
(
Object
o
:
orig
)
{
copyProperties
(
destObject
,
o
);
}
return
destObject
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyProperties error"
,
e
);
return
null
;
}
}
/**
* 拷贝对象
* @param dest
* @param orig
* @param <T>
* @return
*/
public
static
<
T
>
T
copyProperties
(
Class
<
T
>
dest
,
Object
orig
)
{
if
(
orig
==
null
)
{
return
null
;
}
try
{
T
destObject
=
dest
.
newInstance
();
copyProperties
(
destObject
,
orig
);
return
destObject
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyProperties error"
,
e
);
return
null
;
}
}
/**
* 使用 org.springframework.beans.BeanUtils 拷贝对象
* @param dest
* @param orig
*/
public
static
void
copyProperties
(
Object
dest
,
Object
orig
)
{
try
{
BeanCopier
copier
=
BeanCopier
.
create
(
orig
.
getClass
(),
dest
.
getClass
(),
false
);
copier
.
copy
(
orig
,
dest
,
null
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyProperties error"
,
e
);
}
}
/**
* 根据指定名称键值对,填充javaBean对象。
* @param bean
* @param properties
*/
public
static
void
populate
(
Object
bean
,
Map
properties
)
{
try
{
BeanMap
beanMap
=
BeanMap
.
create
(
bean
);
beanMap
.
putAll
(
properties
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"populate bean property error"
,
e
);
}
}
/**
* 根据指定名称键值对,填充javaBean对象。
* @param c
* @param properties
*/
public
static
<
T
>
T
populate
(
Class
<
T
>
c
,
Map
properties
)
{
try
{
T
o
=
c
.
newInstance
();
BeanMap
beanMap
=
BeanMap
.
create
(
o
);
beanMap
.
putAll
(
properties
);
return
(
T
)
beanMap
.
getBean
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"populate bean property error"
,
e
);
}
return
null
;
}
/**
* 根据指定名称键值对,填充javaBean对象。
*/
public
static
<
T
>
List
<
T
>
populateList
(
Class
<
T
>
dest
,
List
<
Map
<
String
,
Object
>>
orig
)
{
if
(
CollectionUtils
.
isEmpty
(
orig
))
{
return
new
ArrayList
<>();
}
List
<
T
>
resultList
=
new
ArrayList
<>(
orig
.
size
());
try
{
BeanMap
beanMap
=
BeanMap
.
create
(
dest
.
newInstance
());
for
(
Map
o
:
orig
)
{
if
(
o
==
null
)
{
continue
;}
T
destObject
=
dest
.
newInstance
();
beanMap
.
setBean
(
destObject
);
beanMap
.
putAll
(
o
);
resultList
.
add
(
destObject
);
}
return
resultList
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"copyList error"
,
e
);
}
return
resultList
;
}
/**
* 检查并返回集合中的一个对象
* 集合不能多于一个对象
* 集合为空时返回null
* @param list
* @param <T>
* @return
*/
/* public static <T> T getSingleResult(List<T> list) {
if (CollectionUtils.isEmpty(list)) {
return null;
}else if(list.size() == 1){
return list.get(0);
}else{
//加载到多余数据
throw new BusinessException("加载到多余条数");
}
}*/
/**
* 检查并返回集合中的第一对象
* 集合为空时返回null
* @param list
* @param <T>
* @return
*/
public
static
<
T
>
T
getFirstResult
(
List
<
T
>
list
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
null
;
}
else
{
return
list
.
get
(
0
);
}
}
/**
* 公共转换 从List转成Map
*
* @param stat
* @return
*/
public
static
<
K
,
V
,
T
>
Map
<
K
,
V
>
transformListToMap
(
List
<
T
>
stat
,
Collector
<
T
,
Map
,
Map
>
collector
){
Map
<
K
,
V
>
hashMap
=
null
;
if
(!
CollectionUtils
.
isEmpty
(
stat
))
{
Stream
<
T
>
stream
=
null
;
if
(
stat
.
size
()
>
1000
)
{
//并行去收集
stream
=
stat
.
parallelStream
();
}
else
{
//否则串行去收集
stream
=
stat
.
stream
();
}
hashMap
=
stream
.
collect
(
collector
);
}
return
hashMap
;
}
/**
* 填充数据
*
* @param finalResult
* @param intoResult
* @param params
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
public
static
<
T
>
Map
<
String
,
T
>
getAssemblyResult
(
Map
<
String
,
T
>
finalResult
,
Map
<
String
,
T
>
intoResult
,
Class
<
T
>
c
,
String
[]
params
)
throws
InvocationTargetException
,
IllegalAccessException
{
if
(!
CollectionUtils
.
isEmpty
(
intoResult
))
{
for
(
Map
.
Entry
<
String
,
T
>
entry
:
intoResult
.
entrySet
())
{
//key
String
key
=
entry
.
getKey
();
//value
T
value
=
entry
.
getValue
();
T
statPerDayOrder
=
finalResult
.
get
(
key
);
if
(
statPerDayOrder
==
null
)
{
finalResult
.
put
(
key
,
value
);
}
else
{
for
(
String
param
:
params
)
{
PropertyDescriptor
propertyDescriptor
=
BeanUtils
.
getPropertyDescriptor
(
c
,
param
);
Method
readMethod
=
propertyDescriptor
.
getReadMethod
();
Method
writeMethod
=
propertyDescriptor
.
getWriteMethod
();
//从finalResult里面获取
Object
oldValue
=
readMethod
.
invoke
(
statPerDayOrder
);
//从新加入对象读
Object
paramValue
=
readMethod
.
invoke
(
value
);
if
(
oldValue
!=
null
&&
paramValue
!=
null
){
if
(
BigDecimal
.
class
.
isInstance
(
paramValue
)){
//BigDecimal
BigDecimal
old
=
(
BigDecimal
)
oldValue
;
paramValue
=
old
.
add
((
BigDecimal
)
paramValue
);
}
else
if
(
Integer
.
class
.
isInstance
(
paramValue
)){
Integer
old
=
(
Integer
)
oldValue
;
paramValue
=
old
+(
Integer
)
paramValue
;
}
else
if
(
Long
.
class
.
isInstance
(
paramValue
)){
Long
old
=
(
Long
)
oldValue
;
paramValue
=
old
+(
Long
)
paramValue
;
}
}
//往已有对象里面写
writeMethod
.
invoke
(
statPerDayOrder
,
paramValue
);
}
}
}
}
return
finalResult
;
}
}
com.sibu.orderHelper.dao/src/main/java/com/sibu/orderHelper/mall/member/read/MemberReadDao.java
查看文件 @
2f9b700
...
...
@@ -99,6 +99,13 @@ public interface MemberReadDao {
*/
Regions
getRegionsById
(
@Param
(
"id"
)
Integer
id
);
/**
* 根据id查询省市级信息
* @param regionIdList
* @return
*/
List
<
Regions
>
getRegionsByIds
(
@Param
(
"list"
)
List
regionIdList
);
/**
* 根据条件查询物流公司
...
...
@@ -148,4 +155,11 @@ public interface MemberReadDao {
* @return
*/
int
countOrderProductNum
(
@Param
(
"id"
)
String
orderProductId
);
/**
* 根据旧订单号获取新订单号
* @param orderSn
* @return
*/
String
getNewOrderSnByOldOrderSn
(
@Param
(
"orderSn"
)
String
orderSn
);
}
...
...
com.sibu.orderHelper.integralMall/pom.xml
查看文件 @
2f9b700
...
...
@@ -18,6 +18,20 @@
<groupId>
com.sibu.orderHelper.service
</groupId>
<artifactId>
com.sibu.orderHelper.service
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-api
</artifactId>
<groupId>
org.slf4j
</groupId>
</exclusion>
<exclusion>
<artifactId>
spring-context
</artifactId>
<groupId>
org.springframework
</groupId>
</exclusion>
<exclusion>
<artifactId>
commons-logging
</artifactId>
<groupId>
commons-logging
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
net.sourceforge.jtds
</groupId>
...
...
@@ -30,6 +44,7 @@
<version>
4.10
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<finalName>
com.sibu.orderHelper.integralMall
</finalName>
...
...
com.sibu.orderHelper.integralMall/src/main/resources/applicationContext.xml
查看文件 @
2f9b700
...
...
@@ -28,6 +28,9 @@
<!--加载mq配置-->
<import
resource=
"classpath:META-INF/conf/service-spring-mq.xml"
></import>
<!--dubbo配置-->
<import
resource=
"classpath:META-INF/conf/dubbo-consumer-config.xml"
></import>
<!-- 开启注解配置
<context:annotation-config />-->
...
...
com.sibu.orderHelper.integralMall/src/main/resources/mall-mapper/member/read/MemberReadMapper.xml
查看文件 @
2f9b700
...
...
@@ -281,6 +281,17 @@
where `id` = #{id}
</select>
<!-- 根据id查询省市级信息-->
<select
id=
"getRegionsByIds"
resultMap=
"regionsResult"
>
select
*
from `regions`
where `id` in
<foreach
collection=
"list"
item=
"regionId"
open=
"("
close=
")"
separator=
","
>
#{regionId}
</foreach>
</select>
<!-- 物流公司实体-->
<resultMap
id=
"courierCompanyResult"
type=
"com.sibu.orderHelper.integral.pineapple.model.CourierCompany"
>
<result
property=
"id"
column=
"id"
/>
...
...
@@ -467,6 +478,7 @@
<result
column=
"member_back_code"
property=
"refundno"
/>
<result
column=
"order_sn"
property=
"platorderno"
/>
<result
column=
"order_product_id"
property=
"subplatorderno"
/>
<result
column=
"orders_product_uid"
property=
"ordersproductuid"
/>
<result
column=
"back_money"
property=
"refundamount"
/>
<result
column=
"create_time"
property=
"createtime"
/>
<result
column=
"member_name"
property=
"buyernick"
/>
...
...
@@ -485,9 +497,8 @@
<select
id=
"getGetRefundBean"
parameterType=
"java.util.Map"
resultMap=
"GetRefundBeanMap"
>
SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name,
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,
o.money_order,o.order_state,o.remark
FROM member_product_back b LEFT JOIN orders o ON b.order_id = o.id
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,b.orders_product_uid
FROM member_product_back b
WHERE b.seller_id = #{supplierId}
<if
test=
"beginTime!=null"
>
AND b.create_time >= #{beginTime}
...
...
@@ -520,4 +531,8 @@
SELECT number FROM orders_product where id = #{id}
</select>
<select
id=
"getNewOrderSnByOldOrderSn"
parameterType=
"java.lang.String"
resultType=
"java.lang.String"
>
SELECT order_sn FROM orders WHERE order_sn_back= #{orderSn}
</select>
</mapper>
\ No newline at end of file
...
...
com.sibu.orderHelper.model/src/main/java/com/sibu/orderHelper/integral/model/GetRefundBean.java
查看文件 @
2f9b700
...
...
@@ -20,6 +20,8 @@ public class GetRefundBean implements Serializable{
//平台子订单号
private
String
subplatorderno
;
private
String
ordersproductuid
;
//订单总金额
private
BigDecimal
totalamount
;
...
...
@@ -296,4 +298,12 @@ public class GetRefundBean implements Serializable{
public
void
setStateMoney
(
Integer
stateMoney
)
{
this
.
stateMoney
=
stateMoney
;
}
public
String
getOrdersproductuid
()
{
return
ordersproductuid
;
}
public
void
setOrdersproductuid
(
String
ordersproductuid
)
{
this
.
ordersproductuid
=
ordersproductuid
;
}
}
...
...
com.sibu.orderHelper.service/pom.xml
查看文件 @
2f9b700
...
...
@@ -42,5 +42,12 @@
<artifactId>
fastdfs-client-java
</artifactId>
<version>
5.0.4
</version>
</dependency>
<dependency>
<groupId>
com.sibu.sibu-mall-order
</groupId>
<artifactId>
sibu-mall-order-service-api
</artifactId>
<version>
1.0.0
</version>
</dependency>
</dependencies>
</project>
...
...
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/CheckRefundStatusBizServiceImpl.java
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
integral
.
service
.
pineapple
.
impl
;
import
com.sibu.orderHelper.common.constants.AppConstants
;
import
com.sibu.orderHelper.common.database.DBContextHolder
;
import
com.sibu.orderHelper.common.strategy.DbUtil
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.doubo.common.model.response.CommonResponse
;
import
com.sibu.mall.order.request.third.ThirdQueryOrderRequest
;
import
com.sibu.mall.order.response.api.ApiOrdersResponse
;
import
com.sibu.mall.order.service.ThirdApiOrderService
;
import
com.sibu.orderHelper.common.util.BeanCopyUtils
;
import
com.sibu.orderHelper.common.util.StringUtil
;
import
com.sibu.orderHelper.enums.*
;
import
com.sibu.orderHelper.integral.dao.PineappleDao
;
import
com.sibu.orderHelper.integral.model.CheckRefundStatusBean
;
import
com.sibu.orderHelper.integral.model.IMDoingOrderBean
;
import
com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum
;
import
com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum
;
import
com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum
;
import
com.sibu.orderHelper.integral.pineapple.exception.BizException
;
import
com.sibu.orderHelper.integral.pineapple.model.MemberProductBack
;
...
...
@@ -22,7 +21,6 @@ import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
import
com.sibu.orderHelper.mall.member.read.MemberReadDao
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -33,13 +31,28 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
@Resource
private
MemberReadDao
memberReadDao
;
@Reference
private
ThirdApiOrderService
thirdApiOrderService
;
@Override
public
CheckRefundStatusResponse
call
(
CallRequest
<
CheckRefundStatusRequest
>
callRequest
)
throws
Exception
{
CheckRefundStatusResponse
checkRefundStatusResponse
=
new
CheckRefundStatusResponse
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"orderSn"
,
callRequest
.
getBizModel
().
getOrderID
());
params
.
put
(
"sellerId"
,
callRequest
.
getSupplier
().
getId
());
Orders
orders
=
memberReadDao
.
getOrdersByMap
(
params
);
//旧订单号处理
if
(!
callRequest
.
getBizModel
().
getOrderID
().
startsWith
(
"B"
)){
callRequest
.
getBizModel
().
setOrderID
(
memberReadDao
.
getNewOrderSnByOldOrderSn
(
callRequest
.
getBizModel
().
getOrderID
()));
}
ThirdQueryOrderRequest
thirdQueryOrderRequest
=
new
ThirdQueryOrderRequest
();
thirdQueryOrderRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getOrderID
());
thirdQueryOrderRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
Orders
orders
=
null
;
CommonResponse
<
ApiOrdersResponse
>
commonResponse
=
thirdApiOrderService
.
getOrdersByMap
(
thirdQueryOrderRequest
);
if
(
commonResponse
.
isSuccess
()){
orders
=
BeanCopyUtils
.
copyProperties
(
Orders
.
class
,
commonResponse
.
getResult
());
}
else
{
throw
new
BizException
(
commonResponse
.
getErrorMsg
());
}
if
(
StringUtil
.
isNull
(
orders
)){
log
.
error
(
String
.
format
(
"检测订单退款,获取订单数据业务异常,订单号:[%s]"
,
callRequest
.
getBizModel
().
getOrderID
()));
throw
new
BizException
(
String
.
format
(
"检测订单退款,获取订单数据业务异常,订单号:[%s]"
,
callRequest
.
getBizModel
().
getOrderID
()));
...
...
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/GetOrderBizServiceImpl.java
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
integral
.
service
.
pineapple
.
impl
;
import
com.sibu.orderHelper.common.constants.AppConstants
;
import
com.sibu.orderHelper.common.database.DBContextHolder
;
import
com.sibu.orderHelper.common.strategy.DbUtil
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.doubo.common.model.response.CommonResponse
;
import
com.sibu.mall.common.response.PageResult
;
import
com.sibu.mall.order.request.api.ApiOrdersSnRequest
;
import
com.sibu.mall.order.request.third.ThirdPageQueryOrderListRequest
;
import
com.sibu.mall.order.response.api.ApiOrdersProductResponse
;
import
com.sibu.mall.order.response.api.ApiOrdersResponse
;
import
com.sibu.mall.order.service.ApiOrdersProductService
;
import
com.sibu.mall.order.service.ThirdApiOrderService
;
import
com.sibu.orderHelper.common.util.BeanCopyUtils
;
import
com.sibu.orderHelper.common.util.StringUtil
;
import
com.sibu.orderHelper.integral.dao.IMDoingOrderDao
;
import
com.sibu.orderHelper.integral.dao.PineappleDao
;
import
com.sibu.orderHelper.integral.model.IMDoingOrderBean
;
import
com.sibu.orderHelper.integral.model.IMProductBean
;
import
com.sibu.orderHelper.integral.model.IMSupplier
;
import
com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst
;
import
com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum
;
import
com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum
;
import
com.sibu.orderHelper.integral.pineapple.exception.BizException
;
import
com.sibu.orderHelper.integral.pineapple.model.Orders
;
import
com.sibu.orderHelper.integral.pineapple.model.OrdersProduct
;
import
com.sibu.orderHelper.integral.pineapple.model.Regions
;
import
com.sibu.orderHelper.integral.pineapple.request.CallRequest
;
import
com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest
;
import
com.sibu.orderHelper.integral.pineapple.response.BaseResponse
;
import
com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse
;
import
com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse
;
import
com.sibu.orderHelper.integral.pineapple.response.OrderResponse
;
import
com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse
;
import
com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse
;
import
com.sibu.orderHelper.integral.service.IIMDoingOrderService
;
import
com.sibu.orderHelper.integral.service.impl.IMDoingOrderService
;
import
com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter
;
import
com.sibu.orderHelper.mall.member.read.MemberReadDao
;
import
com.sibu.orderHelper.service.redis.RedisProductSkuService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.xml.bind.ValidationException
;
import
java.math.BigDecimal
;
import
java.text.MessageFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.
Map
;
import
java.util.
Optional
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -61,30 +53,78 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
@Resource
private
MemberReadDao
memberReadDao
;
@Reference
private
ApiOrdersProductService
apiOrdersProductService
;
@Reference
private
ThirdApiOrderService
thirdApiOrderService
;
@Override
public
BaseResponse
call
(
CallRequest
<
GetOrderRequest
>
callRequest
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>
();
ThirdPageQueryOrderListRequest
thirdPageQueryOrderListRequest
=
new
ThirdPageQueryOrderListRequest
();
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getPlatOrderNo
())){
params
.
put
(
"orderSn"
,
callRequest
.
getBizModel
().
getPlatOrderNo
());
//旧订单号处理
if
(!
callRequest
.
getBizModel
().
getPlatOrderNo
().
startsWith
(
"B"
)){
callRequest
.
getBizModel
().
setPlatOrderNo
(
memberReadDao
.
getNewOrderSnByOldOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
thirdPageQueryOrderListRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
());
}
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getOrderStatus
())){
OrderStatusEnum
orderStatusEnum
=
OrderStatusEnum
.
resolve
(
callRequest
.
getBizModel
().
getOrderStatus
());
params
.
put
(
"orderState"
,
orderStatusEnum
.
getMallOrderStatus
());
thirdPageQueryOrderListRequest
.
setOrderState
(
orderStatusEnum
.
getMallOrderStatus
());
}
params
.
put
(
"sellerId"
,
callRequest
.
getSupplier
().
getId
());
thirdPageQueryOrderListRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getStartTime
())){
params
.
put
(
"startTime"
,
callRequest
.
getBizModel
().
getStartTime
());
thirdPageQueryOrderListRequest
.
setStartTime
(
callRequest
.
getBizModel
().
getStartTime
());
}
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getEndTime
())){
params
.
put
(
"endTime"
,
callRequest
.
getBizModel
().
getEndTime
());
thirdPageQueryOrderListRequest
.
setEndTime
(
callRequest
.
getBizModel
().
getEndTime
());
}
params
.
put
(
"PageIndex"
,(
callRequest
.
getBizModel
().
getPageIndex
()
-
1
)
*
callRequest
.
getBizModel
().
getPageSize
());
params
.
put
(
"PageSize"
,
callRequest
.
getBizModel
().
getPageSize
());
List
<
Orders
>
ordersList
=
memberReadDao
.
getOrdersList
(
params
);
thirdPageQueryOrderListRequest
.
setPageNow
(
callRequest
.
getBizModel
().
getPageIndex
());
thirdPageQueryOrderListRequest
.
setPageSize
(
callRequest
.
getBizModel
().
getPageSize
());
CommonResponse
<
PageResult
<
ApiOrdersResponse
>>
thirdResponse
=
thirdApiOrderService
.
pageOrder
(
thirdPageQueryOrderListRequest
);
GetOrderResponse
response
=
new
GetOrderResponse
();
response
.
setNumTotalOrder
(
memberReadDao
.
countgetOrdersList
(
params
)
);
response
.
setOrders
(
findOrders
(
ordersList
));
response
.
setNumTotalOrder
(
0
);
response
.
setOrders
(
new
ArrayList
<>(
));
response
.
setCode
(
PineAppleConst
.
SUCCESS_CODE
);
if
(
thirdResponse
.
isSuccess
()){
List
<
Orders
>
ordersList
=
BeanCopyUtils
.
copyList
(
Orders
.
class
,
thirdResponse
.
getResult
().
getDatas
());
List
<
Integer
>
provinceIdList
=
ordersList
.
stream
().
map
(
o
->
o
.
getProvinceId
()).
collect
(
Collectors
.
toList
());
List
<
Regions
>
provinceList
=
memberReadDao
.
getRegionsByIds
(
provinceIdList
);
List
<
Integer
>
cityIdList
=
ordersList
.
stream
().
map
(
o
->
o
.
getCityId
()).
collect
(
Collectors
.
toList
());
List
<
Regions
>
cityList
=
memberReadDao
.
getRegionsByIds
(
cityIdList
);
List
<
Integer
>
areaIdList
=
ordersList
.
stream
().
map
(
o
->
o
.
getAreaId
()).
collect
(
Collectors
.
toList
());
List
<
Regions
>
areaList
=
memberReadDao
.
getRegionsByIds
(
areaIdList
);
ordersList
.
stream
().
forEach
(
i
->{
Optional
<
Regions
>
province
=
provinceList
.
stream
().
filter
(
p
->
p
.
getId
().
intValue
()
==
i
.
getProvinceId
()).
findFirst
();
province
.
ifPresent
(
e
->{
i
.
setRegionName1
(
e
.
getRegionName
());
});
Optional
<
Regions
>
city
=
cityList
.
stream
().
filter
(
p
->
p
.
getId
().
intValue
()
==
i
.
getCityId
()).
findFirst
();
city
.
ifPresent
(
e
->{
i
.
setRegionName2
(
e
.
getRegionName
());
});
Optional
<
Regions
>
area
=
areaList
.
stream
().
filter
(
p
->
p
.
getId
().
intValue
()
==
i
.
getAreaId
()).
findFirst
();
area
.
ifPresent
(
e
->{
i
.
setRegionName3
(
e
.
getRegionName
());
});
});
response
.
setNumTotalOrder
(
thirdResponse
.
getResult
().
getTotalRecord
());
response
.
setOrders
(
findOrders
(
ordersList
));
}
else
{
throw
new
BizException
(
thirdResponse
.
getErrorMsg
());
}
return
response
;
}
...
...
@@ -94,7 +134,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
ordersList
.
stream
().
forEach
(
o
->{
OrderResponse
orderResponse
=
this
.
getOrderResponse
(
o
);
try
{
List
<
OrdersProduct
>
ordersProductList
=
memberReadDao
.
getOrdersProductList
(
o
.
getOrderSn
());
List
<
OrdersProduct
>
ordersProductList
=
null
;
CommonResponse
<
List
<
ApiOrdersProductResponse
>>
commonResponse
=
apiOrdersProductService
.
getOrdersProductByOrderSn
(
new
ApiOrdersSnRequest
(
o
.
getOrderSn
()));
if
(
commonResponse
.
isSuccess
()){
ordersProductList
=
BeanCopyUtils
.
copyList
(
OrdersProduct
.
class
,
commonResponse
.
getResult
());
}
if
(
StringUtil
.
isNull
(
ordersProductList
)){
throw
new
BizException
(
String
.
format
(
"获取子订单数据业务异常[%s]"
,(
o
.
getOrderSn
())));
}
...
...
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/GetRefundBizServiceImpl.java
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
integral
.
service
.
pineapple
.
impl
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.doubo.common.model.response.CommonResponse
;
import
com.sibu.mall.order.request.api.ApiOrdersSnRequest
;
import
com.sibu.mall.order.request.third.ThirdOrdersProductIdRequest
;
import
com.sibu.mall.order.response.api.ApiOrdersResponse
;
import
com.sibu.mall.order.service.ApiOrdersService
;
import
com.sibu.mall.order.service.ThirdApiOrderService
;
import
com.sibu.orderHelper.common.constants.AppConstants
;
import
com.sibu.orderHelper.common.database.DBContextHolder
;
import
com.sibu.orderHelper.common.strategy.DbUtil
;
...
...
@@ -36,6 +43,12 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
@Resource
private
MemberReadDao
memberReadDao
;
@Reference
private
ThirdApiOrderService
thirdApiOrderService
;
@Reference
private
ApiOrdersService
apiOrdersService
;
@Override
public
GetRefundResponse
call
(
CallRequest
<
GetRefundRequest
>
callRequest
)
throws
Exception
{
GetRefundResponse
getRefundResponse
=
new
GetRefundResponse
();
...
...
@@ -49,8 +62,23 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
List
<
GetRefundBean
>
refundBeanList
=
memberReadDao
.
getGetRefundBean
(
params
);
if
(!
StringUtil
.
isNull
(
refundBeanList
)
&&
!
refundBeanList
.
isEmpty
()){
for
(
GetRefundBean
getRefundBean:
refundBeanList
){
int
productNum
=
memberReadDao
.
countOrderProductNum
(
getRefundBean
.
getSubplatorderno
());
getRefundBean
.
setProductnum
(
productNum
);
String
orderSn
=
getRefundBean
.
getPlatorderno
();
//旧订单号处理
if
(!
orderSn
.
startsWith
(
"B"
)){
orderSn
=
memberReadDao
.
getNewOrderSnByOldOrderSn
(
orderSn
);
}
CommonResponse
<
ApiOrdersResponse
>
orderResponse
=
apiOrdersService
.
getOrdersByOrderSn
(
new
ApiOrdersSnRequest
(
orderSn
));
if
(
orderResponse
.
isSuccess
()){
getRefundBean
.
setTotalamount
(
orderResponse
.
getResult
().
getMoneyOrder
());
getRefundBean
.
setPayamount
(
orderResponse
.
getResult
().
getMoneyOrder
());
getRefundBean
.
setOrderstatus
(
String
.
valueOf
(
orderResponse
.
getResult
().
getOrderState
()));
}
else
{
throw
new
BizException
(
orderResponse
.
getErrorMsg
());
}
CommonResponse
<
Integer
>
response
=
thirdApiOrderService
.
countOrderProductNum
(
new
ThirdOrdersProductIdRequest
(
getRefundBean
.
getOrdersproductuid
(),
orderSn
));
getRefundBean
.
setProductnum
(
response
.
getResult
());
OrderStatusEnum
orderStatusEnum
=
OrderStatusEnum
.
resolveByPlatformOrderStatus
(
Integer
.
valueOf
(
getRefundBean
.
getOrderstatus
()));
if
(
orderStatusEnum
.
getCode
().
equals
(
OrderStatusEnum
.
UNKNOWN
.
getCode
())){
throw
new
BizException
(
String
.
format
(
"菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败"
,
getRefundBean
.
getOrderstatus
()));
...
...
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/PineappleSendBizServiceImpl.java
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
integral
.
service
.
pineapple
.
impl
;
import
com.sibu.orderHelper.common.constants.AppConstants
;
import
com.sibu.orderHelper.common.database.DBContextHolder
;
import
com.sibu.orderHelper.common.strategy.DbUtil
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.doubo.common.model.response.CommonResponse
;
import
com.sibu.mall.order.request.third.ThirdQueryOrderRequest
;
import
com.sibu.mall.order.request.third.ThirdUpdateOrderRequest
;
import
com.sibu.mall.order.response.api.ApiOrdersResponse
;
import
com.sibu.mall.order.service.ThirdApiOrderService
;
import
com.sibu.orderHelper.common.util.BeanCopyUtils
;
import
com.sibu.orderHelper.common.util.StringUtil
;
import
com.sibu.orderHelper.enums.PayOrderStatus
;
import
com.sibu.orderHelper.enums.PineappleEnum
;
import
com.sibu.orderHelper.enums.PineappleMethodsEnum
;
import
com.sibu.orderHelper.integral.dao.PineappleDao
;
import
com.sibu.orderHelper.integral.model.IMDoingOrderBean
;
import
com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum
;
import
com.sibu.orderHelper.integral.pineapple.exception.BizException
;
import
com.sibu.orderHelper.integral.pineapple.model.CourierCompany
;
...
...
@@ -21,7 +22,6 @@ import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import
com.sibu.orderHelper.mall.member.write.MemberWriteDao
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -34,14 +34,32 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
@Resource
private
MemberWriteDao
memberWriteDao
;
@Reference
private
ThirdApiOrderService
thirdApiOrderService
;
@Override
public
BaseResponse
call
(
CallRequest
<
PineappleSendRequest
>
callRequest
)
throws
Exception
{
BaseResponse
baseResponse
=
new
BaseResponse
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"orderSn"
,
callRequest
.
getBizModel
().
getPlatOrderNo
());
params
.
put
(
"sellerId"
,
callRequest
.
getSupplier
().
getId
());
ThirdUpdateOrderRequest
thirdUpdateOrderRequest
=
new
ThirdUpdateOrderRequest
();
//旧订单号处理
if
(!
callRequest
.
getBizModel
().
getPlatOrderNo
().
startsWith
(
"B"
)){
callRequest
.
getBizModel
().
setPlatOrderNo
(
memberReadDao
.
getNewOrderSnByOldOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
thirdUpdateOrderRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
());
thirdUpdateOrderRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
Orders
orders
=
memberWriteDao
.
getOrdersByMap
(
params
);
ThirdQueryOrderRequest
thirdQueryOrderRequest
=
new
ThirdQueryOrderRequest
();
thirdQueryOrderRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
());
thirdQueryOrderRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
Orders
orders
=
null
;
CommonResponse
<
ApiOrdersResponse
>
commonResponse
=
thirdApiOrderService
.
getOrdersByMap
(
thirdQueryOrderRequest
);
if
(
commonResponse
.
isSuccess
()){
orders
=
BeanCopyUtils
.
copyProperties
(
Orders
.
class
,
commonResponse
.
getResult
());
}
else
{
throw
new
BizException
(
commonResponse
.
getErrorMsg
());
}
if
(
StringUtil
.
isNull
(
orders
)){
log
.
error
(
String
.
format
(
"订单发货,获取订单数据业务异常:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
throw
new
BizException
(
String
.
format
(
"订单发货,获取订单数据业务异常:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
...
...
@@ -52,14 +70,14 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
if
(
orders
.
getOrderState
().
intValue
()
==
EJavaShopOrderStateEnum
.
WaitShip
.
getCode
()){
//订单状态
params
.
put
(
"orderState"
,
EJavaShopOrderStateEnum
.
HasReceived
.
getCode
());
thirdUpdateOrderRequest
.
setOrderState
(
EJavaShopOrderStateEnum
.
HasReceived
.
getCode
());
//收货人名字
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getSenderName
())){
params
.
put
(
"name"
,
callRequest
.
getBizModel
().
getSenderName
());
thirdUpdateOrderRequest
.
setName
(
callRequest
.
getBizModel
().
getSenderName
());
}
//电话
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getSenderTel
())){
params
.
put
(
"mobile"
,
callRequest
.
getBizModel
().
getSenderTel
());
thirdUpdateOrderRequest
.
setMobile
(
callRequest
.
getBizModel
().
getSenderTel
());
}
//地址、快递信息 建议去除
//this.gainInfo(params,callRequest,orders);
...
...
@@ -68,16 +86,18 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
if
(!
StringUtil
.
isNull
(
callRequest
.
getBizModel
().
getLogisticNo
())){
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
Map
<
String
,
Object
>
checkMap
=
new
HashMap
<>();
/*
Map<String,Object> checkMap = new HashMap<>();
checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
checkMap.put("sellerId",callRequest.getSupplier().getId());
int
num
=
memberWriteDao
.
checkLogisticsNumber
(
checkMap
);
if
(
num
==
0
){
int num = memberWriteDao.checkLogisticsNumber(checkMap);*/
thirdQueryOrderRequest
.
setLogisticsNumber
(
callRequest
.
getBizModel
().
getLogisticNo
());
CommonResponse
<
Boolean
>
response
=
thirdApiOrderService
.
checkLogisticsNumber
(
thirdQueryOrderRequest
);
if
(
response
.
isSuccess
()
&&
!
response
.
getResult
()){
if
(
StringUtil
.
isNull
(
orders
.
getLogisticsNumber
())){
params
.
put
(
"logisticsNumber"
,
callRequest
.
getBizModel
().
getLogisticNo
());
thirdUpdateOrderRequest
.
setLogisticsNumber
(
callRequest
.
getBizModel
().
getLogisticNo
());
}
else
{
params
.
put
(
"logisticsNumber"
,
orders
.
getLogisticsNumber
()+
";"
+
callRequest
.
getBizModel
().
getLogisticNo
());
thirdUpdateOrderRequest
.
setLogisticsNumber
(
orders
.
getLogisticsNumber
()+
";"
+
callRequest
.
getBizModel
().
getLogisticNo
());
}
}
}
...
...
@@ -87,7 +107,7 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
throw
new
BizException
(
String
.
format
(
"订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
//修改订单信息
memberWriteDao
.
updateOrdersState
(
params
);
thirdApiOrderService
.
updateOrders
(
thirdUpdateOrderRequest
);
baseResponse
.
setMessage
(
PineappleEnum
.
SUCCESS
.
getMsg
());
baseResponse
.
setCode
(
PineappleEnum
.
SUCCESS
.
getCode
());
return
baseResponse
;
...
...
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/UpdateSellerMemoBizServiceImpl.java
查看文件 @
2f9b700
package
com
.
sibu
.
orderHelper
.
integral
.
service
.
pineapple
.
impl
;
import
com.sibu.orderHelper.common.constants.AppConstants
;
import
com.sibu.orderHelper.common.database.DBContextHolder
;
import
com.sibu.orderHelper.common.strategy.DbUtil
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.doubo.common.model.response.CommonResponse
;
import
com.sibu.mall.order.request.third.ThirdQueryOrderRequest
;
import
com.sibu.mall.order.request.third.ThirdUpdateOrderRequest
;
import
com.sibu.mall.order.response.api.ApiOrdersResponse
;
import
com.sibu.mall.order.service.ThirdApiOrderService
;
import
com.sibu.orderHelper.common.util.BeanCopyUtils
;
import
com.sibu.orderHelper.common.util.StringUtil
;
import
com.sibu.orderHelper.enums.PineappleEnum
;
import
com.sibu.orderHelper.enums.PineappleMethodsEnum
;
import
com.sibu.orderHelper.integral.dao.PineappleDao
;
import
com.sibu.orderHelper.integral.model.IMDoingOrderBean
;
import
com.sibu.orderHelper.integral.pineapple.exception.BizException
;
import
com.sibu.orderHelper.integral.pineapple.model.Orders
;
import
com.sibu.orderHelper.integral.pineapple.request.CallRequest
;
import
com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse
;
import
com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest
;
import
com.sibu.orderHelper.mall.member.read.MemberReadDao
;
import
com.sibu.orderHelper.mall.member.write.MemberWriteDao
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.Map
;
@Service
public
class
UpdateSellerMemoBizServiceImpl
extends
AbstractBizService
<
UpdateSellerMemoRequest
>
{
private
static
Logger
log
=
Logger
.
getLogger
(
UpdateSellerMemoBizServiceImpl
.
class
);
@Resource
private
MemberWriteDao
memberWriteDao
;
private
MemberReadDao
memberReadDao
;
@Reference
private
ThirdApiOrderService
thirdApiOrderService
;
@Override
public
UpdateSellerMemoResponse
call
(
CallRequest
<
UpdateSellerMemoRequest
>
callRequest
)
throws
Exception
{
UpdateSellerMemoResponse
UpdateSellerMemoResponse
=
new
UpdateSellerMemoResponse
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"orderSn"
,
callRequest
.
getBizModel
().
getPlatOrderNo
());
params
.
put
(
"remark"
,
callRequest
.
getBizModel
().
getSellerMemo
());
params
.
put
(
"sellerId"
,
callRequest
.
getSupplier
().
getId
());
Orders
orders
=
memberWriteDao
.
getOrdersByMap
(
params
);
ThirdQueryOrderRequest
thirdQueryOrderRequest
=
new
ThirdQueryOrderRequest
();
//旧订单号处理
if
(!
callRequest
.
getBizModel
().
getPlatOrderNo
().
startsWith
(
"B"
)){
callRequest
.
getBizModel
().
setPlatOrderNo
(
memberReadDao
.
getNewOrderSnByOldOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
thirdQueryOrderRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
());
thirdQueryOrderRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
ThirdUpdateOrderRequest
thirdUpdateOrderRequest
=
new
ThirdUpdateOrderRequest
();
thirdUpdateOrderRequest
.
setOrderSn
(
callRequest
.
getBizModel
().
getPlatOrderNo
());
thirdUpdateOrderRequest
.
setSellerId
(
callRequest
.
getSupplier
().
getId
());
thirdUpdateOrderRequest
.
setRemark
(
callRequest
.
getBizModel
().
getSellerMemo
());
Orders
orders
=
null
;
CommonResponse
<
ApiOrdersResponse
>
response
=
thirdApiOrderService
.
getOrdersByMap
(
thirdQueryOrderRequest
);
if
(
response
.
isSuccess
()){
orders
=
BeanCopyUtils
.
copyProperties
(
Orders
.
class
,
response
.
getResult
());
}
else
{
throw
new
BizException
(
response
.
getErrorMsg
());
}
if
(
StringUtil
.
isNull
(
orders
)){
log
.
error
(
String
.
format
(
"修改订单备注,获取订单数据业务异常,订单号:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
throw
new
BizException
(
String
.
format
(
"修改订单备注,获取订单数据业务异常,订单号:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
if
(
memberWriteDao
.
updateOdersRemark
(
params
)
!=
1
){
CommonResponse
<
Boolean
>
updateResponse
=
thirdApiOrderService
.
updateOrders
(
thirdUpdateOrderRequest
);
if
(!
updateResponse
.
isSuccess
()){
log
.
error
(
String
.
format
(
"修改订单备注,修改失败,订单号:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
throw
new
BizException
(
String
.
format
(
"修改订单备注,修改失败,订单号:[%s]"
,
callRequest
.
getBizModel
().
getPlatOrderNo
()));
}
...
...
pom.xml
查看文件 @
2f9b700
...
...
@@ -25,12 +25,12 @@
</modules>
<properties>
<!-- spring版本 -->
<spring.version>
4.
0.0
.RELEASE
</spring.version>
<spring.version>
4.
3.16
.RELEASE
</spring.version>
<!-- mybatis版本 -->
<mybatis.version>
3.2.4
</mybatis.version>
<!-- log4j日志文件管理包版 -->
<slf4j.version>
1.
6.6
</slf4j.version>
<log4j.version>
1.2.1
3
</log4j.version>
<slf4j.version>
1.
7.25
</slf4j.version>
<log4j.version>
1.2.1
7
</log4j.version>
<!-- mysql驱动的版 -->
<mysql.version>
5.1.35
</mysql.version>
<!-- <mysql.version>3.1.14</mysql.version> -->
...
...
@@ -47,6 +47,10 @@
<doubo-parent.version>
2.0.0
</doubo-parent.version>
<dubbo.version>
2.6.3
</dubbo.version>
<curator.version>
2.12.0
</curator.version>
</properties>
<dependencies>
<dependency>
...
...
@@ -406,6 +410,32 @@
<artifactId>
protobuf-java
</artifactId>
<version>
2.6.1
</version>
</dependency>
<!-- dubbo begin -->
<!-- https://mvnrepository.com/artifact/com.alibaba/dubbo -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
${dubbo.version}
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-log4j12
</artifactId>
<groupId>
org.slf4j
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-framework
</artifactId>
<version>
${curator.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.curator
</groupId>
<artifactId>
curator-recipes
</artifactId>
<version>
${curator.version}
</version>
</dependency>
<!-- dubbo begin -->
<!-- taobao sms start -->
<dependency>
<groupId>
com.taobao
</groupId>
...
...
@@ -426,12 +456,6 @@
<version>
${doubo-parent.version}
</version>
</dependency>
<!--阿里mq-->
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib
</artifactId>
<version>
3.1
</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
...
...
请
注册
或
登录
后发表评论