dd28baea lauka

Merge branch 'dev-feature_分库分表v1.0'

Conflicts:
	com.sibu.orderHelper.service/pom.xml
2 个父辈 d97d4f2a 35215635
正在显示 57 个修改的文件 包含 3520 行增加960 行删除
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
13 <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> 13 <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
14 <sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" /> 14 <sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" />
15 <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> 15 <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
16 <excludeFolder url="file://$MODULE_DIR$/target" />
17 </content> 16 </content>
18 <orderEntry type="inheritedJdk" /> 17 <orderEntry type="inheritedJdk" />
19 <orderEntry type="sourceFolder" forTests="false" /> 18 <orderEntry type="sourceFolder" forTests="false" />
......
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://172.16.2.29:2181?backup=172.16.2.48:2181,172.16.2.31:2181
3 dubbo.applicationName = mall-third-api-consumer
4 dubbo.connectTimeOut = 20000
5 dubbo.connectRetries= 0
6 dubbo.consumer.group= sibu.mall.pro
7 dubbo.consumerVersion= pro-1.0.1
8 ##################### dubbo end #############################
...@@ -4,6 +4,19 @@ jdbc.driverClassName=com.mysql.jdbc.Driver ...@@ -4,6 +4,19 @@ jdbc.driverClassName=com.mysql.jdbc.Driver
4 #数据库url 4 #数据库url
5 jdbc.imtegralurl=jdbc:mysql://10.170.4.106/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8 5 jdbc.imtegralurl=jdbc:mysql://10.170.4.106/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8
6 6
7 mall.write.url=jdbc:mysql://172.16.0.79:3306/ejavashop?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;failOverReadOnly=false
8 mall.write.username=sibu_integralmall
9 mall.write.password=09NWaUZUNjjr0IRCYzm3
10 mall.read.url=jdbc:mysql://172.16.0.136:3306/ejavashop?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;failOverReadOnly=false
11 mall.read.username=sibu_read
12 mall.read.password=vOrTcmMxqNdqkD0c5a7wlQ==
13 mall.analysis.write.url=jdbc:mysql://172.16.0.17:3306/ejavashop_analysis
14 mall.analysis.write.username=sibu_integralmall
15 mall.analysis.write.password=09NWaUZUNjjr0IRCYzm3
16 mall.analysis.read.url=jdbc:mysql://172.16.0.4:3306/ejavashop_analysis
17 mall.analysis.read.username=sibu_read
18 mall.analysis.read.password=vOrTcmMxqNdqkD0c5a7wlQ==
19
7 #数据库用户名 20 #数据库用户名
8 jdbc.imtegralusername=sibu_integralmall 21 jdbc.imtegralusername=sibu_integralmall
9 22
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
7 7
8 <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> 8 <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
9 <!-- 基本属性 url、user、password --> 9 <!-- 基本属性 url、user、password -->
10 <property name="url" value="${jdbc.imtegralurl}"/> 10 <property name="url" value="${mall.read.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
11 <property name="username" value="${jdbc.imtegralusername}"/> 11 <property name="username" value="${mall.read.username}" />
12 <property name="password" value="${jdbc.imtegralpassword}"/> 12 <property name="password" value="${mall.read.password}" />
13 <property name="driverClassName" value="${jdbc.driverClassName}"/> 13 <property name="driverClassName" value="${jdbc.driverClassName}"/>
14 14
15 <!-- 配置初始化大小、最小、最大 --> 15 <!-- 配置初始化大小、最小、最大 -->
......
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,6 +7,19 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE ...@@ -7,6 +7,19 @@ 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://118.89.51.164:3306/ejavashop
11 mall.write.username=sibu_wesale
12 mall.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
13 mall.read.url=jdbc:mysql://111.231.243.221:3306/ejavashop
14 mall.read.username=sibu_wesale
15 mall.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
16 mall.analysis.write.url=jdbc:mysql://118.89.51.164:3306/analysis
17 mall.analysis.write.username=sibu_wesale
18 mall.analysis.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
19 mall.analysis.read.url=jdbc:mysql://111.231.243.221:3306/analysis
20 mall.analysis.read.username=sibu_wesale
21 mall.analysis.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
22
10 #数据库用户名 23 #数据库用户名
11 jdbc.username=root 24 jdbc.username=root
12 sqlserverjdbc.username=sa 25 sqlserverjdbc.username=sa
......
...@@ -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;
......
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 }
1 #redis连接 1 #redis连接
2 address1=120.76.137.184:6379 2 address1=10.116.35.133:6379
3 address2=120.76.137.184:6380 3 address2=10.116.35.133:6380
4 address3=120.24.234.38:6379 4 address3=10.170.13.1:6379
5 address4=120.24.234.38:6380 5 address4=10.170.13.1:6380
6 address5=120.24.65.223:6379 6 address5=10.44.79.57:6379
7 address6=120.24.65.223:6380 7 address6=10.44.79.57:6380
8 8
9 maxRedirections=6 9 maxRedirections=6
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.sibu.orderHelper.integral.dao; 1 package com.sibu.orderHelper.integral.dao;
2 import com.sibu.orderHelper.integral.model.*; 2 import com.sibu.orderHelper.integral.model.*;
3 import com.sibu.orderHelper.integral.pineapple.model.*;
4 import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
3 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; 5 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
4 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; 6 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
5 import com.sibu.orderHelper.integral.reponse.SkuApiResponse; 7 import com.sibu.orderHelper.integral.reponse.SkuApiResponse;
...@@ -11,147 +13,127 @@ import java.util.Map; ...@@ -11,147 +13,127 @@ import java.util.Map;
11 public interface PineappleDao { 13 public interface PineappleDao {
12 14
13 /** 15 /**
14 * 退货退款单下载 16 * 根据订单号查询订单信息 只查询不是主订单的订单
15 * @param params 17 * @param params
16 * @return 18 * @return
17 */ 19 */
18 List<GetRefundBean> pageGetRefundBean(Map<String,Object> params)throws Exception; 20 Orders getOrdersByMap(Map<String,Object> params);
19
20 PineappleOderDetailBean getOneIMOrderById(Map<String,Object> map)throws Exception;
21
22
23
24
25
26 //获取api中的商品详情
27 IMAPIProductBean getApiProductDetailById(@Param("productId") String productId) throws Exception;
28
29
30
31 //根据条件查询退款订单
32 int countCheckRefundStatusResponse(Map<String,Object> params)throws Exception;
33 21
34 /** 22 /**
35 * 根据条件判断该订单是否有成功过的退款记录 23 * 修改订单备注
36 * @param params 24 * @param params
37 * @return 25 * @return
38 * @throws Exception
39 */ 26 */
40 IMDoingOrderBean getIMDoingOrderBean(Map<String,Object> params)throws Exception; 27 int updateOdersRemark(Map<String,Object> params);
41
42 28
43 /** 29 /**
44 * 根据orderCode查询成功退款明细记录 30 * 查询该订单是否有该快递单号
45 * @param orderCode 31 * @param params
46 * @return 32 * @return
47 * @throws Exception
48 */ 33 */
49 List<CheckRefundStatusBean> childrenrefundStatusBySuccess(@Param("orderCode")String orderCode)throws Exception; 34 int checkLogisticsNumber(Map<String,Object> params);
50
51 35
52 /** 36 /**
53 * 根据条件判断该订单是否有退款中的退款记录 37 * 订单发货更新订单状态与信息
54 * @param orderCode 38 * @param params
55 * @return 39 * @return
56 * @throws Exception
57 */ 40 */
58 List<CheckRefundStatusBean> childrenrefundStatusByCourse(@Param("orderCode")String orderCode)throws Exception; 41 int updateOrdersState(Map<String,Object> params);
59 42
60 43
61 /** 44 /**
62 * 根据条件查询产品 45 * 商品下载
63 * @param params 46 * @param params
64 * @return 47 * @return
65 * @throws Exception
66 */ 48 */
67 IMProductBean getIMProductBeanByMap(Map<String,Object> params)throws Exception; 49 List<DownloadProductBean> downloadProductListByMap(Map<String,Object> params);
68 50
69 51
70 /** 52 /**
71 * 修改订单备注 53 * 根据条件查询商品
72 * @param params 54 * @param params
73 * @return 55 * @return
74 */ 56 */
75 int updateSelle(Map<String,Object> params)throws Exception; 57 DownloadProductBean getDownloadProductBeanByMap(Map<String,Object> params);
76 58
77 /** 59 /**
78 * 订单发货 60 * 根据商品ID获取该商品的所有SKU
79 * @param params 61 * @param productId
80 * @return 62 * @return
81 * @throws Exception
82 */ 63 */
83 int updateBusinessSend(Map<String,Object> params)throws Exception; 64 List<DownloadProductSkuBean> downloadSkuByProductId(@Param("productId") String productId);
84 65
85 /** 66 /**
86 * 订单发货时判断订单号是否存在,已存在就不添加该订单号 67 * 根据条件更新sku库存
87 * @param params 68 * @param params
88 * @return 69 * @return
89 * @throws Exception
90 */ 70 */
91 int getOrderByMap(Map<String,Object> params)throws Exception; 71 int updateSkuStock(Map<String,Object> params);
92 72
93 /** 73 /**
94 * 根据条件查SKU 74 * 根据商品ID更新商品库存
95 * @param params 75 * @param params
96 * @return 76 * @return
97 * @throws Exception
98 */ 77 */
99 SkuBean getSkuBeanByMap(Map<String,Object> params)throws Exception; 78 int updateProductStock(Map<String,Object> params);
100 79
101 /** 80 /**
102 * 根据产品ID查询所有SKU 81 * 订单下载
103 * @param productId 82 * @param params
104 * @return 83 * @return
105 * @throws Exception
106 */ 84 */
107 List<SkuApiResponse> getSkuBeanListByMap(String productId)throws Exception; 85 List<Orders> getOrdersList(Map<String,Object> params);
108 86
109 /** 87 /**
110 * 更新SKU库存 88 * 子订单查询
111 * @param skuBean 89 * @param orderSn
112 * @return 90 * @return
113 * @throws Exception
114 */ 91 */
115 int updateSku(SkuBean skuBean)throws Exception; 92 List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn);
116 93
117 //更新产品库存
118 int updateProductInventory(IMProductInventory productInventory) throws Exception;
119 94
120 /** 95 /**
121 * 更新产品库存 96 * 根据条件查询省市级信息
122 * @param params 97 * @param params
123 * @return 98 * @return
124 * @throws Exception
125 */ 99 */
126 int updateProduct(Map<String,Object> params)throws Exception; 100 Regions getRegionsByMap(Map<String,Object> params);
101
102 /**
103 * 根据id查询省市级信息
104 * @param id
105 * @return
106 */
107 Regions getRegionsById(@Param("id") Integer id);
127 108
128 109
129 /** 110 /**
130 * 商品下载 查询产品 111 * 根据条件查询物流公司
131 * @param params
132 * @return 112 * @return
133 * @throws Exception
134 */ 113 */
135 List<DownloadProductBean> getProductListByMap(Map<String,Object> params)throws Exception; 114 List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
136 115
137 /** 116 /**
138 * 根据产品ID查询SKU 117 * 根据订单号查询退货信息
139 * @param productid 118 * @param orderSn
140 * @return 119 * @return
141 * @throws Exception
142 */ 120 */
143 List<DownloadProductSkuBean> getDownloadProductSkuBeanList(String productid)throws Exception; 121 List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
144 122
145 /** 123 /**
146 * 根据产品ID查询SKU属性 124 * 根据订单号查询换货信息
147 * @param skuId 125 * @param orderSn
148 * @return 126 * @return
149 * @throws Exception
150 */ 127 */
151 List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception; 128 List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
129
152 130
131 /**
132 * 根据订单ID查询投诉表
133 * @param id
134 * @return
135 */
136 List<SellerComplaint> getSellerComplaintByOrderId(@Param("orderId") Integer id);
153 137
154 IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception;
155 138
156 IMProductBean getIMProductBeanById(@Param("productId") String productId)throws Exception;
157 } 139 }
......
1 package com.sibu.orderHelper.mall.member.read;
2
3 import com.sibu.orderHelper.integral.model.DownloadProductBean;
4 import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
5 import com.sibu.orderHelper.integral.model.GetRefundBean;
6 import com.sibu.orderHelper.integral.model.IMSupplierApp;
7 import com.sibu.orderHelper.integral.pineapple.model.*;
8 import com.sibu.orderHelper.integral.reponse.MemberAddressResponse;
9 import com.sibu.orderHelper.integral.request.GetRefundRequest;
10 import com.sibu.orderHelper.integral.request.MemberAddressAddRequest;
11 import org.apache.ibatis.annotations.Param;
12
13 import java.util.List;
14 import java.util.Map;
15
16 public interface MemberReadDao {
17 Integer count();
18
19
20 IMSupplierApp findByAppIdAndAppType(Map<String, String> params);
21 /**
22 * 根据订单号查询订单信息 只查询不是主订单的订单
23 * @param params
24 * @return
25 */
26 Orders getOrdersByMap(Map<String,Object> params);
27
28 /**
29 * 查询该订单是否有该快递单号
30 * @param params
31 * @return
32 */
33 int checkLogisticsNumber(Map<String,Object> params);
34
35 /**
36 * 商品下载
37 * @param params
38 * @return
39 */
40 List<DownloadProductBean> downloadProductListByMap(Map<String,Object> params);
41
42
43 /**
44 * 商品下载总数量
45 * @param params
46 * @return
47 */
48 int countDownloadProductListByMap(Map<String,Object> params);
49
50
51 /**
52 * 根据条件查询商品
53 * @param params
54 * @return
55 */
56 DownloadProductBean getDownloadProductBeanByMap(Map<String,Object> params);
57
58 /**
59 * 根据商品ID获取该商品的所有SKU
60 * @param productId
61 * @return
62 */
63 List<DownloadProductSkuBean> downloadSkuByProductId(@Param("productId") String productId);
64
65 /**
66 * 订单下载
67 * @param params
68 * @return
69 */
70 List<Orders> getOrdersList(Map<String,Object> params);
71
72
73 /**
74 * 订单下载总数
75 * @param params
76 * @return
77 */
78 int countgetOrdersList(Map<String,Object> params);
79
80 /**
81 * 子订单查询
82 * @param orderSn
83 * @return
84 */
85 List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn);
86
87
88 /**
89 * 根据条件查询省市级信息
90 * @param params
91 * @return
92 */
93 List<Regions> getRegionsByMap(Map<String,Object> params);
94
95 /**
96 * 根据id查询省市级信息
97 * @param id
98 * @return
99 */
100 Regions getRegionsById(@Param("id") Integer id);
101
102 /**
103 * 根据id查询省市级信息
104 * @param regionIdList
105 * @return
106 */
107 List<Regions> getRegionsByIds(@Param("list") List regionIdList);
108
109
110 /**
111 * 根据条件查询物流公司
112 * @return
113 */
114 List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
115
116 /**
117 * 根据订单号查询退货信息
118 * @param orderSn
119 * @return
120 */
121 List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
122
123 /**
124 * 根据订单号查询换货信息
125 * @param orderSn
126 * @return
127 */
128 List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
129
130
131 /**
132 * 根据订单ID查询投诉表
133 * @param id
134 * @return
135 */
136 List<SellerComplaint> getSellerComplaintById(@Param("orderId") Integer id);
137
138
139 List<Seller> getSeller(@Param("id") String id);
140
141
142 /**
143 * 退款单下载
144 * @param params
145 * @return
146 */
147 List<GetRefundBean> getGetRefundBean(Map<String,Object> params);
148
149
150 int countGetGetRefundBean(Map<String,Object> params);
151
152 /**
153 * 查询退款单的订单购买数量
154 * @param orderProductId
155 * @return
156 */
157 int countOrderProductNum(@Param("id") String orderProductId);
158
159 /**
160 * 根据旧订单号获取新订单号
161 * @param orderSn
162 * @return
163 */
164 String getNewOrderSnByOldOrderSn(@Param("orderSn") String orderSn);
165 }
1 package com.sibu.orderHelper.mall.member.write;
2
3 import com.sibu.orderHelper.integral.pineapple.model.Orders;
4
5 import java.util.Map;
6
7 public interface MemberWriteDao {
8 Integer count();
9
10 /**
11 * 根据订单号查询订单信息 只查询不是主订单的订单
12 * @param params
13 * @return
14 */
15 Orders getOrdersByMap(Map<String,Object> params);
16
17
18 /**
19 * 修改订单备注
20 * @param params
21 * @return
22 */
23 int updateOdersRemark(Map<String,Object> params);
24
25 /**
26 * 订单发货更新订单状态与信息
27 * @param params
28 * @return
29 */
30 int updateOrdersState(Map<String,Object> params);
31
32 /**
33 * 根据条件更新sku库存
34 * @param params
35 * @return
36 */
37 int updateSkuStock(Map<String,Object> params);
38
39 /**
40 * 根据商品ID更新商品库存
41 * @param params
42 * @return
43 */
44 int updateProductStock(Map<String,Object> params);
45
46 /**
47 * 查询该订单是否有该快递单号
48 * @param params
49 * @return
50 */
51 int checkLogisticsNumber(Map<String,Object> params);
52
53 }
...@@ -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>
......
...@@ -10,6 +10,8 @@ import com.sibu.orderHelper.common.util.SpringValuesUtil; ...@@ -10,6 +10,8 @@ import com.sibu.orderHelper.common.util.SpringValuesUtil;
10 import com.sibu.orderHelper.integral.service.IIMDoingOrderService; 10 import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
11 import com.sibu.orderHelper.integral.vo.PayType; 11 import com.sibu.orderHelper.integral.vo.PayType;
12 import com.sibu.orderHelper.integralMall.controller.BaseController; 12 import com.sibu.orderHelper.integralMall.controller.BaseController;
13 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
14 import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
13 import org.apache.commons.lang3.time.DateUtils; 15 import org.apache.commons.lang3.time.DateUtils;
14 import org.aspectj.lang.ProceedingJoinPoint; 16 import org.aspectj.lang.ProceedingJoinPoint;
15 import org.aspectj.lang.annotation.Around; 17 import org.aspectj.lang.annotation.Around;
...@@ -18,11 +20,9 @@ import org.aspectj.lang.annotation.Pointcut; ...@@ -18,11 +20,9 @@ import org.aspectj.lang.annotation.Pointcut;
18 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.http.MediaType; 21 import org.springframework.http.MediaType;
20 import org.springframework.stereotype.Controller; 22 import org.springframework.stereotype.Controller;
21 import org.springframework.web.bind.annotation.RequestMapping; 23 import org.springframework.web.bind.annotation.*;
22 import org.springframework.web.bind.annotation.RequestMethod;
23 import org.springframework.web.bind.annotation.ResponseBody;
24 import org.springframework.web.bind.annotation.RestController;
25 24
25 import javax.annotation.Resource;
26 import javax.validation.ValidationException; 26 import javax.validation.ValidationException;
27 import java.io.BufferedReader; 27 import java.io.BufferedReader;
28 import java.io.InputStreamReader; 28 import java.io.InputStreamReader;
...@@ -47,6 +47,21 @@ import java.util.Map; ...@@ -47,6 +47,21 @@ import java.util.Map;
47 public class IMOrderTestController extends BaseController { 47 public class IMOrderTestController extends BaseController {
48 @Autowired 48 @Autowired
49 private IIMDoingOrderService iimDoingOrderService; 49 private IIMDoingOrderService iimDoingOrderService;
50 @Resource
51 private MemberReadDao memberReadDao;
52 @Resource
53 private MemberWriteDao memberWriteDao;
54
55 /**
56 *
57 *
58 * @return
59 */
60 @RequestMapping(value = "/test/mall/read-write/datasource", method = RequestMethod.GET)
61 public BaseResponse testReadAndWriteDb() {
62 String r = String.format("%s-%s", memberReadDao.count(), memberWriteDao.count());
63 return ResponseRender.renderData(r);
64 }
50 65
51 /** 66 /**
52 * 验证测试环境 67 * 验证测试环境
......
...@@ -14,6 +14,7 @@ import com.sibu.orderHelper.integral.model.IMSupplier; ...@@ -14,6 +14,7 @@ import com.sibu.orderHelper.integral.model.IMSupplier;
14 import com.sibu.orderHelper.integral.model.IMSupplierApp; 14 import com.sibu.orderHelper.integral.model.IMSupplierApp;
15 import com.sibu.orderHelper.integral.pineapple.enums.SubErrorEnum; 15 import com.sibu.orderHelper.integral.pineapple.enums.SubErrorEnum;
16 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 16 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
17 import com.sibu.orderHelper.integral.pineapple.model.Seller;
17 import com.sibu.orderHelper.integral.pineapple.request.BaseRequest; 18 import com.sibu.orderHelper.integral.pineapple.request.BaseRequest;
18 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 19 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
19 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; 20 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
...@@ -27,6 +28,7 @@ import com.sibu.orderHelper.integral.service.pineapple.BizService; ...@@ -27,6 +28,7 @@ import com.sibu.orderHelper.integral.service.pineapple.BizService;
27 import com.sibu.orderHelper.integral.service.pineapple.util.JsonUtils; 28 import com.sibu.orderHelper.integral.service.pineapple.util.JsonUtils;
28 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; 29 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
29 import com.sibu.orderHelper.integral.service.pineapple.util.XmlUtils; 30 import com.sibu.orderHelper.integral.service.pineapple.util.XmlUtils;
31 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
30 import net.sf.json.JSONObject; 32 import net.sf.json.JSONObject;
31 import org.apache.commons.collections.CollectionUtils; 33 import org.apache.commons.collections.CollectionUtils;
32 import org.apache.commons.lang3.StringUtils; 34 import org.apache.commons.lang3.StringUtils;
...@@ -67,6 +69,8 @@ public class PineappleController { ...@@ -67,6 +69,8 @@ public class PineappleController {
67 private IMSupplierAppService imSupplierAppService; 69 private IMSupplierAppService imSupplierAppService;
68 @Autowired 70 @Autowired
69 private IMSupplierDao imSupplierDao; 71 private IMSupplierDao imSupplierDao;
72 @Resource
73 private MemberReadDao memberReadDao;
70 74
71 @RequestMapping( 75 @RequestMapping(
72 value = "/pineapple/call", 76 value = "/pineapple/call",
...@@ -169,14 +173,19 @@ public class PineappleController { ...@@ -169,14 +173,19 @@ public class PineappleController {
169 } 173 }
170 174
171 private IMSupplier findAndCheckIMSupplier(BaseRequest request, IMSupplierApp imSupplierApp) { 175 private IMSupplier findAndCheckIMSupplier(BaseRequest request, IMSupplierApp imSupplierApp) {
172 List<IMSupplier> imSuppliers = imSupplierDao.findByIdIn(Arrays.asList(imSupplierApp.getSupplierId())); 176 //List<IMSupplier> imSuppliers = imSupplierDao.findByIdIn(Arrays.asList(imSupplierApp.getSupplierId()));
173 if (CollectionUtils.isEmpty(imSuppliers)) { 177 List<Seller> seller = memberReadDao.getSeller(imSupplierApp.getSupplierId());
178 if (CollectionUtils.isEmpty(seller)) {
174 throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据为空,请联系客服", request.getAppkey())); 179 throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据为空,请联系客服", request.getAppkey()));
175 } 180 }
176 if (imSuppliers.size() > 1) { 181 if (seller.size() > 1) {
177 throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据有重复,请联系客服", request.getAppkey())); 182 throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据有重复,请联系客服", request.getAppkey()));
178 } 183 }
179 return imSuppliers.get(0); 184 Seller entity = seller.get(0);
185 IMSupplier iMSupplier = new IMSupplier();
186 iMSupplier.setId(String.valueOf(entity.getId()));
187 iMSupplier.setName(entity.getName());
188 return iMSupplier;
180 } 189 }
181 190
182 private IMSupplierApp findAndCheckSupplierApp(BaseRequest request) { 191 private IMSupplierApp findAndCheckSupplierApp(BaseRequest request) {
......
...@@ -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监听 只对当前配置文件有效 -->
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
35 35
36 <!--DEBUG信息输出--> 36 <!--DEBUG信息输出-->
37 <appender name="LOG.DEBUG" class="org.apache.log4j.DailyRollingFileAppender"> 37 <appender name="LOG.DEBUG" class="org.apache.log4j.DailyRollingFileAppender">
38 <param name="File" value="/var/tomcat_8081/pineapple/integral_logs/debug_" /> 38 <param name="File" value="/var/tomcat/mall/third-api/debug_" />
39 <param name="DatePattern" value="yyyy-MM-dd'.log'" /> 39 <param name="DatePattern" value="yyyy-MM-dd'.log'" />
40 <layout class="org.apache.log4j.PatternLayout"> 40 <layout class="org.apache.log4j.PatternLayout">
41 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" /> 41 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
48 48
49 <!--INFO信息输出--> 49 <!--INFO信息输出-->
50 <appender name="LOG.INFO" class="org.apache.log4j.DailyRollingFileAppender"> 50 <appender name="LOG.INFO" class="org.apache.log4j.DailyRollingFileAppender">
51 <param name="File" value="/var/tomcat_8081/pineapple/integral_logs/info_" /> 51 <param name="File" value="/var/tomcat/mall/third-api/info_" />
52 <param name="DatePattern" value="yyyy-MM-dd'.log'" /> 52 <param name="DatePattern" value="yyyy-MM-dd'.log'" />
53 <layout class="org.apache.log4j.PatternLayout"> 53 <layout class="org.apache.log4j.PatternLayout">
54 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" /> 54 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
61 61
62 <!--WARN信息输出--> 62 <!--WARN信息输出-->
63 <appender name="LOG.WARN" class="org.apache.log4j.DailyRollingFileAppender"> 63 <appender name="LOG.WARN" class="org.apache.log4j.DailyRollingFileAppender">
64 <param name="File" value="/var/tomcat_8081/pineapple/integral_logs/warn_" /> 64 <param name="File" value="/var/tomcat/mall/third-api/warn_" />
65 <param name="DatePattern" value="yyyy-MM-dd'.log'" /> 65 <param name="DatePattern" value="yyyy-MM-dd'.log'" />
66 <layout class="org.apache.log4j.PatternLayout"> 66 <layout class="org.apache.log4j.PatternLayout">
67 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" /> 67 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
74 74
75 <!--ERROR信息输出--> 75 <!--ERROR信息输出-->
76 <appender name="LOG.ERROR" class="org.apache.log4j.DailyRollingFileAppender"> 76 <appender name="LOG.ERROR" class="org.apache.log4j.DailyRollingFileAppender">
77 <param name="File" value="/var/tomcat_8081/pineapple/integral_logs/error_" /> 77 <param name="File" value="/var/tomcat/mall/third-api/error_" />
78 <param name="DatePattern" value="yyyy-MM-dd'.log'" /> 78 <param name="DatePattern" value="yyyy-MM-dd'.log'" />
79 <layout class="org.apache.log4j.PatternLayout"> 79 <layout class="org.apache.log4j.PatternLayout">
80 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" /> 80 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
87 87
88 <!--FATAL信息--> 88 <!--FATAL信息-->
89 <appender name="LOG.FATAL" class="org.apache.log4j.DailyRollingFileAppender"> 89 <appender name="LOG.FATAL" class="org.apache.log4j.DailyRollingFileAppender">
90 <param name="File" value="/var/tomcat_8081/pineapple/integral_logs/fatal_" /> 90 <param name="File" value="/var/tomcat/mall/third-api/fatal_" />
91 <param name="DatePattern" value="yyyy-MM-dd'.log'" /> 91 <param name="DatePattern" value="yyyy-MM-dd'.log'" />
92 <layout class="org.apache.log4j.PatternLayout"> 92 <layout class="org.apache.log4j.PatternLayout">
93 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" /> 93 <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.sibu.orderHelper.mall.member.read.MemberReadDao">
6
7 <select id="count" resultType="java.lang.Integer">
8 select count(*) from member
9 </select>
10
11 <!-- 订单实体 -->
12 <resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
13 <result property="id" column="id" />
14 <result property="sellerId" column="seller_id" />
15 <result property="sellerName" column="seller_name" />
16 <result property="orderId" column="order_id" />
17 <result property="orderSn" column="order_sn" />
18 <result property="orderProductId" column="order_product_id" />
19 <result property="productId" column="product_id" />
20 <result property="productName" column="product_name" />
21 <result property="memberId" column="member_id" />
22 <result property="memberName" column="member_name" />
23 <result property="provinceId" column="province_id" />
24 <result property="cityId" column="city_id" />
25 <result property="areaId" column="area_id" />
26 <result property="addressAll" column="address_all" />
27 <result property="addressInfo" column="address_info" />
28 <result property="zipCode" column="zip_code" />
29 <result property="changeName" column="change_name" />
30 <result property="phone" column="phone" />
31 <result property="logisticsId" column="logistics_id" />
32 <result property="logisticsName" column="logistics_name" />
33 <result property="logisticsMark" column="logistics_mark" />
34 <result property="logisticsNumber" column="logistics_number" />
35 <result property="number" column="number" />
36 <result property="question" column="question" />
37 <result property="image" column="image" />
38 <result property="name" column="name" />
39 <result property="state" column="state" />
40 <result property="optId" column="opt_id" />
41 <result property="optName" column="opt_name" />
42 <result property="remark" column="remark" />
43 <result property="createTime" column="create_time" />
44 <result property="updateTime" column="update_time" />
45 <result property="regionName1" column="regionName1" />
46 <result property="regionName2" column="regionName2" />
47 <result property="regionName3" column="regionName3" />
48 <result property="orderState" column="order_state" />
49 <result property="moneyOrder" column="money_order" />
50 <result property="moneyPaidBalance" column="money_paid_balance" />
51 <result property="moneyCoupon" column="money_coupon" />
52 <result property="moneyLogistics" column="money_logistics" />
53 <result property="moneyProduct" column="money_product" />
54 <result property="moneyActFull" column="money_act_full" />
55 <result property="moneyDiscount" column="money_discount" />
56 <result property="moneyBack" column="money_back" />
57 <result property="moneyIntegral" column="money_integral" />
58 <result property="payTime" column="pay_time" />
59 <result property="couponMoney" column="couponMoney" />
60 <result property="moneyDiscount" column="money_discount" />
61 </resultMap>
62
63 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
64 <select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
65 select * from orders where order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND is_parent = 0
66 </select>
67
68
69 <!-- 订单发货-->
70 <!-- 验证订单号是否已存在-->
71 <select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
72 select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
73 </select>
74
75
76 <!-- 商品下载实体-->
77 <resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
78 <result column="id" property="PlatProductID"/>
79 <result column="productName" property="name"/>
80 <result column="outerID" property="OuterID"/>
81 <result column="price" property="price"/>
82 <result column="num" property="num"/>
83 <result column="pictureurl" property="pictureurl"/>
84 </resultMap>
85
86 <!-- 商品下载 -->
87 <select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
88 SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
89 p.mal_mobile_price AS price
90 FROM product p WHERE p.seller_id = #{sellerId}
91 <if test="productId !=null and productId !=''">
92 AND (p.id = #{productId} or p.product_code = #{productId})
93 </if>
94 <if test="state !=null and state !='' and state != -1">
95 AND p.state = #{state}
96 </if>
97 <if test="state !=null and state !='' and state == -1">
98 AND p.state IN ('6','7')
99 </if>
100 <if test="productName !=null and productName !=''">
101 AND p.name1 = #{productName}
102 </if>
103 ORDER BY p.update_time DESC
104 limit ${PageIndex}, ${PageSize}
105 </select>
106
107 <!-- 根据条件查询商品 -->
108 <select id="getDownloadProductBeanByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
109 SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
110 p.mal_mobile_price AS price
111 FROM product p WHERE p.seller_id = #{sellerId}
112 <if test="productId !=null and productId !=''">
113 AND p.id = #{productId}
114 </if>
115 </select>
116
117 <!-- 商品下载总数量 -->
118 <select id="countDownloadProductListByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
119 SELECT count(*)
120 FROM product p WHERE p.seller_id = #{sellerId}
121 <if test="productId !=null and productId !=''">
122 AND (p.id = #{productId} or p.product_code = #{productId})
123 </if>
124 <if test="state !=null and state !='' and state != -1">
125 AND p.state = #{state}
126 </if>
127 <if test="state !=null and state !='' and state == -1">
128 AND p.state IN ('6','7')
129 </if>
130 <if test="productName !=null and productName !=''">
131 AND p.name1 = #{productName}
132 </if>
133 </select>
134
135 <!-- 商品sku实体 -->
136 <resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
137 <result column="skuId" property="SkuID"/>
138 <result column="skuId" property="skuOuterID"/>
139 <result column="skuprice" property="skuprice"/>
140 <result column="skuQuantity" property="skuQuantity"/>
141 <result column="skuname" property="skuname"/>
142 <result column="skupictureurl" property="skupictureurl"/>
143 </resultMap>
144
145 <!-- 获取商品sku -->
146 <select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
147 select g.sku AS skuId,g.mall_mobile_price AS skuprice,g.product_stock AS skuQuantity,
148 g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g
149 WHERE g.product_id = #{productId}
150 </select>
151
152
153 <!-- 主订单下载-->
154 <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
155 select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
156 c.regionName AS regionName2,a.regionName AS regionName3,
157 o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order+o.money_logistics AS couponMoney,o.money_discount,
158 o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
159 LEFT JOIN regions p ON p.id = o.province_id
160 LEFT JOIN regions c ON c.id = o.city_id
161 LEFT JOIN regions a ON a.id = o.area_id
162 WHERE o.is_parent = 0
163 AND o.seller_id = #{sellerId}
164 <if test="orderState!=null and orderState!=''">
165 AND o.order_state in
166 <foreach collection="orderState" item="state" open="(" close=")" separator=",">
167 #{state}
168 </foreach>
169 </if>
170 <if test="orderSn!=null and orderSn!=''">
171 AND o.order_sn = #{orderSn}
172 </if>
173 <if test="startTime!=null and startTime!=''">
174 AND o.create_time >= #{startTime}
175 </if>
176 <if test="endTime!=null and endTime!=''">
177 <![CDATA[
178 and o.create_time <= #{endTime}
179 ]]>
180 </if>
181 ORDER BY o.create_time DESC
182 limit ${PageIndex}, ${PageSize}
183 </select>
184
185 <!-- 订单下载总数-->
186 <select id="countgetOrdersList" parameterType="java.util.Map" resultType="java.lang.Integer">
187 select count(*) FROM orders o
188 WHERE o.is_parent = 0
189 AND o.seller_id = #{sellerId}
190 <if test="orderState!=null and orderState!=''">
191 AND o.order_state in
192 <foreach collection="orderState" item="state" open="(" close=")" separator=",">
193 #{state}
194 </foreach>
195 </if>
196 <if test="orderSn!=null and orderSn!=''">
197 AND o.order_sn = #{orderSn}
198 </if>
199 <if test="startTime!=null and startTime!=''">
200 AND o.create_time >= #{startTime}
201 </if>
202 <if test="endTime!=null and endTime!=''">
203 <![CDATA[
204 and o.create_time <= #{endTime}
205 ]]>
206 </if>
207 </select>
208
209 <!-- 子订单实体-->
210 <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
211 <result property="id" column="id" />
212 <result property="ordersId" column="orders_id" />
213 <result property="ordersSn" column="orders_sn" />
214 <result property="ordersPsn" column="orders_psn" />
215 <result property="sellerId" column="seller_id" />
216 <result property="sellerName" column="seller_name" />
217 <result property="productCateId" column="product_cate_id" />
218 <result property="productId" column="product_id" />
219 <result property="productGoodsId" column="product_goods_id" />
220 <result property="specInfo" column="spec_info" />
221 <result property="productName" column="product_name" />
222 <result property="productSku" column="product_sku" />
223 <result property="packageGroupsId" column="package_groups_id" />
224 <result property="mallGroupsId" column="mall_groups_id" />
225 <result property="giftId" column="gift_id" />
226 <result property="isGift" column="is_gift" />
227 <result property="moneyPrice" column="money_price" />
228 <result property="number" column="number" />
229 <result property="moneyAmount" column="money_amount" />
230 <result property="moneyFullAoumt" column="money_full_amount" />
231 <result property="deductionProductVbMoney" column="deduction_product_vb_money" />
232 <result property="moneyActSingle" column="money_act_single" />
233 <result property="actSingleId" column="act_single_id" />
234 <result property="actGroupId" column="act_group_id" />
235 <result property="actFlashSaleId" column="act_flash_sale_id" />
236 <result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
237 <result property="actBiddingId" column="act_bidding_id" />
238 <result property="actIntegralId" column="act_integral_id" />
239 <result property="actIntegralNum" column="act_integral_num" />
240 <result property="actIntegralMoney" column="act_integral_money" />
241 <result property="systemRemark" column="system_remark" />
242 <result property="backNumber" column="back_number" />
243 <result property="exchangeNumber" column="exchange_number" />
244 <result property="createTime" column="create_time" />
245 <result property="updateTime" column="update_time" />
246 <result property="isEvaluate" column="is_evaluate" />
247 <result property="moneyCouponAmount" column="money_coupon_amount" />
248 </resultMap>
249
250
251 <!-- 查询子订单-->
252 <select id="getOrdersProductList" parameterType="java.lang.String" resultMap="ordersProduct">
253 SELECT product_goods_id,id,product_name,spec_info,number,money_price,money_act_single,money_coupon_amount,money_full_amount FROM orders_product
254 WHERE orders_sn = #{orderSn}
255 </select>
256
257 <!-- 地址实体类-->
258 <resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions">
259 <result property="id" column="id" />
260 <result property="parentId" column="parentId" />
261 <result property="regionName" column="regionName" />
262 <result property="parentPath" column="parentPath" />
263 <result property="firstLetter" column="firstLetter" />
264 <result property="regionType" column="regionType" />
265 <result property="agencyId" column="agencyId" />
266 <result property="shippingId" column="shippingId" />
267 <result property="visible" column="visible" />
268 <result property="rowId" column="rowId" />
269 </resultMap>
270
271 <!-- 根据条件查询省市级信息-->
272 <select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult">
273 SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType}
274 </select>
275
276 <!-- 根据id查询省市级信息-->
277 <select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult">
278 select
279 *
280 from `regions`
281 where `id` = #{id}
282 </select>
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
295 <!-- 物流公司实体-->
296 <resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
297 <result property="id" column="id" />
298 <result property="createTime" column="create_time" />
299 <result property="state" column="state" />
300 <result property="companyMark" column="company_mark" />
301 <result property="companyName" column="company_name" />
302 <result property="seq" column="seq" />
303 <result property="sellerId" column="seller_id" />
304 <result property="companyType" column="company_type" />
305 <result property="imagePath" column="image_path" />
306 <result property="content" column="content" />
307 </resultMap>
308
309 <!-- 根据条件查询物流公司-->
310 <select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult">
311 select
312 *
313 from `courier_company`
314 where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
315 </select>
316
317
318 <!--退货表实体-->
319 <resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
320 <result property="id" column="id" />
321 <result property="sellerId" column="seller_id" />
322 <result property="sellerName" column="seller_name" />
323 <result property="orderId" column="order_id" />
324 <result property="orderSn" column="order_sn" />
325 <result property="orderProductId" column="order_product_id" />
326 <result property="productId" column="product_id" />
327 <result property="productName" column="product_name" />
328 <result property="memberId" column="member_id" />
329 <result property="memberName" column="member_name" />
330 <result property="provinceId" column="province_id" />
331 <result property="cityId" column="city_id" />
332 <result property="areaId" column="area_id" />
333 <result property="addressAll" column="address_all" />
334 <result property="addressInfo" column="address_info" />
335 <result property="zipCode" column="zip_code" />
336 <result property="contactPhone" column="contact_phone" />
337 <result property="contactName" column="contact_name" />
338 <result property="logisticsId" column="logistics_id" />
339 <result property="logisticsName" column="logistics_name" />
340 <result property="logisticsMark" column="logistics_mark" />
341 <result property="logisticsNumber" column="logistics_number" />
342 <result property="question" column="question" />
343 <result property="image" column="image" />
344 <result property="stateReturn" column="state_return" />
345 <result property="stateMoney" column="state_money" />
346 <result property="number" column="number" />
347 <result property="backMoney" column="back_money" />
348 <result property="backIntegral" column="back_integral" />
349 <result property="backIntegralMoney" column="back_integral_money" />
350 <result property="backCouponUserId" column="back_coupon_user_id" />
351 <result property="backMoneyTime" column="back_money_time" />
352 <result property="optId" column="opt_id" />
353 <result property="optName" column="opt_name" />
354 <result property="remark" column="remark" />
355 <result property="createTime" column="create_time" />
356 <result property="updateTime" column="update_time" />
357 </resultMap>
358
359 <!--根据订单号查询换货信息-->
360 <select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
361 SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') AND state_money = 1 ORDER BY create_time DESC
362 </select>
363
364 <!--换货实体类-->
365 <resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
366 <result property="id" column="id" />
367 <result property="sellerId" column="seller_id" />
368 <result property="sellerName" column="seller_name" />
369 <result property="orderId" column="order_id" />
370 <result property="orderSn" column="order_sn" />
371 <result property="orderProductId" column="order_product_id" />
372 <result property="productId" column="product_id" />
373 <result property="productName" column="product_name" />
374 <result property="memberId" column="member_id" />
375 <result property="memberName" column="member_name" />
376 <result property="provinceId" column="province_id" />
377 <result property="cityId" column="city_id" />
378 <result property="areaId" column="area_id" />
379 <result property="addressAll" column="address_all" />
380 <result property="addressInfo" column="address_info" />
381 <result property="zipCode" column="zip_code" />
382 <result property="changeName" column="change_name" />
383 <result property="phone" column="phone" />
384 <result property="logisticsId" column="logistics_id" />
385 <result property="logisticsName" column="logistics_name" />
386 <result property="logisticsMark" column="logistics_mark" />
387 <result property="logisticsNumber" column="logistics_number" />
388 <result property="provinceId2" column="province_id2" />
389 <result property="cityId2" column="city_id2" />
390 <result property="areaId2" column="area_id2" />
391 <result property="addressAll2" column="address_all2" />
392 <result property="addressInfo2" column="address_info2" />
393 <result property="zipCode2" column="zip_code2" />
394 <result property="changeName2" column="change_name2" />
395 <result property="phone2" column="phone2" />
396 <result property="logisticsId2" column="logistics_id2" />
397 <result property="logisticsName2" column="logistics_name2" />
398 <result property="logisticsMark2" column="logistics_mark2" />
399 <result property="logisticsNumber2" column="logistics_number2" />
400 <result property="number" column="number" />
401 <result property="question" column="question" />
402 <result property="image" column="image" />
403 <result property="name" column="name" />
404 <result property="state" column="state" />
405 <result property="optId" column="opt_id" />
406 <result property="optName" column="opt_name" />
407 <result property="remark" column="remark" />
408 <result property="createTime" column="create_time" />
409 <result property="updateTime" column="update_time" />
410 </resultMap>
411
412 <!--根据订单号查询换货信息-->
413 <select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
414 SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time DESC
415 </select>
416
417 <!-- 投诉表实体-->
418 <resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
419 <result property="id" column="id" />
420 <result property="userId" column="user_id" />
421 <result property="userName" column="user_name" />
422 <result property="orderId" column="order_id" />
423 <result property="orderProductId" column="order_product_id" />
424 <result property="productBackId" column="product_back_id" />
425 <result property="productExchangeId" column="product_exchange_id" />
426 <result property="content" column="content" />
427 <result property="image" column="image" />
428 <result property="complaintTime" column="complaint_time" />
429 <result property="sellerId" column="seller_id" />
430 <result property="sellerComplaintTime" column="seller_complaint_time" />
431 <result property="sellerCompContent" column="seller_comp_content" />
432 <result property="sellerCompImage" column="seller_comp_image" />
433 <result property="state" column="state" />
434 <result property="optId" column="opt_id" />
435 <result property="optContent" column="opt_content" />
436 <result property="userContent" column="user_content" />
437 <result property="createTime" column="create_time" />
438 <result property="optTime" column="opt_time" />
439 </resultMap>
440
441 <!-- 根据条件查询投诉表-->
442 <select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
443 SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
444 </select>
445
446
447 <select id="findByAppIdAndAppType" resultMap="BaseResultMap">
448 select * from im_supplier_app where app_id=#{appId} and app_type = #{appType} and app_token = #{appToken}
449 </select>
450 <resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplierApp">
451 <result column="id" property="id"/>
452 <result column="supplier_id" property="supplierId"/>
453 <result column="app_id" property="appId"/>
454 <result column="app_type" property="appType"/>
455 <result column="app_token" property="appToken"/>
456 <result column="app_secret" property="appSecret"/>
457 </resultMap>
458
459
460 <select id="findByIdIn" resultMap="BaseResultMap" parameterType="java.util.Map">
461 SELECT
462 *
463 FROM im_supplier
464 where id in
465 <foreach collection="supplierIds" item="supplierId" open="(" close=")" separator=",">
466 #{supplierId}
467 </foreach>
468 </select>
469
470
471 <select id="getSeller" parameterType="java.lang.String" resultType="com.sibu.orderHelper.integral.pineapple.model.Seller">
472 select * from seller
473 where `id` = #{id}
474 </select>
475
476
477 <resultMap id="GetRefundBeanMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
478 <result column="member_back_code" property="refundno"/>
479 <result column="order_sn" property="platorderno"/>
480 <result column="order_product_id" property="subplatorderno"/>
481 <result column="orders_product_uid" property="ordersproductuid"/>
482 <result column="back_money" property="refundamount"/>
483 <result column="create_time" property="createtime"/>
484 <result column="member_name" property="buyernick"/>
485 <result column="state_return" property="refundstatus"/>
486 <result column="state_money" property="stateMoney"/>
487 <result column="question" property="reason"/>
488 <result column="product_name" property="productname"/>
489 <result column="logistics_name" property="logisticname"/>
490 <result column="logistics_number" property="logisticno"/>
491 <result column="seller_name" property="sellernick"/>
492 <result column="money_order" property="totalamount"/>
493 <result column="order_state" property="orderstatus"/>
494 <result column="money_order" property="payamount"/>
495 </resultMap>
496
497
498 <select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap">
499 SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_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
501 FROM member_product_back b
502 WHERE b.seller_id = #{supplierId}
503 <if test="beginTime!=null">
504 AND b.create_time >= #{beginTime}
505 </if>
506 <if test="endTime!=null">
507 <![CDATA[
508 and b.create_time <= #{endTime}
509 ]]>
510 </if>
511 ORDER by member_back_code DESC
512 limit ${PageIndex}, ${PageSize}
513 </select>
514
515
516 <select id="countGetGetRefundBean" parameterType="java.util.Map" resultType="java.lang.Integer">
517 SELECT count(*)
518 FROM member_product_back b
519 WHERE b.seller_id = #{supplierId}
520 <if test="beginTime!=null">
521 AND b.create_time >= #{beginTime}
522 </if>
523 <if test="endTime!=null">
524 <![CDATA[
525 and b.create_time <= #{endTime}
526 ]]>
527 </if>
528 </select>
529
530 <select id="countOrderProductNum" resultType="java.lang.Integer">
531 SELECT number FROM orders_product where id = #{id}
532 </select>
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
538 </mapper>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.sibu.orderHelper.mall.member.write.MemberWriteDao">
6
7 <!-- 订单实体 -->
8 <resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
9 <result property="id" column="id" />
10 <result property="sellerId" column="seller_id" />
11 <result property="sellerName" column="seller_name" />
12 <result property="orderId" column="order_id" />
13 <result property="orderSn" column="order_sn" />
14 <result property="orderProductId" column="order_product_id" />
15 <result property="productId" column="product_id" />
16 <result property="productName" column="product_name" />
17 <result property="memberId" column="member_id" />
18 <result property="memberName" column="member_name" />
19 <result property="provinceId" column="province_id" />
20 <result property="cityId" column="city_id" />
21 <result property="areaId" column="area_id" />
22 <result property="addressAll" column="address_all" />
23 <result property="addressInfo" column="address_info" />
24 <result property="zipCode" column="zip_code" />
25 <result property="changeName" column="change_name" />
26 <result property="phone" column="phone" />
27 <result property="logisticsId" column="logistics_id" />
28 <result property="logisticsName" column="logistics_name" />
29 <result property="logisticsMark" column="logistics_mark" />
30 <result property="logisticsNumber" column="logistics_number" />
31 <result property="number" column="number" />
32 <result property="question" column="question" />
33 <result property="image" column="image" />
34 <result property="name" column="name" />
35 <result property="state" column="state" />
36 <result property="optId" column="opt_id" />
37 <result property="optName" column="opt_name" />
38 <result property="remark" column="remark" />
39 <result property="createTime" column="create_time" />
40 <result property="updateTime" column="update_time" />
41 <result property="regionName1" column="regionName1" />
42 <result property="regionName2" column="regionName2" />
43 <result property="regionName3" column="regionName3" />
44 <result property="orderState" column="order_state" />
45 <result property="moneyOrder" column="money_order" />
46 <result property="moneyPaidBalance" column="money_paid_balance" />
47 <result property="moneyCoupon" column="money_coupon" />
48 <result property="moneyLogistics" column="money_logistics" />
49 <result property="moneyProduct" column="money_product" />
50 <result property="moneyActFull" column="money_act_full" />
51 <result property="moneyDiscount" column="money_discount" />
52 <result property="moneyBack" column="money_back" />
53 <result property="moneyIntegral" column="money_integral" />
54 <result property="payTime" column="pay_time" />
55 </resultMap>
56
57 <select id="count" resultType="java.lang.Integer">
58 select count(*) from member
59 </select>
60
61 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
62 <select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
63 select * from orders where order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND is_parent = 0
64 </select>
65
66 <!-- 修改订单备注 -->
67 <update id="updateOdersRemark" parameterType="java.util.Map">
68 UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
69 </update>
70
71 <!-- 订单发货-->
72 <!-- 验证订单号是否已存在-->
73 <select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
74 select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
75 </select>
76
77
78 <!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
79 <update id="updateOrdersState">
80 UPDATE orders
81 <set>
82 <if test="name !=null and name !=''">
83 name = #{name},
84 </if>
85 <if test="addressInfo !=null and addressInfo !=''">
86 address_info = #{addressInfo},
87 </if>
88 <if test="logisticsNumber !=null and logisticsNumber !=''">
89 logistics_number = #{logisticsNumber},
90 </if>
91 <if test="mobile !=null and mobile !=''">
92 mobile = #{mobile},
93 </if>
94 <if test="addressAll !=null and addressAll !=''">
95 address_all = #{addressAll},
96 </if>
97 <if test="orderState !=null and orderState !=''">
98 order_state = #{orderState},
99 </if>
100 <if test="provinceId !=null and provinceId !=''">
101 province_id = #{provinceId},
102 </if>
103 <if test="areaId !=null and areaId !=''">
104 area_id = #{areaId},
105 </if>
106 <if test="cityId !=null and cityId !=''">
107 city_id = #{cityId},
108 </if>
109 <if test="deliverTime !=null and deliverTime !=''">
110 deliver_time = now(),
111 </if>
112 <if test="logisticsName !=null and logisticsName !=''">
113 logistics_name = #{logisticsName},
114 </if>
115 <if test="logisticsId !=null and logisticsId !=''">
116 logistics_id = #{logisticsId},
117 </if>
118 update_time = now()
119 </set>
120 WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
121 </update>
122
123
124
125 <!-- 更新SKU库存-->
126 <update id="updateSkuStock" parameterType="java.util.Map">
127 UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
128 </update>
129
130 <!-- 更新产品库存-->
131 <update id="updateProductStock" parameterType="java.util.Map">
132 UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
133 </update>
134
135 </mapper>
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,477 +3,451 @@ ...@@ -3,477 +3,451 @@
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.sibu.orderHelper.integral.dao.PineappleDao"> 5 <mapper namespace="com.sibu.orderHelper.integral.dao.PineappleDao">
6 6 <!-- 订单实体 -->
7 <!--检测退款订单--> 7 <resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
8 <select id="countCheckRefundStatusResponse" parameterType="java.util.Map" resultType="java.lang.Integer"> 8 <result property="id" column="id" />
9 SELECT COUNT(*) FROM im_order_refund WHERE order_code = #{orderCode} AND refund_status NOT IN ('100','101','-128') 9 <result property="sellerId" column="seller_id" />
10 </select> 10 <result property="sellerName" column="seller_name" />
11 11 <result property="orderId" column="order_id" />
12 <select id="getIMDoingOrderBean" parameterType="java.util.Map" resultMap="iMDoingOrderBean"> 12 <result property="orderSn" column="order_sn" />
13 select order_code,order_status from ${doingOrderTable} WHERE order_code = #{orderCode} and supplier_id =#{supplierId} 13 <result property="orderProductId" column="order_product_id" />
14 </select> 14 <result property="productId" column="product_id" />
15 15 <result property="productName" column="product_name" />
16 16 <result property="memberId" column="member_id" />
17 <resultMap id="iMDoingOrderBean" type="com.sibu.orderHelper.integral.model.IMDoingOrderBean"> 17 <result property="memberName" column="member_name" />
18 <result column="order_code" property="orderCode"/> 18 <result property="provinceId" column="province_id" />
19 <result column="order_status" property="orderStatus"/> 19 <result property="cityId" column="city_id" />
20 <result property="areaId" column="area_id" />
21 <result property="addressAll" column="address_all" />
22 <result property="addressInfo" column="address_info" />
23 <result property="zipCode" column="zip_code" />
24 <result property="changeName" column="change_name" />
25 <result property="phone" column="phone" />
26 <result property="logisticsId" column="logistics_id" />
27 <result property="logisticsName" column="logistics_name" />
28 <result property="logisticsMark" column="logistics_mark" />
29 <result property="logisticsNumber" column="logistics_number" />
30 <result property="number" column="number" />
31 <result property="question" column="question" />
32 <result property="image" column="image" />
33 <result property="name" column="name" />
34 <result property="state" column="state" />
35 <result property="optId" column="opt_id" />
36 <result property="optName" column="opt_name" />
37 <result property="remark" column="remark" />
38 <result property="createTime" column="create_time" />
39 <result property="updateTime" column="update_time" />
40 <result property="province" column="regionName1" />
41 <result property="city" column="regionName2" />
42 <result property="area" column="regionName3" />
20 </resultMap> 43 </resultMap>
21 44
22 <select id="childrenrefundStatusBySuccess" parameterType="java.lang.String" resultMap="checkRefundStatusBean"> 45 <!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
23 SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1 46 <select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
24 LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id 47 select * from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} AND is_parent = 0
25 WHERE r.refund_status = 7 AND r.order_code = #{orderCode}
26 </select> 48 </select>
27 49
28 <resultMap id="checkRefundStatusBean" type="com.sibu.orderHelper.integral.model.CheckRefundStatusBean"> 50 <!-- 修改订单备注 -->
29 <result column="refund_code" property="refundno"/> 51 <update id="updateOdersRemark">
30 <result column="name" property="ProductName"/> 52 UPDATE orders SET remark = #{remark} WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
31 <result column="refund_status" property="refundStatus"/> 53 </update>
32 </resultMap>
33 54
34 <select id="childrenrefundStatusByCourse" parameterType="java.lang.String" resultMap="checkRefundStatusBean"> 55 <!-- 订单发货-->
35 SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1 56 <!-- 验证订单号是否已存在-->
36 LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id 57 <select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
37 WHERE r.refund_status NOT IN ('7','100','101','-128') AND r.order_code = #{orderCode} 58 select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
38 </select> 59 </select>
39 60
40 61 <!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
41 62 <update id="updateOrdersState">
42 63 UPDATE orders SET
43 <!-- 退货退款单下载 --> 64 <set>
44 <resultMap id="getRefundBeanResultMap" type="com.sibu.orderHelper.integral.model.GetRefundBean"> 65 <if test="name !=null and name !=''">
45 <result column="refund_code" property="refundno"/> 66 name = #{name},
46 <result column="order_code" property="platorderno"/>
47 <result column="order1_id" property="subplatorderno"/>
48 <result column="refund_money" property="refundamount"/>
49 <result column="apply_date" property="createtime"/>
50 <result column="refund_status_last_update_dt" property="updatetime"/>
51 <result column="refund_reason" property="reason"/>
52 <result column="name" property="productname"/>
53 <result column="refund_goods_deliver_name" property="logisticname"/>
54 <result column="refund_goods_waybill" property="logisticno"/>
55 <result column="status" property="goodsstatus"/>
56 <result column="refund_remark" property="refundstatusdesc"/>
57 <result column="refund_status" property="refundstatus"/>
58 <result column="spec_detail" property="sku"/>
59 <result column="im_product_id" property="outerid"/>
60 </resultMap>
61
62
63 <select id="pageGetRefundBean" parameterType="java.util.Map" resultMap="getRefundBeanResultMap">
64 SELECT r.refund_code,r.order_code,r1.order1_id,r.refund_money,r.apply_date,r.refund_status_last_update_dt,r.refund_status,p.im_product_id,
65 r.refund_remark,'JH_98' status,p.details,r.refund_reason,r.refund_reason,r1.name,r.refund_goods_deliver_name,r.refund_goods_waybill,r1.spec_detail
66 FROM im_order_refund r
67 LEFT JOIN im_refund_order_item r1 ON r.refund_id = r1.refund_id
68 LEFT JOIN im_product p ON p.im_product_id = r1.product_id
69 WHERE 1 = 1 and r.order_from = 1 and r.refund_status NOT IN ('100','101','-128')
70 <if test="supplierId!=null and supplierId !=''">
71 AND r.supplier_id = #{supplierId}
72 </if> 67 </if>
73 <if test="beginTime != null and beginTime !=''"> 68 <if test="addressInfo !=null and addressInfo !=''">
74 and r.apply_date >= #{beginTime} 69 address_info = #{addressInfo},
75 </if> 70 </if>
76 <if test="endTime != null and endTime != ''"> 71 <if test="logisticsNumber !=null and logisticsNumber !=''">
77 <![CDATA[ 72 logistics_number = #{logisticsNumber},
78 and r.apply_date <= #{endTime}
79 ]]>
80 </if> 73 </if>
81 ORDER by r.apply_date DESC 74 <if test="mobile !=null and mobile !=''">
82 limit ${pageNow}, ${PageSize} 75 mobile = #{mobile},
83 </select> 76 </if>
84 77 <if test="addressAll !=null and addressAll !=''">
85 78 address_all = #{addressAll},
86 <!-- 获取订单详情(不包含产品) --> 79 </if>
87 <select id="getOneIMOrderById" parameterType="map" resultMap="pineappleOderDetailBean"> 80 <if test="orderState !=null and orderState !=''">
88 select ifnull(do.total_money,0) money,do.supplier_name,do.buyer_username,do.prerefund_original_order_status,do1.purchase_quantity 81 order_state = #{orderState},
89 from ${doingOrderTable1} do1 LEFT JOIN ${doingOrderTable} do on do1.order_id = do.order_id 82 </if>
90 where do1.order1_id=#{orderId1} 83 <if test="provinceId !=null and provinceId !=''">
91 </select> 84 province_id = #{provinceId},
92 <resultMap type="com.sibu.orderHelper.integral.model.PineappleOderDetailBean" id="pineappleOderDetailBean"> 85 </if>
93 <result column="money" property="totalMoney" /> 86 <if test="areaId !=null and areaId !=''">
94 <result column="supplier_name" property="supplierName" /> 87 area_id = #{areaId},
95 <result column="buyer_username" property="buyerUsername" /> 88 </if>
96 <result column="prerefund_original_order_status" property="orderStatus" /> 89 <if test="cityId !=null and cityId !=''">
97 <result column="purchase_quantity" property="num" /> 90 city_id = #{cityId},
98 </resultMap> 91 </if>
99 92 <if test="deliverTime !=null and deliverTime !=''">
100 93 deliver_time = now(),
101 94 </if>
102 95 <if test="logisticsName !=null and logisticsName !=''">
103 96 logistics_name = #{logisticsName},
104 <resultMap type="com.sibu.orderHelper.integral.model.IMProductBean" id="listAPIIMProduct"> 97 </if>
105 <result column="im_product_id" property="imProductId" /> 98 <if test="logisticsId !=null and logisticsId !=''">
106 <result column="name" property="name" /> 99 logistics_id = #{logisticsId},
107 <result column="short_name" property="shortName" /> 100 </if>
108 <result column="stock_num" property="stockNum" /> 101 </set>
109 <result column="details" property="details" /> 102 WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
110 <result column="exchange_integral" property="exchangeIntegral" /> 103 </update>
111 <result column="xws_exchange_integral" property="xwsExchangeIntegral" />
112 <result column="sibukg_exchange_integral" property="sibukgExchangeIntegral" />
113 <result column="onther1_exchange_integral" property="onther1ExchangeIntegral" />
114 <result column="onther2_exchange_integral" property="onther2ExchangeIntegral" />
115 <result column="onther3_exchange_integral" property="onther3ExchangeIntegral" />
116 <result column="thumb_img" property="thumbImg" />
117 <result column="bannel_img1" property="bannelImg1" />
118 <result column="bannel_img2" property="bannelImg2" />
119 <result column="bannel_img3" property="bannelImg3" />
120 <result column="bannel_img4" property="bannelImg4" />
121 <result column="bannel_img5" property="bannelImg5" />
122 <result column="limit_exchange_number" property="limitExchangeNumber"/>
123 <result column="is_new" property="isNew" />
124 <result column="is_hot" property="isHot" />
125 <result column="is_reco" property="isReco" />
126 <result column="cost" property="cost" />
127 <result column="attention" property="attention" />
128 <result column="total_comment_score" property="totalCommentScore" />
129 <result column="total_comment_number" property="totalCommentNumber" />
130 <result column="member_price" property="memberPrice" />
131 <result column="retail_price" property="retailPrice" />
132 <result column="market_price" property="marketPrice" />
133 <result column="product_type" property="productType" />
134 <result column="is_show" property="isShow"/>
135 <result column="bar_code" property="barCode"/>
136 <result column="is_open_spec" property="isOpenSpec"/>
137 <result column="spec" property="spec"/>
138 <result column="mini_purchase_number" property="miniPurchaseNumber"/>
139 <result column="format_str" property="formatStr"/>
140 <result column="erp_code" property="erpCode"/>
141 <result column="is_group" property="isGroup"/>
142 <result column="share_status" property="shareStatus"/>
143 <result column="share_percentage" property="sharePercentage"/>
144 <result column="im_category_id" property="imCategoryId"/>
145 <result column="delete_flag" property="deleteFlag"/>
146 </resultMap>
147
148
149
150 104
151 <!-- 产品下载 --> 105 <!-- 商品下载实体-->
152 <resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean"> 106 <resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
153 <result column="im_product_id" property="PlatProductID"/> 107 <result column="id" property="PlatProductID"/>
154 <result column="name" property="name"/> 108 <result column="productName" property="name"/>
155 <result column="OuterID" property="OuterID"/> 109 <result column="outerID" property="OuterID"/>
156 <result column="price" property="price"/> 110 <result column="price" property="price"/>
157 <result column="stock_num" property="num"/> 111 <result column="num" property="num"/>
158 <result column="bannel_img1" property="pictureurl"/> 112 <result column="pictureurl" property="pictureurl"/>
159 </resultMap> 113 </resultMap>
160 114
161 <select id="getProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean"> 115 <!-- 商品下载 -->
162 SELECT p.im_product_id,p.name,p.im_product_id AS OuterID,IFNULL(p.retail_price,0) price,p.stock_num,p.bannel_img1 116 <select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
163 FROM im_product p,im_product_supplier i 117 SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
164 WHERE p.im_product_id = i.product_id and i.supplier_id= #{supplierId} 118 p.mal_mobile_price AS price
165 <if test="isShow == 0"> 119 FROM product p WHERE p.seller_id = #{sellerId}
166 and p.is_show = 0 120 <if test="productId !=null and productId !=''">
121 AND (p.id = #{productId} or p.product_code = #{productId})
167 </if> 122 </if>
168 <if test="isShow == 1"> 123 <if test="state !=null and state !='' and state != -1">
169 and p.is_show = 1 124 AND p.state = #{state}
170 </if> 125 </if>
171 <if test="productId !=null and productId !=''"> 126 <if test="state !=null and state !='' and state == -1">
172 AND (p.im_product_id =#{productId} OR p.bar_code =#{productId}) 127 AND p.state IN ('6','7')
173 </if> 128 </if>
174 <if test="productName !=null and productName !=''"> 129 <if test="productName !=null and productName !=''">
175 AND p.name =#{productName} 130 AND p.name1 = #{productName}
176 </if> 131 </if>
177 ORDER BY p.im_product_id DESC 132 ORDER BY p.im_product_id DESC
178 limit ${PageIndex}, ${PageSize} 133 limit ${PageIndex}, ${PageSize}
179 </select> 134 </select>
180 135
181 <resultMap id="downloadProductSkuBeanList" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean"> 136 <!-- 根据条件查询商品 -->
182 <result column="sku_id" property="SkuID"/> 137 <select id="getDownloadProductBeanByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
183 <result column="sku_id" property="skuOuterID"/> 138 SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
184 <result column="retail_price" property="skuprice"/> 139 p.mal_mobile_price AS price
185 <result column="stock_num" property="skuQuantity"/> 140 FROM product p WHERE p.seller_id = #{sellerId}
186 </resultMap> 141 <if test="productId !=null and productId !=''">
187 <select id="getDownloadProductSkuBeanList" parameterType="java.lang.String" resultMap="downloadProductSkuBeanList"> 142 AND p.id = #{productId}
188 SELECT sku_id,stock_num,retail_price FROM sku WHERE im_product_id = #{productId} 143 </if>
189 </select> 144 </select>
190 145
191 <resultMap id="sku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean"> 146 <!-- 商品sku实体 -->
192 <result column="name" property="skuname"/> 147 <resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
148 <result column="skuId" property="SkuID"/>
149 <result column="skuId" property="skuOuterID"/>
150 <result column="skuprice" property="skuprice"/>
151 <result column="skuQuantity" property="skuQuantity"/>
152 <result column="skuname" property="skuname"/>
153 <result column="skupictureurl" property="skupictureurl"/>
193 </resultMap> 154 </resultMap>
194 155
195 <select id="getDownloadSkuBean" parameterType="java.lang.String" resultMap="sku"> 156 <!-- 获取商品sku -->
196 SELECT concat(concat(n.attr_name,':'),v.attr_value) name FROM attr_ref a 157 <select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
197 LEFT JOIN attr_value v ON a.attr_value_id = v.value_id 158 select g.sku AS skuId,g.mall_mobile_price AS skuprice,g.product_stock AS skuQuantity,
198 LEFT JOIN attr_name n on v.attr_id = n.attr_id WHERE a.sku_id = #{skuId} AND n.attr_name IS NOT NULL 159 g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g
160 WHERE g.product_id = #{productId}
199 </select> 161 </select>
200 162
163 <!-- 更新SKU库存-->
164 <update id="updateSkuStock" parameterType="java.util.Map">
165 UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
166 </update>
201 167
168 <!-- 更新产品库存-->
169 <update id="updateProductStock" parameterType="java.util.Map">
170 UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
171 </update>
202 172
203 <!-- 同步库存 -->
204 <resultMap id="rs_SkuBean" type="com.sibu.orderHelper.integral.model.SkuBean">
205 <result property="skuId" column="sku_id" />
206 <result property="imProductId" column="im_product_id"/>
207 <result property="erpCode" column="erp_code" />
208 <result property="stockNum" column="stock_num" />
209 <result property="exchangeIntegral" column="exchange_integral"/>
210 <result property="retailPrice" column="retail_price" />
211 <result property="marketPrice" column="market_price" />
212 <result property="createDate" column="create_date" />
213 <result property="updateDate" column="update_date" />
214 <result property="isShow" column="is_show" />
215 </resultMap>
216
217 <resultMap id="skuApiResponse" type="com.sibu.orderHelper.integral.reponse.SkuApiResponse">
218 <result property="skuId" column="sku_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
219 <result property="erpCode" column="erp_code" javaType="java.lang.String" jdbcType="VARCHAR"/>
220 <result property="stockNum" column="stock_num" javaType="java.lang.Integer" jdbcType="INTEGER"/>
221 <result property="exchangeIntegral" column="exchange_integral" javaType="java.lang.Integer" jdbcType="INTEGER"/>
222 <result property="memberPrice" column="member_price"/>
223 <result property="retailPrice" column="retail_price"/>
224 <result property="marketPrice" column="market_price"/>
225 <collection property="values" ofType="com.sibu.orderHelper.integral.reponse.SkuValueResponse" column="sku_Id">
226 <result property="attrValueId" column="attr_value_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
227 <result property="attrId" column="attr_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
228 <result property="attrName" column="attr_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
229 <result property="valueName" column="attr_value" javaType="java.lang.String" jdbcType="VARCHAR"/>
230 <result property="sortIndex" column="sort_index" javaType="java.lang.Integer" jdbcType="TINYINT"/>
231 </collection>
232 </resultMap>
233
234 <!--根据产品ID与SKUID 查询SKU -->
235 <select id="getSkuBeanByMap" parameterType="java.util.Map" resultMap="rs_SkuBean">
236 SELECT * FROM sku where
237 sku_id = #{skuId} AND im_product_id = #{productId} and is_show =1
238 </select>
239 173
240 <!-- 查询product sku返回 --> 174 <!-- 下载订单实体-->
241 <select id="getSkuBeanListByMap" parameterType="java.lang.String" resultMap="skuApiResponse"> 175 <!-- <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse">
242 SELECT s.sku_id,s.erp_code,s.stock_num,s.exchange_integral,s.retail_price,s.market_price,s.member_price, 176 <result property="platOrderNo" column="order_sn" />
243 s.is_show,ref.attr_value_id,n.attr_id,n.attr_name,v.attr_value ,n.sort_index FROM sku s 177 <result property="tradeStatus" column="order_state" />
244 LEFT JOIN attr_ref ref ON s.sku_id =ref.sku_id 178 <result property="tradeStatusDescription" column="remark" />
245 LEFT JOIN attr_value v ON v.value_id =ref.attr_value_id 179 <result property="tradeTime" column="create_time" />
246 LEFT JOIN attr_name n ON n.attr_id =v.attr_id 180 <result property="province" column="regionName1" />
247 WHERE s.im_product_id =#{productId} 181 <result property="city" column="regionName2" />
182 <result property="area" column="regionName3" />
183 <result property="address" column="address_info" />
184 <result property="mobile" column="mobile" />
185 <result property="zip" column="zip_code" />
186 <result property="postFee" column="money_logistics" />
187 <result property="totalMoney" column="money_order" />
188 <result property="favourableMoney" column="couponMoney" />
189 <result property="goodsFee" column="money_product" />
190 <result property="payTime" column="pay_time" />
191 <result property="nick" column="member_name" />
192 </resultMap>-->
193
194
195 <!-- 主订单下载-->
196 <select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
197 select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
198 c.regionName AS regionName2,a.regionName AS regionName3,
199 o.address_info,o.mobile,o.zip_code,o.zip_code,o.money_logistics,o.money_product-o.money_order-o.money_logistics AS couponMoney
200 o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
201 LEFT JOIN regions p ON p.id = o.province_id
202 LEFT JOIN regions c ON c.id = o.city_id
203 LEFT JOIN regions a ON a.id = o.area_id
204 WHERE o.is_parent = 0
205 AND seller_id = #{sellerId} AND order_sn = #{orderSn}
206 <if test="startTime !=null and startTime ! =''">
207 AND create_time >= #{startTime}
208 </if>
209 <if test="endTime !=null and endTime ! =''">
210 <![CDATA[
211 and create_time <= #{endTime}
212 ]]>
213 </if>
214 ORDER BY o.id DESC
215 limit ${PageIndex}, ${PageSize}
248 </select> 216 </select>
249 217
218 <!-- 子订单实体-->
219 <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
220 <result property="id" column="id" />
221 <result property="ordersId" column="orders_id" />
222 <result property="ordersSn" column="orders_sn" />
223 <result property="ordersPsn" column="orders_psn" />
224 <result property="sellerId" column="seller_id" />
225 <result property="sellerName" column="seller_name" />
226 <result property="productCateId" column="product_cate_id" />
227 <result property="productId" column="product_id" />
228 <result property="productGoodsId" column="product_goods_id" />
229 <result property="specInfo" column="spec_info" />
230 <result property="productName" column="product_name" />
231 <result property="productSku" column="product_sku" />
232 <result property="packageGroupsId" column="package_groups_id" />
233 <result property="mallGroupsId" column="mall_groups_id" />
234 <result property="giftId" column="gift_id" />
235 <result property="isGift" column="is_gift" />
236 <result property="moneyPrice" column="money_price" />
237 <result property="number" column="number" />
238 <result property="moneyAmount" column="money_amount" />
239 <result property="moneyActSingle" column="money_act_single" />
240 <result property="actSingleId" column="act_single_id" />
241 <result property="actGroupId" column="act_group_id" />
242 <result property="actFlashSaleId" column="act_flash_sale_id" />
243 <result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
244 <result property="actBiddingId" column="act_bidding_id" />
245 <result property="actIntegralId" column="act_integral_id" />
246 <result property="actIntegralNum" column="act_integral_num" />
247 <result property="actIntegralMoney" column="act_integral_money" />
248 <result property="systemRemark" column="system_remark" />
249 <result property="backNumber" column="back_number" />
250 <result property="exchangeNumber" column="exchange_number" />
251 <result property="createTime" column="create_time" />
252 <result property="updateTime" column="update_time" />
253 <result property="isEvaluate" column="is_evaluate" />
254 </resultMap>
250 255
256 <!-- 下载子订单实体-->
257 <!-- <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse">
258 <result property="productId" column="" />
259 <result property="subOrderNo" column="" />
260 <result property="tradeGoodsNo" column="" />
261 <result property="tradeGoodsName" column="" />
262 <result property="tradeGoodsSpec" column="" />
263 <result property="goodsCount" column="" />
264 <result property="price" column="" />
265 <result property="discountMoney" column="" />
266 <result property="status" column="" />
267 </resultMap>-->
268
269
270 <!-- 查询子订单-->
271 <select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct">
272 SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
273 WHERE orders_sn = #{ordersSn}
274 </select>
251 275
252 <!-- 更新SKU--> 276 <!-- 地址实体类-->
253 <update id="updateSku" parameterType="com.sibu.orderHelper.integral.model.SkuBean"> 277 <resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions">
254 update sku SET stock_num = #{stockNum} WHERE sku_id = #{skuId} 278 <result property="id" column="id" />
255 </update> 279 <result property="parentId" column="parentId" />
256 280 <result property="regionName" column="regionName" />
257 281 <result property="parentPath" column="parentPath" />
258 <!-- 根据条件查询产品 --> 282 <result property="firstLetter" column="firstLetter" />
259 <sql id="Base_Product_Column"> 283 <result property="regionType" column="regionType" />
260 imp.im_product_id, 284 <result property="agencyId" column="agencyId" />
261 imp.name, 285 <result property="shippingId" column="shippingId" />
262 imp.short_name, 286 <result property="visible" column="visible" />
263 imp.stock_num, 287 <result property="rowId" column="rowId" />
264 imp.exchange_integral, 288 </resultMap>
265 imp.xws_exchange_integral,
266 imp.sibukg_exchange_integral,
267 imp.onther1_exchange_integral,
268 imp.onther2_exchange_integral,
269 imp.onther3_exchange_integral,
270 imp.limit_exchange_number,
271 imp.thumb_img,
272 imp.is_new,
273 imp.is_hot,
274 imp.is_reco,
275 imp.cost,
276 imp.attention,
277 imp.is_show,
278 imp.product_type,
279 imp.member_price,
280 imp.retail_price,
281 imp.market_price,
282 imp.is_open_spec,
283 imp.spec,
284 imp.mini_purchase_number,
285 imp.format_str,
286 imp.share_status,
287 imp.share_percentage
288 </sql>
289
290 289
291 <select id="getIMProductBeanByMap" parameterType="java.util.Map" resultMap="listAPIIMProduct"> 290 <!-- 根据条件查询省市级信息-->
292 SELECT 291 <select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult">
293 <include refid="Base_Product_Column" /> 292 SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType}
294 FROM
295 im_product imp,im_product_supplier s
296 WHERE imp.im_product_id = s.product_id
297 AND imp.im_product_id = #{productId}
298 AND s.supplier_id = #{supplierId}
299 </select> 293 </select>
300 294
301 <select id="getIMProductBeanById" parameterType="java.lang.String" resultMap="listAPIIMProduct"> 295 <!-- 根据id查询省市级信息-->
302 SELECT 296 <select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult">
303 <include refid="Base_Product_Column" />,imp.bar_code 297 select
304 FROM 298 *
305 im_product imp 299 from `regions`
306 WHERE imp.im_product_id = #{productId} 300 where `id` = #{id}
307 </select> 301 </select>
308 302
303 <!-- 物流公司实体-->
304 <resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
305 <result property="id" column="id" />
306 <result property="createTime" column="create_time" />
307 <result property="state" column="state" />
308 <result property="companyMark" column="company_mark" />
309 <result property="companyName" column="company_name" />
310 <result property="seq" column="seq" />
311 <result property="sellerId" column="seller_id" />
312 <result property="companyType" column="company_type" />
313 <result property="imagePath" column="image_path" />
314 <result property="content" column="content" />
315 </resultMap>
309 316
310 <update id="updateProductInventory" parameterType="com.sibu.orderHelper.integral.model.IMProductInventory"> 317 <!-- 根据条件查询物流公司-->
311 update im_product_inventory set stock_num=#{stockNum} where im_product_id=#{imProductId} 318 <select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult">
312 </update> 319 select
313 320 *
314 <update id="updateProduct" parameterType="java.util.Map"> 321 from `courier_company`
315 update im_product set stock_num = #{stockNum} WHERE im_product_id = #{productId} 322 where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
316 </update>
317
318
319 <select id="getApiProductDetailById" resultMap="listAPIIMProduct" parameterType="String" useCache="true" statementType="PREPARED">
320 select imp.im_product_id,
321 imp.name,
322 imp.short_name,
323 imp.stock_num,
324 imp.details,
325 imp.exchange_integral,
326 imp.xws_exchange_integral,
327 imp.sibukg_exchange_integral,
328 imp.onther1_exchange_integral,
329 imp.onther2_exchange_integral,
330 imp.onther3_exchange_integral,
331 imp.limit_exchange_number,
332 imp.thumb_img,
333 imp.bannel_img1,
334 imp.bannel_img2,
335 imp.bannel_img3,
336 imp.bannel_img4,
337 imp.bannel_img5,
338 imp.is_new,
339 imp.is_hot,
340 imp.is_reco,
341 imp.is_show,
342 imp.product_type,
343 imp.member_price,
344 imp.retail_price,
345 imp.market_price,
346 imp.is_open_spec,
347 imp.spec,
348 imp.mini_purchase_number,
349 imp.format_str,
350 imp.erp_code,
351 imp.is_group,
352 imp.share_status,
353 imp.share_percentage,
354 ipi.attention,
355 ipi.total_comment_score,
356 ipi.total_comment_number,
357 ipi.cost,
358 imp.delete_flag
359 FROM im_product imp left join im_product_inventory ipi on imp.im_product_id = ipi.im_product_id
360 WHERE
361 imp.im_product_id = #{productId}
362 </select> 323 </select>
363 324
364 <!-- 订单发货-->
365 <select id="getOrderByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
366 SELECT COUNT(*) FROM ${doingOrderTable} WHERE express_code like concat(concat('%',#{expressCode},'%')) AND order_code = #{orderCode}
367 AND supplier_id = #{supplierId}
368 </select>
369 325
370 <resultMap type="com.sibu.orderHelper.integral.model.IMDoingOrderBean" id="iMDoingOrderBean2"> 326 <!--退货表实体-->
371 <id column="order_id" property="orderId"/> 327 <resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
372 <result column="member_id" property="memberId"/> 328 <result property="id" column="id" />
373 <result column="order_code" property="orderCode"/> 329 <result property="sellerId" column="seller_id" />
374 <result column="main_order_code" property="mainOrderCode"/> 330 <result property="sellerName" column="seller_name" />
375 <result column="order_status" property="orderStatus"/> 331 <result property="orderId" column="order_id" />
376 <result column="order_from" property="orderFrom"/> 332 <result property="orderSn" column="order_sn" />
377 <result column="order_platform" property="orderPlatform"/> 333 <result property="orderProductId" column="order_product_id" />
378 <result column="contact" property="contact"/> 334 <result property="productId" column="product_id" />
379 <result column="phone" property="phone"/> 335 <result property="productName" column="product_name" />
380 <result column="province" property="province"/> 336 <result property="memberId" column="member_id" />
381 <result column="city" property="city"/> 337 <result property="memberName" column="member_name" />
382 <result column="area" property="area"/> 338 <result property="provinceId" column="province_id" />
383 <result column="address" property="address"/> 339 <result property="cityId" column="city_id" />
384 <result column="zipcode" property="zipcode"/> 340 <result property="areaId" column="area_id" />
385 <result column="buyer_remark" property="buyerRemark"/> 341 <result property="addressAll" column="address_all" />
386 <result column="seller_remark" property="sellerRemark"/> 342 <result property="addressInfo" column="address_info" />
387 <result column="total_integral" property="totalIntegral"/> 343 <result property="zipCode" column="zip_code" />
388 <result column="total_money" property="totalMoney"/> 344 <result property="contactPhone" column="contact_phone" />
389 <result column="freight" property="freight"/> 345 <result property="contactName" column="contact_name" />
390 <result column="express_name" property="expressName"/> 346 <result property="logisticsId" column="logistics_id" />
391 <result column="express_code" property="expressCode"/> 347 <result property="logisticsName" column="logistics_name" />
392 <result column="express_code2" property="expressCode2"/> 348 <result property="logisticsMark" column="logistics_mark" />
393 <result column="create_dt" property="createDt"/> 349 <result property="logisticsNumber" column="logistics_number" />
394 <result column="pay_dt" property="payDt"/> 350 <result property="question" column="question" />
395 <result column="transaction_id" property="transactionId"/> 351 <result property="image" column="image" />
396 <result column="pay_type" property="payType"/> 352 <result property="stateReturn" column="state_return" />
397 <result column="open_id" property="openId"/> 353 <result property="stateMoney" column="state_money" />
398 <result column="buyer_username" property="buyerUsername"></result> 354 <result property="number" column="number" />
399 <result column="buyer_phone" property="buyerPhone"></result> 355 <result property="backMoney" column="back_money" />
400 <result column="erp_import" property="erpImport"></result> 356 <result property="backIntegral" column="back_integral" />
401 <result column="erp_import_dt" property="erpImportDt"></result> 357 <result property="backIntegralMoney" column="back_integral_money" />
402 <result column="ship_dt" property="shipDt"></result> 358 <result property="backCouponUserId" column="back_coupon_user_id" />
403 <result column="receive_dt" property="receiveDt"/> 359 <result property="backMoneyTime" column="back_money_time" />
404 <result column="user_coupon_money" property="userCouponMoney"/> 360 <result property="optId" column="opt_id" />
405 <result column="deduction_vb" property="deductionVb"/> 361 <result property="optName" column="opt_name" />
406 <result column="deduction_money" property="deductionMoney"/> 362 <result property="remark" column="remark" />
407 <result column="prerefund_original_order_status" property="prerefundOriginalOrderStatus"/> 363 <result property="createTime" column="create_time" />
408 <result column="share_member_id" property="shareMemberId"/> 364 <result property="updateTime" column="update_time" />
409 <result column="share_order_money" property="shareOrderMoney"/>
410 <result column="platform_type" property="platformType"/>
411 <result column="supplier_id" property="supplierId"/>
412 <result column="supplier_name" property="supplierName"/>
413 <result column="sign_pay_status" property="signPayStatus"/>
414 </resultMap> 365 </resultMap>
415 366
416 367 <!--根据订单号查询换货信息-->
417 368 <select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
418 <select id="getOrderListByMap" parameterType="java.util.Map" resultMap="iMDoingOrderBean2"> 369 SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') ORDER BY create_time
419 SELECT order_id,member_id,order_code,order_status,order_from,
420 contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id,
421 province,city,area,address,zipcode,buyer_remark,pay_type,transaction_id,user_coupon_id,user_coupon_money,
422 express_name,express_code,express_code2,order_platform,
423 erp_import,prerefund_original_order_status FROM ${doingOrderTable} WHERE order_code = #{orderCode}
424 AND supplier_id = #{supplierId}
425 </select> 370 </select>
426 371
427 <update id="updateBusinessSend" parameterType="java.util.Map"> 372 <!--换货实体类-->
428 UPDATE ${doingOrderTable} 373 <resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
429 <set> 374 <result property="id" column="id" />
430 <if test="buyerUsername !=null and buyerUsername !='' "> 375 <result property="sellerId" column="seller_id" />
431 buyer_username =#{buyerUsername}, 376 <result property="sellerName" column="seller_name" />
432 </if> 377 <result property="orderId" column="order_id" />
433 <if test="expressCode !=null and expressCode !='' "> 378 <result property="orderSn" column="order_sn" />
434 express_code = #{expressCode}, 379 <result property="orderProductId" column="order_product_id" />
435 </if> 380 <result property="productId" column="product_id" />
436 <if test="buyerPhone !=null and buyerPhone !=''"> 381 <result property="productName" column="product_name" />
437 buyer_phone = #{buyerPhone}, 382 <result property="memberId" column="member_id" />
438 </if> 383 <result property="memberName" column="member_name" />
439 <if test="address!=null and address!='' "> 384 <result property="provinceId" column="province_id" />
440 address =#{address}, 385 <result property="cityId" column="city_id" />
441 </if> 386 <result property="areaId" column="area_id" />
442 <if test="expressName !=null and expressName !='' "> 387 <result property="addressAll" column="address_all" />
443 express_name =#{expressName}, 388 <result property="addressInfo" column="address_info" />
444 </if> 389 <result property="zipCode" column="zip_code" />
445 <if test="province !=null and province !='' "> 390 <result property="changeName" column="change_name" />
446 province =#{province}, 391 <result property="phone" column="phone" />
447 </if> 392 <result property="logisticsId" column="logistics_id" />
448 <if test="city !=null and city !='' "> 393 <result property="logisticsName" column="logistics_name" />
449 city =#{city}, 394 <result property="logisticsMark" column="logistics_mark" />
450 </if> 395 <result property="logisticsNumber" column="logistics_number" />
451 <if test="area !=null and area !='' "> 396 <result property="provinceId2" column="province_id2" />
452 area =#{area}, 397 <result property="cityId2" column="city_id2" />
453 </if> 398 <result property="areaId2" column="area_id2" />
454 <if test="buyerUsername !=null and buyerUsername !='' "> 399 <result property="addressAll2" column="address_all2" />
455 buyer_username =#{buyerUsername}, 400 <result property="addressInfo2" column="address_info2" />
456 </if> 401 <result property="zipCode2" column="zip_code2" />
457 <if test="erpImportDt !=null and erpImportDt !='' "> 402 <result property="changeName2" column="change_name2" />
458 erp_import_dt =#{erpImportDt}, 403 <result property="phone2" column="phone2" />
459 </if> 404 <result property="logisticsId2" column="logistics_id2" />
460 <if test="shipDt !=null and shipDt !='' "> 405 <result property="logisticsName2" column="logistics_name2" />
461 ship_dt =#{shipDt}, 406 <result property="logisticsMark2" column="logistics_mark2" />
462 </if> 407 <result property="logisticsNumber2" column="logistics_number2" />
463 <if test="orderStatus !=null and orderStatus !='' "> 408 <result property="number" column="number" />
464 order_status =#{orderStatus}, 409 <result property="question" column="question" />
465 </if> 410 <result property="image" column="image" />
466 erp_import = 1 411 <result property="name" column="name" />
467 </set> 412 <result property="state" column="state" />
468 WHERE order_code = #{orderCode} 413 <result property="optId" column="opt_id" />
469 AND supplier_id = #{supplierId} 414 <result property="optName" column="opt_name" />
470 </update> 415 <result property="remark" column="remark" />
416 <result property="createTime" column="create_time" />
417 <result property="updateTime" column="update_time" />
418 </resultMap>
471 419
420 <!--根据订单号查询换货信息-->
421 <select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
422 SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time
423 </select>
472 424
425 <!-- 投诉表实体-->
426 <resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
427 <result property="id" column="id" />
428 <result property="userId" column="user_id" />
429 <result property="userName" column="user_name" />
430 <result property="orderId" column="order_id" />
431 <result property="orderProductId" column="order_product_id" />
432 <result property="productBackId" column="product_back_id" />
433 <result property="productExchangeId" column="product_exchange_id" />
434 <result property="content" column="content" />
435 <result property="image" column="image" />
436 <result property="complaintTime" column="complaint_time" />
437 <result property="sellerId" column="seller_id" />
438 <result property="sellerComplaintTime" column="seller_complaint_time" />
439 <result property="sellerCompContent" column="seller_comp_content" />
440 <result property="sellerCompImage" column="seller_comp_image" />
441 <result property="state" column="state" />
442 <result property="optId" column="opt_id" />
443 <result property="optContent" column="opt_content" />
444 <result property="userContent" column="user_content" />
445 <result property="createTime" column="create_time" />
446 <result property="optTime" column="opt_time" />
447 </resultMap>
473 448
474 <!-- 修改订单备注 --> 449 <!-- 根据条件查询投诉表-->
475 <update id="updateSelle" parameterType="java.util.Map"> 450 <select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
476 UPDATE ${doingOrderTable} SET seller_remark = #{sellerRemark} WHERE order_code = #{orderCode} 451 SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
477 AND supplier_id = #{supplierId} 452 </select>
478 </update>
479 </mapper> 453 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -37,6 +37,110 @@ ...@@ -37,6 +37,110 @@
37 <!-- 事务注解驱动,标注@Transactional的类和方法将具有事务性 --> 37 <!-- 事务注解驱动,标注@Transactional的类和方法将具有事务性 -->
38 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" mode="proxy"/> 38 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" mode="proxy"/>
39 39
40
41
42 <!-- begin 新系统mall -->
43 <bean id="mallReadDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
44 <!-- 基本属性 url、user、password -->
45 <property name="url" value="${mall.read.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
46 <property name="username" value="${mall.read.username}" />
47 <property name="password" value="${mall.read.password}" />
48
49 <!-- 配置初始化大小、最小、最大 -->
50 <property name="initialSize" value="1"/>
51 <property name="minIdle" value="1"/>
52 <property name="maxActive" value="200"/>
53
54 <!-- 配置获取连接等待超时的时间 -->
55 <property name="maxWait" value="60000"/>
56
57 <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
58 <property name="timeBetweenEvictionRunsMillis" value="60000"/>
59
60 <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
61 <property name="minEvictableIdleTimeMillis" value="300000"/>
62
63 <property name="validationQuery" value="SELECT 'x'"/>
64 <property name="testWhileIdle" value="true"/>
65 <property name="testOnBorrow" value="false"/>
66 <property name="testOnReturn" value="false"/>
67
68 <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
69 <property name="poolPreparedStatements" value="true"/>
70 <property name="maxPoolPreparedStatementPerConnectionSize" value="20"/>
71
72 <!-- 配置监控统计拦截的filters -->
73 <property name="filters" value="stat"/>
74 </bean>
75
76 <bean id="mallReadSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
77 <property name="mapperLocations" value="classpath:mall-mapper/**/read/**/*.xml" />
78 <!--<property name="typeAliasesPackage" value="com.ejavashop.entity" />-->
79 <property name="configLocation" value="classpath:mybatis-config.xml"></property>
80 <property name="dataSource" ref="mallReadDataSource"/>
81 </bean>
82 <bean name="mallReadMapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
83 <property name="basePackage" value="com.sibu.orderHelper.mall.*.read" />
84 <property name="sqlSessionFactoryBeanName" value="mallReadSqlSessionFactory" />
85 </bean>
86
87
88
89 <bean id="mallWriteDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
90 <!-- 基本属性 url、user、password -->
91 <property name="url" value="${mall.write.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
92 <property name="username" value="${mall.write.username}" />
93 <property name="password" value="${mall.write.password}" />
94
95 <!-- 配置初始化大小、最小、最大 -->
96 <property name="initialSize" value="1"/>
97 <property name="minIdle" value="1"/>
98 <property name="maxActive" value="200"/>
99
100 <!-- 配置获取连接等待超时的时间 -->
101 <property name="maxWait" value="60000"/>
102
103 <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
104 <property name="timeBetweenEvictionRunsMillis" value="60000"/>
105
106 <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
107 <property name="minEvictableIdleTimeMillis" value="300000"/>
108
109 <property name="validationQuery" value="SELECT 'x'"/>
110 <property name="testWhileIdle" value="true"/>
111 <property name="testOnBorrow" value="false"/>
112 <property name="testOnReturn" value="false"/>
113
114 <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
115 <property name="poolPreparedStatements" value="true"/>
116 <property name="maxPoolPreparedStatementPerConnectionSize" value="20"/>
117
118 <!-- 配置监控统计拦截的filters -->
119 <property name="filters" value="stat"/>
120 </bean>
121
122 <bean id="mallWriteSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
123 <property name="mapperLocations" value="classpath:mall-mapper/**/write/**/*.xml" />
124 <!--<property name="typeAliasesPackage" value="com.ejavashop.entity" />-->
125 <property name="configLocation" value="classpath:mybatis-config.xml"></property>
126 <property name="dataSource" ref="mallWriteDataSource" />
127 </bean>
128
129 <bean name="shopMapperScannerWrite" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
130 <property name="basePackage" value="com.sibu.orderHelper.mall.*.write" />
131 <property name="sqlSessionFactoryBeanName" value="mallWriteSqlSessionFactory" />
132 </bean>
133
134 <bean id="transactionManagerForMall" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
135 <property name="dataSource" ref="mallWriteDataSource"/>
136 </bean>
137
138 <tx:annotation-driven transaction-manager="transactionManagerForMall"/>
139
140 <!-- end 新系统mall -->
141
142
143
40 <!-- 配置事务的传播特性 --> 144 <!-- 配置事务的传播特性 -->
41 <!--<tx:advice id="txAdvice" transaction-manager="transactionManager">--> 145 <!--<tx:advice id="txAdvice" transaction-manager="transactionManager">-->
42 <!--<tx:attributes>--> 146 <!--<tx:attributes>-->
......
...@@ -16,12 +16,12 @@ public enum PineappleEnum { ...@@ -16,12 +16,12 @@ public enum PineappleEnum {
16 /** 16 /**
17 * 菠萝派对应商城【产品已上架】状态 17 * 菠萝派对应商城【产品已上架】状态
18 */ 18 */
19 public static final Integer MALL_PRODUCT_PUTAWAY__STATUS = 1; 19 public static final Integer MALL_PRODUCT_PUTAWAY__STATUS = 6;
20 20
21 /** 21 /**
22 * 菠萝派对应商城【产品已下架】状态 22 * 菠萝派对应商城【产品已下架】状态
23 */ 23 */
24 public static final Integer MALL_PRODUCT_SOLDIOUT__STATUS = 0; 24 public static final Integer MALL_PRODUCT_SOLDIOUT__STATUS = 7;
25 25
26 26
27 27
......
...@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums; ...@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums;
2 2
3 3
4 import com.alibaba.druid.util.StringUtils; 4 import com.alibaba.druid.util.StringUtils;
5 import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
5 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum; 6 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
7 import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
6 import org.apache.commons.lang3.EnumUtils; 8 import org.apache.commons.lang3.EnumUtils;
7 9
8 import java.util.ArrayList; 10 import java.util.ArrayList;
...@@ -15,14 +17,16 @@ import java.util.List; ...@@ -15,14 +17,16 @@ import java.util.List;
15 * @description 菠萝派商城退款验证退款状态举类 17 * @description 菠萝派商城退款验证退款状态举类
16 */ 18 */
17 public enum PineappleRefundEnum { 19 public enum PineappleRefundEnum {
18 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_AUDIT.getCode())), 20 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductBackEnum.Pending.getCode())),
19 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_REFUND_GOODS.getCode(),OrderRefundStatusEnum.AGREE_CHANGE_GOODS.getCode())), 21 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductBackEnum.AuditSucceess.getCode())),
20 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_RECEIVE_GOODS.getCode(),OrderRefundStatusEnum.WAIT_SELLER_AUDIT_RECEIVE_GOODS.getCode())), 22 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())),
21 JH_04("JH_04", "卖家拒绝退款",Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_AUDIT.getCode(),OrderRefundStatusEnum.DISAGREE_REFUNDING_MONEY.getCode(),OrderRefundStatusEnum.DISAGREE_CHANGE_GOODS.getCode(),OrderRefundStatusEnum.DENY_CHANGE_GOODS.getCode())), 23 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
22 JH_05("JH_05", "退款关闭",new ArrayList<>()), 24 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())),
23 JH_06("JH_06", "退款成功",Arrays.asList(OrderRefundStatusEnum.SELLER_REFUNDING_MONEY_SUCCESS.getCode())), 25 JH_06("JH_06", "退款成功",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode())),
24 JH_07("JH_07", "没有退款",new ArrayList<>()), 26 JH_07("JH_07", "没有退款",new ArrayList<>()),
25 JH_99("JH_99", "其他",new ArrayList<>()); 27 JH_99("JH_99", "其他",Arrays.asList());
28
29
26 30
27 private String code; // 错误代码 31 private String code; // 错误代码
28 private String msg; // 错误消息 32 private String msg; // 错误消息
......
1 package com.sibu.orderHelper.enums;
2
3
4 import com.alibaba.druid.util.StringUtils;
5 import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
6 import org.apache.commons.lang3.EnumUtils;
7
8 import java.util.ArrayList;
9 import java.util.Arrays;
10 import java.util.List;
11
12 /**
13 * @author lauka
14 * @date 2018/03/30
15 * @description 菠萝派商城退款验证退款状态举类
16 */
17 public enum PineappleRefundMoneyStateEnum {
18 NOT_REFUND("1", "未退款",PineappleRefundEnum.JH_99),
19 REFUND_ACCOUNT("2", "退款到账户", PineappleRefundEnum.JH_06),
20 REFUND_BANK("3", "退款到银行",PineappleRefundEnum.JH_06),
21 REFUND_ING("4", "退款中",PineappleRefundEnum.JH_99),
22 REFUND_ERROR ("5", "退款失败",PineappleRefundEnum.JH_99),
23 REFUND_UNKNOWN("-1", "未知",PineappleRefundEnum.JH_99),;
24
25
26 private String code; // 错误代码
27 private String msg; // 错误消息
28 private PineappleRefundEnum pineappleRefundEnum;
29
30 PineappleRefundMoneyStateEnum(String code, String msg, PineappleRefundEnum pineappleRefundEnum) {
31 this.code = code;
32 this.msg = msg;
33 this.pineappleRefundEnum = pineappleRefundEnum;
34 }
35
36 public String getCode() {
37 return code;
38 }
39
40 public void setCode(String code) {
41 this.code = code;
42 }
43
44 public String getMsg() {
45 return msg;
46 }
47
48 public void setMsg(String msg) {
49 this.msg = msg;
50 }
51
52 public PineappleRefundEnum getPineappleRefundEnum() {
53 return pineappleRefundEnum;
54 }
55
56 public void setPineappleRefundEnum(PineappleRefundEnum pineappleRefundEnum) {
57 this.pineappleRefundEnum = pineappleRefundEnum;
58 }
59
60 public static PineappleRefundMoneyStateEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
61 List<PineappleRefundMoneyStateEnum> enums = EnumUtils.getEnumList(PineappleRefundMoneyStateEnum.class);
62 PineappleRefundMoneyStateEnum result = enums.stream()
63 .filter(p -> p.code.equals(platformOrderStatus))
64 .findFirst()
65 .orElse(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN);
66 return result;
67 }
68 }
...@@ -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
...@@ -86,6 +88,9 @@ public class GetRefundBean implements Serializable{ ...@@ -86,6 +88,9 @@ public class GetRefundBean implements Serializable{
86 //商品外部商家编码 88 //商品外部商家编码
87 private String outerid; 89 private String outerid;
88 90
91 //退款状态
92 private Integer stateMoney;
93
89 public String getRefundno() { 94 public String getRefundno() {
90 return refundno; 95 return refundno;
91 } 96 }
...@@ -285,4 +290,20 @@ public class GetRefundBean implements Serializable{ ...@@ -285,4 +290,20 @@ public class GetRefundBean implements Serializable{
285 public void setOuterid(String outerid) { 290 public void setOuterid(String outerid) {
286 this.outerid = outerid; 291 this.outerid = outerid;
287 } 292 }
293
294 public Integer getStateMoney() {
295 return stateMoney;
296 }
297
298 public void setStateMoney(Integer stateMoney) {
299 this.stateMoney = stateMoney;
300 }
301
302 public String getOrdersproductuid() {
303 return ordersproductuid;
304 }
305
306 public void setOrdersproductuid(String ordersproductuid) {
307 this.ordersproductuid = ordersproductuid;
308 }
288 } 309 }
......
1 package com.sibu.orderHelper.integral.pineapple.constant; 1 package com.sibu.orderHelper.integral.pineapple.constant;
2 2
3 import com.sibu.orderHelper.enums.PayOrderStatus; 3 import com.sibu.orderHelper.enums.PayOrderStatus;
4 import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
4 5
5 import java.util.Arrays; 6 import java.util.Arrays;
6 import java.util.List; 7 import java.util.List;
...@@ -19,45 +20,44 @@ public class PineAppleConst { ...@@ -19,45 +20,44 @@ public class PineAppleConst {
19 /** 20 /**
20 * 菠萝派对应商城【等待买家付款】状态 21 * 菠萝派对应商城【等待买家付款】状态
21 */ 22 */
22 public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitPay.getCode()); 23 public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitPay.getCode());
23 /** 24 /**
24 * 菠萝派对应商城【等待卖家发货】状态 25 * 菠萝派对应商城【等待卖家发货】状态
25 */ 26 */
26 public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitShip.getCode()); 27 public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitConfirmed.getCode(),EJavaShopOrderStateEnum.WaitShip.getCode());
27 /** 28 /**
28 * 菠萝派对应商城【等待买家确认收货】状态 29 * 菠萝派对应商城【等待买家确认收货】状态
29 */ 30 */
30 public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasReceived.getCode()); 31 public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.HasReceived.getCode());
31 /** 32 /**
32 * 菠萝派对应商城【交易完成】状态 33 * 菠萝派对应商城【交易完成】状态
33 */ 34 */
34 public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasDelive.getCode(), PayOrderStatus.Finished.getCode()); 35 public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.Finished.getCode());
35 /** 36 /**
36 * 菠萝派对应商城【交易关闭】状态 37 * 菠萝派对应商城【交易关闭】状态
37 */ 38 */
38 public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(PayOrderStatus.RefundFail.getCode()); 39 public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.RefundFail.getCode());
39 /** 40 /**
40 * 菠萝派对应商城【所有订单】 41 * 菠萝派对应商城【所有订单】
41 */ 42 */
42 public static final List<Integer> MALL_ALL_ORDER = Arrays.asList( 43 public static final List<Integer> MALL_ALL_ORDER = Arrays.asList(
43 PayOrderStatus.WaitPay.getCode(), 44 EJavaShopOrderStateEnum.WaitPay.getCode(),
44 PayOrderStatus.WaitShip.getCode(), 45 EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
45 PayOrderStatus.HasReceived.getCode(), 46 EJavaShopOrderStateEnum.WaitShip.getCode(),
46 PayOrderStatus.HasDelive.getCode(), 47 EJavaShopOrderStateEnum.HasReceived.getCode(),
47 PayOrderStatus.Finished.getCode(), 48 EJavaShopOrderStateEnum.Finished.getCode(),
48 PayOrderStatus.RefundFail.getCode() 49 EJavaShopOrderStateEnum.RefundFail.getCode()
49
50 ); 50 );
51 51
52 /** 52 /**
53 * 菠萝派对应商城【未知】状态订单 53 * 菠萝派对应商城【未知】状态订单
54 */ 54 */
55 public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList( 55 public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList(
56 PayOrderStatus.WaitPay.getCode(), 56 EJavaShopOrderStateEnum.WaitPay.getCode(),
57 PayOrderStatus.WaitShip.getCode(), 57 EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
58 PayOrderStatus.HasReceived.getCode(), 58 EJavaShopOrderStateEnum.WaitShip.getCode(),
59 PayOrderStatus.HasDelive.getCode(), 59 EJavaShopOrderStateEnum.HasReceived.getCode(),
60 PayOrderStatus.Finished.getCode(), 60 EJavaShopOrderStateEnum.Finished.getCode(),
61 PayOrderStatus.RefundFail.getCode() 61 EJavaShopOrderStateEnum.RefundFail.getCode()
62 ); 62 );
63 } 63 }
......
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3 import com.alibaba.druid.util.StringUtils;
4 import com.sibu.orderHelper.enums.PayOrderStatus;
5 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
6 import org.apache.commons.lang3.EnumUtils;
7
8 import java.util.List;
9
10 /**
11 * @author LauKa
12 * @contact a062431@vip.qq.com
13 * @date 2018/05/15
14 * @description 新系统丁订单状态
15 */
16 public enum EJavaShopOrderStateEnum {
17 WaitPay(1, "待支付"), WaitConfirmed(2, "待确认"), WaitShip(3, "待发货"),
18 HasReceived(4, "已发货"), RefundFail(6, "交易关闭"),Finished(5, "交易完成");
19
20 private int code; // 错误代码
21 private String msg; // 错误消息
22
23 public int getCode() {
24 return code;
25 }
26
27 public String getMsg() {
28 return msg;
29 }
30
31 EJavaShopOrderStateEnum(int code, String msg) {
32 this.code = code;
33 this.msg = msg;
34 }
35
36 public static EJavaShopOrderStateEnum valueOf(int code) { // 手写的从int到enum的转换函数
37 List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class);
38 EJavaShopOrderStateEnum result = enums.stream()
39 .filter(p -> p.getCode() == code)
40 .findFirst()
41 .orElse(EJavaShopOrderStateEnum.RefundFail);
42 return result;
43 }
44
45
46 public static EJavaShopOrderStateEnum resolve(String code) {
47 List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class);
48 EJavaShopOrderStateEnum result = enums.stream()
49 .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
50 .findFirst()
51 .orElse(EJavaShopOrderStateEnum.RefundFail);
52 return result;
53 }
54
55
56 }
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3 import com.alibaba.druid.util.StringUtils;
4 import org.apache.commons.lang3.EnumUtils;
5
6 import java.util.List;
7
8 /**
9 * @author LauKa
10 * @contact a062431@vip.qq.com
11 * @date 2018/05/15
12 * @description 新系统退款表状态 1、未处理;2、审核通过;3、用户发货,4、店铺收货;5、不予处理'
13 */
14 public enum MemberProductBackEnum {
15 Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发货"),
16 ShopDelivery(4, "店铺收货"), Inattentive(5, "不予处理");
17
18 private int code; // 错误代码
19 private String msg; // 错误消息
20
21 public int getCode() {
22 return code;
23 }
24
25 public String getMsg() {
26 return msg;
27 }
28
29 MemberProductBackEnum(int code, String msg) {
30 this.code = code;
31 this.msg = msg;
32 }
33
34 public static MemberProductBackEnum valueOf(int code) { // 手写的从int到enum的转换函数
35 List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
36 MemberProductBackEnum result = enums.stream()
37 .filter(p -> p.getCode() == code)
38 .findFirst()
39 .orElse(null);
40 return result;
41 }
42
43
44 public static MemberProductBackEnum resolve(String code) {
45 List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
46 MemberProductBackEnum result = enums.stream()
47 .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
48 .findFirst()
49 .orElse(null);
50 return result;
51 }
52
53
54 }
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3 import com.alibaba.druid.util.StringUtils;
4 import org.apache.commons.lang3.EnumUtils;
5
6 import java.util.List;
7
8 /**
9 * @author LauKa
10 * @contact a062431@vip.qq.com
11 * @date 2018/05/15
12 * @description 新系统换货表状态 换货状态:1、未处理;2、审核通过;3、用户发回退件;4、商家收到退件;5、商家发出换件;6、原件退还;7、不处理
13 */
14 public enum MemberProductExchangeEnum {
15 Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发回退件"),
16 ShopDelivery(4, "商家收到退件"),ShopExchange(5,"商家发出换件"),ReturnOld(6,"原件退还"), Inattentive(7, "不予处理");
17
18 private int code; // 错误代码
19 private String msg; // 错误消息
20
21 public int getCode() {
22 return code;
23 }
24
25 public String getMsg() {
26 return msg;
27 }
28
29 MemberProductExchangeEnum(int code, String msg) {
30 this.code = code;
31 this.msg = msg;
32 }
33
34 public static MemberProductExchangeEnum valueOf(int code) { // 手写的从int到enum的转换函数
35 List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
36 MemberProductExchangeEnum result = enums.stream()
37 .filter(p -> p.getCode() == code)
38 .findFirst()
39 .orElse(null);
40 return result;
41 }
42
43
44 public static MemberProductExchangeEnum resolve(String code) {
45 List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
46 MemberProductExchangeEnum result = enums.stream()
47 .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
48 .findFirst()
49 .orElse(null);
50 return result;
51 }
52
53
54 }
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3
4 import com.alibaba.druid.util.StringUtils;
5 import org.apache.commons.lang3.EnumUtils;
6
7 import java.util.ArrayList;
8 import java.util.Arrays;
9 import java.util.List;
10
11 /**
12 * @author lauka
13 * @date 2018/03/30
14 * @description 菠萝派商城退款验证换货状态举类
15 */
16 public enum PineappleExchangeEnum {
17 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductExchangeEnum.Pending.getCode())),
18 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductExchangeEnum.AuditSucceess.getCode())),
19 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductExchangeEnum.MemberDeliver.getCode())),
20 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
21 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductExchangeEnum.Inattentive.getCode())),
22 JH_06("JH_06", "退款成功",Arrays.asList()),
23 JH_07("JH_07", "没有退款",Arrays.asList(MemberProductExchangeEnum.ReturnOld.getCode(),MemberProductExchangeEnum.ShopExchange.getCode())),
24 JH_99("JH_99", "其他",new ArrayList<>(MemberProductExchangeEnum.ShopDelivery.getCode()));
25
26
27
28 private String code; // 错误代码
29 private String msg; // 错误消息
30 List<Integer> mallOrderStatus;
31
32
33 PineappleExchangeEnum(String code, String msg, List<Integer> mallOrderStatus) {
34 this.code = code;
35 this.msg = msg;
36 this.mallOrderStatus = mallOrderStatus;
37 }
38
39 public String getCode() {
40 return code;
41 }
42
43 public void setCode(String code) {
44 this.code = code;
45 }
46
47 public String getMsg() {
48 return msg;
49 }
50
51 public void setMsg(String msg) {
52 this.msg = msg;
53 }
54
55 public static PineappleExchangeEnum resolve(String code) {
56 List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
57 PineappleExchangeEnum result = enums.stream()
58 .filter(p -> StringUtils.equalsIgnoreCase(p.code, code))
59 .findFirst()
60 .orElse(PineappleExchangeEnum.JH_99);
61 return result;
62 }
63
64 public static PineappleExchangeEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
65 List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
66 PineappleExchangeEnum result = enums.stream()
67 .filter(p -> p.mallOrderStatus != null && p.mallOrderStatus.contains(platformOrderStatus))
68 .findFirst()
69 .orElse(PineappleExchangeEnum.JH_99);
70 return result;
71 }
72
73
74
75 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class CourierCompany implements Serializable{
11
12
13 private Integer id;
14 private java.util.Date createTime;
15 private Integer state;
16 private String companyMark;
17 private String companyName;
18 private Integer seq;
19 private String companyType;
20 private Integer sellerId;
21 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class MemberProductBack implements Serializable{
11
12 private java.lang.Integer id;
13 private java.lang.Integer sellerId;
14 private java.lang.String sellerName;
15 private java.lang.Integer orderId;
16 private java.lang.String orderSn;
17 private java.lang.Integer orderProductId;
18 private java.lang.Integer productId;
19 private java.lang.String productName;
20 private java.lang.Integer memberId;
21 private java.lang.String memberName;
22 private java.lang.Integer provinceId;
23 private java.lang.Integer cityId;
24 private java.lang.Integer areaId;
25 private java.lang.String addressAll;
26 private java.lang.String addressInfo;
27 private java.lang.String zipCode;
28 private java.lang.String contactPhone;
29 private java.lang.String contactName;
30 private java.lang.Integer logisticsId;
31 private java.lang.String logisticsName;
32 private java.lang.String logisticsMark;
33 private java.lang.String logisticsNumber;
34 private java.lang.String question;
35 private java.lang.String image;
36 private java.lang.Integer stateReturn;
37 private java.lang.Integer stateMoney;
38 private java.lang.Integer number;
39 private java.math.BigDecimal backMoney;
40 private java.lang.Integer backIntegral;
41 private java.math.BigDecimal backIntegralMoney;
42 private java.lang.Integer backCouponUserId;
43 private java.util.Date backMoneyTime;
44 private java.lang.Integer optId;
45 private java.lang.String optName;
46 private java.lang.String remark;
47 private java.util.Date createTime;
48 private java.util.Date updateTime;
49 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class MemberProductExchange implements Serializable {
11
12 private java.lang.Integer id;
13 private java.lang.Integer sellerId;
14 private java.lang.String sellerName;
15 private java.lang.Integer orderId;
16 private java.lang.String orderSn;
17 private java.lang.Integer orderProductId;
18 private java.lang.Integer productId;
19 private java.lang.String productName;
20 private java.lang.Integer memberId;
21 private java.lang.String memberName;
22 private java.lang.Integer provinceId;
23 private java.lang.Integer cityId;
24 private java.lang.Integer areaId;
25 private java.lang.String addressAll;
26 private java.lang.String addressInfo;
27 private java.lang.String zipCode;
28 private java.lang.String changeName;
29 private java.lang.String phone;
30 private java.lang.Integer logisticsId;
31 private java.lang.String logisticsName;
32 private java.lang.String logisticsMark;
33 private java.lang.String logisticsNumber;
34 private java.lang.Integer provinceId2;
35 private java.lang.Integer cityId2;
36 private java.lang.Integer areaId2;
37 private java.lang.String addressAll2;
38 private java.lang.String addressInfo2;
39 private java.lang.String zipCode2;
40 private java.lang.String changeName2;
41 private java.lang.String phone2;
42 private java.lang.Integer logisticsId2;
43 private java.lang.String logisticsName2;
44 private java.lang.String logisticsMark2;
45 private java.lang.String logisticsNumber2;
46 private java.lang.Integer number;
47 private java.lang.String question;
48 private java.lang.String image;
49 private java.lang.String name;
50 private java.lang.Integer state;
51 private java.lang.Integer optId;
52 private java.lang.String optName;
53 private java.lang.String remark;
54 private java.util.Date createTime;
55 private java.util.Date updateTime;
56 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7 import java.math.BigDecimal;
8 import java.util.Date;
9 import java.util.List;
10
11 @Data
12 @ToString
13 public class Orders implements Serializable{
14 private Integer id;
15 private String orderSn;
16 private String orderPsn;
17 private Integer isParent;
18 private Integer isShow;
19 private String relationOrderSn;
20 private Integer orderType;
21 private Integer sellerId;
22 private String sellerName;
23 private Integer memberId;
24 private String memberName;
25 private Integer orderState;
26 private Date payTime;
27 private Integer paymentStatus;
28 private Integer invoiceStatus;
29 private String invoiceTitle;
30 private String invoiceType;
31 private BigDecimal moneyProduct;
32 private BigDecimal moneyLogistics;
33 private BigDecimal moneyOrder;
34 private BigDecimal moneyPaidBalance;
35 private BigDecimal moneyPaidReality;
36 private BigDecimal moneyCoupon;
37 private BigDecimal moneyActFull;
38 private BigDecimal moneyDiscount;
39 private BigDecimal moneyBack;
40 private BigDecimal moneyIntegral;
41 private Integer integral;
42 private Integer couponUserId;
43 private Integer actFullId;
44 private Integer activityId;
45 private String ip;
46 private String paymentName;
47 private String paymentCode;
48 private String name;
49 private Integer provinceId;
50 private Integer cityId;
51 private Integer areaId;
52 private String addressAll;
53 private String addressInfo;
54 private String mobile;
55 private String email;
56 private String zipCode;
57 private String remark;
58 private String deliverTime;
59 private String finishTime;
60 private String tradeSn;
61 private Integer source;
62 private Integer logisticsId;
63 private String logisticsName;
64 private String logisticsNumber;
65 private Integer isCodconfim;
66 private Integer codconfirmId;
67 private String codconfirmName;
68 private String codconfirmTime;
69 private String codconfirmRemark;
70 private Integer codconfirmState;
71 private Date createTime;
72 private String updateTime;
73 private Integer evaluateState;
74 private String regionName1;
75 private String regionName2;
76 private String regionName3;
77 private BigDecimal deductionVbMoney;
78 private BigDecimal couponMoney;
79
80 private List<OrdersProduct> goodinfos;
81
82
83 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.math.BigDecimal;
7 import java.util.Date;
8
9 @Data
10 @ToString
11 public class OrdersProduct {
12 private Integer id;
13 private Integer ordersId;
14 private String ordersSn;
15 private String ordersPsn;
16 private Integer sellerId;
17 private String sellerName;
18 private Integer productCateId;
19 private Integer productId;
20 private Integer productGoodsId;
21 private String specInfo;
22 private String productName;
23 private String productSku;
24 private Integer packageGroupsId;
25 private Integer mallGroupsId;
26 private Integer giftId;
27 private Integer isGift;
28 private BigDecimal moneyPrice;
29 private Integer number;
30 private BigDecimal moneyAmount;
31 private BigDecimal moneyActSingle;
32 private Integer actSingleId;
33 private Integer actGroupId;
34 private Integer actFlashSaleId;
35 private Integer actFlashSaleProductId;
36 private Integer actBiddingId;
37 private Integer actIntegralId;
38 private Integer actIntegralNum;
39 private BigDecimal actIntegralMoney;
40 private String systemRemark;
41 private Integer backNumber;
42 private Integer exchangeNumber;
43 private Date createTime;
44 private Date updateTime;
45 private Integer isEvaluate;
46 private BigDecimal moneyFullAoumt;
47 private BigDecimal moneyCouponAmount;
48 private BigDecimal deductionProductVbMoney;
49
50
51
52 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.math.BigDecimal;
7 import java.util.Date;
8
9 @Data
10 @ToString
11 public class Product {
12 private Integer id;
13 private Integer productCateId;
14 private String productCatePath;
15 private String name1;
16 private String name2;
17 private String keyword;
18 private Integer productBrandId;
19 private Integer isSelf;
20 private BigDecimal costPrice;
21 private BigDecimal protectedPrice;
22 private BigDecimal marketPrice;
23 private BigDecimal mallPcPrice;
24 private BigDecimal malMobilePrice;
25 private Integer virtualSales;
26 private Integer actualSales;
27 private Integer productStock;
28 private Integer isNorm;
29 private String normIds;
30 private String normName;
31 private Integer state;
32 private Integer isTop;
33 private Date upTime;
34 private String description;
35 private String packing;
36 private Integer sellerId;
37 private Integer createId;
38 private Date createTime;
39 private Date updateTime;
40 private Integer sellerCateId;
41 private Integer sellerIsTop;
42 private Integer sellerState;
43 private Integer commentsNumber;
44 private Integer productCateState;
45 private Integer isInventedProduct;
46 private Integer transportType;
47 private Integer transportId;
48 private String masterImg;
49 private String productCode;
50 private BigDecimal saleScale1;
51 private BigDecimal saleScale2;
52
53
54 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 @Data
7 @ToString
8 public class ProductGoods {
9 private Long id;
10 private Long productId;
11 private String normAttrId;
12 private String normName;
13 private Double mallPcPrice;
14 private Double mallMobilePrice;
15 private Long productStock;
16 private Long productStockWarning;
17 private Long actualSales;
18 private String sku;
19 private String images;
20 private Long state;
21 private Double weight;
22 private Long length;
23 private Long width;
24 private Long height;
25
26
27 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3
4 import lombok.Data;
5 import lombok.ToString;
6
7 import java.io.Serializable;
8
9 @Data
10 @ToString
11 public class Regions implements Serializable{
12
13 private Integer id;
14 private Integer parentId;
15 private String regionName;
16 private String parentPath;
17 private String firstLetter;
18 private Integer regionType;
19 private Integer agencyId;
20 private Integer shippingId;
21 private Integer visible;
22 private String rowId;
23 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7 import java.math.BigDecimal;
8 import java.util.Date;
9
10 @Data
11 @ToString
12 public class Seller implements Serializable{
13
14
15 private Integer id; //id
16 private Integer memberId; //用户ID
17 private String name; //用户名
18 private String sellerName; //店铺名称
19 private String sellerLogo; //店铺logo
20 private Integer sellerGrade; //店铺等级
21 private String scoreService; //店铺评分服务
22 private String scoreDeliverGoods; //店铺评分发货
23 private String scoreDescription; //店铺评分描述
24 private Integer productNumber; //商品数量
25 private Integer collectionNumber; //店铺收藏
26 private Date createTime; //创建时间
27 private BigDecimal saleMoney; //店铺总销售金额
28 private Integer orderCount; //店铺总订单量
29 private Integer orderCountOver; //店铺完成订单量
30 private String sellerKeyword; //SEO关键字
31 private String sellerDes; //SEO店铺描述
32 private Integer auditStatus; //审核状态 1、待审核;2、审核通过;3、冻结
33 private String storeSlide;
34 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class SellerComplaint implements Serializable {
11
12 private java.lang.Integer id; //id
13 private java.lang.Integer userId; //投诉人ID
14 private java.lang.String userName; //投诉人账户
15 private java.lang.Integer orderId; //订单ID
16 private java.lang.Integer orderProductId; //网单ID
17 private java.lang.Integer productBackId; //退货管理id,如没有置为0
18 private java.lang.Integer productExchangeId; //换货管理id,如没有置为0
19 private java.lang.String content; //投诉内容
20 private java.lang.String image; //投诉图片
21 private java.util.Date complaintTime; //投诉时间
22 private java.lang.Integer sellerId; //投诉商家
23 private java.util.Date sellerComplaintTime; //商家申诉时间
24 private java.lang.String sellerCompContent; //商家申诉内容
25 private java.lang.String sellerCompImage; //商家申诉图片
26 private java.lang.Integer state; //状态:1、买家投诉待审核;2、买家投诉不通过;3、买家投诉通过;4、卖家申诉待审核;5、卖家申诉不通过;6、卖家申诉通过;
27 private java.lang.Integer optId; //平台处理人ID
28 private java.lang.String optContent; //平台处理结果
29 private java.lang.String userContent; //客户反馈意见
30 private java.util.Date createTime; //创建时间
31 private java.util.Date optTime; //处理时间
32 }
...@@ -12,6 +12,7 @@ public class PineappleSyncStockRequest { ...@@ -12,6 +12,7 @@ public class PineappleSyncStockRequest {
12 @JsonProperty("PlatProductID") 12 @JsonProperty("PlatProductID")
13 private String platProductID; 13 private String platProductID;
14 14
15 @NotBlank(message = "skuid参数不能为空")
15 @JsonProperty("SkuID") 16 @JsonProperty("SkuID")
16 private String skuID; 17 private String skuID;
17 18
......
...@@ -36,11 +36,17 @@ ...@@ -36,11 +36,17 @@
36 <artifactId>com.sibu.orderHelper.activeMQ</artifactId> 36 <artifactId>com.sibu.orderHelper.activeMQ</artifactId>
37 <version>0.0.1-SNAPSHOT</version> 37 <version>0.0.1-SNAPSHOT</version>
38 </dependency> 38 </dependency>
39 <!-- https://mvnrepository.com/artifact/org.csource/fastdfs-client-java --> 39 <!-- fastDfs jar 导入 -->
40 <dependency> 40 <dependency>
41 <groupId>org.csource</groupId> 41 <groupId>org.csource</groupId>
42 <artifactId>fastdfs-client-java</artifactId> 42 <artifactId>fastdfs-client-java</artifactId>
43 <version>1.25</version> 43 <version>5.0.4</version>
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>
44 </dependency> 50 </dependency>
45 51
46 </dependencies> 52 </dependencies>
......
...@@ -6,9 +6,11 @@ import com.sibu.orderHelper.integral.dao.IMSupplierAppDao; ...@@ -6,9 +6,11 @@ import com.sibu.orderHelper.integral.dao.IMSupplierAppDao;
6 import com.sibu.orderHelper.integral.model.IMSupplierApp; 6 import com.sibu.orderHelper.integral.model.IMSupplierApp;
7 import com.sibu.orderHelper.integral.pineapple.request.BaseRequest; 7 import com.sibu.orderHelper.integral.pineapple.request.BaseRequest;
8 import com.sibu.orderHelper.integral.service.IMSupplierAppService; 8 import com.sibu.orderHelper.integral.service.IMSupplierAppService;
9 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
11 12
13 import javax.annotation.Resource;
12 import java.util.HashMap; 14 import java.util.HashMap;
13 import java.util.Map; 15 import java.util.Map;
14 16
...@@ -23,6 +25,9 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService { ...@@ -23,6 +25,9 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService {
23 @Autowired 25 @Autowired
24 private IMSupplierAppDao imSupplierAppDao; 26 private IMSupplierAppDao imSupplierAppDao;
25 27
28 @Resource
29 private MemberReadDao memberReadDao;
30
26 @Override 31 @Override
27 public IMSupplierApp findByAppIdAndAppType(String appId, SupplierAppTypeEnum appType) { 32 public IMSupplierApp findByAppIdAndAppType(String appId, SupplierAppTypeEnum appType) {
28 Map<String, String> params = new HashMap<>(); 33 Map<String, String> params = new HashMap<>();
...@@ -37,6 +42,6 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService { ...@@ -37,6 +42,6 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService {
37 params.put("appId", requestParams.getAppkey()); 42 params.put("appId", requestParams.getAppkey());
38 params.put("appToken", requestParams.getToken()); 43 params.put("appToken", requestParams.getToken());
39 params.put("appType", appType.getCode()); 44 params.put("appType", appType.getCode());
40 return imSupplierAppDao.findByAppIdAndAppType(params); 45 return memberReadDao.findByAppIdAndAppType(params);
41 } 46 }
42 } 47 }
......
...@@ -45,7 +45,7 @@ public class PineappleServiceImpl implements PineappleService { ...@@ -45,7 +45,7 @@ public class PineappleServiceImpl implements PineappleService {
45 params.put("endTime",""); 45 params.put("endTime","");
46 params.put("pageNow","1"); 46 params.put("pageNow","1");
47 params.put("PageSize","10"); 47 params.put("PageSize","10");
48 return pineappleDao.pageGetRefundBean(params); 48 return null;
49 } 49 }
50 50
51 @Override 51 @Override
...@@ -68,7 +68,7 @@ public class PineappleServiceImpl implements PineappleService { ...@@ -68,7 +68,7 @@ public class PineappleServiceImpl implements PineappleService {
68 @Override 68 @Override
69 public PineappleSyncStockResponse updateSyncStock(PineappleSyncStockRequest pineappleSyncStockRequest) throws Exception { 69 public PineappleSyncStockResponse updateSyncStock(PineappleSyncStockRequest pineappleSyncStockRequest) throws Exception {
70 PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse(); 70 PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
71 Map<String,Object> params = new HashMap<>(); 71 /* Map<String,Object> params = new HashMap<>();
72 params.put("supplierId",""); 72 params.put("supplierId","");
73 params.put("productId",pineappleSyncStockRequest.getPlatProductID()); 73 params.put("productId",pineappleSyncStockRequest.getPlatProductID());
74 //先判断SKU在判断产品 74 //先判断SKU在判断产品
...@@ -144,12 +144,13 @@ public class PineappleServiceImpl implements PineappleService { ...@@ -144,12 +144,13 @@ public class PineappleServiceImpl implements PineappleService {
144 pineappleSyncStockResponse.setQuantity(String.valueOf(pineappleSyncStockRequest.getQuantity())); 144 pineappleSyncStockResponse.setQuantity(String.valueOf(pineappleSyncStockRequest.getQuantity()));
145 pineappleSyncStockResponse.setMessage(PineappleEnum.ERROR.getMsg()); 145 pineappleSyncStockResponse.setMessage(PineappleEnum.ERROR.getMsg());
146 pineappleSyncStockResponse.setCode(PineappleEnum.ERROR.getCode()); 146 pineappleSyncStockResponse.setCode(PineappleEnum.ERROR.getCode());
147 return pineappleSyncStockResponse; 147 return pineappleSyncStockResponse;*/
148 return null;
148 } 149 }
149 150
150 @Override 151 @Override
151 public BaseResponse shipments(PineappleSendRequest pineappleSend) throws Exception { 152 public BaseResponse shipments(PineappleSendRequest pineappleSend) throws Exception {
152 BaseResponse baseResponse =new BaseResponse(); 153 /*BaseResponse baseResponse =new BaseResponse();
153 Map<String,Object> params = new HashMap<>(); 154 Map<String,Object> params = new HashMap<>();
154 String redisMysqlDbConfig = ""; 155 String redisMysqlDbConfig = "";
155 //订单号不符合 156 //订单号不符合
...@@ -200,12 +201,13 @@ public class PineappleServiceImpl implements PineappleService { ...@@ -200,12 +201,13 @@ public class PineappleServiceImpl implements PineappleService {
200 pineappleDao.updateBusinessSend(params); 201 pineappleDao.updateBusinessSend(params);
201 baseResponse.setMessage(PineappleEnum.ERROR.getMsg()); 202 baseResponse.setMessage(PineappleEnum.ERROR.getMsg());
202 baseResponse.setCode(PineappleEnum.ERROR.getCode()); 203 baseResponse.setCode(PineappleEnum.ERROR.getCode());
203 return baseResponse; 204 return baseResponse;*/
205 return null;
204 } 206 }
205 207
206 @Override 208 @Override
207 public UpdateSellerMemoResponse updateSelle(UpdateSellerMemoRequest updateSellerMemoRequest)throws Exception { 209 public UpdateSellerMemoResponse updateSelle(UpdateSellerMemoRequest updateSellerMemoRequest)throws Exception {
208 UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse(); 210 /* UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
209 Map<String,Object> params = new HashMap<>(); 211 Map<String,Object> params = new HashMap<>();
210 String redisMysqlDbConfig = ""; 212 String redisMysqlDbConfig = "";
211 //订单号不符合 213 //订单号不符合
...@@ -226,6 +228,7 @@ public class PineappleServiceImpl implements PineappleService { ...@@ -226,6 +228,7 @@ public class PineappleServiceImpl implements PineappleService {
226 UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode()); 228 UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
227 UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 229 UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
228 230
229 return UpdateSellerMemoResponse; 231 return UpdateSellerMemoResponse;*/
232 return null;
230 } 233 }
231 } 234 }
......
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.utils.SeqGenUtil;
6 import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
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.*; 11 import com.sibu.orderHelper.enums.*;
8 import com.sibu.orderHelper.integral.dao.PineappleDao; 12 import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
9 import com.sibu.orderHelper.integral.model.CheckRefundStatusBean; 13 import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
10 import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
11 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 14 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
15 import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
16 import com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange;
17 import com.sibu.orderHelper.integral.pineapple.model.Orders;
18 import com.sibu.orderHelper.integral.pineapple.model.SellerComplaint;
12 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 19 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
13 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; 20 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
14 import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest; 21 import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
22 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
15 import org.apache.log4j.Logger; 23 import org.apache.log4j.Logger;
16 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
17
18 import javax.annotation.Resource; 25 import javax.annotation.Resource;
19 import java.util.*; 26 import java.util.*;
20 27
...@@ -23,89 +30,97 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef ...@@ -23,89 +30,97 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
23 30
24 private static Logger log = Logger.getLogger(CheckRefundStatusBizServiceImpl.class); 31 private static Logger log = Logger.getLogger(CheckRefundStatusBizServiceImpl.class);
25 @Resource 32 @Resource
26 private PineappleDao pineappleDao; 33 private MemberReadDao memberReadDao;
34
35 @Reference
36 private ThirdApiOrderService thirdApiOrderService;
27 37
28 @Override 38 @Override
29 public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception { 39 public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
30 CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse(); 40 CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
31 Map<String,Object> params = new HashMap<>();
32 params.put("orderCode",callRequest.getBizModel().getOrderID());
33 List<CheckRefundStatusBean> checkRefundStatusBeanList = new ArrayList<>();
34 41
42 //旧订单号处理
43 if(!callRequest.getBizModel().getOrderID().startsWith("B")){
44 callRequest.getBizModel().setOrderID(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getOrderID()));
45 }
35 46
36 //先判断是否有退款 47 ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
37 if(pineappleDao.countCheckRefundStatusResponse(params)>0){ 48 thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getOrderID());
38 Map<String,Object> map = new HashMap<>(); 49 thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
39 String redisMysqlDbConfig = ""; 50 thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
40 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getOrderID()); 51 Orders orders = null;
41 String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getOrderID()); 52 CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
42 map.put("doingOrderTable","im_doing_order_" + tableIndex); 53 if(commonResponse.isSuccess()){
43 map.put("orderStatus", IMOrderStatus.RefundSuccess); 54 orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
44 map.put("orderCode",callRequest.getBizModel().getOrderID()); 55 }else {
45 map.put("supplierId",callRequest.getSupplier().getId()); 56 throw new BizException(commonResponse.getErrorMsg());
46 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
47 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
48 //再判断是否有退款成功的(全部退款,部分退款,退款中)
49 IMDoingOrderBean IMDoingOrderBean = pineappleDao.getIMDoingOrderBean(map);
50 if(StringUtil.isNull(IMDoingOrderBean)){
51 log.error(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
52 throw new BizException(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
53 } 57 }
54 //看是否全额退款 查询退款成功 58 if(StringUtil.isNull(orders)){
55 checkRefundStatusBeanList = pineappleDao.childrenrefundStatusBySuccess(IMDoingOrderBean.getOrderCode()); 59 log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
56 if(PayOrderStatus.RefundSuccess.getCode()== IMDoingOrderBean.getOrderStatus().intValue()) { 60 throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
57 if (StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
58 log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
59 throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
60 } 61 }
61 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) { 62 if(orders.getOrderState() == EJavaShopOrderStateEnum.RefundFail.getCode()){
62 bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg()); 63 log.error(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
63 bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode()); 64 throw new BizException(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
64 } 65 }
66 //1.查询退货表有没有记录
67 List<MemberProductBack> memberProductBackList= memberReadDao.getMemberProductBackByOrderSn(callRequest.getBizModel().getOrderID());
68 //5.如果退货表有记录,退款状态为店铺收货,判断退款金额状态
69 if(!StringUtil.isNull(memberProductBackList) && !memberProductBackList.isEmpty()){
70 MemberProductBack memberProductBack = memberProductBackList.stream().findFirst().get();
71 PineappleRefundEnum refundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(memberProductBack.getStateReturn());
72 //如果退款状态是店铺收货需要判断该退款信息是否已付款
73 /*if(memberProductBack.getStateReturn().intValue() == MemberProductBackEnum.ShopDelivery.getCode()){
74 if(memberProductBack.getStateMoney() == 1){
75 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
76 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
77 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
78 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
79 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
80 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
81 return checkRefundStatusResponse;
82 }else{
65 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode()); 83 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
66 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg()); 84 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg());
67 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg()); 85 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
68 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList); 86 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
69 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 87 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
70 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 88 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
71 return checkRefundStatusResponse; 89 return checkRefundStatusResponse;
72 } 90 }
73 if(PayOrderStatus.HasReceived.getCode() == IMDoingOrderBean.getOrderStatus().intValue() || PayOrderStatus.HasDelive.getCode() == IMDoingOrderBean.getOrderStatus().intValue() 91 }*/
74 || PayOrderStatus.RefundDoing.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ||PayOrderStatus.Finished.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ){ 92 checkRefundStatusResponse.setRefundStatus(refundEnum.getCode());
75 //部分退款 93 checkRefundStatusResponse.setSubmessage(refundEnum.getMsg());
76 if (!StringUtil.isNull(checkRefundStatusBeanList) && !checkRefundStatusBeanList.isEmpty()) { 94 checkRefundStatusResponse.setRefundStatusdescription(refundEnum.getMsg());
77 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) { 95 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
78 bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
79 bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
80 }
81 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
82 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
83 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
84 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
85 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 96 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
86 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 97 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
87 return checkRefundStatusResponse; 98 return checkRefundStatusResponse;
88 }else{ 99
89 checkRefundStatusBeanList = pineappleDao.childrenrefundStatusByCourse(IMDoingOrderBean.getOrderCode());
90 if(StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
91 log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
92 throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
93 }
94 Optional<CheckRefundStatusBean> entity = checkRefundStatusBeanList.stream().findFirst();
95 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getCode());
96 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
97 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
98 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
99 bean.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getMsg());
100 bean.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getCode());
101 } 100 }
101 //2.查询换货表有没有记录
102 List<MemberProductExchange> memberProductExchangeList = memberReadDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
103 if(!StringUtil.isNull(memberProductExchangeList) && !memberProductExchangeList.isEmpty()){
104 MemberProductExchange memberProductExchange = memberProductExchangeList.stream().findFirst().get();
105 PineappleExchangeEnum exchangeEnum = PineappleExchangeEnum.resolveByPlatformRefundStatus(memberProductExchange.getState());
106 checkRefundStatusResponse.setRefundStatus(exchangeEnum.getCode());
107 checkRefundStatusResponse.setSubmessage(exchangeEnum.getMsg());
108 checkRefundStatusResponse.setRefundStatusdescription(exchangeEnum.getMsg());
109 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
102 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 110 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
103 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 111 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
104 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
105 return checkRefundStatusResponse; 112 return checkRefundStatusResponse;
106
107 }
108 } 113 }
114 //3.如果都没有记录需要查询seller_complaint(投诉表),根据order_id订单id查询
115 List<SellerComplaint> sellerComplaintList = memberReadDao.getSellerComplaintById(orders.getId());
116 if(!StringUtil.isNull(sellerComplaintList) && !sellerComplaintList.isEmpty()){
117 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
118 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
119 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
120 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
121 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
122 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
123 return checkRefundStatusResponse;
109 } 124 }
110 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode()); 125 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode());
111 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg()); 126 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg());
......
...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.DownloadProductSkuBean; ...@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
10 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 10 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
11 import com.sibu.orderHelper.integral.reponse.DownloadProductResponse; 11 import com.sibu.orderHelper.integral.reponse.DownloadProductResponse;
12 import com.sibu.orderHelper.integral.request.DownloadProductRequest; 12 import com.sibu.orderHelper.integral.request.DownloadProductRequest;
13 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
13 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
14 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
15 16
...@@ -23,15 +24,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP ...@@ -23,15 +24,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
23 24
24 private static Logger log = Logger.getLogger(DownloadProductBizServiceImpl.class); 25 private static Logger log = Logger.getLogger(DownloadProductBizServiceImpl.class);
25 @Resource 26 @Resource
26 private PineappleDao pineappleDao; 27 private MemberReadDao memberReadDao;
27 28
28 @Override 29 @Override
29 public DownloadProductResponse call(CallRequest<DownloadProductRequest> callRequest) throws Exception { 30 public DownloadProductResponse call(CallRequest<DownloadProductRequest> callRequest) throws Exception {
30 DownloadProductResponse downloadProductResponse = new DownloadProductResponse(); 31 DownloadProductResponse downloadProductResponse = new DownloadProductResponse();
31 Map<String,Object> params =new HashMap<>(); 32 Map<String,Object> params =new HashMap<>();
32 params.put("supplierId",callRequest.getSupplier().getId()); 33 params.put("sellerId",callRequest.getSupplier().getId());
33 if(!StringUtil.isNull(callRequest.getBizModel().getStatus())){ 34 if(!StringUtil.isNull(callRequest.getBizModel().getStatus())){
34 params.put("isShow", DownloadProductStatusEnum.resolve(callRequest.getBizModel().getStatus()).intValue()); 35 params.put("state", DownloadProductStatusEnum.resolve(callRequest.getBizModel().getStatus()).intValue());
35 } 36 }
36 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize()); 37 params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
37 params.put("PageSize",callRequest.getBizModel().getPageSize()); 38 params.put("PageSize",callRequest.getBizModel().getPageSize());
...@@ -42,35 +43,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP ...@@ -42,35 +43,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
42 params.put("productName",callRequest.getBizModel().getPageSize()); 43 params.put("productName",callRequest.getBizModel().getPageSize());
43 } 44 }
44 //查询产品 45 //查询产品
45 List<DownloadProductBean> downloadProductBeanList = pineappleDao.getProductListByMap(params); 46 List<DownloadProductBean> downloadProductBeanList = memberReadDao.downloadProductListByMap(params);
46 if(!StringUtil.isNull(downloadProductBeanList) && !downloadProductBeanList.isEmpty()){ 47 if(!StringUtil.isNull(downloadProductBeanList) && !downloadProductBeanList.isEmpty()){
47 for(DownloadProductBean product : downloadProductBeanList){ 48 for(DownloadProductBean product : downloadProductBeanList){
48 //产品SKU 49 //产品SKU
49 List<DownloadProductSkuBean> downloadProductSkuBeanList = pineappleDao.getDownloadProductSkuBeanList(product.getPlatProductID()); 50 List<DownloadProductSkuBean> downloadProductSkuBeanList = memberReadDao.downloadSkuByProductId(product.getPlatProductID());
50 if(!StringUtil.isNull(downloadProductSkuBeanList) && !downloadProductSkuBeanList.isEmpty()){
51 for(int i=0;i<downloadProductSkuBeanList.size();i++){
52 DownloadProductSkuBean sku = downloadProductSkuBeanList.get(i);
53 //查询SKU规格名称
54 List<DownloadProductSkuBean> skuList = pineappleDao.getDownloadSkuBean(sku.getSkuID());
55 if(!StringUtil.isNull(skuList) && !skuList.isEmpty()){
56 StringBuffer sb = new StringBuffer();
57 for(int j = 0;j<skuList.size();j++){
58 if(j ==0){
59 sb.append(skuList.get(j).getSkuname());
60 }else{
61 sb.append(","+skuList.get(j).getSkuname());
62 }
63 }
64 sku.setSkuname(sb.toString());
65 sku.setSkupictureurl(product.getPictureurl());
66 }
67
68 }
69 }
70 product.setSkus(downloadProductSkuBeanList); 51 product.setSkus(downloadProductSkuBeanList);
71 }; 52 };
72 53 int count = memberReadDao.countDownloadProductListByMap(params);
73 downloadProductResponse.setTotalcount(downloadProductBeanList.size()); 54 downloadProductResponse.setTotalcount(count);
74 }else{ 55 }else{
75 downloadProductResponse.setTotalcount(0); 56 downloadProductResponse.setTotalcount(0);
76 } 57 }
......
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.common.utils.SeqGenUtil;
7 import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
8 import com.sibu.mall.order.request.third.ThirdPageQueryOrderListRequest;
9 import com.sibu.mall.order.response.api.ApiOrdersProductResponse;
10 import com.sibu.mall.order.response.api.ApiOrdersResponse;
11 import com.sibu.mall.order.service.ApiOrdersProductService;
12 import com.sibu.mall.order.service.ThirdApiOrderService;
13 import com.sibu.orderHelper.common.util.BeanCopyUtils;
6 import com.sibu.orderHelper.common.util.StringUtil; 14 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; 15 import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
16 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
13 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 17 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
18 import com.sibu.orderHelper.integral.pineapple.model.Orders;
19 import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
20 import com.sibu.orderHelper.integral.pineapple.model.Regions;
14 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 21 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
15
16 import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest; 22 import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
17 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; 23 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
18 import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse; 24 import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
25 import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
19 import com.sibu.orderHelper.integral.pineapple.response.OrderResponse; 26 import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
20 import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
21 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
22 import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
23 import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
24 import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter; 27 import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter;
25 import com.sibu.orderHelper.service.redis.RedisProductSkuService; 28 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
26 import org.apache.commons.lang3.StringUtils;
27 import org.apache.log4j.Logger; 29 import org.apache.log4j.Logger;
28 import org.springframework.beans.factory.annotation.Autowired; 30 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.stereotype.Service; 31 import org.springframework.stereotype.Service;
30
31 import javax.annotation.Resource; 32 import javax.annotation.Resource;
33 import java.math.BigDecimal;
34 import java.text.MessageFormat;
35 import java.text.SimpleDateFormat;
32 import java.util.ArrayList; 36 import java.util.ArrayList;
33 import java.util.HashMap;
34 import java.util.List; 37 import java.util.List;
35 import java.util.Map; 38 import java.util.Optional;
36 import java.util.stream.Collectors; 39 import java.util.stream.Collectors;
37 40
38 /** 41 /**
...@@ -44,145 +47,228 @@ import java.util.stream.Collectors; ...@@ -44,145 +47,228 @@ import java.util.stream.Collectors;
44 @Service 47 @Service
45 public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> { 48 public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> {
46 private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class); 49 private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class);
47 @Resource
48 private IIMDoingOrderService iimDoingOrderService;
49 50
50 @Resource
51 private IMDoingOrderDao iMDoingOrderDao;
52 @Autowired 51 @Autowired
53 private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter; 52 private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter;
54 53
55 @Resource 54 @Resource
56 PineappleDao pineappleDao; 55 private MemberReadDao memberReadDao;
56
57 @Reference
58 private ApiOrdersProductService apiOrdersProductService;
59
60 @Reference
61 private ThirdApiOrderService thirdApiOrderService;
57 62
58 @Override 63 @Override
59 public BaseResponse call(CallRequest<GetOrderRequest> callRequest) { 64 public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
60 if (StringUtils.isNotBlank(callRequest.getBizModel().getPlatOrderNo())) { 65 ThirdPageQueryOrderListRequest thirdPageQueryOrderListRequest = new ThirdPageQueryOrderListRequest();
61 return this.findByOrderCode(callRequest); 66 if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
62 } else { 67 //旧订单号处理
63 return this.findList(callRequest); 68 if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
69 callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
64 } 70 }
71 thirdPageQueryOrderListRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
65 } 72 }
66 73 if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){
67 74 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus());
68 @Override 75 thirdPageQueryOrderListRequest.setOrderState(orderStatusEnum.getMallOrderStatus());
69 public String getHandleMethodName() {
70 return "Differ.JH.Business.GetOrder";
71 } 76 }
72 77
73 78 thirdPageQueryOrderListRequest.setSellerId(callRequest.getSupplier().getId());
74 private GetOrderResponse findByOrderCode(CallRequest<GetOrderRequest> callRequest) { 79 if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
75 DoingOrderDetailResponse order = null; 80 thirdPageQueryOrderListRequest.setStartTime(callRequest.getBizModel().getStartTime());
76 try {
77 order = iimDoingOrderService.getIMOrderDetailByOrderCode(callRequest.getBizModel().getPlatOrderNo());
78 if (order != null) {
79 this.getBarCode(order);
80 }
81 } catch (Exception e) {
82 log.error("获取订单数据业务异常", e);
83 throw new BizException("获取订单数据业务异常", e);
84 } 81 }
85 int numTotalOrder = 0; 82 if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){
86 List<OrderResponse> orders = new ArrayList<>(); 83 thirdPageQueryOrderListRequest.setEndTime(callRequest.getBizModel().getEndTime());
87 if (order != null) {
88 numTotalOrder = 1;
89 orders.add(this.convertOrder(order));
90 } 84 }
85 thirdPageQueryOrderListRequest.setPageNow(callRequest.getBizModel().getPageIndex());
86 thirdPageQueryOrderListRequest.setPageSize(callRequest.getBizModel().getPageSize());
87 thirdPageQueryOrderListRequest.setInitiationID(SeqGenUtil.getLogId());
88 CommonResponse<PageResult<ApiOrdersResponse>> thirdResponse = thirdApiOrderService.pageOrder(thirdPageQueryOrderListRequest);
89
91 GetOrderResponse response = new GetOrderResponse(); 90 GetOrderResponse response = new GetOrderResponse();
92 response.setNumTotalOrder(numTotalOrder); 91 response.setNumTotalOrder(0);
93 response.setOrders(orders); 92 response.setOrders(new ArrayList<>());
94 response.setCode(PineAppleConst.SUCCESS_CODE); 93 response.setCode(PineAppleConst.SUCCESS_CODE);
94 if(thirdResponse.isSuccess()){
95
96 List<Orders> ordersList = BeanCopyUtils.copyList(Orders.class,thirdResponse.getResult().getDatas());
97
98 List<Integer> provinceIdList = ordersList.stream().map(o->o.getProvinceId()).collect(Collectors.toList());
99 List<Regions> provinceList = memberReadDao.getRegionsByIds(provinceIdList);
100
101 List<Integer> cityIdList = ordersList.stream().map(o->o.getCityId()).collect(Collectors.toList());
102 List<Regions> cityList = memberReadDao.getRegionsByIds(cityIdList);
103
104 List<Integer> areaIdList = ordersList.stream().map(o->o.getAreaId()).collect(Collectors.toList());
105 List<Regions> areaList = memberReadDao.getRegionsByIds(areaIdList);
106
107 ordersList.stream().forEach(i->{
108 Optional<Regions> province = provinceList.stream().filter(p->p.getId().intValue() == i.getProvinceId()).findFirst();
109 province.ifPresent(e->{
110 i.setRegionName1(e.getRegionName());
111 });
112
113 Optional<Regions> city = cityList.stream().filter(p->p.getId().intValue() == i.getCityId()).findFirst();
114 city.ifPresent(e->{
115 i.setRegionName2(e.getRegionName());
116 });
117
118 Optional<Regions> area = areaList.stream().filter(p->p.getId().intValue() == i.getAreaId()).findFirst();
119 area.ifPresent(e->{
120 i.setRegionName3(e.getRegionName());
121 });
122 });
123
124 response.setNumTotalOrder(thirdResponse.getResult().getTotalRecord());
125 response.setOrders(findOrders(ordersList));
126 }else {
127 throw new BizException(thirdResponse.getErrorMsg());
128 }
95 return response; 129 return response;
96 } 130 }
97 131
98 private OrderResponse convertOrder(DoingOrderDetailResponse order) { 132 private List<OrderResponse> findOrders(List<Orders> ordersList){
99 return this.platformOrderToPineAppleOrderConverter.convert(order); 133 List<OrderResponse> orderResponseList = new ArrayList<>();
100 } 134 if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){
101 135 ordersList.stream().forEach(o ->{
102 public DoingOrderDetailResponse getBarCode(DoingOrderDetailResponse source) throws Exception { 136 OrderResponse orderResponse = this.getOrderResponse(o);
103 for (DoingOrder1DetailResponse entity:source.getOrder1s()){
104 IMProductBean product = pineappleDao.getIMProductBeanById(entity.getProductId());
105 if(StringUtil.isNotBlank(product.getBarCode())){
106 entity.setBarCode(product.getBarCode());
107 }
108 }
109 return source;
110 }
111
112
113 private BaseResponse findList(CallRequest<GetOrderRequest> callRequest) {
114 List<IMDoingOrderBean> list = new ArrayList<IMDoingOrderBean>();
115 //默认获取订单数量值
116 int[] modelValues = {0, 1, 2, 3, 4, 5, 6, 7};
117 String redisMysqlDbConfig = "";
118 Map<String, Object> params = new HashMap<>();
119 String orderTableName = "im_doing_order_";
120 String order1TableName = "im_doing_order1_";
121 List<String[]> tableNames = new ArrayList<String[]>();
122 //放入两个表名
123 for (int j = 0; j < DbUtil.TABLE_LASTCHAR1.size(); j++) {
124 tableNames.add(new String[]{orderTableName + DbUtil.TABLE_LASTCHAR1.get(j), order1TableName + DbUtil.TABLE_LASTCHAR1.get(j)});
125 }
126 params.put("tableNames", tableNames);
127 params.put("orderStatusList", callRequest.getBizModel().convertOrderStatus().getMallOrderStatus());
128 params.put("supplierId", callRequest.getSupplier().getId());
129 params.put("startTime", callRequest.getBizModel().convertAndCheckStartTime());
130 params.put("endTime", callRequest.getBizModel().convertAndCheckEndTime());
131 params.put("timeType", callRequest.getBizModel().convertTimeTypeEnum().getCode());
132 int pageStartInit = (callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize();
133 int pageSizeInt = callRequest.getBizModel().getPageSize();
134 int totalRecord = 0;
135 boolean queryFlag = true;
136 List<DoingOrderDetailResponse> orderBeans = new ArrayList<>();
137 //开始循环库查询
138 for (int i = 0; i < modelValues.length; i++) {
139 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, modelValues[i]);
140 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
141 int number = iMDoingOrderDao.countPineAppleOrder(params);
142 totalRecord += number;
143 if (queryFlag && number > 0) {
144 //已经查到有数据了,从下一张表的第一条记录开始查询
145 if (orderBeans != null && orderBeans.size() > 0) {
146 int pageSize = pageSizeInt - orderBeans.size();//减去已查到的数据
147 params.put("pageNow", 0);
148 params.put("pageSize", pageSize);
149 } else if (totalRecord > pageStartInit) {
150 int pageNow = pageStartInit - (totalRecord - number);
151 params.put("pageNow", pageNow);
152 params.put("pageSize", pageSizeInt);
153 } else {
154 continue;//继续循环
155 }
156 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
157 List<DoingOrderDetailResponse> orders = iMDoingOrderDao.pagerPineAppleOrders(params);
158 orderBeans.addAll(orders);
159 if (orderBeans.size() >= callRequest.getBizModel().getPageSize()) {
160 queryFlag = false;
161 }
162 }
163 }
164 List<OrderResponse> orders = orderBeans
165 .stream()
166 .map(p -> {
167 DoingOrderDetailResponse order = null;
168 try { 137 try {
169 order = iimDoingOrderService.getIMOrderDetailByOrderCode(p.getOrderCode()); 138 List<OrdersProduct> ordersProductList = null;
170 if(!StringUtil.isNull(order)){ 139 ApiOrdersSnRequest apiOrdersSnRequest = new ApiOrdersSnRequest(o.getOrderSn());
171 this.getBarCode(order); 140 apiOrdersSnRequest.setInitiationID(SeqGenUtil.getLogId());
141 CommonResponse<List<ApiOrdersProductResponse>> commonResponse = apiOrdersProductService.getOrdersProductByOrderSn(apiOrdersSnRequest);
142 if(commonResponse.isSuccess()){
143 ordersProductList = BeanCopyUtils.copyList(OrdersProduct.class, commonResponse.getResult());
144 }
145
146 if(StringUtil.isNull(ordersProductList)){
147 throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
172 } 148 }
149 List<OrderGoodResponse> goodInfos = new ArrayList<>();
150 ordersProductList.stream().forEach(p ->{
151 OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
152 goodInfos.add(orderGoodResponse);
153 });
154
155 orderResponse.setGoodInfos(goodInfos);
156 orderResponseList.add(orderResponse);
173 } catch (Exception e) { 157 } catch (Exception e) {
174 log.error("获取订单数据业务异常", e); 158 log.error("获取订单数据业务异常", e);
175 throw new BizException("获取订单数据业务异常", e); 159 throw new BizException(String.format("获取订单数据业务异常:[%s]",o.getOrderSn()));
160 }
161 });
162 }
163 return orderResponseList;
176 } 164 }
177 return order;
178 })
179 .map(p -> platformOrderToPineAppleOrderConverter.convert(p))
180 .collect(Collectors.toList());
181 GetOrderResponse response = new GetOrderResponse();
182 response.setNumTotalOrder(totalRecord);
183 response.setOrders(orders);
184 response.setCode(PineAppleConst.SUCCESS_CODE);
185 165
186 return response; 166 /**
167 * 主订单数据
168 * @param orders
169 * @return
170 */
171 private OrderResponse getOrderResponse(Orders orders){
172 OrderStatusEnum orderStatusEnum = this.convertAndCheckOrderStatusEnum(orders);
173 OrderResponse orderResponse = new OrderResponse();
174 orderResponse.setTradeStatus(orderStatusEnum.getCode());//订单状态
175 orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
176 orderResponse.setPlatOrderNo(orders.getOrderSn());//订单号
177 orderResponse.setTradeStatusDescription(orders.getRemark());//订单备注
178 orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));//交易时间
179 orderResponse.setProvince(orders.getRegionName1());//省
180 orderResponse.setCity(orders.getRegionName2());//市
181 orderResponse.setArea(orders.getRegionName3());//区
182 orderResponse.setAddress(orders.getAddressInfo());//地址
183 orderResponse.setNick(orders.getMemberName());//买家昵称
184 orderResponse.setPhone(orders.getMobile());//电话
185 orderResponse.setMobile(orders.getMobile());
186 orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));//邮费
187 orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));//货款金额
188 orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));//支付金额
189 orderResponse.setFavourableMoney(this.convertAndCheckFreight(orders.getMoneyDiscount()));//优惠金额
190 orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));//支付时间
191 orderResponse.setShouldPayType("银行收款");//结算方式
192 orderResponse.setTown("");
193 orderResponse.setTaxAmount("");
194 orderResponse.setCommissionValue("");
195 orderResponse.setTariffAmount("");
196 orderResponse.setAddedValueAmount("");
197 orderResponse.setConsumptionDutyAmount("");
198 orderResponse.setSendStyle("");
199 orderResponse.setQq("");
200 orderResponse.setEmail("");
201 orderResponse.setInvoiceTitle("");
202 orderResponse.setTaxPayerIdent("");
203 orderResponse.setCodServiceFee("");
204 orderResponse.setCurrencyCode("");
205 orderResponse.setIdCard("");
206 orderResponse.setIdCardTrueName("");
207 orderResponse.setWhseCode("");
208 orderResponse.setIsHwgFlag("");
209 return orderResponse;
187 } 210 }
211
212
213 /**
214 * 子订单数据
215 * @param ordersProduct
216 * @return
217 *
218 *
219 */
220 private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
221 OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
222 orderGoodResponse.setProductId(String.valueOf(ordersProduct.getProductGoodsId()));//平台商品ID或SKUID(SKUID优先)
223 orderGoodResponse.setSubOrderNo(String.valueOf(ordersProduct.getId()));//子订单号(若需要支持拆单发货,则必填)
224 orderGoodResponse.setTradeGoodsNo(ordersProduct.getProductSku());//外部商家编码或外部SKU编码(SKU编码优先)。注意,如果要与管家对接,这里一般返回管家的商品编码,作为平台的外部商家编码,与管家商品映射
225 orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());//商品交易名称
226 orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());//商品交易规格
227 orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));//商品数量
228 orderGoodResponse.setPrice(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));//单价
229 orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(getOrdersProductDiscountMoney(ordersProduct)));//子订单优惠金额
230 orderGoodResponse.setTaxAmount("");
231 orderGoodResponse.setRefundStatus("");
232 orderGoodResponse.setStatus("");
233 orderGoodResponse.setRemark("");
234 return orderGoodResponse;
235 }
236
237 private BigDecimal getOrdersProductDiscountMoney(OrdersProduct ordersProduct){
238 BigDecimal moneyActSingle = ordersProduct.getMoneyActSingle() ==null? BigDecimal.ZERO : ordersProduct.getMoneyActSingle();//立减优惠金额
239 BigDecimal moneyFullAmount = ordersProduct.getMoneyFullAoumt() ==null? BigDecimal.ZERO:ordersProduct.getMoneyFullAoumt();//网单满减金额和
240 BigDecimal moneyCouponAmount = ordersProduct.getMoneyCouponAmount() ==null?BigDecimal.ZERO:ordersProduct.getMoneyCouponAmount();//网单优惠券优惠金额和
241 BigDecimal deductionProductVbMoney = ordersProduct.getDeductionProductVbMoney() ==null?BigDecimal.ZERO:ordersProduct.getDeductionProductVbMoney();
242 BigDecimal sumDiscountMoney =BigDecimal.ZERO;
243 sumDiscountMoney = sumDiscountMoney.add(moneyActSingle);
244 sumDiscountMoney = sumDiscountMoney.add(moneyFullAmount);
245 sumDiscountMoney = sumDiscountMoney.add(moneyCouponAmount);
246 sumDiscountMoney = sumDiscountMoney.add(deductionProductVbMoney);
247 return sumDiscountMoney;
248 }
249
250
251 private OrderStatusEnum convertAndCheckOrderStatusEnum(Orders orders) {
252 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(orders.getOrderState());
253 if (orderStatusEnum.equals(OrderStatusEnum.UNKNOWN) || orderStatusEnum.equals(OrderStatusEnum.ALL_ORDER)) {
254 throw new BizException(MessageFormat.format("订单状态【{0}】转换失败,", orders.getOrderState()));
255 }
256 return orderStatusEnum;
257 }
258
259 private SimpleDateFormat buildDefaultSimpleDateFormat() {
260 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
261 return sdf;
262 }
263
264 private String convertAndCheckFreight(BigDecimal money) {
265 BigDecimal price = money==null?BigDecimal.ZERO:money;
266 return price.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
267 }
268
269 @Override
270 public String getHandleMethodName() {
271 return "Differ.JH.Business.GetOrder";
272 }
273
188 } 274 }
......
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.common.utils.SeqGenUtil;
6 import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
7 import com.sibu.mall.order.request.third.ThirdOrdersProductIdRequest;
8 import com.sibu.mall.order.response.api.ApiOrdersResponse;
9 import com.sibu.mall.order.service.ApiOrdersService;
10 import com.sibu.mall.order.service.ThirdApiOrderService;
3 import com.sibu.orderHelper.common.constants.AppConstants; 11 import com.sibu.orderHelper.common.constants.AppConstants;
4 import com.sibu.orderHelper.common.database.DBContextHolder; 12 import com.sibu.orderHelper.common.database.DBContextHolder;
5 import com.sibu.orderHelper.common.strategy.DbUtil; 13 import com.sibu.orderHelper.common.strategy.DbUtil;
...@@ -7,6 +15,7 @@ import com.sibu.orderHelper.common.util.StringUtil; ...@@ -7,6 +15,7 @@ import com.sibu.orderHelper.common.util.StringUtil;
7 import com.sibu.orderHelper.enums.PineappleEnum; 15 import com.sibu.orderHelper.enums.PineappleEnum;
8 import com.sibu.orderHelper.enums.PineappleMethodsEnum; 16 import com.sibu.orderHelper.enums.PineappleMethodsEnum;
9 import com.sibu.orderHelper.enums.PineappleRefundEnum; 17 import com.sibu.orderHelper.enums.PineappleRefundEnum;
18 import com.sibu.orderHelper.enums.PineappleRefundMoneyStateEnum;
10 import com.sibu.orderHelper.integral.dao.PineappleDao; 19 import com.sibu.orderHelper.integral.dao.PineappleDao;
11 import com.sibu.orderHelper.integral.model.GetRefundBean; 20 import com.sibu.orderHelper.integral.model.GetRefundBean;
12 import com.sibu.orderHelper.integral.model.PineappleOderDetailBean; 21 import com.sibu.orderHelper.integral.model.PineappleOderDetailBean;
...@@ -15,6 +24,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException; ...@@ -15,6 +24,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException;
15 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 24 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
16 import com.sibu.orderHelper.integral.reponse.GetRefundResponse; 25 import com.sibu.orderHelper.integral.reponse.GetRefundResponse;
17 import com.sibu.orderHelper.integral.request.GetRefundRequest; 26 import com.sibu.orderHelper.integral.request.GetRefundRequest;
27 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
18 import org.apache.log4j.Logger; 28 import org.apache.log4j.Logger;
19 import org.springframework.stereotype.Service; 29 import org.springframework.stereotype.Service;
20 30
...@@ -31,6 +41,14 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -31,6 +41,14 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
31 @Resource 41 @Resource
32 private PineappleDao pineappleDao; 42 private PineappleDao pineappleDao;
33 43
44 @Resource
45 private MemberReadDao memberReadDao;
46
47 @Reference
48 private ThirdApiOrderService thirdApiOrderService;
49
50 @Reference
51 private ApiOrdersService apiOrdersService;
34 52
35 @Override 53 @Override
36 public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception { 54 public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
...@@ -39,12 +57,53 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -39,12 +57,53 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
39 params.put("supplierId",callRequest.getSupplier().getId()); 57 params.put("supplierId",callRequest.getSupplier().getId());
40 params.put("beginTime",callRequest.getBizModel().getBeginTime()); 58 params.put("beginTime",callRequest.getBizModel().getBeginTime());
41 params.put("endTime",callRequest.getBizModel().getEndTime()); 59 params.put("endTime",callRequest.getBizModel().getEndTime());
42 params.put("pageNow",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize()); 60 params.put("PageIndex",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
43 params.put("PageSize",callRequest.getBizModel().getPageSize()); 61 params.put("PageSize",callRequest.getBizModel().getPageSize());
44 62
45 List<GetRefundBean> refundBeanList = pineappleDao.pageGetRefundBean(params); 63 List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params);
46 if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){ 64 if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){
47 for(GetRefundBean getRefundBean:refundBeanList){ 65 for(GetRefundBean getRefundBean:refundBeanList){
66
67 String orderSn = getRefundBean.getPlatorderno();
68 //旧订单号处理
69 if(!orderSn.startsWith("B")){
70 orderSn = memberReadDao.getNewOrderSnByOldOrderSn(orderSn);
71 }
72
73 ApiOrdersSnRequest apiOrdersSnRequest = new ApiOrdersSnRequest(orderSn);
74 apiOrdersSnRequest.setInitiationID(SeqGenUtil.getLogId());
75 CommonResponse<ApiOrdersResponse> orderResponse = apiOrdersService.getOrdersByOrderSn(apiOrdersSnRequest);
76 if(orderResponse.isSuccess()){
77 getRefundBean.setTotalamount(orderResponse.getResult().getMoneyOrder());
78 getRefundBean.setPayamount(orderResponse.getResult().getMoneyOrder());
79 getRefundBean.setOrderstatus(String.valueOf(orderResponse.getResult().getOrderState()));
80 }else {
81 throw new BizException(orderResponse.getErrorMsg());
82 }
83 ThirdOrdersProductIdRequest thirdOrdersProductIdRequest = new ThirdOrdersProductIdRequest(getRefundBean.getOrdersproductuid(),orderSn);
84 thirdOrdersProductIdRequest.setInitiationID(SeqGenUtil.getLogId());
85 CommonResponse<Integer> response = thirdApiOrderService.countOrderProductNum(thirdOrdersProductIdRequest);
86 getRefundBean.setProductnum(response.getResult());
87 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus()));
88 if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){
89 throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus()));
90 }
91 getRefundBean.setOrderstatus(orderStatusEnum.getCode());
92 getRefundBean.setOrderstatusdesc(orderStatusEnum.getMsg());
93 PineappleRefundEnum pineappleRefundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus()));
94 if(pineappleRefundEnum.getCode() == PineappleRefundEnum.JH_06.getCode()){
95 PineappleRefundMoneyStateEnum pineappleRefundMoneyStateEnum = PineappleRefundMoneyStateEnum.resolveByPlatformRefundStatus(getRefundBean.getStateMoney());
96 if(pineappleRefundMoneyStateEnum.getCode().equals(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN.getCode())){
97 throw new BizException(String.format("菠萝派退款单下载,枚举查询退款状态报错,订单状态【{0}】转换失败",getRefundBean.getRefundstatus()));
98 }
99 getRefundBean.setRefundstatus(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getCode());
100 getRefundBean.setRefundstatusdesc(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getMsg());
101 }else{
102 getRefundBean.setRefundstatus(pineappleRefundEnum.getCode());
103 getRefundBean.setRefundstatusdesc(pineappleRefundEnum.getMsg());
104 }
105 }
106 /*for(GetRefundBean getRefundBean:refundBeanList){
48 Map<String,Object> map = new HashMap<>(); 107 Map<String,Object> map = new HashMap<>();
49 String redisMysqlDbConfig = ""; 108 String redisMysqlDbConfig = "";
50 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno()); 109 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno());
...@@ -54,7 +113,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -54,7 +113,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
54 map.put("orderId1",getRefundBean.getSubplatorderno()); 113 map.put("orderId1",getRefundBean.getSubplatorderno());
55 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); 114 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
56 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 115 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
57 PineappleOderDetailBean pineappleOderDetailBean = pineappleDao.getOneIMOrderById(map); 116 PineappleOderDetailBean pineappleOderDetailBean = null;
58 if(StringUtil.isNull(pineappleOderDetailBean)){ 117 if(StringUtil.isNull(pineappleOderDetailBean)){
59 log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 118 log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
60 throw new BizException(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 119 throw new BizException(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
...@@ -75,8 +134,8 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -75,8 +134,8 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
75 getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode()); 134 getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode());
76 135
77 136
78 } 137 }*/
79 getRefundResponse.setTotalcount(refundBeanList.size()); 138 getRefundResponse.setTotalcount(memberReadDao.countGetGetRefundBean(params));
80 }else{ 139 }else{
81 getRefundResponse.setTotalcount(0); 140 getRefundResponse.setTotalcount(0);
82 } 141 }
......
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.utils.SeqGenUtil;
6 import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
7 import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
8 import com.sibu.mall.order.response.api.ApiOrdersResponse;
9 import com.sibu.mall.order.service.ThirdApiOrderService;
10 import com.sibu.orderHelper.common.util.BeanCopyUtils;
6 import com.sibu.orderHelper.common.util.StringUtil; 11 import com.sibu.orderHelper.common.util.StringUtil;
7 import com.sibu.orderHelper.enums.PayOrderStatus;
8 import com.sibu.orderHelper.enums.PineappleEnum; 12 import com.sibu.orderHelper.enums.PineappleEnum;
9 import com.sibu.orderHelper.enums.PineappleMethodsEnum; 13 import com.sibu.orderHelper.enums.PineappleMethodsEnum;
10 import com.sibu.orderHelper.integral.dao.PineappleDao; 14 import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
11 import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
12 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 15 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
16 import com.sibu.orderHelper.integral.pineapple.model.CourierCompany;
17 import com.sibu.orderHelper.integral.pineapple.model.Orders;
18 import com.sibu.orderHelper.integral.pineapple.model.Regions;
13 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 19 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
14 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; 20 import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
15 import com.sibu.orderHelper.integral.request.PineappleSendRequest; 21 import com.sibu.orderHelper.integral.request.PineappleSendRequest;
22 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
23 import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
16 import org.apache.log4j.Logger; 24 import org.apache.log4j.Logger;
17 import org.springframework.stereotype.Service; 25 import org.springframework.stereotype.Service;
18
19 import javax.annotation.Resource; 26 import javax.annotation.Resource;
20 import java.util.Date; 27 import java.util.*;
21 import java.util.HashMap;
22 import java.util.Map;
23 28
24 @Service 29 @Service
25 public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSendRequest> { 30 public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSendRequest> {
26 31
27 private static Logger log = Logger.getLogger(PineappleSendBizServiceImpl.class); 32 private static Logger log = Logger.getLogger(PineappleSendBizServiceImpl.class);
28 @Resource 33 @Resource
29 private PineappleDao pineappleDao; 34 private MemberReadDao memberReadDao;
35 @Resource
36 private MemberWriteDao memberWriteDao;
37
38 @Reference
39 private ThirdApiOrderService thirdApiOrderService;
30 40
31 @Override 41 @Override
32 public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception { 42 public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception {
33 BaseResponse baseResponse =new BaseResponse(); 43 BaseResponse baseResponse =new BaseResponse();
34 Map<String,Object> params = new HashMap<>(); 44 ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
35 String redisMysqlDbConfig = ""; 45
36 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo()); 46 //旧订单号处理
37 String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo()); 47 if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
38 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); 48 callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
39 params.put("doingOrderTable","im_doing_order_" + tableIndex);
40 params.put("orderCode",callRequest.getBizModel().getPlatOrderNo());
41 params.put("supplierId",callRequest.getSupplier().getId());
42 //只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常
43 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
44 IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params);
45 if(StringUtil.isNull(iMDoingOrderBean)){
46 log.error("获取订单数据业务异常");
47 throw new BizException("获取订单数据业务异常");
48 } 49 }
49 50
50 if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasReceived.getCode() || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasDelive.getCode() 51 thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
51 || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){ 52 thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
52 if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){ 53
53 params.put("orderStatus",PayOrderStatus.HasReceived.getCode()); 54 ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
54 params.put("erpImportDt",new Date()); 55 thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
55 params.put("shipDt",new Date()); 56 thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
57 thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
58 Orders orders = null;
59 CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
60 if(commonResponse.isSuccess()){
61 orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
62 }else {
63 throw new BizException(commonResponse.getErrorMsg());
56 } 64 }
57 if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ 65 if(StringUtil.isNull(orders)){
58 params.put("expressCode",callRequest.getBizModel().getLogisticNo()); 66 log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
67 throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
68 }
69 //只有订单状态为345可以允许操作该接口,其中状态为3才可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常,4、5只允许添加快递单号
70 if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()
71 && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitConfirmed.getCode()){
72
73 if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
74 //订单状态
75 thirdUpdateOrderRequest.setOrderState(EJavaShopOrderStateEnum.HasReceived.getCode());
76 //收货人名字
77 if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){
78 thirdUpdateOrderRequest.setName(callRequest.getBizModel().getSenderName());
79 }
80 //电话
81 if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
82 thirdUpdateOrderRequest.setMobile(callRequest.getBizModel().getSenderTel());
83 }
84 //地址、快递信息 建议去除
85 //this.gainInfo(params,callRequest,orders);
86
59 } 87 }
60 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
61 //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
62 int num = pineappleDao.getOrderByMap(params);
63 88
64 if(num > 0){
65 params.put("expressCode","");
66 }else{
67 if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ 89 if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
68 if(StringUtil.isNull(iMDoingOrderBean.getExpressCode())){ 90 //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
69 params.put("expressCode",callRequest.getBizModel().getLogisticNo()); 91 /* Map<String,Object> checkMap = new HashMap<>();
92 checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
93 checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
94 checkMap.put("sellerId",callRequest.getSupplier().getId());
95 int num = memberWriteDao.checkLogisticsNumber(checkMap);*/
96 thirdQueryOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
97 CommonResponse<Boolean> response = thirdApiOrderService.checkLogisticsNumber(thirdQueryOrderRequest);
98 if(response.isSuccess() && !response.getResult()){
99 if(StringUtil.isNull(orders.getLogisticsNumber())){
100 thirdUpdateOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
70 }else{ 101 }else{
71 params.put("expressCode",iMDoingOrderBean.getExpressCode()+";"+callRequest.getBizModel().getLogisticNo()); 102 thirdUpdateOrderRequest.setLogisticsNumber(orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
72 } 103 }
73 } 104 }
74 } 105 }
75 if(StringUtil.isNull(callRequest.getBizModel().getSenderName())){ 106
76 params.put("buyerUsername",""); 107 }else{
108 log.error(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
109 throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
77 } 110 }
78 if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ 111 //修改订单信息
79 params.put("buyerPhone",callRequest.getBizModel().getSenderTel()); 112 thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
113 baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
114 baseResponse.setCode(PineappleEnum.SUCCESS.getCode());
115 return baseResponse;
80 } 116 }
117
118
119 private void gainInfo(Map<String,Object> params,CallRequest<PineappleSendRequest> callRequest,Orders orders){
120 //地址
81 if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){ 121 if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){
82 String [] str = callRequest.getBizModel().getSenderAddress().split(" "); 122 String [] str = callRequest.getBizModel().getSenderAddress().split(" ");
83 if(!StringUtil.isNull(str) && str.length >3){ 123 if(!StringUtil.isNull(str) && str.length >3){
84 params.put("province",str[0]);
85 params.put("city", str[1]);
86 params.put("area",str[2]);
87 StringBuffer address = new StringBuffer(); 124 StringBuffer address = new StringBuffer();
88 for(int i = 3;i<str.length;i++){ 125 for(int i = 3;i<str.length;i++){
89 address.append(str[i]); 126 address.append(str[i]);
90 } 127 }
91 params.put("address",str[0]+"-"+str[1]+"-"+str[2]+"-"+address); 128 params.put("addressAll",str[0]+"-"+str[1]+"-"+str[2]);
129 params.put("addressInfo",str[0]+"-"+str[1]+"-"+str[2]+"-"+address);
130 //查询省市级ID 先寻找最低级 然后查询上去
131 Map<String,Object> map = new HashMap<>();
132 map.put("regionType",3);
133 map.put("name",str[2]);
134 List<Regions> regions = memberReadDao.getRegionsByMap(map);
135 if(StringUtil.isNull(regions) || regions.size() > 1){
136 params.put("provinceId","99999990");
137 params.put("cityId", "99999989");
138 params.put("areaId","99999988");
139 }else{
140 params.put("area",regions.get(0).getId());
141 Regions city = memberReadDao.getRegionsById(regions.get(0).getId());
142 Regions province = null;
143 if(!StringUtil.isNull(city)){
144 province = memberReadDao.getRegionsById(city.getId());
145 }
146 if(!StringUtil.isNull(city) && !StringUtil.isNull(province)){
147 params.put("provinceId", province.getId());
148 params.put("cityId", city.getId());
149 }else{
150 params.put("provinceId","99999990");
151 params.put("cityId", "99999989");
152 params.put("areaId","99999988");
153 }
154 }
92 }else{ 155 }else{
93 log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 156 log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
94 throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 157 throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
95 } 158 }
96 } 159 }
97 params.put("expressName",callRequest.getBizModel().getLogisticName()); 160 //物流公司名字
98 161 if(StringUtil.isNull(orders.getLogisticsName())){
162 Map<String,Object> m = new HashMap<>();
163 m.put("name","orders.getLogisticsName()");
164 m.put("sellerId",callRequest.getSupplier().getId());
165 List<CourierCompany> courierCompanyByName = memberReadDao.getCourierCompanyByName(m);
166 if(!StringUtil.isNull(courierCompanyByName) && !courierCompanyByName.isEmpty() && courierCompanyByName.size() == 1){
167 Optional<CourierCompany> first = courierCompanyByName.stream().findFirst();
168 params.put("logisticsName",callRequest.getBizModel().getLogisticName());
169 params.put("logisticsId", first.get().getId());
99 }else{ 170 }else{
100 log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); 171 params.put("logisticsName","其他");
101 throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); 172 params.put("logisticsId","999999990");
173 }
102 } 174 }
103 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
104 pineappleDao.updateBusinessSend(params);
105 baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
106 baseResponse.setCode(PineappleEnum.SUCCESS.getCode());
107 return baseResponse;
108 } 175 }
109
110 @Override 176 @Override
111 public String getHandleMethodName() { 177 public String getHandleMethodName() {
112 return PineappleMethodsEnum.Send.getMethod(); 178 return PineappleMethodsEnum.Send.getMethod();
......
...@@ -4,14 +4,14 @@ import com.sibu.orderHelper.common.util.StringUtil; ...@@ -4,14 +4,14 @@ import com.sibu.orderHelper.common.util.StringUtil;
4 import com.sibu.orderHelper.enums.PineappleEnum; 4 import com.sibu.orderHelper.enums.PineappleEnum;
5 import com.sibu.orderHelper.enums.PineappleMethodsEnum; 5 import com.sibu.orderHelper.enums.PineappleMethodsEnum;
6 import com.sibu.orderHelper.integral.dao.PineappleDao; 6 import com.sibu.orderHelper.integral.dao.PineappleDao;
7 import com.sibu.orderHelper.integral.model.IMProductBean; 7 import com.sibu.orderHelper.integral.model.*;
8 import com.sibu.orderHelper.integral.model.IMProductInventory;
9 import com.sibu.orderHelper.integral.model.SkuBean;
10 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 8 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
11 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 9 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
12 import com.sibu.orderHelper.integral.reponse.PineappleSyncStockResponse; 10 import com.sibu.orderHelper.integral.reponse.PineappleSyncStockResponse;
13 import com.sibu.orderHelper.integral.reponse.SkuApiResponse; 11 import com.sibu.orderHelper.integral.reponse.SkuApiResponse;
14 import com.sibu.orderHelper.integral.request.PineappleSyncStockRequest; 12 import com.sibu.orderHelper.integral.request.PineappleSyncStockRequest;
13 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
14 import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
15 import com.sibu.orderHelper.service.redis.RedisProductSkuService; 15 import com.sibu.orderHelper.service.redis.RedisProductSkuService;
16 import com.sibu.orderHelper.service.redis.RedisProductStockService; 16 import com.sibu.orderHelper.service.redis.RedisProductStockService;
17 import org.apache.log4j.Logger; 17 import org.apache.log4j.Logger;
...@@ -26,101 +26,53 @@ import java.util.Map; ...@@ -26,101 +26,53 @@ import java.util.Map;
26 @Service 26 @Service
27 public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncStockRequest> { 27 public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncStockRequest> {
28 private static Logger log = Logger.getLogger(SyncStockBizServiceImpl.class); 28 private static Logger log = Logger.getLogger(SyncStockBizServiceImpl.class);
29
30 @Resource
31 private MemberReadDao memberReadDao;
29 @Resource 32 @Resource
30 private PineappleDao pineappleDao; 33 private MemberWriteDao memberWriteDao;
31 34
32 @Transactional(rollbackFor = Exception.class) 35 @Transactional(value ="transactionManagerForMall",rollbackFor = Exception.class)
33 @Override 36 @Override
34 public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception { 37 public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception {
35 PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse(); 38 PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
39 if(callRequest.getBizModel().getQuantity() < 0){
40 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
41 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
42 }
36 Map<String,Object> params = new HashMap<>(); 43 Map<String,Object> params = new HashMap<>();
37 params.put("supplierId",callRequest.getSupplier().getId()); 44 params.put("sellerId",callRequest.getSupplier().getId());
38 params.put("productId",callRequest.getBizModel().getPlatProductID()); 45 params.put("productId",callRequest.getBizModel().getPlatProductID());
39 //先判断SKU在判断产品 46 params.put("skuId",callRequest.getBizModel().getSkuID());
40 IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params); 47 params.put("stock",callRequest.getBizModel().getQuantity());
41 if(StringUtil.isNull(iMProductBean)){ 48
42 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey())); 49 DownloadProductBean downloadProductBeans = memberReadDao.getDownloadProductBeanByMap(params);
43 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey())); 50 if(StringUtil.isNull(downloadProductBeans)){
51 log.error(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
52 throw new BizException(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
44 } 53 }
45 if(callRequest.getBizModel().getQuantity() < 0){ 54 if(memberWriteDao.updateSkuStock(params) != 1){
46 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey())); 55 log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
47 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey())); 56 throw new BizException(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
48 } 57 }
49 if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) && !"0".equals(callRequest.getBizModel().getSkuID())) { 58 List<DownloadProductSkuBean> skuBean = memberReadDao.downloadSkuByProductId(callRequest.getBizModel().getPlatProductID());
50 params.put("skuId",callRequest.getBizModel().getSkuID());
51 //查询该条SKUi
52 SkuBean skuBean = pineappleDao.getSkuBeanByMap(params);
53 if(StringUtil.isNull(skuBean)){ 59 if(StringUtil.isNull(skuBean)){
54 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey())); 60 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
55 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey())); 61 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
56 } 62 }
57 //更新该条SKU 63 //获取sku总库存
58 skuBean.setStockNum(callRequest.getBizModel().getQuantity()); 64 Integer sumStock = skuBean.stream().map(s -> s.getSkuQuantity()).reduce(0,(a,b) ->{
59 if(pineappleDao.updateSku(skuBean) > 0){
60 //根据产品ID获取所有SKU总数
61 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
62 if(StringUtil.isNull(skuBeanList)){
63 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey()));
64 throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey())));
65 }
66 //更新SKU缓存
67 RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID());
68 Integer sumStock = skuBeanList.stream().map(s -> s.getStockNum()).reduce(0,(a,b) ->{
69 return a+b; 65 return a+b;
70 }); 66 });
71 //更新产品 67 params.put("productStock",sumStock);
72 params.put("stockNum",sumStock); 68 if(memberWriteDao.updateProductStock(params) != 1){
73 if(pineappleDao.updateProduct(params) > 0){ 69 log.error(String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
74 //更新产品缓存 70 throw new BizException((String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())));
75 RedisProductStockService.setProductStock(iMProductBean.getImProductId(), sumStock);
76 //1、更新商品库存
77 IMProductInventory productInventory = new IMProductInventory();
78 productInventory.setImProductId(iMProductBean.getImProductId());
79 productInventory.setStockNum(sumStock);
80 if(pineappleDao.updateProductInventory(productInventory) > 0){
81 //更新缓存
82 pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
83 pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
84 pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
85 return pineappleSyncStockResponse;
86 }
87 }else {
88 log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
89 throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey())));
90 }
91 }else{
92 log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey()));
93 throw new BizException((String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey())));
94 } 71 }
95 }
96 if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){
97 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
98 if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){
99 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
100 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
101 }
102 params.put("stockNum",callRequest.getBizModel().getQuantity());
103 if(pineappleDao.updateProduct(params) > 0){
104 //更新产品
105 RedisProductStockService.setProductStock(iMProductBean.getImProductId(), callRequest.getBizModel().getQuantity());
106 //1、更新商品库存
107 IMProductInventory productInventory = new IMProductInventory();
108 productInventory.setImProductId(iMProductBean.getImProductId());
109 productInventory.setStockNum(callRequest.getBizModel().getQuantity());
110 if(pineappleDao.updateProductInventory(productInventory) > 0){
111 //更新缓存
112 pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity())); 72 pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
113 pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 73 pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
114 pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode()); 74 pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
115 return pineappleSyncStockResponse; 75 return pineappleSyncStockResponse;
116 }else{
117 log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
118 throw new BizException((String.format("菠萝派商城更新sku库存失败", callRequest.getRequest().getAppkey())));
119 }
120 }
121 }
122 log.error(String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey()));
123 throw new BizException((String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey())));
124 } 76 }
125 77
126 @Override 78 @Override
......
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.utils.SeqGenUtil;
6 import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
7 import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
8 import com.sibu.mall.order.response.api.ApiOrdersResponse;
9 import com.sibu.mall.order.service.ThirdApiOrderService;
10 import com.sibu.orderHelper.common.util.BeanCopyUtils;
6 import com.sibu.orderHelper.common.util.StringUtil; 11 import com.sibu.orderHelper.common.util.StringUtil;
7 import com.sibu.orderHelper.enums.PineappleEnum; 12 import com.sibu.orderHelper.enums.PineappleEnum;
8 import com.sibu.orderHelper.enums.PineappleMethodsEnum; 13 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; 14 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
15 import com.sibu.orderHelper.integral.pineapple.model.Orders;
12 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 16 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
13 import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse; 17 import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse;
14 import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest; 18 import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest;
19 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
15 import org.apache.log4j.Logger; 20 import org.apache.log4j.Logger;
16 import org.springframework.stereotype.Service; 21 import org.springframework.stereotype.Service;
17
18 import javax.annotation.Resource; 22 import javax.annotation.Resource;
19 import java.util.HashMap; 23
20 import java.util.Map;
21 @Service 24 @Service
22 public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> { 25 public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> {
23 26
24 private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class); 27 private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class);
25 28
26 @Resource 29 @Resource
27 private PineappleDao pineappleDao; 30 private MemberReadDao memberReadDao;
31
32 @Reference
33 private ThirdApiOrderService thirdApiOrderService;
28 34
29 @Override 35 @Override
30 public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception { 36 public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception {
31 UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse(); 37 UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
32 Map<String,Object> params = new HashMap<>(); 38
33 String redisMysqlDbConfig = ""; 39 ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
34 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo()); 40 //旧订单号处理
35 String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo()); 41 if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
36 params.put("doingOrderTable","im_doing_order_" + tableIndex); 42 callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
37 params.put("orderCode",callRequest.getBizModel().getPlatOrderNo()); 43 }
38 params.put("sellerRemark",callRequest.getBizModel().getSellerMemo()); 44
39 params.put("supplierId",callRequest.getSupplier().getId()); 45 thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
40 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); 46 thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
41 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 47 thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
42 IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params); 48
43 if(StringUtil.isNull(iMDoingOrderBean)){ 49 ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
44 log.error("获取订单数据业务异常"); 50 thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
45 throw new BizException("获取订单数据业务异常"); 51 thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
52 thirdUpdateOrderRequest.setRemark(callRequest.getBizModel().getSellerMemo());
53 thirdUpdateOrderRequest.setInitiationID(SeqGenUtil.getLogId());
54
55 Orders orders = null;
56 CommonResponse<ApiOrdersResponse> response = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
57 if(response.isSuccess()){
58 orders = BeanCopyUtils.copyProperties(Orders.class,response.getResult());
59 }else {
60 throw new BizException(response.getErrorMsg());
61 }
62 if(StringUtil.isNull(orders)){
63 log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
64 throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
65 }
66 CommonResponse<Boolean> updateResponse = thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
67 if(!updateResponse.isSuccess()){
68 log.error(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
69 throw new BizException(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
46 } 70 }
47 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
48 pineappleDao.updateSelle(params);
49 UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode()); 71 UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
50 UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 72 UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
51 return UpdateSellerMemoResponse; 73 return UpdateSellerMemoResponse;
......
...@@ -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>
......