菠萝派接口分库分表
正在显示
22 个修改的文件
包含
879 行增加
和
107 行删除
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" | ||
3 | xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
5 | xmlns:context="http://www.springframework.org/schema/context" | ||
6 | xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
7 | http://www.springframework.org/schema/beans/spring-beans.xsd | ||
8 | http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd | ||
9 | 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"> | ||
10 | |||
11 | <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | ||
12 | <property name="locations"> | ||
13 | <list> | ||
14 | <value>classpath:META-INF/conf/dubbo.properties</value> | ||
15 | </list> | ||
16 | </property> | ||
17 | </bean> | ||
18 | |||
19 | <!-- zookeeper注册中心 --> | ||
20 | <dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" /> | ||
21 | |||
22 | <!-- 远程服务代理接口 --> | ||
23 | <dubbo:annotation package="com.sibu.mall.order" /> | ||
24 | |||
25 | <!-- 关闭提供者的检索 --> | ||
26 | <dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/> | ||
27 | |||
28 | <!-- 服务调用超时,超时重试--> | ||
29 | <dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/> | ||
30 | |||
31 | <!-- 消费者名称 --> | ||
32 | <dubbo:application name="${dubbo.applicationName}" /> | ||
33 | |||
34 | </beans> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ##################### dubbo begin ############################# | ||
2 | dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181 | ||
3 | dubbo.applicationName = mall-third-consumer | ||
4 | dubbo.connectTimeOut = 20000 | ||
5 | dubbo.connectRetries= 0 | ||
6 | dubbo.consumer.group= dev.sso.qiujw | ||
7 | dubbo.consumerVersion= 1.0 | ||
8 | ##################### dubbo end ############################# |
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" | ||
3 | xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
5 | xmlns:context="http://www.springframework.org/schema/context" | ||
6 | xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
7 | http://www.springframework.org/schema/beans/spring-beans.xsd | ||
8 | http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd | ||
9 | 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"> | ||
10 | |||
11 | <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | ||
12 | <property name="locations"> | ||
13 | <list> | ||
14 | <value>classpath:META-INF/conf/dubbo.properties</value> | ||
15 | </list> | ||
16 | </property> | ||
17 | </bean> | ||
18 | |||
19 | <!-- zookeeper注册中心 --> | ||
20 | <dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" /> | ||
21 | |||
22 | <!-- 远程服务代理接口 --> | ||
23 | <dubbo:annotation package="com.sibu.mall.order" /> | ||
24 | |||
25 | <!-- 关闭提供者的检索 --> | ||
26 | <dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/> | ||
27 | |||
28 | <!-- 服务调用超时,超时重试--> | ||
29 | <dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/> | ||
30 | |||
31 | <!-- 消费者名称 --> | ||
32 | <dubbo:application name="${dubbo.applicationName}" /> | ||
33 | |||
34 | </beans> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ##################### dubbo begin ############################# | ||
2 | dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181 | ||
3 | dubbo.applicationName = mall-third-consumer | ||
4 | dubbo.connectTimeOut = 20000 | ||
5 | dubbo.connectRetries= 0 | ||
6 | dubbo.consumer.group= dev.sso.qiujw | ||
7 | dubbo.consumerVersion= 1.0 | ||
8 | ##################### dubbo end ############################# |
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" | ||
3 | xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
5 | xmlns:context="http://www.springframework.org/schema/context" | ||
6 | xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
7 | http://www.springframework.org/schema/beans/spring-beans.xsd | ||
8 | http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd | ||
9 | 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"> | ||
10 | |||
11 | <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | ||
12 | <property name="locations"> | ||
13 | <list> | ||
14 | <value>classpath:META-INF/conf/dubbo.properties</value> | ||
15 | </list> | ||
16 | </property> | ||
17 | </bean> | ||
18 | |||
19 | <!-- zookeeper注册中心 --> | ||
20 | <dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" /> | ||
21 | |||
22 | <!-- 远程服务代理接口 --> | ||
23 | <dubbo:annotation package="com.sibu.mall.order" /> | ||
24 | |||
25 | <!-- 关闭提供者的检索 --> | ||
26 | <dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/> | ||
27 | |||
28 | <!-- 服务调用超时,超时重试--> | ||
29 | <dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/> | ||
30 | |||
31 | <!-- 消费者名称 --> | ||
32 | <dubbo:application name="${dubbo.applicationName}" /> | ||
33 | |||
34 | </beans> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ##################### dubbo begin ############################# | ||
2 | dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181 | ||
3 | dubbo.applicationName = mall-third-consumer | ||
4 | dubbo.connectTimeOut = 20000 | ||
5 | dubbo.connectRetries= 0 | ||
6 | dubbo.consumer.group= dev.sso.qiujw | ||
7 | dubbo.consumerVersion= wangzhiliang2 | ||
8 | ##################### dubbo end ############################# |
... | @@ -7,18 +7,18 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE | ... | @@ -7,18 +7,18 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE |
7 | jdbc.imtegralurl=jdbc:mysql://120.76.137.184/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8 | 7 | jdbc.imtegralurl=jdbc:mysql://120.76.137.184/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8 |
8 | sqlserverjdbc.url=jdbc\:jtds\:sqlserver\://120.25.75.53\:1433;databaseName\=sibu_wesale_base_read_03 | 8 | sqlserverjdbc.url=jdbc\:jtds\:sqlserver\://120.25.75.53\:1433;databaseName\=sibu_wesale_base_read_03 |
9 | 9 | ||
10 | mall.write.url=jdbc:mysql://39.108.19.165:3306/ejavashop | 10 | mall.write.url=jdbc:mysql://118.89.51.164:3306/ejavashop |
11 | mall.write.username=sibu_wesale | 11 | mall.write.username=sibu_wesale |
12 | mall.write.password=sibu123.. | 12 | mall.write.password=6SvbL5+JhXQSpf+ASsQ0Rg== |
13 | mall.read.url=jdbc:mysql://120.77.6.187:3306/ejavashop | 13 | mall.read.url=jdbc:mysql://111.231.243.221:3306/ejavashop |
14 | mall.read.username=sibu_wesale | 14 | mall.read.username=sibu_wesale |
15 | mall.read.password=sibu123.. | 15 | mall.read.password=6SvbL5+JhXQSpf+ASsQ0Rg== |
16 | mall.analysis.write.url=jdbc:mysql://39.108.19.165:3306/ejavashop | 16 | mall.analysis.write.url=jdbc:mysql://118.89.51.164:3306/analysis |
17 | mall.analysis.write.username=sibu_wesale | 17 | mall.analysis.write.username=sibu_wesale |
18 | mall.analysis.write.password=sibu123.. | 18 | mall.analysis.write.password=6SvbL5+JhXQSpf+ASsQ0Rg== |
19 | mall.analysis.read.url=jdbc:mysql://120.77.6.187:3306/ejavashop | 19 | mall.analysis.read.url=jdbc:mysql://111.231.243.221:3306/analysis |
20 | mall.analysis.read.username=sibu_wesale | 20 | mall.analysis.read.username=sibu_wesale |
21 | mall.analysis.read.password=sibu123.. | 21 | mall.analysis.read.password=6SvbL5+JhXQSpf+ASsQ0Rg== |
22 | 22 | ||
23 | #数据库用户名 | 23 | #数据库用户名 |
24 | jdbc.username=root | 24 | jdbc.username=root | ... | ... |
... | @@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter | ... | @@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter |
84 | } | 84 | } |
85 | 85 | ||
86 | private Charset getContentTypeCharset(MediaType contentType) { | 86 | private Charset getContentTypeCharset(MediaType contentType) { |
87 | if (contentType != null && contentType.getCharSet() != null) { | 87 | if (contentType != null && contentType.getCharset() != null) { |
88 | return contentType.getCharSet(); | 88 | return contentType.getCharset(); |
89 | } | 89 | } |
90 | else { | 90 | else { |
91 | return DEFAULT_CHARSET; | 91 | return DEFAULT_CHARSET; | ... | ... |
... | @@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter | ... | @@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter |
84 | } | 84 | } |
85 | 85 | ||
86 | private Charset getContentTypeCharset(MediaType contentType) { | 86 | private Charset getContentTypeCharset(MediaType contentType) { |
87 | if (contentType != null && contentType.getCharSet() != null) { | 87 | if (contentType != null && contentType.getCharset() != null) { |
88 | return contentType.getCharSet(); | 88 | return contentType.getCharset(); |
89 | } | 89 | } |
90 | else { | 90 | else { |
91 | return DEFAULT_CHARSET; | 91 | return DEFAULT_CHARSET; | ... | ... |
com.sibu.orderHelper.common/src/main/java/com/sibu/orderHelper/common/util/BeanCopyUtils.java
0 → 100644
1 | package com.sibu.orderHelper.common.util; | ||
2 | |||
3 | import net.sf.cglib.beans.BeanCopier; | ||
4 | import net.sf.cglib.beans.BeanMap; | ||
5 | import org.slf4j.Logger; | ||
6 | import org.slf4j.LoggerFactory; | ||
7 | import org.springframework.beans.BeanUtils; | ||
8 | import org.springframework.util.CollectionUtils; | ||
9 | |||
10 | import java.beans.PropertyDescriptor; | ||
11 | import java.lang.reflect.*; | ||
12 | import java.math.BigDecimal; | ||
13 | import java.util.*; | ||
14 | import java.util.function.BiConsumer; | ||
15 | import java.util.function.Consumer; | ||
16 | import java.util.stream.Collector; | ||
17 | import java.util.stream.Stream; | ||
18 | |||
19 | /** | ||
20 | * Description:bean 拷贝 | ||
21 | * Author: wei | ||
22 | * Date:2017/12/13 | ||
23 | */ | ||
24 | public class BeanCopyUtils { | ||
25 | |||
26 | private static final Logger LOGGER = LoggerFactory.getLogger(BeanCopyUtils.class); | ||
27 | |||
28 | /** | ||
29 | * 拷贝list | ||
30 | * @param dest | ||
31 | * @param orig | ||
32 | * @param <T> | ||
33 | * @return | ||
34 | */ | ||
35 | public static <T> List<T> copyList(Class<T> dest, List orig) { | ||
36 | if (CollectionUtils.isEmpty(orig)) { | ||
37 | return new ArrayList<>(); | ||
38 | } | ||
39 | BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false); | ||
40 | List<T> resultList = new ArrayList<>(orig.size()); | ||
41 | try { | ||
42 | for (Object o : orig) { | ||
43 | if (o == null) {continue;} | ||
44 | |||
45 | T destObject = dest.newInstance(); | ||
46 | |||
47 | beanCopier.copy(o,destObject,null); | ||
48 | resultList.add(destObject); | ||
49 | } | ||
50 | return resultList; | ||
51 | } catch (Exception e) { | ||
52 | LOGGER.error("copyList error", e); | ||
53 | } | ||
54 | return resultList; | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * 拷贝list | ||
59 | * @param dest | ||
60 | * @param orig | ||
61 | * @return | ||
62 | */ | ||
63 | public static <D,O> List<D> copyList(Class<D> dest, List<O> orig,Consumer<D> d) { | ||
64 | if (CollectionUtils.isEmpty(orig)) { | ||
65 | return new ArrayList<>(); | ||
66 | } | ||
67 | BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false); | ||
68 | List<D> resultList = new ArrayList<>(orig.size()); | ||
69 | try { | ||
70 | for (Object o : orig) { | ||
71 | if (o == null) {continue;} | ||
72 | |||
73 | D destObject = dest.newInstance(); | ||
74 | |||
75 | beanCopier.copy(o,destObject,null); | ||
76 | if(d != null){ | ||
77 | d.accept(destObject); | ||
78 | } | ||
79 | resultList.add(destObject); | ||
80 | } | ||
81 | } catch (Exception e) { | ||
82 | LOGGER.error("copyList error", e); | ||
83 | } | ||
84 | return resultList; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝) | ||
89 | * @param dest 目标 | ||
90 | * @param orig 源 | ||
91 | * @param transformKey 转换 | ||
92 | * @param <T> | ||
93 | * @return | ||
94 | */ | ||
95 | public static <T> List<T> copyListAndDetail(Class<T> dest, | ||
96 | List orig, | ||
97 | Map<String,String> transformKey) { | ||
98 | return copyListAndDetail(dest,orig,transformKey,null); | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝) | ||
103 | * @param dest | ||
104 | * @param orig | ||
105 | * @param transformKey | ||
106 | * @param consumer | ||
107 | * @return | ||
108 | */ | ||
109 | public static <T,C> List<T> copyListAndDetail(Class<T> dest, | ||
110 | List orig, | ||
111 | Map<String,String> transformKey, | ||
112 | BiConsumer<T,C> consumer) { | ||
113 | try { | ||
114 | List<T> resultList = new ArrayList<>(); | ||
115 | if (orig == null || orig.size() <= 0) { | ||
116 | return resultList; | ||
117 | } | ||
118 | Field[] originFields = null; | ||
119 | Field[] destFields = null; | ||
120 | int i =0; | ||
121 | if(!CollectionUtils.isEmpty(transformKey)){ | ||
122 | originFields = new Field[transformKey.size()]; | ||
123 | destFields = new Field[transformKey.size()]; | ||
124 | Class origClass = orig.get(0).getClass(); | ||
125 | Set<Map.Entry<String, String>> entries = transformKey.entrySet(); | ||
126 | for(Iterator<Map.Entry<String, String>> iterator = entries.iterator();iterator.hasNext();i++){ | ||
127 | Map.Entry<String, String> entry = iterator.next(); | ||
128 | String key = entry.getKey();//源 | ||
129 | String value = entry.getValue();//目标 | ||
130 | originFields[i] = origClass.getDeclaredField(key); | ||
131 | destFields[i] = dest.getDeclaredField(value); | ||
132 | } | ||
133 | //私有属性 允许访问 | ||
134 | AccessibleObject.setAccessible(originFields,true); | ||
135 | AccessibleObject.setAccessible(destFields,true); | ||
136 | } | ||
137 | |||
138 | for (Object o : orig) { | ||
139 | T destObject = dest.newInstance(); | ||
140 | if (o == null) { | ||
141 | continue; | ||
142 | } | ||
143 | copyProperties(destObject, o); | ||
144 | |||
145 | for(int a = 0;a<i; a++){ | ||
146 | //源字段 | ||
147 | Field originField = originFields[a]; | ||
148 | //源里面的值 | ||
149 | List o1 = (List)originField.get(o); | ||
150 | //目标字段 | ||
151 | Field destField = destFields[a]; | ||
152 | Class childClass = (Class)((ParameterizedType) destField.getGenericType()).getActualTypeArguments()[0]; | ||
153 | |||
154 | List destList = copyList(childClass, o1,destObject,consumer); | ||
155 | |||
156 | destField.set(destObject,destList); | ||
157 | } | ||
158 | resultList.add(destObject); | ||
159 | } | ||
160 | if(originFields != null && destFields != null){ | ||
161 | //私有属性 不允许访问 | ||
162 | AccessibleObject.setAccessible(originFields,false); | ||
163 | AccessibleObject.setAccessible(destFields,false); | ||
164 | } | ||
165 | return resultList; | ||
166 | } catch (Exception e) { | ||
167 | LOGGER.error("copyListAndDetail error", e); | ||
168 | return null; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * 拷贝list | ||
174 | * @param dest | ||
175 | * @param orig | ||
176 | * @param out (相当于 一对多环境中的 一) | ||
177 | * @param consumer | ||
178 | * @param <T> | ||
179 | * @return | ||
180 | */ | ||
181 | private static <T,O> List<T> copyList(Class<T> dest, List orig, O out, BiConsumer<O,T> consumer) { | ||
182 | if (CollectionUtils.isEmpty(orig)) { | ||
183 | return new ArrayList<>(); | ||
184 | } | ||
185 | BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false); | ||
186 | List<T> resultList = new ArrayList<>(orig.size()); | ||
187 | try { | ||
188 | for (Object o : orig) { | ||
189 | if (o == null) {continue;} | ||
190 | |||
191 | T destObject = dest.newInstance(); | ||
192 | beanCopier.copy(o,destObject,null); | ||
193 | resultList.add(destObject); | ||
194 | if(out != null && consumer!=null){ | ||
195 | consumer.accept(out,destObject); | ||
196 | } | ||
197 | } | ||
198 | return resultList; | ||
199 | } catch (Exception e) { | ||
200 | LOGGER.error("copyList error", e); | ||
201 | } | ||
202 | return resultList; | ||
203 | } | ||
204 | |||
205 | |||
206 | /** | ||
207 | * 多个orig对象 属性 浅拷贝到 dest | ||
208 | * | ||
209 | * @param dest | ||
210 | * @param orig | ||
211 | * @param <T> | ||
212 | * @return | ||
213 | */ | ||
214 | public static <T> T copyProperties(Class<T> dest, Object... orig) { | ||
215 | if (orig == null) { | ||
216 | return null; | ||
217 | } | ||
218 | try { | ||
219 | T destObject = dest.newInstance(); | ||
220 | for (Object o : orig) { | ||
221 | copyProperties(destObject, o); | ||
222 | } | ||
223 | return destObject; | ||
224 | } catch (Exception e) { | ||
225 | LOGGER.error("copyProperties error", e); | ||
226 | return null; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /** | ||
231 | * 拷贝对象 | ||
232 | * @param dest | ||
233 | * @param orig | ||
234 | * @param <T> | ||
235 | * @return | ||
236 | */ | ||
237 | public static <T> T copyProperties(Class<T> dest, Object orig) { | ||
238 | if (orig == null) { | ||
239 | return null; | ||
240 | } | ||
241 | try { | ||
242 | T destObject = dest.newInstance(); | ||
243 | copyProperties(destObject, orig); | ||
244 | return destObject; | ||
245 | } catch (Exception e) { | ||
246 | LOGGER.error("copyProperties error", e); | ||
247 | return null; | ||
248 | } | ||
249 | } | ||
250 | /** | ||
251 | * 使用 org.springframework.beans.BeanUtils 拷贝对象 | ||
252 | * @param dest | ||
253 | * @param orig | ||
254 | */ | ||
255 | public static void copyProperties(Object dest, Object orig) { | ||
256 | try { | ||
257 | BeanCopier copier = BeanCopier.create(orig.getClass(), dest.getClass(), false); | ||
258 | copier.copy(orig, dest,null); | ||
259 | } catch (Exception e) { | ||
260 | LOGGER.error("copyProperties error", e); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | |||
265 | /** | ||
266 | * 根据指定名称键值对,填充javaBean对象。 | ||
267 | * @param bean | ||
268 | * @param properties | ||
269 | */ | ||
270 | public static void populate(Object bean, Map properties) { | ||
271 | try { | ||
272 | BeanMap beanMap = BeanMap.create(bean); | ||
273 | beanMap.putAll(properties); | ||
274 | } catch (Exception e) { | ||
275 | LOGGER.error("populate bean property error", e); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * 根据指定名称键值对,填充javaBean对象。 | ||
281 | * @param c | ||
282 | * @param properties | ||
283 | */ | ||
284 | public static <T> T populate(Class<T> c, Map properties) { | ||
285 | try { | ||
286 | T o = c.newInstance(); | ||
287 | BeanMap beanMap = BeanMap.create(o); | ||
288 | beanMap.putAll(properties); | ||
289 | return (T)beanMap.getBean(); | ||
290 | } catch (Exception e) { | ||
291 | LOGGER.error("populate bean property error", e); | ||
292 | } | ||
293 | return null; | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * 根据指定名称键值对,填充javaBean对象。 | ||
298 | */ | ||
299 | public static <T> List<T> populateList(Class<T> dest, List<Map<String,Object>> orig) { | ||
300 | if (CollectionUtils.isEmpty(orig)) { | ||
301 | return new ArrayList<>(); | ||
302 | } | ||
303 | |||
304 | List<T> resultList = new ArrayList<>(orig.size()); | ||
305 | try { | ||
306 | BeanMap beanMap = BeanMap.create(dest.newInstance()); | ||
307 | for (Map o : orig) { | ||
308 | if (o == null) {continue;} | ||
309 | |||
310 | T destObject = dest.newInstance(); | ||
311 | beanMap.setBean(destObject); | ||
312 | beanMap.putAll(o); | ||
313 | resultList.add(destObject); | ||
314 | } | ||
315 | return resultList; | ||
316 | } catch (Exception e) { | ||
317 | LOGGER.error("copyList error", e); | ||
318 | } | ||
319 | return resultList; | ||
320 | |||
321 | } | ||
322 | |||
323 | /** | ||
324 | * 检查并返回集合中的一个对象 | ||
325 | * 集合不能多于一个对象 | ||
326 | * 集合为空时返回null | ||
327 | * @param list | ||
328 | * @param <T> | ||
329 | * @return | ||
330 | */ | ||
331 | /* public static <T> T getSingleResult(List<T> list) { | ||
332 | if (CollectionUtils.isEmpty(list)) { | ||
333 | return null; | ||
334 | }else if(list.size() == 1){ | ||
335 | return list.get(0); | ||
336 | }else{ | ||
337 | //加载到多余数据 | ||
338 | throw new BusinessException("加载到多余条数"); | ||
339 | } | ||
340 | }*/ | ||
341 | |||
342 | /** | ||
343 | * 检查并返回集合中的第一对象 | ||
344 | * 集合为空时返回null | ||
345 | * @param list | ||
346 | * @param <T> | ||
347 | * @return | ||
348 | */ | ||
349 | public static <T> T getFirstResult(List<T> list) { | ||
350 | if (CollectionUtils.isEmpty(list)) { | ||
351 | return null; | ||
352 | }else { | ||
353 | return list.get(0); | ||
354 | } | ||
355 | } | ||
356 | |||
357 | /** | ||
358 | * 公共转换 从List转成Map | ||
359 | * | ||
360 | * @param stat | ||
361 | * @return | ||
362 | */ | ||
363 | public static <K,V,T> Map<K, V> transformListToMap(List<T> stat, | ||
364 | Collector<T,Map, Map> collector){ | ||
365 | Map<K, V> hashMap = null; | ||
366 | if (!CollectionUtils.isEmpty(stat)) { | ||
367 | Stream<T> stream = null; | ||
368 | if (stat.size() > 1000) {//并行去收集 | ||
369 | stream = stat.parallelStream(); | ||
370 | } else { | ||
371 | //否则串行去收集 | ||
372 | stream = stat.stream(); | ||
373 | } | ||
374 | hashMap = stream.collect(collector); | ||
375 | } | ||
376 | return hashMap; | ||
377 | } | ||
378 | |||
379 | /** | ||
380 | * 填充数据 | ||
381 | * | ||
382 | * @param finalResult | ||
383 | * @param intoResult | ||
384 | * @param params | ||
385 | * @return | ||
386 | * @throws InvocationTargetException | ||
387 | * @throws IllegalAccessException | ||
388 | */ | ||
389 | public static <T> Map<String, T> getAssemblyResult(Map<String, T> finalResult, | ||
390 | Map<String, T> intoResult, | ||
391 | Class<T> c, | ||
392 | String[] params) throws InvocationTargetException, IllegalAccessException { | ||
393 | if (!CollectionUtils.isEmpty(intoResult)) { | ||
394 | for (Map.Entry<String, T> entry : intoResult.entrySet()) { | ||
395 | //key | ||
396 | String key = entry.getKey(); | ||
397 | //value | ||
398 | T value = entry.getValue(); | ||
399 | |||
400 | T statPerDayOrder = finalResult.get(key); | ||
401 | if (statPerDayOrder == null) { | ||
402 | finalResult.put(key, value); | ||
403 | } else { | ||
404 | for (String param : params) { | ||
405 | PropertyDescriptor propertyDescriptor = BeanUtils.getPropertyDescriptor(c, param); | ||
406 | Method readMethod = propertyDescriptor.getReadMethod(); | ||
407 | Method writeMethod = propertyDescriptor.getWriteMethod(); | ||
408 | //从finalResult里面获取 | ||
409 | Object oldValue = readMethod.invoke(statPerDayOrder); | ||
410 | //从新加入对象读 | ||
411 | Object paramValue = readMethod.invoke(value); | ||
412 | if(oldValue != null && paramValue != null){ | ||
413 | if(BigDecimal.class.isInstance(paramValue)){//BigDecimal | ||
414 | BigDecimal old = (BigDecimal) oldValue; | ||
415 | paramValue = old.add((BigDecimal) paramValue); | ||
416 | }else if(Integer.class.isInstance(paramValue)){ | ||
417 | Integer old = (Integer) oldValue; | ||
418 | paramValue = old+(Integer) paramValue; | ||
419 | }else if(Long.class.isInstance(paramValue)){ | ||
420 | Long old = (Long) oldValue; | ||
421 | paramValue = old+(Long) paramValue; | ||
422 | } | ||
423 | } | ||
424 | //往已有对象里面写 | ||
425 | writeMethod.invoke(statPerDayOrder, paramValue); | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | return finalResult; | ||
431 | } | ||
432 | |||
433 | } |
... | @@ -99,6 +99,13 @@ public interface MemberReadDao { | ... | @@ -99,6 +99,13 @@ public interface MemberReadDao { |
99 | */ | 99 | */ |
100 | Regions getRegionsById(@Param("id") Integer id); | 100 | Regions getRegionsById(@Param("id") Integer id); |
101 | 101 | ||
102 | /** | ||
103 | * 根据id查询省市级信息 | ||
104 | * @param regionIdList | ||
105 | * @return | ||
106 | */ | ||
107 | List<Regions> getRegionsByIds(@Param("list") List regionIdList); | ||
108 | |||
102 | 109 | ||
103 | /** | 110 | /** |
104 | * 根据条件查询物流公司 | 111 | * 根据条件查询物流公司 |
... | @@ -148,4 +155,11 @@ public interface MemberReadDao { | ... | @@ -148,4 +155,11 @@ public interface MemberReadDao { |
148 | * @return | 155 | * @return |
149 | */ | 156 | */ |
150 | int countOrderProductNum(@Param("id") String orderProductId); | 157 | int countOrderProductNum(@Param("id") String orderProductId); |
158 | |||
159 | /** | ||
160 | * 根据旧订单号获取新订单号 | ||
161 | * @param orderSn | ||
162 | * @return | ||
163 | */ | ||
164 | String getNewOrderSnByOldOrderSn(@Param("orderSn") String orderSn); | ||
151 | } | 165 | } | ... | ... |
... | @@ -18,6 +18,20 @@ | ... | @@ -18,6 +18,20 @@ |
18 | <groupId>com.sibu.orderHelper.service</groupId> | 18 | <groupId>com.sibu.orderHelper.service</groupId> |
19 | <artifactId>com.sibu.orderHelper.service</artifactId> | 19 | <artifactId>com.sibu.orderHelper.service</artifactId> |
20 | <version>0.0.1-SNAPSHOT</version> | 20 | <version>0.0.1-SNAPSHOT</version> |
21 | <exclusions> | ||
22 | <exclusion> | ||
23 | <artifactId>slf4j-api</artifactId> | ||
24 | <groupId>org.slf4j</groupId> | ||
25 | </exclusion> | ||
26 | <exclusion> | ||
27 | <artifactId>spring-context</artifactId> | ||
28 | <groupId>org.springframework</groupId> | ||
29 | </exclusion> | ||
30 | <exclusion> | ||
31 | <artifactId>commons-logging</artifactId> | ||
32 | <groupId>commons-logging</groupId> | ||
33 | </exclusion> | ||
34 | </exclusions> | ||
21 | </dependency> | 35 | </dependency> |
22 | <dependency> | 36 | <dependency> |
23 | <groupId>net.sourceforge.jtds</groupId> | 37 | <groupId>net.sourceforge.jtds</groupId> |
... | @@ -30,6 +44,7 @@ | ... | @@ -30,6 +44,7 @@ |
30 | <version>4.10</version> | 44 | <version>4.10</version> |
31 | <scope>test</scope> | 45 | <scope>test</scope> |
32 | </dependency> | 46 | </dependency> |
47 | |||
33 | </dependencies> | 48 | </dependencies> |
34 | <build> | 49 | <build> |
35 | <finalName>com.sibu.orderHelper.integralMall</finalName> | 50 | <finalName>com.sibu.orderHelper.integralMall</finalName> | ... | ... |
... | @@ -29,6 +29,9 @@ | ... | @@ -29,6 +29,9 @@ |
29 | <!--加载mq配置--> | 29 | <!--加载mq配置--> |
30 | <import resource="classpath:META-INF/conf/service-spring-mq.xml"></import> | 30 | <import resource="classpath:META-INF/conf/service-spring-mq.xml"></import> |
31 | 31 | ||
32 | <!--dubbo配置--> | ||
33 | <import resource="classpath:META-INF/conf/dubbo-consumer-config.xml"></import> | ||
34 | |||
32 | <!-- 开启注解配置 | 35 | <!-- 开启注解配置 |
33 | <context:annotation-config />--> | 36 | <context:annotation-config />--> |
34 | <!-- 开启AOP监听 只对当前配置文件有效 --> | 37 | <!-- 开启AOP监听 只对当前配置文件有效 --> | ... | ... |
... | @@ -281,6 +281,17 @@ | ... | @@ -281,6 +281,17 @@ |
281 | where `id` = #{id} | 281 | where `id` = #{id} |
282 | </select> | 282 | </select> |
283 | 283 | ||
284 | <!-- 根据id查询省市级信息--> | ||
285 | <select id="getRegionsByIds" resultMap="regionsResult"> | ||
286 | select | ||
287 | * | ||
288 | from `regions` | ||
289 | where `id` in | ||
290 | <foreach collection="list" item="regionId" open="(" close=")" separator=","> | ||
291 | #{regionId} | ||
292 | </foreach> | ||
293 | </select> | ||
294 | |||
284 | <!-- 物流公司实体--> | 295 | <!-- 物流公司实体--> |
285 | <resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany"> | 296 | <resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany"> |
286 | <result property="id" column="id" /> | 297 | <result property="id" column="id" /> |
... | @@ -467,6 +478,7 @@ | ... | @@ -467,6 +478,7 @@ |
467 | <result column="member_back_code" property="refundno"/> | 478 | <result column="member_back_code" property="refundno"/> |
468 | <result column="order_sn" property="platorderno"/> | 479 | <result column="order_sn" property="platorderno"/> |
469 | <result column="order_product_id" property="subplatorderno"/> | 480 | <result column="order_product_id" property="subplatorderno"/> |
481 | <result column="orders_product_uid" property="ordersproductuid"/> | ||
470 | <result column="back_money" property="refundamount"/> | 482 | <result column="back_money" property="refundamount"/> |
471 | <result column="create_time" property="createtime"/> | 483 | <result column="create_time" property="createtime"/> |
472 | <result column="member_name" property="buyernick"/> | 484 | <result column="member_name" property="buyernick"/> |
... | @@ -485,9 +497,8 @@ | ... | @@ -485,9 +497,8 @@ |
485 | 497 | ||
486 | <select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap"> | 498 | <select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap"> |
487 | SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name, | 499 | SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name, |
488 | b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name, | 500 | b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,b.orders_product_uid |
489 | o.money_order,o.order_state,o.remark | 501 | FROM member_product_back b |
490 | FROM member_product_back b LEFT JOIN orders o ON b.order_id = o.id | ||
491 | WHERE b.seller_id = #{supplierId} | 502 | WHERE b.seller_id = #{supplierId} |
492 | <if test="beginTime!=null"> | 503 | <if test="beginTime!=null"> |
493 | AND b.create_time >= #{beginTime} | 504 | AND b.create_time >= #{beginTime} |
... | @@ -520,4 +531,8 @@ | ... | @@ -520,4 +531,8 @@ |
520 | SELECT number FROM orders_product where id = #{id} | 531 | SELECT number FROM orders_product where id = #{id} |
521 | </select> | 532 | </select> |
522 | 533 | ||
534 | <select id="getNewOrderSnByOldOrderSn" parameterType="java.lang.String" resultType="java.lang.String"> | ||
535 | SELECT order_sn FROM orders WHERE order_sn_back= #{orderSn} | ||
536 | </select> | ||
537 | |||
523 | </mapper> | 538 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -20,6 +20,8 @@ public class GetRefundBean implements Serializable{ | ... | @@ -20,6 +20,8 @@ public class GetRefundBean implements Serializable{ |
20 | //平台子订单号 | 20 | //平台子订单号 |
21 | private String subplatorderno; | 21 | private String subplatorderno; |
22 | 22 | ||
23 | private String ordersproductuid; | ||
24 | |||
23 | //订单总金额 | 25 | //订单总金额 |
24 | private BigDecimal totalamount; | 26 | private BigDecimal totalamount; |
25 | 27 | ||
... | @@ -296,4 +298,12 @@ public class GetRefundBean implements Serializable{ | ... | @@ -296,4 +298,12 @@ public class GetRefundBean implements Serializable{ |
296 | public void setStateMoney(Integer stateMoney) { | 298 | public void setStateMoney(Integer stateMoney) { |
297 | this.stateMoney = stateMoney; | 299 | this.stateMoney = stateMoney; |
298 | } | 300 | } |
301 | |||
302 | public String getOrdersproductuid() { | ||
303 | return ordersproductuid; | ||
304 | } | ||
305 | |||
306 | public void setOrdersproductuid(String ordersproductuid) { | ||
307 | this.ordersproductuid = ordersproductuid; | ||
308 | } | ||
299 | } | 309 | } | ... | ... |
... | @@ -42,5 +42,12 @@ | ... | @@ -42,5 +42,12 @@ |
42 | <artifactId>fastdfs-client-java</artifactId> | 42 | <artifactId>fastdfs-client-java</artifactId> |
43 | <version>5.0.4</version> | 43 | <version>5.0.4</version> |
44 | </dependency> | 44 | </dependency> |
45 | |||
46 | <dependency> | ||
47 | <groupId>com.sibu.sibu-mall-order</groupId> | ||
48 | <artifactId>sibu-mall-order-service-api</artifactId> | ||
49 | <version>1.0.0</version> | ||
50 | </dependency> | ||
51 | |||
45 | </dependencies> | 52 | </dependencies> |
46 | </project> | 53 | </project> | ... | ... |
1 | package com.sibu.orderHelper.integral.service.pineapple.impl; | 1 | package com.sibu.orderHelper.integral.service.pineapple.impl; |
2 | 2 | ||
3 | import com.sibu.orderHelper.common.constants.AppConstants; | 3 | import com.alibaba.dubbo.config.annotation.Reference; |
4 | import com.sibu.orderHelper.common.database.DBContextHolder; | 4 | import com.doubo.common.model.response.CommonResponse; |
5 | import com.sibu.orderHelper.common.strategy.DbUtil; | 5 | import com.sibu.mall.order.request.third.ThirdQueryOrderRequest; |
6 | import com.sibu.mall.order.response.api.ApiOrdersResponse; | ||
7 | import com.sibu.mall.order.service.ThirdApiOrderService; | ||
8 | import com.sibu.orderHelper.common.util.BeanCopyUtils; | ||
6 | import com.sibu.orderHelper.common.util.StringUtil; | 9 | import com.sibu.orderHelper.common.util.StringUtil; |
7 | import com.sibu.orderHelper.enums.*; | 10 | import com.sibu.orderHelper.enums.*; |
8 | import com.sibu.orderHelper.integral.dao.PineappleDao; | ||
9 | import com.sibu.orderHelper.integral.model.CheckRefundStatusBean; | ||
10 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; | ||
11 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; | 11 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; |
12 | import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum; | ||
13 | import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum; | 12 | import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum; |
14 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
15 | import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack; | 14 | import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack; |
... | @@ -22,7 +21,6 @@ import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest; | ... | @@ -22,7 +21,6 @@ import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest; |
22 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; | 21 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; |
23 | import org.apache.log4j.Logger; | 22 | import org.apache.log4j.Logger; |
24 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
25 | |||
26 | import javax.annotation.Resource; | 24 | import javax.annotation.Resource; |
27 | import java.util.*; | 25 | import java.util.*; |
28 | 26 | ||
... | @@ -33,13 +31,28 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef | ... | @@ -33,13 +31,28 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef |
33 | @Resource | 31 | @Resource |
34 | private MemberReadDao memberReadDao; | 32 | private MemberReadDao memberReadDao; |
35 | 33 | ||
34 | @Reference | ||
35 | private ThirdApiOrderService thirdApiOrderService; | ||
36 | |||
36 | @Override | 37 | @Override |
37 | public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception { | 38 | public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception { |
38 | CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse(); | 39 | CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse(); |
39 | Map<String,Object> params = new HashMap<>(); | 40 | |
40 | params.put("orderSn",callRequest.getBizModel().getOrderID()); | 41 | //旧订单号处理 |
41 | params.put("sellerId",callRequest.getSupplier().getId()); | 42 | if(!callRequest.getBizModel().getOrderID().startsWith("B")){ |
42 | Orders orders = memberReadDao.getOrdersByMap(params); | 43 | callRequest.getBizModel().setOrderID(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getOrderID())); |
44 | } | ||
45 | |||
46 | ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest(); | ||
47 | thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getOrderID()); | ||
48 | thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId()); | ||
49 | Orders orders = null; | ||
50 | CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest); | ||
51 | if(commonResponse.isSuccess()){ | ||
52 | orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult()); | ||
53 | }else { | ||
54 | throw new BizException(commonResponse.getErrorMsg()); | ||
55 | } | ||
43 | if(StringUtil.isNull(orders)){ | 56 | if(StringUtil.isNull(orders)){ |
44 | log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID())); | 57 | log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID())); |
45 | throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID())); | 58 | throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID())); | ... | ... |
1 | package com.sibu.orderHelper.integral.service.pineapple.impl; | 1 | package com.sibu.orderHelper.integral.service.pineapple.impl; |
2 | 2 | ||
3 | import com.sibu.orderHelper.common.constants.AppConstants; | 3 | import com.alibaba.dubbo.config.annotation.Reference; |
4 | import com.sibu.orderHelper.common.database.DBContextHolder; | 4 | import com.doubo.common.model.response.CommonResponse; |
5 | import com.sibu.orderHelper.common.strategy.DbUtil; | 5 | import com.sibu.mall.common.response.PageResult; |
6 | import com.sibu.mall.order.request.api.ApiOrdersSnRequest; | ||
7 | import com.sibu.mall.order.request.third.ThirdPageQueryOrderListRequest; | ||
8 | import com.sibu.mall.order.response.api.ApiOrdersProductResponse; | ||
9 | import com.sibu.mall.order.response.api.ApiOrdersResponse; | ||
10 | import com.sibu.mall.order.service.ApiOrdersProductService; | ||
11 | import com.sibu.mall.order.service.ThirdApiOrderService; | ||
12 | import com.sibu.orderHelper.common.util.BeanCopyUtils; | ||
6 | import com.sibu.orderHelper.common.util.StringUtil; | 13 | import com.sibu.orderHelper.common.util.StringUtil; |
7 | import com.sibu.orderHelper.integral.dao.IMDoingOrderDao; | ||
8 | import com.sibu.orderHelper.integral.dao.PineappleDao; | ||
9 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; | ||
10 | import com.sibu.orderHelper.integral.model.IMProductBean; | ||
11 | import com.sibu.orderHelper.integral.model.IMSupplier; | ||
12 | import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; | 14 | import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; |
13 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; | ||
14 | import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum; | 15 | import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum; |
15 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 16 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
16 | import com.sibu.orderHelper.integral.pineapple.model.Orders; | 17 | import com.sibu.orderHelper.integral.pineapple.model.Orders; |
17 | import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct; | 18 | import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct; |
19 | import com.sibu.orderHelper.integral.pineapple.model.Regions; | ||
18 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; | 20 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; |
19 | |||
20 | import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; | 21 | import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; |
21 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; | 22 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; |
22 | import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse; | 23 | import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse; |
23 | import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse; | 24 | import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse; |
24 | import com.sibu.orderHelper.integral.pineapple.response.OrderResponse; | 25 | import com.sibu.orderHelper.integral.pineapple.response.OrderResponse; |
25 | import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse; | ||
26 | import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; | ||
27 | import com.sibu.orderHelper.integral.service.IIMDoingOrderService; | ||
28 | import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService; | ||
29 | import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter; | 26 | import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter; |
30 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; | 27 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; |
31 | import com.sibu.orderHelper.service.redis.RedisProductSkuService; | ||
32 | import org.apache.commons.lang3.StringUtils; | ||
33 | import org.apache.log4j.Logger; | 28 | import org.apache.log4j.Logger; |
34 | import org.springframework.beans.factory.annotation.Autowired; | 29 | import org.springframework.beans.factory.annotation.Autowired; |
35 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
36 | |||
37 | import javax.annotation.Resource; | 31 | import javax.annotation.Resource; |
38 | import javax.xml.bind.ValidationException; | ||
39 | import java.math.BigDecimal; | 32 | import java.math.BigDecimal; |
40 | import java.text.MessageFormat; | 33 | import java.text.MessageFormat; |
41 | import java.text.SimpleDateFormat; | 34 | import java.text.SimpleDateFormat; |
42 | import java.util.ArrayList; | 35 | import java.util.ArrayList; |
43 | import java.util.HashMap; | ||
44 | import java.util.List; | 36 | import java.util.List; |
45 | import java.util.Map; | 37 | import java.util.Optional; |
46 | import java.util.stream.Collectors; | 38 | import java.util.stream.Collectors; |
47 | 39 | ||
48 | /** | 40 | /** |
... | @@ -61,30 +53,78 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> | ... | @@ -61,30 +53,78 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> |
61 | @Resource | 53 | @Resource |
62 | private MemberReadDao memberReadDao; | 54 | private MemberReadDao memberReadDao; |
63 | 55 | ||
56 | @Reference | ||
57 | private ApiOrdersProductService apiOrdersProductService; | ||
58 | |||
59 | @Reference | ||
60 | private ThirdApiOrderService thirdApiOrderService; | ||
61 | |||
64 | @Override | 62 | @Override |
65 | public BaseResponse call(CallRequest<GetOrderRequest> callRequest) { | 63 | public BaseResponse call(CallRequest<GetOrderRequest> callRequest) { |
66 | Map<String,Object> params = new HashMap<>(); | 64 | ThirdPageQueryOrderListRequest thirdPageQueryOrderListRequest = new ThirdPageQueryOrderListRequest(); |
67 | if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){ | 65 | if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){ |
68 | params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); | 66 | //旧订单号处理 |
67 | if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){ | ||
68 | callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo())); | ||
69 | } | ||
70 | thirdPageQueryOrderListRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo()); | ||
69 | } | 71 | } |
70 | if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){ | 72 | if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){ |
71 | OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus()); | 73 | OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus()); |
72 | params.put("orderState",orderStatusEnum.getMallOrderStatus()); | 74 | thirdPageQueryOrderListRequest.setOrderState(orderStatusEnum.getMallOrderStatus()); |
73 | } | 75 | } |
74 | params.put("sellerId",callRequest.getSupplier().getId()); | 76 | |
77 | thirdPageQueryOrderListRequest.setSellerId(callRequest.getSupplier().getId()); | ||
75 | if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){ | 78 | if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){ |
76 | params.put("startTime",callRequest.getBizModel().getStartTime()); | 79 | thirdPageQueryOrderListRequest.setStartTime(callRequest.getBizModel().getStartTime()); |
77 | } | 80 | } |
78 | if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){ | 81 | if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){ |
79 | params.put("endTime",callRequest.getBizModel().getEndTime()); | 82 | thirdPageQueryOrderListRequest.setEndTime(callRequest.getBizModel().getEndTime()); |
80 | } | 83 | } |
81 | params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); | 84 | thirdPageQueryOrderListRequest.setPageNow(callRequest.getBizModel().getPageIndex()); |
82 | params.put("PageSize",callRequest.getBizModel().getPageSize()); | 85 | thirdPageQueryOrderListRequest.setPageSize(callRequest.getBizModel().getPageSize()); |
83 | List<Orders> ordersList = memberReadDao.getOrdersList(params); | 86 | |
87 | CommonResponse<PageResult<ApiOrdersResponse>> thirdResponse = thirdApiOrderService.pageOrder(thirdPageQueryOrderListRequest); | ||
88 | |||
84 | GetOrderResponse response = new GetOrderResponse(); | 89 | GetOrderResponse response = new GetOrderResponse(); |
85 | response.setNumTotalOrder(memberReadDao.countgetOrdersList(params)); | 90 | response.setNumTotalOrder(0); |
86 | response.setOrders(findOrders(ordersList)); | 91 | response.setOrders(new ArrayList<>()); |
87 | response.setCode(PineAppleConst.SUCCESS_CODE); | 92 | response.setCode(PineAppleConst.SUCCESS_CODE); |
93 | if(thirdResponse.isSuccess()){ | ||
94 | |||
95 | List<Orders> ordersList = BeanCopyUtils.copyList(Orders.class,thirdResponse.getResult().getDatas()); | ||
96 | |||
97 | List<Integer> provinceIdList = ordersList.stream().map(o->o.getProvinceId()).collect(Collectors.toList()); | ||
98 | List<Regions> provinceList = memberReadDao.getRegionsByIds(provinceIdList); | ||
99 | |||
100 | List<Integer> cityIdList = ordersList.stream().map(o->o.getCityId()).collect(Collectors.toList()); | ||
101 | List<Regions> cityList = memberReadDao.getRegionsByIds(cityIdList); | ||
102 | |||
103 | List<Integer> areaIdList = ordersList.stream().map(o->o.getAreaId()).collect(Collectors.toList()); | ||
104 | List<Regions> areaList = memberReadDao.getRegionsByIds(areaIdList); | ||
105 | |||
106 | ordersList.stream().forEach(i->{ | ||
107 | Optional<Regions> province = provinceList.stream().filter(p->p.getId().intValue() == i.getProvinceId()).findFirst(); | ||
108 | province.ifPresent(e->{ | ||
109 | i.setRegionName1(e.getRegionName()); | ||
110 | }); | ||
111 | |||
112 | Optional<Regions> city = cityList.stream().filter(p->p.getId().intValue() == i.getCityId()).findFirst(); | ||
113 | city.ifPresent(e->{ | ||
114 | i.setRegionName2(e.getRegionName()); | ||
115 | }); | ||
116 | |||
117 | Optional<Regions> area = areaList.stream().filter(p->p.getId().intValue() == i.getAreaId()).findFirst(); | ||
118 | area.ifPresent(e->{ | ||
119 | i.setRegionName3(e.getRegionName()); | ||
120 | }); | ||
121 | }); | ||
122 | |||
123 | response.setNumTotalOrder(thirdResponse.getResult().getTotalRecord()); | ||
124 | response.setOrders(findOrders(ordersList)); | ||
125 | }else { | ||
126 | throw new BizException(thirdResponse.getErrorMsg()); | ||
127 | } | ||
88 | return response; | 128 | return response; |
89 | } | 129 | } |
90 | 130 | ||
... | @@ -94,7 +134,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> | ... | @@ -94,7 +134,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> |
94 | ordersList.stream().forEach(o ->{ | 134 | ordersList.stream().forEach(o ->{ |
95 | OrderResponse orderResponse = this.getOrderResponse(o); | 135 | OrderResponse orderResponse = this.getOrderResponse(o); |
96 | try { | 136 | try { |
97 | List<OrdersProduct> ordersProductList = memberReadDao.getOrdersProductList(o.getOrderSn()); | 137 | List<OrdersProduct> ordersProductList = null; |
138 | CommonResponse<List<ApiOrdersProductResponse>> commonResponse = apiOrdersProductService.getOrdersProductByOrderSn(new ApiOrdersSnRequest(o.getOrderSn())); | ||
139 | if(commonResponse.isSuccess()){ | ||
140 | ordersProductList = BeanCopyUtils.copyList(OrdersProduct.class, commonResponse.getResult()); | ||
141 | } | ||
142 | |||
98 | if(StringUtil.isNull(ordersProductList)){ | 143 | if(StringUtil.isNull(ordersProductList)){ |
99 | throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn()))); | 144 | throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn()))); |
100 | } | 145 | } | ... | ... |
1 | package com.sibu.orderHelper.integral.service.pineapple.impl; | 1 | package com.sibu.orderHelper.integral.service.pineapple.impl; |
2 | 2 | ||
3 | import com.alibaba.dubbo.config.annotation.Reference; | ||
4 | import com.doubo.common.model.response.CommonResponse; | ||
5 | import com.sibu.mall.order.request.api.ApiOrdersSnRequest; | ||
6 | import com.sibu.mall.order.request.third.ThirdOrdersProductIdRequest; | ||
7 | import com.sibu.mall.order.response.api.ApiOrdersResponse; | ||
8 | import com.sibu.mall.order.service.ApiOrdersService; | ||
9 | import com.sibu.mall.order.service.ThirdApiOrderService; | ||
3 | import com.sibu.orderHelper.common.constants.AppConstants; | 10 | import com.sibu.orderHelper.common.constants.AppConstants; |
4 | import com.sibu.orderHelper.common.database.DBContextHolder; | 11 | import com.sibu.orderHelper.common.database.DBContextHolder; |
5 | import com.sibu.orderHelper.common.strategy.DbUtil; | 12 | import com.sibu.orderHelper.common.strategy.DbUtil; |
... | @@ -36,6 +43,12 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques | ... | @@ -36,6 +43,12 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques |
36 | @Resource | 43 | @Resource |
37 | private MemberReadDao memberReadDao; | 44 | private MemberReadDao memberReadDao; |
38 | 45 | ||
46 | @Reference | ||
47 | private ThirdApiOrderService thirdApiOrderService; | ||
48 | |||
49 | @Reference | ||
50 | private ApiOrdersService apiOrdersService; | ||
51 | |||
39 | @Override | 52 | @Override |
40 | public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception { | 53 | public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception { |
41 | GetRefundResponse getRefundResponse =new GetRefundResponse(); | 54 | GetRefundResponse getRefundResponse =new GetRefundResponse(); |
... | @@ -49,8 +62,23 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques | ... | @@ -49,8 +62,23 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques |
49 | List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params); | 62 | List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params); |
50 | if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){ | 63 | if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){ |
51 | for(GetRefundBean getRefundBean:refundBeanList){ | 64 | for(GetRefundBean getRefundBean:refundBeanList){ |
52 | int productNum = memberReadDao.countOrderProductNum(getRefundBean.getSubplatorderno()); | 65 | |
53 | getRefundBean.setProductnum(productNum); | 66 | String orderSn = getRefundBean.getPlatorderno(); |
67 | //旧订单号处理 | ||
68 | if(!orderSn.startsWith("B")){ | ||
69 | orderSn = memberReadDao.getNewOrderSnByOldOrderSn(orderSn); | ||
70 | } | ||
71 | |||
72 | CommonResponse<ApiOrdersResponse> orderResponse = apiOrdersService.getOrdersByOrderSn(new ApiOrdersSnRequest(orderSn)); | ||
73 | if(orderResponse.isSuccess()){ | ||
74 | getRefundBean.setTotalamount(orderResponse.getResult().getMoneyOrder()); | ||
75 | getRefundBean.setPayamount(orderResponse.getResult().getMoneyOrder()); | ||
76 | getRefundBean.setOrderstatus(String.valueOf(orderResponse.getResult().getOrderState())); | ||
77 | }else { | ||
78 | throw new BizException(orderResponse.getErrorMsg()); | ||
79 | } | ||
80 | CommonResponse<Integer> response = thirdApiOrderService.countOrderProductNum(new ThirdOrdersProductIdRequest(getRefundBean.getOrdersproductuid(),orderSn)); | ||
81 | getRefundBean.setProductnum(response.getResult()); | ||
54 | OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus())); | 82 | OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus())); |
55 | if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){ | 83 | if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){ |
56 | throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus())); | 84 | throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus())); | ... | ... |
1 | package com.sibu.orderHelper.integral.service.pineapple.impl; | 1 | package com.sibu.orderHelper.integral.service.pineapple.impl; |
2 | 2 | ||
3 | import com.sibu.orderHelper.common.constants.AppConstants; | 3 | import com.alibaba.dubbo.config.annotation.Reference; |
4 | import com.sibu.orderHelper.common.database.DBContextHolder; | 4 | import com.doubo.common.model.response.CommonResponse; |
5 | import com.sibu.orderHelper.common.strategy.DbUtil; | 5 | import com.sibu.mall.order.request.third.ThirdQueryOrderRequest; |
6 | import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest; | ||
7 | import com.sibu.mall.order.response.api.ApiOrdersResponse; | ||
8 | import com.sibu.mall.order.service.ThirdApiOrderService; | ||
9 | import com.sibu.orderHelper.common.util.BeanCopyUtils; | ||
6 | import com.sibu.orderHelper.common.util.StringUtil; | 10 | import com.sibu.orderHelper.common.util.StringUtil; |
7 | import com.sibu.orderHelper.enums.PayOrderStatus; | ||
8 | import com.sibu.orderHelper.enums.PineappleEnum; | 11 | import com.sibu.orderHelper.enums.PineappleEnum; |
9 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; | 12 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; |
10 | import com.sibu.orderHelper.integral.dao.PineappleDao; | ||
11 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; | ||
12 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; | 13 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; |
13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 14 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
14 | import com.sibu.orderHelper.integral.pineapple.model.CourierCompany; | 15 | import com.sibu.orderHelper.integral.pineapple.model.CourierCompany; |
... | @@ -21,7 +22,6 @@ import com.sibu.orderHelper.mall.member.read.MemberReadDao; | ... | @@ -21,7 +22,6 @@ import com.sibu.orderHelper.mall.member.read.MemberReadDao; |
21 | import com.sibu.orderHelper.mall.member.write.MemberWriteDao; | 22 | import com.sibu.orderHelper.mall.member.write.MemberWriteDao; |
22 | import org.apache.log4j.Logger; | 23 | import org.apache.log4j.Logger; |
23 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
24 | |||
25 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
26 | import java.util.*; | 26 | import java.util.*; |
27 | 27 | ||
... | @@ -34,14 +34,32 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -34,14 +34,32 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
34 | @Resource | 34 | @Resource |
35 | private MemberWriteDao memberWriteDao; | 35 | private MemberWriteDao memberWriteDao; |
36 | 36 | ||
37 | @Reference | ||
38 | private ThirdApiOrderService thirdApiOrderService; | ||
39 | |||
37 | @Override | 40 | @Override |
38 | public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception { | 41 | public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception { |
39 | BaseResponse baseResponse =new BaseResponse(); | 42 | BaseResponse baseResponse =new BaseResponse(); |
40 | Map<String,Object> params = new HashMap<>(); | 43 | ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest(); |
41 | params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); | 44 | |
42 | params.put("sellerId",callRequest.getSupplier().getId()); | 45 | //旧订单号处理 |
46 | if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){ | ||
47 | callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo())); | ||
48 | } | ||
49 | |||
50 | thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo()); | ||
51 | thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId()); | ||
43 | 52 | ||
44 | Orders orders = memberWriteDao.getOrdersByMap(params); | 53 | ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest(); |
54 | thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo()); | ||
55 | thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId()); | ||
56 | Orders orders = null; | ||
57 | CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest); | ||
58 | if(commonResponse.isSuccess()){ | ||
59 | orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult()); | ||
60 | }else { | ||
61 | throw new BizException(commonResponse.getErrorMsg()); | ||
62 | } | ||
45 | if(StringUtil.isNull(orders)){ | 63 | if(StringUtil.isNull(orders)){ |
46 | log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 64 | log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
47 | throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 65 | throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
... | @@ -52,14 +70,14 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -52,14 +70,14 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
52 | 70 | ||
53 | if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){ | 71 | if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){ |
54 | //订单状态 | 72 | //订单状态 |
55 | params.put("orderState",EJavaShopOrderStateEnum.HasReceived.getCode()); | 73 | thirdUpdateOrderRequest.setOrderState(EJavaShopOrderStateEnum.HasReceived.getCode()); |
56 | //收货人名字 | 74 | //收货人名字 |
57 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){ | 75 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){ |
58 | params.put("name",callRequest.getBizModel().getSenderName()); | 76 | thirdUpdateOrderRequest.setName(callRequest.getBizModel().getSenderName()); |
59 | } | 77 | } |
60 | //电话 | 78 | //电话 |
61 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ | 79 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ |
62 | params.put("mobile",callRequest.getBizModel().getSenderTel()); | 80 | thirdUpdateOrderRequest.setMobile(callRequest.getBizModel().getSenderTel()); |
63 | } | 81 | } |
64 | //地址、快递信息 建议去除 | 82 | //地址、快递信息 建议去除 |
65 | //this.gainInfo(params,callRequest,orders); | 83 | //this.gainInfo(params,callRequest,orders); |
... | @@ -68,16 +86,18 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -68,16 +86,18 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
68 | 86 | ||
69 | if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ | 87 | if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ |
70 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 | 88 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 |
71 | Map<String,Object> checkMap = new HashMap<>(); | 89 | /* Map<String,Object> checkMap = new HashMap<>(); |
72 | checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo()); | 90 | checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo()); |
73 | checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); | 91 | checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); |
74 | checkMap.put("sellerId",callRequest.getSupplier().getId()); | 92 | checkMap.put("sellerId",callRequest.getSupplier().getId()); |
75 | int num = memberWriteDao.checkLogisticsNumber(checkMap); | 93 | int num = memberWriteDao.checkLogisticsNumber(checkMap);*/ |
76 | if(num == 0){ | 94 | thirdQueryOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo()); |
95 | CommonResponse<Boolean> response = thirdApiOrderService.checkLogisticsNumber(thirdQueryOrderRequest); | ||
96 | if(response.isSuccess() && !response.getResult()){ | ||
77 | if(StringUtil.isNull(orders.getLogisticsNumber())){ | 97 | if(StringUtil.isNull(orders.getLogisticsNumber())){ |
78 | params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo()); | 98 | thirdUpdateOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo()); |
79 | }else{ | 99 | }else{ |
80 | params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo()); | 100 | thirdUpdateOrderRequest.setLogisticsNumber(orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo()); |
81 | } | 101 | } |
82 | } | 102 | } |
83 | } | 103 | } |
... | @@ -87,7 +107,7 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -87,7 +107,7 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
87 | throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 107 | throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
88 | } | 108 | } |
89 | //修改订单信息 | 109 | //修改订单信息 |
90 | memberWriteDao.updateOrdersState(params); | 110 | thirdApiOrderService.updateOrders(thirdUpdateOrderRequest); |
91 | baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); | 111 | baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); |
92 | baseResponse.setCode(PineappleEnum.SUCCESS.getCode()); | 112 | baseResponse.setCode(PineappleEnum.SUCCESS.getCode()); |
93 | return baseResponse; | 113 | return baseResponse; | ... | ... |
1 | package com.sibu.orderHelper.integral.service.pineapple.impl; | 1 | package com.sibu.orderHelper.integral.service.pineapple.impl; |
2 | 2 | ||
3 | import com.sibu.orderHelper.common.constants.AppConstants; | 3 | import com.alibaba.dubbo.config.annotation.Reference; |
4 | import com.sibu.orderHelper.common.database.DBContextHolder; | 4 | import com.doubo.common.model.response.CommonResponse; |
5 | import com.sibu.orderHelper.common.strategy.DbUtil; | 5 | import com.sibu.mall.order.request.third.ThirdQueryOrderRequest; |
6 | import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest; | ||
7 | import com.sibu.mall.order.response.api.ApiOrdersResponse; | ||
8 | import com.sibu.mall.order.service.ThirdApiOrderService; | ||
9 | import com.sibu.orderHelper.common.util.BeanCopyUtils; | ||
6 | import com.sibu.orderHelper.common.util.StringUtil; | 10 | import com.sibu.orderHelper.common.util.StringUtil; |
7 | import com.sibu.orderHelper.enums.PineappleEnum; | 11 | import com.sibu.orderHelper.enums.PineappleEnum; |
8 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; | 12 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; |
9 | import com.sibu.orderHelper.integral.dao.PineappleDao; | ||
10 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; | ||
11 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
12 | import com.sibu.orderHelper.integral.pineapple.model.Orders; | 14 | import com.sibu.orderHelper.integral.pineapple.model.Orders; |
13 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; | 15 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; |
14 | import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse; | 16 | import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse; |
15 | import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest; | 17 | import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest; |
16 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; | 18 | import com.sibu.orderHelper.mall.member.read.MemberReadDao; |
17 | import com.sibu.orderHelper.mall.member.write.MemberWriteDao; | ||
18 | import org.apache.log4j.Logger; | 19 | import org.apache.log4j.Logger; |
19 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
20 | import org.springframework.transaction.annotation.Transactional; | ||
21 | |||
22 | import javax.annotation.Resource; | 21 | import javax.annotation.Resource; |
23 | import java.util.HashMap; | 22 | |
24 | import java.util.Map; | ||
25 | @Service | 23 | @Service |
26 | public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> { | 24 | public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> { |
27 | 25 | ||
28 | private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class); | 26 | private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class); |
29 | 27 | ||
30 | @Resource | 28 | @Resource |
31 | private MemberWriteDao memberWriteDao; | 29 | private MemberReadDao memberReadDao; |
30 | |||
31 | @Reference | ||
32 | private ThirdApiOrderService thirdApiOrderService; | ||
32 | 33 | ||
33 | @Override | 34 | @Override |
34 | public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception { | 35 | public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception { |
35 | UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse(); | 36 | UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse(); |
36 | Map<String,Object> params = new HashMap<>(); | 37 | |
37 | params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); | 38 | ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest(); |
38 | params.put("remark",callRequest.getBizModel().getSellerMemo()); | 39 | //旧订单号处理 |
39 | params.put("sellerId",callRequest.getSupplier().getId()); | 40 | if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){ |
40 | Orders orders = memberWriteDao.getOrdersByMap(params); | 41 | callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo())); |
42 | } | ||
43 | |||
44 | thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo()); | ||
45 | thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId()); | ||
46 | |||
47 | ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest(); | ||
48 | thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo()); | ||
49 | thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId()); | ||
50 | thirdUpdateOrderRequest.setRemark(callRequest.getBizModel().getSellerMemo()); | ||
51 | |||
52 | Orders orders = null; | ||
53 | CommonResponse<ApiOrdersResponse> response = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest); | ||
54 | if(response.isSuccess()){ | ||
55 | orders = BeanCopyUtils.copyProperties(Orders.class,response.getResult()); | ||
56 | }else { | ||
57 | throw new BizException(response.getErrorMsg()); | ||
58 | } | ||
41 | if(StringUtil.isNull(orders)){ | 59 | if(StringUtil.isNull(orders)){ |
42 | log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 60 | log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
43 | throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 61 | throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
44 | } | 62 | } |
45 | if(memberWriteDao.updateOdersRemark(params) != 1){ | 63 | CommonResponse<Boolean> updateResponse = thirdApiOrderService.updateOrders(thirdUpdateOrderRequest); |
64 | if(!updateResponse.isSuccess()){ | ||
46 | log.error(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 65 | log.error(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
47 | throw new BizException(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); | 66 | throw new BizException(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
48 | } | 67 | } | ... | ... |
... | @@ -25,12 +25,12 @@ | ... | @@ -25,12 +25,12 @@ |
25 | </modules> | 25 | </modules> |
26 | <properties> | 26 | <properties> |
27 | <!-- spring版本 --> | 27 | <!-- spring版本 --> |
28 | <spring.version>4.0.0.RELEASE</spring.version> | 28 | <spring.version>4.3.16.RELEASE</spring.version> |
29 | <!-- mybatis版本 --> | 29 | <!-- mybatis版本 --> |
30 | <mybatis.version>3.2.4</mybatis.version> | 30 | <mybatis.version>3.2.4</mybatis.version> |
31 | <!-- log4j日志文件管理包版 --> | 31 | <!-- log4j日志文件管理包版 --> |
32 | <slf4j.version>1.6.6</slf4j.version> | 32 | <slf4j.version>1.7.25</slf4j.version> |
33 | <log4j.version>1.2.13</log4j.version> | 33 | <log4j.version>1.2.17</log4j.version> |
34 | <!-- mysql驱动的版 --> | 34 | <!-- mysql驱动的版 --> |
35 | <mysql.version>5.1.35</mysql.version> | 35 | <mysql.version>5.1.35</mysql.version> |
36 | <!-- <mysql.version>3.1.14</mysql.version> --> | 36 | <!-- <mysql.version>3.1.14</mysql.version> --> |
... | @@ -47,6 +47,10 @@ | ... | @@ -47,6 +47,10 @@ |
47 | 47 | ||
48 | <doubo-parent.version>2.0.0</doubo-parent.version> | 48 | <doubo-parent.version>2.0.0</doubo-parent.version> |
49 | 49 | ||
50 | <dubbo.version>2.6.3</dubbo.version> | ||
51 | |||
52 | <curator.version>2.12.0</curator.version> | ||
53 | |||
50 | </properties> | 54 | </properties> |
51 | <dependencies> | 55 | <dependencies> |
52 | <dependency> | 56 | <dependency> |
... | @@ -406,6 +410,32 @@ | ... | @@ -406,6 +410,32 @@ |
406 | <artifactId>protobuf-java</artifactId> | 410 | <artifactId>protobuf-java</artifactId> |
407 | <version>2.6.1</version> | 411 | <version>2.6.1</version> |
408 | </dependency> | 412 | </dependency> |
413 | |||
414 | <!-- dubbo begin --> | ||
415 | <!-- https://mvnrepository.com/artifact/com.alibaba/dubbo --> | ||
416 | <dependency> | ||
417 | <groupId>com.alibaba</groupId> | ||
418 | <artifactId>dubbo</artifactId> | ||
419 | <version>${dubbo.version}</version> | ||
420 | <exclusions> | ||
421 | <exclusion> | ||
422 | <artifactId>slf4j-log4j12</artifactId> | ||
423 | <groupId>org.slf4j</groupId> | ||
424 | </exclusion> | ||
425 | </exclusions> | ||
426 | </dependency> | ||
427 | <dependency> | ||
428 | <groupId>org.apache.curator</groupId> | ||
429 | <artifactId>curator-framework</artifactId> | ||
430 | <version>${curator.version}</version> | ||
431 | </dependency> | ||
432 | <dependency> | ||
433 | <groupId>org.apache.curator</groupId> | ||
434 | <artifactId>curator-recipes</artifactId> | ||
435 | <version>${curator.version}</version> | ||
436 | </dependency> | ||
437 | <!-- dubbo begin --> | ||
438 | |||
409 | <!-- taobao sms start --> | 439 | <!-- taobao sms start --> |
410 | <dependency> | 440 | <dependency> |
411 | <groupId>com.taobao</groupId> | 441 | <groupId>com.taobao</groupId> |
... | @@ -426,12 +456,6 @@ | ... | @@ -426,12 +456,6 @@ |
426 | <version>${doubo-parent.version}</version> | 456 | <version>${doubo-parent.version}</version> |
427 | </dependency> | 457 | </dependency> |
428 | <!--阿里mq--> | 458 | <!--阿里mq--> |
429 | |||
430 | <dependency> | ||
431 | <groupId>cglib</groupId> | ||
432 | <artifactId>cglib</artifactId> | ||
433 | <version>3.1</version> | ||
434 | </dependency> | ||
435 | </dependencies> | 459 | </dependencies> |
436 | <dependencyManagement> | 460 | <dependencyManagement> |
437 | <dependencies> | 461 | <dependencies> | ... | ... |
-
请 注册 或 登录 后发表评论