dd28baea lauka

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

Conflicts:
	com.sibu.orderHelper.service/pom.xml
2 个父辈 d97d4f2a 35215635
正在显示 57 个修改的文件 包含 3580 行增加1020 行删除
......@@ -13,7 +13,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName = mall-third-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= dev.sso.qiujw
dubbo.consumerVersion= 1.0
##################### dubbo end #############################
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://172.16.2.29:2181?backup=172.16.2.48:2181,172.16.2.31:2181
dubbo.applicationName = mall-third-api-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= sibu.mall.pro
dubbo.consumerVersion= pro-1.0.1
##################### dubbo end #############################
......@@ -4,6 +4,19 @@ jdbc.driverClassName=com.mysql.jdbc.Driver
#数据库url
jdbc.imtegralurl=jdbc:mysql://10.170.4.106/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8
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
mall.write.username=sibu_integralmall
mall.write.password=09NWaUZUNjjr0IRCYzm3
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
mall.read.username=sibu_read
mall.read.password=vOrTcmMxqNdqkD0c5a7wlQ==
mall.analysis.write.url=jdbc:mysql://172.16.0.17:3306/ejavashop_analysis
mall.analysis.write.username=sibu_integralmall
mall.analysis.write.password=09NWaUZUNjjr0IRCYzm3
mall.analysis.read.url=jdbc:mysql://172.16.0.4:3306/ejavashop_analysis
mall.analysis.read.username=sibu_read
mall.analysis.read.password=vOrTcmMxqNdqkD0c5a7wlQ==
#数据库用户名
jdbc.imtegralusername=sibu_integralmall
......
......@@ -7,9 +7,9 @@
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="${jdbc.imtegralurl}"/>
<property name="username" value="${jdbc.imtegralusername}"/>
<property name="password" value="${jdbc.imtegralpassword}"/>
<property name="url" value="${mall.read.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
<property name="username" value="${mall.read.username}" />
<property name="password" value="${mall.read.password}" />
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<!-- 配置初始化大小、最小、最大 -->
......@@ -51,8 +51,8 @@
<property name="targetDataSources">
<map>
</map>
<!-- 这里用配置设置多个数据源 <map key-type="java.lang.String"> <entry key="ORCL"
value-ref="orclDataSource"></entry> <entry key="ISC" value-ref="iscDataSource"></entry>
<!-- 这里用配置设置多个数据源 <map key-type="java.lang.String"> <entry key="ORCL"
value-ref="orclDataSource"></entry> <entry key="ISC" value-ref="iscDataSource"></entry>
</map> -->
</property>
<property name="defaultTargetDataSource" ref="dataSource" />
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName = mall-third-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= dev.sso.qiujw
dubbo.consumerVersion= wangzhiliang2
##################### dubbo end #############################
......@@ -7,6 +7,19 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE
jdbc.imtegralurl=jdbc:mysql://120.76.137.184/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8
sqlserverjdbc.url=jdbc\:jtds\:sqlserver\://120.25.75.53\:1433;databaseName\=sibu_wesale_base_read_03
mall.write.url=jdbc:mysql://118.89.51.164:3306/ejavashop
mall.write.username=sibu_wesale
mall.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.read.url=jdbc:mysql://111.231.243.221:3306/ejavashop
mall.read.username=sibu_wesale
mall.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.write.url=jdbc:mysql://118.89.51.164:3306/analysis
mall.analysis.write.username=sibu_wesale
mall.analysis.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.read.url=jdbc:mysql://111.231.243.221:3306/analysis
mall.analysis.read.username=sibu_wesale
mall.analysis.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
#数据库用户名
jdbc.username=root
sqlserverjdbc.username=sa
......
......@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private Charset getContentTypeCharset(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
return contentType.getCharSet();
if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset();
}
else {
return DEFAULT_CHARSET;
......
......@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private Charset getContentTypeCharset(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
return contentType.getCharSet();
if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset();
}
else {
return DEFAULT_CHARSET;
......
package com.sibu.orderHelper.common.util;
import net.sf.cglib.beans.BeanCopier;
import net.sf.cglib.beans.BeanMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.beans.PropertyDescriptor;
import java.lang.reflect.*;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collector;
import java.util.stream.Stream;
/**
* Description:bean 拷贝
* Author: wei
* Date:2017/12/13
*/
public class BeanCopyUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(BeanCopyUtils.class);
/**
* 拷贝list
* @param dest
* @param orig
* @param <T>
* @return
*/
public static <T> List<T> copyList(Class<T> dest, List orig) {
if (CollectionUtils.isEmpty(orig)) {
return new ArrayList<>();
}
BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false);
List<T> resultList = new ArrayList<>(orig.size());
try {
for (Object o : orig) {
if (o == null) {continue;}
T destObject = dest.newInstance();
beanCopier.copy(o,destObject,null);
resultList.add(destObject);
}
return resultList;
} catch (Exception e) {
LOGGER.error("copyList error", e);
}
return resultList;
}
/**
* 拷贝list
* @param dest
* @param orig
* @return
*/
public static <D,O> List<D> copyList(Class<D> dest, List<O> orig,Consumer<D> d) {
if (CollectionUtils.isEmpty(orig)) {
return new ArrayList<>();
}
BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false);
List<D> resultList = new ArrayList<>(orig.size());
try {
for (Object o : orig) {
if (o == null) {continue;}
D destObject = dest.newInstance();
beanCopier.copy(o,destObject,null);
if(d != null){
d.accept(destObject);
}
resultList.add(destObject);
}
} catch (Exception e) {
LOGGER.error("copyList error", e);
}
return resultList;
}
/**
* 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝)
* @param dest 目标
* @param orig 源
* @param transformKey 转换
* @param <T>
* @return
*/
public static <T> List<T> copyListAndDetail(Class<T> dest,
List orig,
Map<String,String> transformKey) {
return copyListAndDetail(dest,orig,transformKey,null);
}
/**
* 拷贝List并且 明细也能拷贝(常用与 1里面包含明细数据 进行拷贝)
* @param dest
* @param orig
* @param transformKey
* @param consumer
* @return
*/
public static <T,C> List<T> copyListAndDetail(Class<T> dest,
List orig,
Map<String,String> transformKey,
BiConsumer<T,C> consumer) {
try {
List<T> resultList = new ArrayList<>();
if (orig == null || orig.size() <= 0) {
return resultList;
}
Field[] originFields = null;
Field[] destFields = null;
int i =0;
if(!CollectionUtils.isEmpty(transformKey)){
originFields = new Field[transformKey.size()];
destFields = new Field[transformKey.size()];
Class origClass = orig.get(0).getClass();
Set<Map.Entry<String, String>> entries = transformKey.entrySet();
for(Iterator<Map.Entry<String, String>> iterator = entries.iterator();iterator.hasNext();i++){
Map.Entry<String, String> entry = iterator.next();
String key = entry.getKey();//源
String value = entry.getValue();//目标
originFields[i] = origClass.getDeclaredField(key);
destFields[i] = dest.getDeclaredField(value);
}
//私有属性 允许访问
AccessibleObject.setAccessible(originFields,true);
AccessibleObject.setAccessible(destFields,true);
}
for (Object o : orig) {
T destObject = dest.newInstance();
if (o == null) {
continue;
}
copyProperties(destObject, o);
for(int a = 0;a<i; a++){
//源字段
Field originField = originFields[a];
//源里面的值
List o1 = (List)originField.get(o);
//目标字段
Field destField = destFields[a];
Class childClass = (Class)((ParameterizedType) destField.getGenericType()).getActualTypeArguments()[0];
List destList = copyList(childClass, o1,destObject,consumer);
destField.set(destObject,destList);
}
resultList.add(destObject);
}
if(originFields != null && destFields != null){
//私有属性 不允许访问
AccessibleObject.setAccessible(originFields,false);
AccessibleObject.setAccessible(destFields,false);
}
return resultList;
} catch (Exception e) {
LOGGER.error("copyListAndDetail error", e);
return null;
}
}
/**
* 拷贝list
* @param dest
* @param orig
* @param out (相当于 一对多环境中的 一)
* @param consumer
* @param <T>
* @return
*/
private static <T,O> List<T> copyList(Class<T> dest, List orig, O out, BiConsumer<O,T> consumer) {
if (CollectionUtils.isEmpty(orig)) {
return new ArrayList<>();
}
BeanCopier beanCopier = BeanCopier.create(orig.get(0).getClass(),dest,false);
List<T> resultList = new ArrayList<>(orig.size());
try {
for (Object o : orig) {
if (o == null) {continue;}
T destObject = dest.newInstance();
beanCopier.copy(o,destObject,null);
resultList.add(destObject);
if(out != null && consumer!=null){
consumer.accept(out,destObject);
}
}
return resultList;
} catch (Exception e) {
LOGGER.error("copyList error", e);
}
return resultList;
}
/**
* 多个orig对象 属性 浅拷贝到 dest
*
* @param dest
* @param orig
* @param <T>
* @return
*/
public static <T> T copyProperties(Class<T> dest, Object... orig) {
if (orig == null) {
return null;
}
try {
T destObject = dest.newInstance();
for (Object o : orig) {
copyProperties(destObject, o);
}
return destObject;
} catch (Exception e) {
LOGGER.error("copyProperties error", e);
return null;
}
}
/**
* 拷贝对象
* @param dest
* @param orig
* @param <T>
* @return
*/
public static <T> T copyProperties(Class<T> dest, Object orig) {
if (orig == null) {
return null;
}
try {
T destObject = dest.newInstance();
copyProperties(destObject, orig);
return destObject;
} catch (Exception e) {
LOGGER.error("copyProperties error", e);
return null;
}
}
/**
* 使用 org.springframework.beans.BeanUtils 拷贝对象
* @param dest
* @param orig
*/
public static void copyProperties(Object dest, Object orig) {
try {
BeanCopier copier = BeanCopier.create(orig.getClass(), dest.getClass(), false);
copier.copy(orig, dest,null);
} catch (Exception e) {
LOGGER.error("copyProperties error", e);
}
}
/**
* 根据指定名称键值对,填充javaBean对象。
* @param bean
* @param properties
*/
public static void populate(Object bean, Map properties) {
try {
BeanMap beanMap = BeanMap.create(bean);
beanMap.putAll(properties);
} catch (Exception e) {
LOGGER.error("populate bean property error", e);
}
}
/**
* 根据指定名称键值对,填充javaBean对象。
* @param c
* @param properties
*/
public static <T> T populate(Class<T> c, Map properties) {
try {
T o = c.newInstance();
BeanMap beanMap = BeanMap.create(o);
beanMap.putAll(properties);
return (T)beanMap.getBean();
} catch (Exception e) {
LOGGER.error("populate bean property error", e);
}
return null;
}
/**
* 根据指定名称键值对,填充javaBean对象。
*/
public static <T> List<T> populateList(Class<T> dest, List<Map<String,Object>> orig) {
if (CollectionUtils.isEmpty(orig)) {
return new ArrayList<>();
}
List<T> resultList = new ArrayList<>(orig.size());
try {
BeanMap beanMap = BeanMap.create(dest.newInstance());
for (Map o : orig) {
if (o == null) {continue;}
T destObject = dest.newInstance();
beanMap.setBean(destObject);
beanMap.putAll(o);
resultList.add(destObject);
}
return resultList;
} catch (Exception e) {
LOGGER.error("copyList error", e);
}
return resultList;
}
/**
* 检查并返回集合中的一个对象
* 集合不能多于一个对象
* 集合为空时返回null
* @param list
* @param <T>
* @return
*/
/* public static <T> T getSingleResult(List<T> list) {
if (CollectionUtils.isEmpty(list)) {
return null;
}else if(list.size() == 1){
return list.get(0);
}else{
//加载到多余数据
throw new BusinessException("加载到多余条数");
}
}*/
/**
* 检查并返回集合中的第一对象
* 集合为空时返回null
* @param list
* @param <T>
* @return
*/
public static <T> T getFirstResult(List<T> list) {
if (CollectionUtils.isEmpty(list)) {
return null;
}else {
return list.get(0);
}
}
/**
* 公共转换 从List转成Map
*
* @param stat
* @return
*/
public static <K,V,T> Map<K, V> transformListToMap(List<T> stat,
Collector<T,Map, Map> collector){
Map<K, V> hashMap = null;
if (!CollectionUtils.isEmpty(stat)) {
Stream<T> stream = null;
if (stat.size() > 1000) {//并行去收集
stream = stat.parallelStream();
} else {
//否则串行去收集
stream = stat.stream();
}
hashMap = stream.collect(collector);
}
return hashMap;
}
/**
* 填充数据
*
* @param finalResult
* @param intoResult
* @param params
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
public static <T> Map<String, T> getAssemblyResult(Map<String, T> finalResult,
Map<String, T> intoResult,
Class<T> c,
String[] params) throws InvocationTargetException, IllegalAccessException {
if (!CollectionUtils.isEmpty(intoResult)) {
for (Map.Entry<String, T> entry : intoResult.entrySet()) {
//key
String key = entry.getKey();
//value
T value = entry.getValue();
T statPerDayOrder = finalResult.get(key);
if (statPerDayOrder == null) {
finalResult.put(key, value);
} else {
for (String param : params) {
PropertyDescriptor propertyDescriptor = BeanUtils.getPropertyDescriptor(c, param);
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
//从finalResult里面获取
Object oldValue = readMethod.invoke(statPerDayOrder);
//从新加入对象读
Object paramValue = readMethod.invoke(value);
if(oldValue != null && paramValue != null){
if(BigDecimal.class.isInstance(paramValue)){//BigDecimal
BigDecimal old = (BigDecimal) oldValue;
paramValue = old.add((BigDecimal) paramValue);
}else if(Integer.class.isInstance(paramValue)){
Integer old = (Integer) oldValue;
paramValue = old+(Integer) paramValue;
}else if(Long.class.isInstance(paramValue)){
Long old = (Long) oldValue;
paramValue = old+(Long) paramValue;
}
}
//往已有对象里面写
writeMethod.invoke(statPerDayOrder, paramValue);
}
}
}
}
return finalResult;
}
}
#redis连接
address1=120.76.137.184:6379
address2=120.76.137.184:6380
address3=120.24.234.38:6379
address4=120.24.234.38:6380
address5=120.24.65.223:6379
address6=120.24.65.223:6380
address1=10.116.35.133:6379
address2=10.116.35.133:6380
address3=10.170.13.1:6379
address4=10.170.13.1:6380
address5=10.44.79.57:6379
address6=10.44.79.57:6380
maxRedirections=6
\ No newline at end of file
......
package com.sibu.orderHelper.integral.dao;
import com.sibu.orderHelper.integral.model.*;
import com.sibu.orderHelper.integral.pineapple.model.*;
import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.reponse.SkuApiResponse;
......@@ -11,147 +13,127 @@ import java.util.Map;
public interface PineappleDao {
/**
* 退货退款单下载
* 根据订单号查询订单信息 只查询不是主订单的订单
* @param params
* @return
*/
List<GetRefundBean> pageGetRefundBean(Map<String,Object> params)throws Exception;
PineappleOderDetailBean getOneIMOrderById(Map<String,Object> map)throws Exception;
//获取api中的商品详情
IMAPIProductBean getApiProductDetailById(@Param("productId") String productId) throws Exception;
//根据条件查询退款订单
int countCheckRefundStatusResponse(Map<String,Object> params)throws Exception;
Orders getOrdersByMap(Map<String,Object> params);
/**
* 根据条件判断该订单是否有成功过的退款记录
* 修改订单备注
* @param params
* @return
* @throws Exception
*/
IMDoingOrderBean getIMDoingOrderBean(Map<String,Object> params)throws Exception;
int updateOdersRemark(Map<String,Object> params);
/**
* 根据orderCode查询成功退款明细记录
* @param orderCode
* 查询该订单是否有该快递单号
* @param params
* @return
* @throws Exception
*/
List<CheckRefundStatusBean> childrenrefundStatusBySuccess(@Param("orderCode")String orderCode)throws Exception;
int checkLogisticsNumber(Map<String,Object> params);
/**
* 根据条件判断该订单是否有退款中的退款记录
* @param orderCode
* 订单发货更新订单状态与信息
* @param params
* @return
* @throws Exception
*/
List<CheckRefundStatusBean> childrenrefundStatusByCourse(@Param("orderCode")String orderCode)throws Exception;
int updateOrdersState(Map<String,Object> params);
/**
* 根据条件查询产品
* 商品下载
* @param params
* @return
* @throws Exception
*/
IMProductBean getIMProductBeanByMap(Map<String,Object> params)throws Exception;
List<DownloadProductBean> downloadProductListByMap(Map<String,Object> params);
/**
* 修改订单备注
* 根据条件查询商品
* @param params
* @return
*/
int updateSelle(Map<String,Object> params)throws Exception;
DownloadProductBean getDownloadProductBeanByMap(Map<String,Object> params);
/**
* 订单发货
* @param params
* 根据商品ID获取该商品的所有SKU
* @param productId
* @return
* @throws Exception
*/
int updateBusinessSend(Map<String,Object> params)throws Exception;
List<DownloadProductSkuBean> downloadSkuByProductId(@Param("productId") String productId);
/**
* 订单发货时判断订单号是否存在,已存在就不添加该订单号
* 根据条件更新sku库存
* @param params
* @return
* @throws Exception
*/
int getOrderByMap(Map<String,Object> params)throws Exception;
int updateSkuStock(Map<String,Object> params);
/**
* 根据条件查SKU
* 根据商品ID更新商品库存
* @param params
* @return
* @throws Exception
*/
SkuBean getSkuBeanByMap(Map<String,Object> params)throws Exception;
int updateProductStock(Map<String,Object> params);
/**
* 根据产品ID查询所有SKU
* @param productId
* 订单下载
* @param params
* @return
* @throws Exception
*/
List<SkuApiResponse> getSkuBeanListByMap(String productId)throws Exception;
List<Orders> getOrdersList(Map<String,Object> params);
/**
* 更新SKU库存
* @param skuBean
* 子订单查询
* @param orderSn
* @return
* @throws Exception
*/
int updateSku(SkuBean skuBean)throws Exception;
List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn);
//更新产品库存
int updateProductInventory(IMProductInventory productInventory) throws Exception;
/**
* 更新产品库存
* 根据条件查询省市级信息
* @param params
* @return
* @throws Exception
*/
int updateProduct(Map<String,Object> params)throws Exception;
Regions getRegionsByMap(Map<String,Object> params);
/**
* 根据id查询省市级信息
* @param id
* @return
*/
Regions getRegionsById(@Param("id") Integer id);
/**
* 商品下载 查询产品
* @param params
* 根据条件查询物流公司
* @return
* @throws Exception
*/
List<DownloadProductBean> getProductListByMap(Map<String,Object> params)throws Exception;
List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
/**
* 根据产品ID查询SKU
* @param productid
* 根据订单号查询退货信息
* @param orderSn
* @return
* @throws Exception
*/
List<DownloadProductSkuBean> getDownloadProductSkuBeanList(String productid)throws Exception;
List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据产品ID查询SKU属性
* @param skuId
* 根据订单号查询换货信息
* @param orderSn
* @return
* @throws Exception
*/
List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception;
List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据订单ID查询投诉表
* @param id
* @return
*/
List<SellerComplaint> getSellerComplaintByOrderId(@Param("orderId") Integer id);
IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception;
IMProductBean getIMProductBeanById(@Param("productId") String productId)throws Exception;
}
......
package com.sibu.orderHelper.mall.member.read;
import com.sibu.orderHelper.integral.model.DownloadProductBean;
import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
import com.sibu.orderHelper.integral.model.GetRefundBean;
import com.sibu.orderHelper.integral.model.IMSupplierApp;
import com.sibu.orderHelper.integral.pineapple.model.*;
import com.sibu.orderHelper.integral.reponse.MemberAddressResponse;
import com.sibu.orderHelper.integral.request.GetRefundRequest;
import com.sibu.orderHelper.integral.request.MemberAddressAddRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface MemberReadDao {
Integer count();
IMSupplierApp findByAppIdAndAppType(Map<String, String> params);
/**
* 根据订单号查询订单信息 只查询不是主订单的订单
* @param params
* @return
*/
Orders getOrdersByMap(Map<String,Object> params);
/**
* 查询该订单是否有该快递单号
* @param params
* @return
*/
int checkLogisticsNumber(Map<String,Object> params);
/**
* 商品下载
* @param params
* @return
*/
List<DownloadProductBean> downloadProductListByMap(Map<String,Object> params);
/**
* 商品下载总数量
* @param params
* @return
*/
int countDownloadProductListByMap(Map<String,Object> params);
/**
* 根据条件查询商品
* @param params
* @return
*/
DownloadProductBean getDownloadProductBeanByMap(Map<String,Object> params);
/**
* 根据商品ID获取该商品的所有SKU
* @param productId
* @return
*/
List<DownloadProductSkuBean> downloadSkuByProductId(@Param("productId") String productId);
/**
* 订单下载
* @param params
* @return
*/
List<Orders> getOrdersList(Map<String,Object> params);
/**
* 订单下载总数
* @param params
* @return
*/
int countgetOrdersList(Map<String,Object> params);
/**
* 子订单查询
* @param orderSn
* @return
*/
List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn);
/**
* 根据条件查询省市级信息
* @param params
* @return
*/
List<Regions> getRegionsByMap(Map<String,Object> params);
/**
* 根据id查询省市级信息
* @param id
* @return
*/
Regions getRegionsById(@Param("id") Integer id);
/**
* 根据id查询省市级信息
* @param regionIdList
* @return
*/
List<Regions> getRegionsByIds(@Param("list") List regionIdList);
/**
* 根据条件查询物流公司
* @return
*/
List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
/**
* 根据订单号查询退货信息
* @param orderSn
* @return
*/
List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据订单号查询换货信息
* @param orderSn
* @return
*/
List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据订单ID查询投诉表
* @param id
* @return
*/
List<SellerComplaint> getSellerComplaintById(@Param("orderId") Integer id);
List<Seller> getSeller(@Param("id") String id);
/**
* 退款单下载
* @param params
* @return
*/
List<GetRefundBean> getGetRefundBean(Map<String,Object> params);
int countGetGetRefundBean(Map<String,Object> params);
/**
* 查询退款单的订单购买数量
* @param orderProductId
* @return
*/
int countOrderProductNum(@Param("id") String orderProductId);
/**
* 根据旧订单号获取新订单号
* @param orderSn
* @return
*/
String getNewOrderSnByOldOrderSn(@Param("orderSn") String orderSn);
}
package com.sibu.orderHelper.mall.member.write;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import java.util.Map;
public interface MemberWriteDao {
Integer count();
/**
* 根据订单号查询订单信息 只查询不是主订单的订单
* @param params
* @return
*/
Orders getOrdersByMap(Map<String,Object> params);
/**
* 修改订单备注
* @param params
* @return
*/
int updateOdersRemark(Map<String,Object> params);
/**
* 订单发货更新订单状态与信息
* @param params
* @return
*/
int updateOrdersState(Map<String,Object> params);
/**
* 根据条件更新sku库存
* @param params
* @return
*/
int updateSkuStock(Map<String,Object> params);
/**
* 根据商品ID更新商品库存
* @param params
* @return
*/
int updateProductStock(Map<String,Object> params);
/**
* 查询该订单是否有该快递单号
* @param params
* @return
*/
int checkLogisticsNumber(Map<String,Object> params);
}
......@@ -18,6 +18,20 @@
<groupId>com.sibu.orderHelper.service</groupId>
<artifactId>com.sibu.orderHelper.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
......@@ -30,6 +44,7 @@
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>com.sibu.orderHelper.integralMall</finalName>
......
......@@ -10,6 +10,8 @@ import com.sibu.orderHelper.common.util.SpringValuesUtil;
import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
import com.sibu.orderHelper.integral.vo.PayType;
import com.sibu.orderHelper.integralMall.controller.BaseController;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
import org.apache.commons.lang3.time.DateUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
......@@ -18,11 +20,9 @@ import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.ValidationException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
......@@ -47,6 +47,21 @@ import java.util.Map;
public class IMOrderTestController extends BaseController {
@Autowired
private IIMDoingOrderService iimDoingOrderService;
@Resource
private MemberReadDao memberReadDao;
@Resource
private MemberWriteDao memberWriteDao;
/**
*
*
* @return
*/
@RequestMapping(value = "/test/mall/read-write/datasource", method = RequestMethod.GET)
public BaseResponse testReadAndWriteDb() {
String r = String.format("%s-%s", memberReadDao.count(), memberWriteDao.count());
return ResponseRender.renderData(r);
}
/**
* 验证测试环境
......
......@@ -14,6 +14,7 @@ import com.sibu.orderHelper.integral.model.IMSupplier;
import com.sibu.orderHelper.integral.model.IMSupplierApp;
import com.sibu.orderHelper.integral.pineapple.enums.SubErrorEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Seller;
import com.sibu.orderHelper.integral.pineapple.request.BaseRequest;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
......@@ -27,6 +28,7 @@ import com.sibu.orderHelper.integral.service.pineapple.BizService;
import com.sibu.orderHelper.integral.service.pineapple.util.JsonUtils;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import com.sibu.orderHelper.integral.service.pineapple.util.XmlUtils;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -67,6 +69,8 @@ public class PineappleController {
private IMSupplierAppService imSupplierAppService;
@Autowired
private IMSupplierDao imSupplierDao;
@Resource
private MemberReadDao memberReadDao;
@RequestMapping(
value = "/pineapple/call",
......@@ -169,14 +173,19 @@ public class PineappleController {
}
private IMSupplier findAndCheckIMSupplier(BaseRequest request, IMSupplierApp imSupplierApp) {
List<IMSupplier> imSuppliers = imSupplierDao.findByIdIn(Arrays.asList(imSupplierApp.getSupplierId()));
if (CollectionUtils.isEmpty(imSuppliers)) {
//List<IMSupplier> imSuppliers = imSupplierDao.findByIdIn(Arrays.asList(imSupplierApp.getSupplierId()));
List<Seller> seller = memberReadDao.getSeller(imSupplierApp.getSupplierId());
if (CollectionUtils.isEmpty(seller)) {
throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据为空,请联系客服", request.getAppkey()));
}
if (imSuppliers.size() > 1) {
if (seller.size() > 1) {
throw new BizException(MessageFormat.format("appKey【{0}】的店铺数据有重复,请联系客服", request.getAppkey()));
}
return imSuppliers.get(0);
Seller entity = seller.get(0);
IMSupplier iMSupplier = new IMSupplier();
iMSupplier.setId(String.valueOf(entity.getId()));
iMSupplier.setName(entity.getName());
return iMSupplier;
}
private IMSupplierApp findAndCheckSupplierApp(BaseRequest request) {
......
......@@ -28,6 +28,9 @@
<!--加载mq配置-->
<import resource="classpath:META-INF/conf/service-spring-mq.xml"></import>
<!--dubbo配置-->
<import resource="classpath:META-INF/conf/dubbo-consumer-config.xml"></import>
<!-- 开启注解配置
<context:annotation-config />-->
......
......@@ -35,7 +35,7 @@
<!--DEBUG信息输出-->
<appender name="LOG.DEBUG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/var/tomcat_8081/pineapple/integral_logs/debug_" />
<param name="File" value="/var/tomcat/mall/third-api/debug_" />
<param name="DatePattern" value="yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......@@ -48,7 +48,7 @@
<!--INFO信息输出-->
<appender name="LOG.INFO" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/var/tomcat_8081/pineapple/integral_logs/info_" />
<param name="File" value="/var/tomcat/mall/third-api/info_" />
<param name="DatePattern" value="yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......@@ -61,7 +61,7 @@
<!--WARN信息输出-->
<appender name="LOG.WARN" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/var/tomcat_8081/pineapple/integral_logs/warn_" />
<param name="File" value="/var/tomcat/mall/third-api/warn_" />
<param name="DatePattern" value="yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......@@ -74,7 +74,7 @@
<!--ERROR信息输出-->
<appender name="LOG.ERROR" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/var/tomcat_8081/pineapple/integral_logs/error_" />
<param name="File" value="/var/tomcat/mall/third-api/error_" />
<param name="DatePattern" value="yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......@@ -87,7 +87,7 @@
<!--FATAL信息-->
<appender name="LOG.FATAL" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/var/tomcat_8081/pineapple/integral_logs/fatal_" />
<param name="File" value="/var/tomcat/mall/third-api/fatal_" />
<param name="DatePattern" value="yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] [%C-%M] %m%n" />
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.mall.member.read.MemberReadDao">
<select id="count" resultType="java.lang.Integer">
select count(*) from member
</select>
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
<result property="orderState" column="order_state" />
<result property="moneyOrder" column="money_order" />
<result property="moneyPaidBalance" column="money_paid_balance" />
<result property="moneyCoupon" column="money_coupon" />
<result property="moneyLogistics" column="money_logistics" />
<result property="moneyProduct" column="money_product" />
<result property="moneyActFull" column="money_act_full" />
<result property="moneyDiscount" column="money_discount" />
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
<result property="couponMoney" column="couponMoney" />
<result property="moneyDiscount" column="money_discount" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
<select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
select * from orders where order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND is_parent = 0
</select>
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!-- 商品下载实体-->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="id" property="PlatProductID"/>
<result column="productName" property="name"/>
<result column="outerID" property="OuterID"/>
<result column="price" property="price"/>
<result column="num" property="num"/>
<result column="pictureurl" property="pictureurl"/>
</resultMap>
<!-- 商品下载 -->
<select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.id = #{productId} or p.product_code = #{productId})
</if>
<if test="state !=null and state !='' and state != -1">
AND p.state = #{state}
</if>
<if test="state !=null and state !='' and state == -1">
AND p.state IN ('6','7')
</if>
<if test="productName !=null and productName !=''">
AND p.name1 = #{productName}
</if>
ORDER BY p.update_time DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 根据条件查询商品 -->
<select id="getDownloadProductBeanByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND p.id = #{productId}
</if>
</select>
<!-- 商品下载总数量 -->
<select id="countDownloadProductListByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.id = #{productId} or p.product_code = #{productId})
</if>
<if test="state !=null and state !='' and state != -1">
AND p.state = #{state}
</if>
<if test="state !=null and state !='' and state == -1">
AND p.state IN ('6','7')
</if>
<if test="productName !=null and productName !=''">
AND p.name1 = #{productName}
</if>
</select>
<!-- 商品sku实体 -->
<resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="skuId" property="SkuID"/>
<result column="skuId" property="skuOuterID"/>
<result column="skuprice" property="skuprice"/>
<result column="skuQuantity" property="skuQuantity"/>
<result column="skuname" property="skuname"/>
<result column="skupictureurl" property="skupictureurl"/>
</resultMap>
<!-- 获取商品sku -->
<select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
select g.sku AS skuId,g.mall_mobile_price AS skuprice,g.product_stock AS skuQuantity,
g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g
WHERE g.product_id = #{productId}
</select>
<!-- 主订单下载-->
<select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
c.regionName AS regionName2,a.regionName AS regionName3,
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,
o.money_order,o.money_product,o.pay_time,o.member_name FROM orders o
LEFT JOIN regions p ON p.id = o.province_id
LEFT JOIN regions c ON c.id = o.city_id
LEFT JOIN regions a ON a.id = o.area_id
WHERE o.is_parent = 0
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and o.create_time <= #{endTime}
]]>
</if>
ORDER BY o.create_time DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 订单下载总数-->
<select id="countgetOrdersList" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) FROM orders o
WHERE o.is_parent = 0
AND o.seller_id = #{sellerId}
<if test="orderState!=null and orderState!=''">
AND o.order_state in
<foreach collection="orderState" item="state" open="(" close=")" separator=",">
#{state}
</foreach>
</if>
<if test="orderSn!=null and orderSn!=''">
AND o.order_sn = #{orderSn}
</if>
<if test="startTime!=null and startTime!=''">
AND o.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[
and o.create_time <= #{endTime}
]]>
</if>
</select>
<!-- 子订单实体-->
<resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
<result property="id" column="id" />
<result property="ordersId" column="orders_id" />
<result property="ordersSn" column="orders_sn" />
<result property="ordersPsn" column="orders_psn" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="productCateId" column="product_cate_id" />
<result property="productId" column="product_id" />
<result property="productGoodsId" column="product_goods_id" />
<result property="specInfo" column="spec_info" />
<result property="productName" column="product_name" />
<result property="productSku" column="product_sku" />
<result property="packageGroupsId" column="package_groups_id" />
<result property="mallGroupsId" column="mall_groups_id" />
<result property="giftId" column="gift_id" />
<result property="isGift" column="is_gift" />
<result property="moneyPrice" column="money_price" />
<result property="number" column="number" />
<result property="moneyAmount" column="money_amount" />
<result property="moneyFullAoumt" column="money_full_amount" />
<result property="deductionProductVbMoney" column="deduction_product_vb_money" />
<result property="moneyActSingle" column="money_act_single" />
<result property="actSingleId" column="act_single_id" />
<result property="actGroupId" column="act_group_id" />
<result property="actFlashSaleId" column="act_flash_sale_id" />
<result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
<result property="actBiddingId" column="act_bidding_id" />
<result property="actIntegralId" column="act_integral_id" />
<result property="actIntegralNum" column="act_integral_num" />
<result property="actIntegralMoney" column="act_integral_money" />
<result property="systemRemark" column="system_remark" />
<result property="backNumber" column="back_number" />
<result property="exchangeNumber" column="exchange_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isEvaluate" column="is_evaluate" />
<result property="moneyCouponAmount" column="money_coupon_amount" />
</resultMap>
<!-- 查询子订单-->
<select id="getOrdersProductList" parameterType="java.lang.String" resultMap="ordersProduct">
SELECT product_goods_id,id,product_name,spec_info,number,money_price,money_act_single,money_coupon_amount,money_full_amount FROM orders_product
WHERE orders_sn = #{orderSn}
</select>
<!-- 地址实体类-->
<resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions">
<result property="id" column="id" />
<result property="parentId" column="parentId" />
<result property="regionName" column="regionName" />
<result property="parentPath" column="parentPath" />
<result property="firstLetter" column="firstLetter" />
<result property="regionType" column="regionType" />
<result property="agencyId" column="agencyId" />
<result property="shippingId" column="shippingId" />
<result property="visible" column="visible" />
<result property="rowId" column="rowId" />
</resultMap>
<!-- 根据条件查询省市级信息-->
<select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult">
SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType}
</select>
<!-- 根据id查询省市级信息-->
<select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult">
select
*
from `regions`
where `id` = #{id}
</select>
<!-- 根据id查询省市级信息-->
<select id="getRegionsByIds" resultMap="regionsResult">
select
*
from `regions`
where `id` in
<foreach collection="list" item="regionId" open="(" close=")" separator=",">
#{regionId}
</foreach>
</select>
<!-- 物流公司实体-->
<resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="state" column="state" />
<result property="companyMark" column="company_mark" />
<result property="companyName" column="company_name" />
<result property="seq" column="seq" />
<result property="sellerId" column="seller_id" />
<result property="companyType" column="company_type" />
<result property="imagePath" column="image_path" />
<result property="content" column="content" />
</resultMap>
<!-- 根据条件查询物流公司-->
<select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult">
select
*
from `courier_company`
where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
</select>
<!--退货表实体-->
<resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="contactPhone" column="contact_phone" />
<result property="contactName" column="contact_name" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="stateReturn" column="state_return" />
<result property="stateMoney" column="state_money" />
<result property="number" column="number" />
<result property="backMoney" column="back_money" />
<result property="backIntegral" column="back_integral" />
<result property="backIntegralMoney" column="back_integral_money" />
<result property="backCouponUserId" column="back_coupon_user_id" />
<result property="backMoneyTime" column="back_money_time" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
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
</select>
<!--换货实体类-->
<resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="provinceId2" column="province_id2" />
<result property="cityId2" column="city_id2" />
<result property="areaId2" column="area_id2" />
<result property="addressAll2" column="address_all2" />
<result property="addressInfo2" column="address_info2" />
<result property="zipCode2" column="zip_code2" />
<result property="changeName2" column="change_name2" />
<result property="phone2" column="phone2" />
<result property="logisticsId2" column="logistics_id2" />
<result property="logisticsName2" column="logistics_name2" />
<result property="logisticsMark2" column="logistics_mark2" />
<result property="logisticsNumber2" column="logistics_number2" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time DESC
</select>
<!-- 投诉表实体-->
<resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="orderId" column="order_id" />
<result property="orderProductId" column="order_product_id" />
<result property="productBackId" column="product_back_id" />
<result property="productExchangeId" column="product_exchange_id" />
<result property="content" column="content" />
<result property="image" column="image" />
<result property="complaintTime" column="complaint_time" />
<result property="sellerId" column="seller_id" />
<result property="sellerComplaintTime" column="seller_complaint_time" />
<result property="sellerCompContent" column="seller_comp_content" />
<result property="sellerCompImage" column="seller_comp_image" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optContent" column="opt_content" />
<result property="userContent" column="user_content" />
<result property="createTime" column="create_time" />
<result property="optTime" column="opt_time" />
</resultMap>
<!-- 根据条件查询投诉表-->
<select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
</select>
<select id="findByAppIdAndAppType" resultMap="BaseResultMap">
select * from im_supplier_app where app_id=#{appId} and app_type = #{appType} and app_token = #{appToken}
</select>
<resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMSupplierApp">
<result column="id" property="id"/>
<result column="supplier_id" property="supplierId"/>
<result column="app_id" property="appId"/>
<result column="app_type" property="appType"/>
<result column="app_token" property="appToken"/>
<result column="app_secret" property="appSecret"/>
</resultMap>
<select id="findByIdIn" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
*
FROM im_supplier
where id in
<foreach collection="supplierIds" item="supplierId" open="(" close=")" separator=",">
#{supplierId}
</foreach>
</select>
<select id="getSeller" parameterType="java.lang.String" resultType="com.sibu.orderHelper.integral.pineapple.model.Seller">
select * from seller
where `id` = #{id}
</select>
<resultMap id="GetRefundBeanMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
<result column="member_back_code" property="refundno"/>
<result column="order_sn" property="platorderno"/>
<result column="order_product_id" property="subplatorderno"/>
<result column="orders_product_uid" property="ordersproductuid"/>
<result column="back_money" property="refundamount"/>
<result column="create_time" property="createtime"/>
<result column="member_name" property="buyernick"/>
<result column="state_return" property="refundstatus"/>
<result column="state_money" property="stateMoney"/>
<result column="question" property="reason"/>
<result column="product_name" property="productname"/>
<result column="logistics_name" property="logisticname"/>
<result column="logistics_number" property="logisticno"/>
<result column="seller_name" property="sellernick"/>
<result column="money_order" property="totalamount"/>
<result column="order_state" property="orderstatus"/>
<result column="money_order" property="payamount"/>
</resultMap>
<select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap">
SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name,
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,b.orders_product_uid
FROM member_product_back b
WHERE b.seller_id = #{supplierId}
<if test="beginTime!=null">
AND b.create_time >= #{beginTime}
</if>
<if test="endTime!=null">
<![CDATA[
and b.create_time <= #{endTime}
]]>
</if>
ORDER by member_back_code DESC
limit ${PageIndex}, ${PageSize}
</select>
<select id="countGetGetRefundBean" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM member_product_back b
WHERE b.seller_id = #{supplierId}
<if test="beginTime!=null">
AND b.create_time >= #{beginTime}
</if>
<if test="endTime!=null">
<![CDATA[
and b.create_time <= #{endTime}
]]>
</if>
</select>
<select id="countOrderProductNum" resultType="java.lang.Integer">
SELECT number FROM orders_product where id = #{id}
</select>
<select id="getNewOrderSnByOldOrderSn" parameterType="java.lang.String" resultType="java.lang.String">
SELECT order_sn FROM orders WHERE order_sn_back= #{orderSn}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.mall.member.write.MemberWriteDao">
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
<result property="orderState" column="order_state" />
<result property="moneyOrder" column="money_order" />
<result property="moneyPaidBalance" column="money_paid_balance" />
<result property="moneyCoupon" column="money_coupon" />
<result property="moneyLogistics" column="money_logistics" />
<result property="moneyProduct" column="money_product" />
<result property="moneyActFull" column="money_act_full" />
<result property="moneyDiscount" column="money_discount" />
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
</resultMap>
<select id="count" resultType="java.lang.Integer">
select count(*) from member
</select>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
<select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
select * from orders where order_sn=#{orderSn,jdbcType=VARCHAR} AND seller_id=#{sellerId,jdbcType=INTEGER} AND is_parent = 0
</select>
<!-- 修改订单备注 -->
<update id="updateOdersRemark" parameterType="java.util.Map">
UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
<update id="updateOrdersState">
UPDATE orders
<set>
<if test="name !=null and name !=''">
name = #{name},
</if>
<if test="addressInfo !=null and addressInfo !=''">
address_info = #{addressInfo},
</if>
<if test="logisticsNumber !=null and logisticsNumber !=''">
logistics_number = #{logisticsNumber},
</if>
<if test="mobile !=null and mobile !=''">
mobile = #{mobile},
</if>
<if test="addressAll !=null and addressAll !=''">
address_all = #{addressAll},
</if>
<if test="orderState !=null and orderState !=''">
order_state = #{orderState},
</if>
<if test="provinceId !=null and provinceId !=''">
province_id = #{provinceId},
</if>
<if test="areaId !=null and areaId !=''">
area_id = #{areaId},
</if>
<if test="cityId !=null and cityId !=''">
city_id = #{cityId},
</if>
<if test="deliverTime !=null and deliverTime !=''">
deliver_time = now(),
</if>
<if test="logisticsName !=null and logisticsName !=''">
logistics_name = #{logisticsName},
</if>
<if test="logisticsId !=null and logisticsId !=''">
logistics_id = #{logisticsId},
</if>
update_time = now()
</set>
WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 更新SKU库存-->
<update id="updateSkuStock" parameterType="java.util.Map">
UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
</update>
<!-- 更新产品库存-->
<update id="updateProductStock" parameterType="java.util.Map">
UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
</update>
</mapper>
\ No newline at end of file
......@@ -3,477 +3,451 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.integral.dao.PineappleDao">
<!--检测退款订单-->
<select id="countCheckRefundStatusResponse" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM im_order_refund WHERE order_code = #{orderCode} AND refund_status NOT IN ('100','101','-128')
</select>
<select id="getIMDoingOrderBean" parameterType="java.util.Map" resultMap="iMDoingOrderBean">
select order_code,order_status from ${doingOrderTable} WHERE order_code = #{orderCode} and supplier_id =#{supplierId}
</select>
<resultMap id="iMDoingOrderBean" type="com.sibu.orderHelper.integral.model.IMDoingOrderBean">
<result column="order_code" property="orderCode"/>
<result column="order_status" property="orderStatus"/>
</resultMap>
<select id="childrenrefundStatusBySuccess" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status = 7 AND r.order_code = #{orderCode}
</select>
<resultMap id="checkRefundStatusBean" type="com.sibu.orderHelper.integral.model.CheckRefundStatusBean">
<result column="refund_code" property="refundno"/>
<result column="name" property="ProductName"/>
<result column="refund_status" property="refundStatus"/>
</resultMap>
<select id="childrenrefundStatusByCourse" parameterType="java.lang.String" resultMap="checkRefundStatusBean">
SELECT r.refund_code,r1.name,r.refund_status FROM im_refund_order_item r1
LEFT JOIN im_order_refund r ON r1.refund_id = r.refund_id
WHERE r.refund_status NOT IN ('7','100','101','-128') AND r.order_code = #{orderCode}
</select>
<!-- 退货退款单下载 -->
<resultMap id="getRefundBeanResultMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
<result column="refund_code" property="refundno"/>
<result column="order_code" property="platorderno"/>
<result column="order1_id" property="subplatorderno"/>
<result column="refund_money" property="refundamount"/>
<result column="apply_date" property="createtime"/>
<result column="refund_status_last_update_dt" property="updatetime"/>
<result column="refund_reason" property="reason"/>
<result column="name" property="productname"/>
<result column="refund_goods_deliver_name" property="logisticname"/>
<result column="refund_goods_waybill" property="logisticno"/>
<result column="status" property="goodsstatus"/>
<result column="refund_remark" property="refundstatusdesc"/>
<result column="refund_status" property="refundstatus"/>
<result column="spec_detail" property="sku"/>
<result column="im_product_id" property="outerid"/>
</resultMap>
<select id="pageGetRefundBean" parameterType="java.util.Map" resultMap="getRefundBeanResultMap">
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,
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
FROM im_order_refund r
LEFT JOIN im_refund_order_item r1 ON r.refund_id = r1.refund_id
LEFT JOIN im_product p ON p.im_product_id = r1.product_id
WHERE 1 = 1 and r.order_from = 1 and r.refund_status NOT IN ('100','101','-128')
<if test="supplierId!=null and supplierId !=''">
AND r.supplier_id = #{supplierId}
</if>
<if test="beginTime != null and beginTime !=''">
and r.apply_date >= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
<![CDATA[
and r.apply_date <= #{endTime}
]]>
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="province" column="regionName1" />
<result property="city" column="regionName2" />
<result property="area" column="regionName3" />
</resultMap>
<!-- 根据订单号查询订单信息 只查询不是主订单的订单 -->
<select id="getOrdersByMap" parameterType="java.util.Map" resultMap="orders">
select * from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} AND is_parent = 0
</select>
<!-- 修改订单备注 -->
<update id="updateOdersRemark">
UPDATE orders SET remark = #{remark} WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
<update id="updateOrdersState">
UPDATE orders SET
<set>
<if test="name !=null and name !=''">
name = #{name},
</if>
<if test="addressInfo !=null and addressInfo !=''">
address_info = #{addressInfo},
</if>
<if test="logisticsNumber !=null and logisticsNumber !=''">
logistics_number = #{logisticsNumber},
</if>
<if test="mobile !=null and mobile !=''">
mobile = #{mobile},
</if>
<if test="addressAll !=null and addressAll !=''">
address_all = #{addressAll},
</if>
<if test="orderState !=null and orderState !=''">
order_state = #{orderState},
</if>
<if test="provinceId !=null and provinceId !=''">
province_id = #{provinceId},
</if>
<if test="areaId !=null and areaId !=''">
area_id = #{areaId},
</if>
<if test="cityId !=null and cityId !=''">
city_id = #{cityId},
</if>
<if test="deliverTime !=null and deliverTime !=''">
deliver_time = now(),
</if>
<if test="logisticsName !=null and logisticsName !=''">
logistics_name = #{logisticsName},
</if>
<if test="logisticsId !=null and logisticsId !=''">
logistics_id = #{logisticsId},
</if>
</set>
WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 商品下载实体-->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="id" property="PlatProductID"/>
<result column="productName" property="name"/>
<result column="outerID" property="OuterID"/>
<result column="price" property="price"/>
<result column="num" property="num"/>
<result column="pictureurl" property="pictureurl"/>
</resultMap>
<!-- 商品下载 -->
<select id="downloadProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND (p.id = #{productId} or p.product_code = #{productId})
</if>
<if test="state !=null and state !='' and state != -1">
AND p.state = #{state}
</if>
<if test="state !=null and state !='' and state == -1">
AND p.state IN ('6','7')
</if>
<if test="productName !=null and productName !=''">
AND p.name1 = #{productName}
</if>
ORDER BY p.im_product_id DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 根据条件查询商品 -->
<select id="getDownloadProductBeanByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
SELECT p.id,p.product_code AS outerID,p.name1 AS productName,p.product_stock AS num,p.master_img AS pictureurl,
p.mal_mobile_price AS price
FROM product p WHERE p.seller_id = #{sellerId}
<if test="productId !=null and productId !=''">
AND p.id = #{productId}
</if>
ORDER by r.apply_date DESC
limit ${pageNow}, ${PageSize}
</select>
<!-- 获取订单详情(不包含产品) -->
<select id="getOneIMOrderById" parameterType="map" resultMap="pineappleOderDetailBean">
select ifnull(do.total_money,0) money,do.supplier_name,do.buyer_username,do.prerefund_original_order_status,do1.purchase_quantity
from ${doingOrderTable1} do1 LEFT JOIN ${doingOrderTable} do on do1.order_id = do.order_id
where do1.order1_id=#{orderId1}
</select>
<resultMap type="com.sibu.orderHelper.integral.model.PineappleOderDetailBean" id="pineappleOderDetailBean">
<result column="money" property="totalMoney" />
<result column="supplier_name" property="supplierName" />
<result column="buyer_username" property="buyerUsername" />
<result column="prerefund_original_order_status" property="orderStatus" />
<result column="purchase_quantity" property="num" />
</resultMap>
<resultMap type="com.sibu.orderHelper.integral.model.IMProductBean" id="listAPIIMProduct">
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
<result column="short_name" property="shortName" />
<result column="stock_num" property="stockNum" />
<result column="details" property="details" />
<result column="exchange_integral" property="exchangeIntegral" />
<result column="xws_exchange_integral" property="xwsExchangeIntegral" />
<result column="sibukg_exchange_integral" property="sibukgExchangeIntegral" />
<result column="onther1_exchange_integral" property="onther1ExchangeIntegral" />
<result column="onther2_exchange_integral" property="onther2ExchangeIntegral" />
<result column="onther3_exchange_integral" property="onther3ExchangeIntegral" />
<result column="thumb_img" property="thumbImg" />
<result column="bannel_img1" property="bannelImg1" />
<result column="bannel_img2" property="bannelImg2" />
<result column="bannel_img3" property="bannelImg3" />
<result column="bannel_img4" property="bannelImg4" />
<result column="bannel_img5" property="bannelImg5" />
<result column="limit_exchange_number" property="limitExchangeNumber"/>
<result column="is_new" property="isNew" />
<result column="is_hot" property="isHot" />
<result column="is_reco" property="isReco" />
<result column="cost" property="cost" />
<result column="attention" property="attention" />
<result column="total_comment_score" property="totalCommentScore" />
<result column="total_comment_number" property="totalCommentNumber" />
<result column="member_price" property="memberPrice" />
<result column="retail_price" property="retailPrice" />
<result column="market_price" property="marketPrice" />
<result column="product_type" property="productType" />
<result column="is_show" property="isShow"/>
<result column="bar_code" property="barCode"/>
<result column="is_open_spec" property="isOpenSpec"/>
<result column="spec" property="spec"/>
<result column="mini_purchase_number" property="miniPurchaseNumber"/>
<result column="format_str" property="formatStr"/>
<result column="erp_code" property="erpCode"/>
<result column="is_group" property="isGroup"/>
<result column="share_status" property="shareStatus"/>
<result column="share_percentage" property="sharePercentage"/>
<result column="im_category_id" property="imCategoryId"/>
<result column="delete_flag" property="deleteFlag"/>
</resultMap>
<!-- 产品下载 -->
<resultMap id="downloadProductBean" type="com.sibu.orderHelper.integral.model.DownloadProductBean">
<result column="im_product_id" property="PlatProductID"/>
<result column="name" property="name"/>
<result column="OuterID" property="OuterID"/>
<result column="price" property="price"/>
<result column="stock_num" property="num"/>
<result column="bannel_img1" property="pictureurl"/>
<!-- 商品sku实体 -->
<resultMap id="downloadSku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="skuId" property="SkuID"/>
<result column="skuId" property="skuOuterID"/>
<result column="skuprice" property="skuprice"/>
<result column="skuQuantity" property="skuQuantity"/>
<result column="skuname" property="skuname"/>
<result column="skupictureurl" property="skupictureurl"/>
</resultMap>
<!-- 获取商品sku -->
<select id="downloadSkuByProductId" resultType="java.lang.String" resultMap="downloadSku">
select g.sku AS skuId,g.mall_mobile_price AS skuprice,g.product_stock AS skuQuantity,
g.norm_name AS skuname ,g.images AS skupictureurl FROM product_goods g
WHERE g.product_id = #{productId}
</select>
<!-- 更新SKU库存-->
<update id="updateSkuStock" parameterType="java.util.Map">
UPDATE product_goods SET product_stock = #{stock} WHERE sku = #{skuId} and product_id = #{productId}
</update>
<!-- 更新产品库存-->
<update id="updateProductStock" parameterType="java.util.Map">
UPDATE product SET product_stock = #{productStock} WHERE id = #{productId}
</update>
<!-- 下载订单实体-->
<!-- <resultMap id="orderResponse" type="com.sibu.orderHelper.integral.pineapple.response.OrderResponse">
<result property="platOrderNo" column="order_sn" />
<result property="tradeStatus" column="order_state" />
<result property="tradeStatusDescription" column="remark" />
<result property="tradeTime" column="create_time" />
<result property="province" column="regionName1" />
<result property="city" column="regionName2" />
<result property="area" column="regionName3" />
<result property="address" column="address_info" />
<result property="mobile" column="mobile" />
<result property="zip" column="zip_code" />
<result property="postFee" column="money_logistics" />
<result property="totalMoney" column="money_order" />
<result property="favourableMoney" column="couponMoney" />
<result property="goodsFee" column="money_product" />
<result property="payTime" column="pay_time" />
<result property="nick" column="member_name" />
</resultMap>-->
<!-- 主订单下载-->
<select id="getOrdersList" parameterType="java.util.Map" resultMap="orders">
select o.order_sn,o.order_state,o.remark,o.create_time,p.regionName AS regionName1,
c.regionName AS regionName2,a.regionName AS regionName3,
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_order,o.money_product,o.pay_time,o.member_name FROM orders o
LEFT JOIN regions p ON p.id = o.province_id
LEFT JOIN regions c ON c.id = o.city_id
LEFT JOIN regions a ON a.id = o.area_id
WHERE o.is_parent = 0
AND seller_id = #{sellerId} AND order_sn = #{orderSn}
<if test="startTime !=null and startTime ! =''">
AND create_time >= #{startTime}
</if>
<if test="endTime !=null and endTime ! =''">
<![CDATA[
and create_time <= #{endTime}
]]>
</if>
ORDER BY o.id DESC
limit ${PageIndex}, ${PageSize}
</select>
<!-- 子订单实体-->
<resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct">
<result property="id" column="id" />
<result property="ordersId" column="orders_id" />
<result property="ordersSn" column="orders_sn" />
<result property="ordersPsn" column="orders_psn" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="productCateId" column="product_cate_id" />
<result property="productId" column="product_id" />
<result property="productGoodsId" column="product_goods_id" />
<result property="specInfo" column="spec_info" />
<result property="productName" column="product_name" />
<result property="productSku" column="product_sku" />
<result property="packageGroupsId" column="package_groups_id" />
<result property="mallGroupsId" column="mall_groups_id" />
<result property="giftId" column="gift_id" />
<result property="isGift" column="is_gift" />
<result property="moneyPrice" column="money_price" />
<result property="number" column="number" />
<result property="moneyAmount" column="money_amount" />
<result property="moneyActSingle" column="money_act_single" />
<result property="actSingleId" column="act_single_id" />
<result property="actGroupId" column="act_group_id" />
<result property="actFlashSaleId" column="act_flash_sale_id" />
<result property="actFlashSaleProductId" column="act_flash_sale_product_id" />
<result property="actBiddingId" column="act_bidding_id" />
<result property="actIntegralId" column="act_integral_id" />
<result property="actIntegralNum" column="act_integral_num" />
<result property="actIntegralMoney" column="act_integral_money" />
<result property="systemRemark" column="system_remark" />
<result property="backNumber" column="back_number" />
<result property="exchangeNumber" column="exchange_number" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isEvaluate" column="is_evaluate" />
</resultMap>
<!-- 下载子订单实体-->
<!-- <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse">
<result property="productId" column="" />
<result property="subOrderNo" column="" />
<result property="tradeGoodsNo" column="" />
<result property="tradeGoodsName" column="" />
<result property="tradeGoodsSpec" column="" />
<result property="goodsCount" column="" />
<result property="price" column="" />
<result property="discountMoney" column="" />
<result property="status" column="" />
</resultMap>-->
<!-- 查询子订单-->
<select id="getOrdersProductList" resultType="java.util.Map" resultMap="ordersProduct">
SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product
WHERE orders_sn = #{ordersSn}
</select>
<!-- 地址实体类-->
<resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions">
<result property="id" column="id" />
<result property="parentId" column="parentId" />
<result property="regionName" column="regionName" />
<result property="parentPath" column="parentPath" />
<result property="firstLetter" column="firstLetter" />
<result property="regionType" column="regionType" />
<result property="agencyId" column="agencyId" />
<result property="shippingId" column="shippingId" />
<result property="visible" column="visible" />
<result property="rowId" column="rowId" />
</resultMap>
<select id="getProductListByMap" parameterType="java.util.Map" resultMap="downloadProductBean">
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
FROM im_product p,im_product_supplier i
WHERE p.im_product_id = i.product_id and i.supplier_id= #{supplierId}
<if test="isShow == 0">
and p.is_show = 0
</if>
<if test="isShow == 1">
and p.is_show = 1
</if>
<if test="productId !=null and productId !=''">
AND (p.im_product_id =#{productId} OR p.bar_code =#{productId})
</if>
<if test="productName !=null and productName !=''">
AND p.name =#{productName}
</if>
ORDER BY p.im_product_id DESC
limit ${PageIndex}, ${PageSize}
<!-- 根据条件查询省市级信息-->
<select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult">
SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType}
</select>
<resultMap id="downloadProductSkuBeanList" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="sku_id" property="SkuID"/>
<result column="sku_id" property="skuOuterID"/>
<result column="retail_price" property="skuprice"/>
<result column="stock_num" property="skuQuantity"/>
</resultMap>
<select id="getDownloadProductSkuBeanList" parameterType="java.lang.String" resultMap="downloadProductSkuBeanList">
SELECT sku_id,stock_num,retail_price FROM sku WHERE im_product_id = #{productId}
<!-- 根据id查询省市级信息-->
<select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult">
select
*
from `regions`
where `id` = #{id}
</select>
<resultMap id="sku" type="com.sibu.orderHelper.integral.model.DownloadProductSkuBean">
<result column="name" property="skuname"/>
<!-- 物流公司实体-->
<resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="state" column="state" />
<result property="companyMark" column="company_mark" />
<result property="companyName" column="company_name" />
<result property="seq" column="seq" />
<result property="sellerId" column="seller_id" />
<result property="companyType" column="company_type" />
<result property="imagePath" column="image_path" />
<result property="content" column="content" />
</resultMap>
<select id="getDownloadSkuBean" parameterType="java.lang.String" resultMap="sku">
SELECT concat(concat(n.attr_name,':'),v.attr_value) name FROM attr_ref a
LEFT JOIN attr_value v ON a.attr_value_id = v.value_id
LEFT JOIN attr_name n on v.attr_id = n.attr_id WHERE a.sku_id = #{skuId} AND n.attr_name IS NOT NULL
<!-- 根据条件查询物流公司-->
<select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult">
select
*
from `courier_company`
where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
</select>
<!-- 同步库存 -->
<resultMap id="rs_SkuBean" type="com.sibu.orderHelper.integral.model.SkuBean">
<result property="skuId" column="sku_id" />
<result property="imProductId" column="im_product_id"/>
<result property="erpCode" column="erp_code" />
<result property="stockNum" column="stock_num" />
<result property="exchangeIntegral" column="exchange_integral"/>
<result property="retailPrice" column="retail_price" />
<result property="marketPrice" column="market_price" />
<result property="createDate" column="create_date" />
<result property="updateDate" column="update_date" />
<result property="isShow" column="is_show" />
<!--退货表实体-->
<resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="contactPhone" column="contact_phone" />
<result property="contactName" column="contact_name" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="stateReturn" column="state_return" />
<result property="stateMoney" column="state_money" />
<result property="number" column="number" />
<result property="backMoney" column="back_money" />
<result property="backIntegral" column="back_integral" />
<result property="backIntegralMoney" column="back_integral_money" />
<result property="backCouponUserId" column="back_coupon_user_id" />
<result property="backMoneyTime" column="back_money_time" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="skuApiResponse" type="com.sibu.orderHelper.integral.reponse.SkuApiResponse">
<result property="skuId" column="sku_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="erpCode" column="erp_code" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="stockNum" column="stock_num" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="exchangeIntegral" column="exchange_integral" javaType="java.lang.Integer" jdbcType="INTEGER"/>
<result property="memberPrice" column="member_price"/>
<result property="retailPrice" column="retail_price"/>
<result property="marketPrice" column="market_price"/>
<collection property="values" ofType="com.sibu.orderHelper.integral.reponse.SkuValueResponse" column="sku_Id">
<result property="attrValueId" column="attr_value_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrId" column="attr_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result property="attrName" column="attr_name" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="valueName" column="attr_value" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result property="sortIndex" column="sort_index" javaType="java.lang.Integer" jdbcType="TINYINT"/>
</collection>
</resultMap>
<!--根据产品ID与SKUID 查询SKU -->
<select id="getSkuBeanByMap" parameterType="java.util.Map" resultMap="rs_SkuBean">
SELECT * FROM sku where
sku_id = #{skuId} AND im_product_id = #{productId} and is_show =1
</select>
<!-- 查询product sku返回 -->
<select id="getSkuBeanListByMap" parameterType="java.lang.String" resultMap="skuApiResponse">
SELECT s.sku_id,s.erp_code,s.stock_num,s.exchange_integral,s.retail_price,s.market_price,s.member_price,
s.is_show,ref.attr_value_id,n.attr_id,n.attr_name,v.attr_value ,n.sort_index FROM sku s
LEFT JOIN attr_ref ref ON s.sku_id =ref.sku_id
LEFT JOIN attr_value v ON v.value_id =ref.attr_value_id
LEFT JOIN attr_name n ON n.attr_id =v.attr_id
WHERE s.im_product_id =#{productId}
</select>
<!-- 更新SKU-->
<update id="updateSku" parameterType="com.sibu.orderHelper.integral.model.SkuBean">
update sku SET stock_num = #{stockNum} WHERE sku_id = #{skuId}
</update>
<!-- 根据条件查询产品 -->
<sql id="Base_Product_Column">
imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.cost,
imp.attention,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.share_status,
imp.share_percentage
</sql>
<select id="getIMProductBeanByMap" parameterType="java.util.Map" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />
FROM
im_product imp,im_product_supplier s
WHERE imp.im_product_id = s.product_id
AND imp.im_product_id = #{productId}
AND s.supplier_id = #{supplierId}
</select>
<select id="getIMProductBeanById" parameterType="java.lang.String" resultMap="listAPIIMProduct">
SELECT
<include refid="Base_Product_Column" />,imp.bar_code
FROM
im_product imp
WHERE imp.im_product_id = #{productId}
<!--根据订单号查询换货信息-->
<select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') ORDER BY create_time
</select>
<!--换货实体类-->
<resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="provinceId2" column="province_id2" />
<result property="cityId2" column="city_id2" />
<result property="areaId2" column="area_id2" />
<result property="addressAll2" column="address_all2" />
<result property="addressInfo2" column="address_info2" />
<result property="zipCode2" column="zip_code2" />
<result property="changeName2" column="change_name2" />
<result property="phone2" column="phone2" />
<result property="logisticsId2" column="logistics_id2" />
<result property="logisticsName2" column="logistics_name2" />
<result property="logisticsMark2" column="logistics_mark2" />
<result property="logisticsNumber2" column="logistics_number2" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<update id="updateProductInventory" parameterType="com.sibu.orderHelper.integral.model.IMProductInventory">
update im_product_inventory set stock_num=#{stockNum} where im_product_id=#{imProductId}
</update>
<update id="updateProduct" parameterType="java.util.Map">
update im_product set stock_num = #{stockNum} WHERE im_product_id = #{productId}
</update>
<select id="getApiProductDetailById" resultMap="listAPIIMProduct" parameterType="String" useCache="true" statementType="PREPARED">
select imp.im_product_id,
imp.name,
imp.short_name,
imp.stock_num,
imp.details,
imp.exchange_integral,
imp.xws_exchange_integral,
imp.sibukg_exchange_integral,
imp.onther1_exchange_integral,
imp.onther2_exchange_integral,
imp.onther3_exchange_integral,
imp.limit_exchange_number,
imp.thumb_img,
imp.bannel_img1,
imp.bannel_img2,
imp.bannel_img3,
imp.bannel_img4,
imp.bannel_img5,
imp.is_new,
imp.is_hot,
imp.is_reco,
imp.is_show,
imp.product_type,
imp.member_price,
imp.retail_price,
imp.market_price,
imp.is_open_spec,
imp.spec,
imp.mini_purchase_number,
imp.format_str,
imp.erp_code,
imp.is_group,
imp.share_status,
imp.share_percentage,
ipi.attention,
ipi.total_comment_score,
ipi.total_comment_number,
ipi.cost,
imp.delete_flag
FROM im_product imp left join im_product_inventory ipi on imp.im_product_id = ipi.im_product_id
WHERE
imp.im_product_id = #{productId}
</select>
<!-- 订单发货-->
<select id="getOrderByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*) FROM ${doingOrderTable} WHERE express_code like concat(concat('%',#{expressCode},'%')) AND order_code = #{orderCode}
AND supplier_id = #{supplierId}
<!--根据订单号查询换货信息-->
<select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time
</select>
<resultMap type="com.sibu.orderHelper.integral.model.IMDoingOrderBean" id="iMDoingOrderBean2">
<id column="order_id" property="orderId"/>
<result column="member_id" property="memberId"/>
<result column="order_code" property="orderCode"/>
<result column="main_order_code" property="mainOrderCode"/>
<result column="order_status" property="orderStatus"/>
<result column="order_from" property="orderFrom"/>
<result column="order_platform" property="orderPlatform"/>
<result column="contact" property="contact"/>
<result column="phone" property="phone"/>
<result column="province" property="province"/>
<result column="city" property="city"/>
<result column="area" property="area"/>
<result column="address" property="address"/>
<result column="zipcode" property="zipcode"/>
<result column="buyer_remark" property="buyerRemark"/>
<result column="seller_remark" property="sellerRemark"/>
<result column="total_integral" property="totalIntegral"/>
<result column="total_money" property="totalMoney"/>
<result column="freight" property="freight"/>
<result column="express_name" property="expressName"/>
<result column="express_code" property="expressCode"/>
<result column="express_code2" property="expressCode2"/>
<result column="create_dt" property="createDt"/>
<result column="pay_dt" property="payDt"/>
<result column="transaction_id" property="transactionId"/>
<result column="pay_type" property="payType"/>
<result column="open_id" property="openId"/>
<result column="buyer_username" property="buyerUsername"></result>
<result column="buyer_phone" property="buyerPhone"></result>
<result column="erp_import" property="erpImport"></result>
<result column="erp_import_dt" property="erpImportDt"></result>
<result column="ship_dt" property="shipDt"></result>
<result column="receive_dt" property="receiveDt"/>
<result column="user_coupon_money" property="userCouponMoney"/>
<result column="deduction_vb" property="deductionVb"/>
<result column="deduction_money" property="deductionMoney"/>
<result column="prerefund_original_order_status" property="prerefundOriginalOrderStatus"/>
<result column="share_member_id" property="shareMemberId"/>
<result column="share_order_money" property="shareOrderMoney"/>
<result column="platform_type" property="platformType"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
<result column="sign_pay_status" property="signPayStatus"/>
<!-- 投诉表实体-->
<resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="orderId" column="order_id" />
<result property="orderProductId" column="order_product_id" />
<result property="productBackId" column="product_back_id" />
<result property="productExchangeId" column="product_exchange_id" />
<result property="content" column="content" />
<result property="image" column="image" />
<result property="complaintTime" column="complaint_time" />
<result property="sellerId" column="seller_id" />
<result property="sellerComplaintTime" column="seller_complaint_time" />
<result property="sellerCompContent" column="seller_comp_content" />
<result property="sellerCompImage" column="seller_comp_image" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optContent" column="opt_content" />
<result property="userContent" column="user_content" />
<result property="createTime" column="create_time" />
<result property="optTime" column="opt_time" />
</resultMap>
<select id="getOrderListByMap" parameterType="java.util.Map" resultMap="iMDoingOrderBean2">
SELECT order_id,member_id,order_code,order_status,order_from,
contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id,
province,city,area,address,zipcode,buyer_remark,pay_type,transaction_id,user_coupon_id,user_coupon_money,
express_name,express_code,express_code2,order_platform,
erp_import,prerefund_original_order_status FROM ${doingOrderTable} WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
<!-- 根据条件查询投诉表-->
<select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
</select>
<update id="updateBusinessSend" parameterType="java.util.Map">
UPDATE ${doingOrderTable}
<set>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<if test="expressCode !=null and expressCode !='' ">
express_code = #{expressCode},
</if>
<if test="buyerPhone !=null and buyerPhone !=''">
buyer_phone = #{buyerPhone},
</if>
<if test="address!=null and address!='' ">
address =#{address},
</if>
<if test="expressName !=null and expressName !='' ">
express_name =#{expressName},
</if>
<if test="province !=null and province !='' ">
province =#{province},
</if>
<if test="city !=null and city !='' ">
city =#{city},
</if>
<if test="area !=null and area !='' ">
area =#{area},
</if>
<if test="buyerUsername !=null and buyerUsername !='' ">
buyer_username =#{buyerUsername},
</if>
<if test="erpImportDt !=null and erpImportDt !='' ">
erp_import_dt =#{erpImportDt},
</if>
<if test="shipDt !=null and shipDt !='' ">
ship_dt =#{shipDt},
</if>
<if test="orderStatus !=null and orderStatus !='' ">
order_status =#{orderStatus},
</if>
erp_import = 1
</set>
WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</update>
<!-- 修改订单备注 -->
<update id="updateSelle" parameterType="java.util.Map">
UPDATE ${doingOrderTable} SET seller_remark = #{sellerRemark} WHERE order_code = #{orderCode}
AND supplier_id = #{supplierId}
</update>
</mapper>
\ No newline at end of file
......
......@@ -37,6 +37,110 @@
<!-- 事务注解驱动,标注@Transactional的类和方法将具有事务性 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" mode="proxy"/>
<!-- begin 新系统mall -->
<bean id="mallReadDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="${mall.read.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
<property name="username" value="${mall.read.username}" />
<property name="password" value="${mall.read.password}" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1"/>
<property name="minIdle" value="1"/>
<property name="maxActive" value="200"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000"/>
<property name="validationQuery" value="SELECT 'x'"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="true"/>
<property name="maxPoolPreparedStatementPerConnectionSize" value="20"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<bean id="mallReadSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="mapperLocations" value="classpath:mall-mapper/**/read/**/*.xml" />
<!--<property name="typeAliasesPackage" value="com.ejavashop.entity" />-->
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="dataSource" ref="mallReadDataSource"/>
</bean>
<bean name="mallReadMapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sibu.orderHelper.mall.*.read" />
<property name="sqlSessionFactoryBeanName" value="mallReadSqlSessionFactory" />
</bean>
<bean id="mallWriteDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="${mall.write.url}?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;allowMultiQueries=true" />
<property name="username" value="${mall.write.username}" />
<property name="password" value="${mall.write.password}" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1"/>
<property name="minIdle" value="1"/>
<property name="maxActive" value="200"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000"/>
<property name="validationQuery" value="SELECT 'x'"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="true"/>
<property name="maxPoolPreparedStatementPerConnectionSize" value="20"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<bean id="mallWriteSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="mapperLocations" value="classpath:mall-mapper/**/write/**/*.xml" />
<!--<property name="typeAliasesPackage" value="com.ejavashop.entity" />-->
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="dataSource" ref="mallWriteDataSource" />
</bean>
<bean name="shopMapperScannerWrite" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.sibu.orderHelper.mall.*.write" />
<property name="sqlSessionFactoryBeanName" value="mallWriteSqlSessionFactory" />
</bean>
<bean id="transactionManagerForMall" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mallWriteDataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManagerForMall"/>
<!-- end 新系统mall -->
<!-- 配置事务的传播特性 -->
<!--<tx:advice id="txAdvice" transaction-manager="transactionManager">-->
<!--<tx:attributes>-->
......
......@@ -16,12 +16,12 @@ public enum PineappleEnum {
/**
* 菠萝派对应商城【产品已上架】状态
*/
public static final Integer MALL_PRODUCT_PUTAWAY__STATUS = 1;
public static final Integer MALL_PRODUCT_PUTAWAY__STATUS = 6;
/**
* 菠萝派对应商城【产品已下架】状态
*/
public static final Integer MALL_PRODUCT_SOLDIOUT__STATUS = 0;
public static final Integer MALL_PRODUCT_SOLDIOUT__STATUS = 7;
......
......@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums;
import com.alibaba.druid.util.StringUtils;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
import org.apache.commons.lang3.EnumUtils;
import java.util.ArrayList;
......@@ -15,14 +17,16 @@ import java.util.List;
* @description 菠萝派商城退款验证退款状态举类
*/
public enum PineappleRefundEnum {
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_AUDIT.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_REFUND_GOODS.getCode(),OrderRefundStatusEnum.AGREE_CHANGE_GOODS.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_RECEIVE_GOODS.getCode(),OrderRefundStatusEnum.WAIT_SELLER_AUDIT_RECEIVE_GOODS.getCode())),
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())),
JH_05("JH_05", "退款关闭",new ArrayList<>()),
JH_06("JH_06", "退款成功",Arrays.asList(OrderRefundStatusEnum.SELLER_REFUNDING_MONEY_SUCCESS.getCode())),
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductBackEnum.Pending.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductBackEnum.AuditSucceess.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())),
JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())),
JH_06("JH_06", "退款成功",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode())),
JH_07("JH_07", "没有退款",new ArrayList<>()),
JH_99("JH_99", "其他",new ArrayList<>());
JH_99("JH_99", "其他",Arrays.asList());
private String code; // 错误代码
private String msg; // 错误消息
......
package com.sibu.orderHelper.enums;
import com.alibaba.druid.util.StringUtils;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
import org.apache.commons.lang3.EnumUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author lauka
* @date 2018/03/30
* @description 菠萝派商城退款验证退款状态举类
*/
public enum PineappleRefundMoneyStateEnum {
NOT_REFUND("1", "未退款",PineappleRefundEnum.JH_99),
REFUND_ACCOUNT("2", "退款到账户", PineappleRefundEnum.JH_06),
REFUND_BANK("3", "退款到银行",PineappleRefundEnum.JH_06),
REFUND_ING("4", "退款中",PineappleRefundEnum.JH_99),
REFUND_ERROR ("5", "退款失败",PineappleRefundEnum.JH_99),
REFUND_UNKNOWN("-1", "未知",PineappleRefundEnum.JH_99),;
private String code; // 错误代码
private String msg; // 错误消息
private PineappleRefundEnum pineappleRefundEnum;
PineappleRefundMoneyStateEnum(String code, String msg, PineappleRefundEnum pineappleRefundEnum) {
this.code = code;
this.msg = msg;
this.pineappleRefundEnum = pineappleRefundEnum;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public PineappleRefundEnum getPineappleRefundEnum() {
return pineappleRefundEnum;
}
public void setPineappleRefundEnum(PineappleRefundEnum pineappleRefundEnum) {
this.pineappleRefundEnum = pineappleRefundEnum;
}
public static PineappleRefundMoneyStateEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
List<PineappleRefundMoneyStateEnum> enums = EnumUtils.getEnumList(PineappleRefundMoneyStateEnum.class);
PineappleRefundMoneyStateEnum result = enums.stream()
.filter(p -> p.code.equals(platformOrderStatus))
.findFirst()
.orElse(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN);
return result;
}
}
......@@ -20,6 +20,8 @@ public class GetRefundBean implements Serializable{
//平台子订单号
private String subplatorderno;
private String ordersproductuid;
//订单总金额
private BigDecimal totalamount;
......@@ -86,6 +88,9 @@ public class GetRefundBean implements Serializable{
//商品外部商家编码
private String outerid;
//退款状态
private Integer stateMoney;
public String getRefundno() {
return refundno;
}
......@@ -285,4 +290,20 @@ public class GetRefundBean implements Serializable{
public void setOuterid(String outerid) {
this.outerid = outerid;
}
public Integer getStateMoney() {
return stateMoney;
}
public void setStateMoney(Integer stateMoney) {
this.stateMoney = stateMoney;
}
public String getOrdersproductuid() {
return ordersproductuid;
}
public void setOrdersproductuid(String ordersproductuid) {
this.ordersproductuid = ordersproductuid;
}
}
......
package com.sibu.orderHelper.integral.pineapple.constant;
import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import java.util.Arrays;
import java.util.List;
......@@ -19,45 +20,44 @@ public class PineAppleConst {
/**
* 菠萝派对应商城【等待买家付款】状态
*/
public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitPay.getCode());
public static final List<Integer> MALL_WAIT_BUYER_PAY_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitPay.getCode());
/**
* 菠萝派对应商城【等待卖家发货】状态
*/
public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(PayOrderStatus.WaitShip.getCode());
public static final List<Integer> MALL_WAIT_SELLER_DELIVER_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.WaitConfirmed.getCode(),EJavaShopOrderStateEnum.WaitShip.getCode());
/**
* 菠萝派对应商城【等待买家确认收货】状态
*/
public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasReceived.getCode());
public static final List<Integer> MALL_WAIT_BUYER_RECEIVED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.HasReceived.getCode());
/**
* 菠萝派对应商城【交易完成】状态
*/
public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(PayOrderStatus.HasDelive.getCode(), PayOrderStatus.Finished.getCode());
public static final List<Integer> MALL_TRANSACTION_FINISHED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.Finished.getCode());
/**
* 菠萝派对应商城【交易关闭】状态
*/
public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(PayOrderStatus.RefundFail.getCode());
public static final List<Integer> MALL_TRANSACTION_CLOSED_ORDER_STATUS = Arrays.asList(EJavaShopOrderStateEnum.RefundFail.getCode());
/**
* 菠萝派对应商城【所有订单】
*/
public static final List<Integer> MALL_ALL_ORDER = Arrays.asList(
PayOrderStatus.WaitPay.getCode(),
PayOrderStatus.WaitShip.getCode(),
PayOrderStatus.HasReceived.getCode(),
PayOrderStatus.HasDelive.getCode(),
PayOrderStatus.Finished.getCode(),
PayOrderStatus.RefundFail.getCode()
EJavaShopOrderStateEnum.WaitPay.getCode(),
EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
EJavaShopOrderStateEnum.WaitShip.getCode(),
EJavaShopOrderStateEnum.HasReceived.getCode(),
EJavaShopOrderStateEnum.Finished.getCode(),
EJavaShopOrderStateEnum.RefundFail.getCode()
);
/**
* 菠萝派对应商城【未知】状态订单
*/
public static final List<Integer> MALL_UNKNOWN_ORDER_STATUS = Arrays.asList(
PayOrderStatus.WaitPay.getCode(),
PayOrderStatus.WaitShip.getCode(),
PayOrderStatus.HasReceived.getCode(),
PayOrderStatus.HasDelive.getCode(),
PayOrderStatus.Finished.getCode(),
PayOrderStatus.RefundFail.getCode()
EJavaShopOrderStateEnum.WaitPay.getCode(),
EJavaShopOrderStateEnum.WaitConfirmed.getCode(),
EJavaShopOrderStateEnum.WaitShip.getCode(),
EJavaShopOrderStateEnum.HasReceived.getCode(),
EJavaShopOrderStateEnum.Finished.getCode(),
EJavaShopOrderStateEnum.RefundFail.getCode()
);
}
......
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import org.apache.commons.lang3.EnumUtils;
import java.util.List;
/**
* @author LauKa
* @contact a062431@vip.qq.com
* @date 2018/05/15
* @description 新系统丁订单状态
*/
public enum EJavaShopOrderStateEnum {
WaitPay(1, "待支付"), WaitConfirmed(2, "待确认"), WaitShip(3, "待发货"),
HasReceived(4, "已发货"), RefundFail(6, "交易关闭"),Finished(5, "交易完成");
private int code; // 错误代码
private String msg; // 错误消息
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
EJavaShopOrderStateEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static EJavaShopOrderStateEnum valueOf(int code) { // 手写的从int到enum的转换函数
List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class);
EJavaShopOrderStateEnum result = enums.stream()
.filter(p -> p.getCode() == code)
.findFirst()
.orElse(EJavaShopOrderStateEnum.RefundFail);
return result;
}
public static EJavaShopOrderStateEnum resolve(String code) {
List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class);
EJavaShopOrderStateEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
.findFirst()
.orElse(EJavaShopOrderStateEnum.RefundFail);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.List;
/**
* @author LauKa
* @contact a062431@vip.qq.com
* @date 2018/05/15
* @description 新系统退款表状态 1、未处理;2、审核通过;3、用户发货,4、店铺收货;5、不予处理'
*/
public enum MemberProductBackEnum {
Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发货"),
ShopDelivery(4, "店铺收货"), Inattentive(5, "不予处理");
private int code; // 错误代码
private String msg; // 错误消息
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
MemberProductBackEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static MemberProductBackEnum valueOf(int code) { // 手写的从int到enum的转换函数
List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
MemberProductBackEnum result = enums.stream()
.filter(p -> p.getCode() == code)
.findFirst()
.orElse(null);
return result;
}
public static MemberProductBackEnum resolve(String code) {
List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
MemberProductBackEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
.findFirst()
.orElse(null);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.List;
/**
* @author LauKa
* @contact a062431@vip.qq.com
* @date 2018/05/15
* @description 新系统换货表状态 换货状态:1、未处理;2、审核通过;3、用户发回退件;4、商家收到退件;5、商家发出换件;6、原件退还;7、不处理
*/
public enum MemberProductExchangeEnum {
Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发回退件"),
ShopDelivery(4, "商家收到退件"),ShopExchange(5,"商家发出换件"),ReturnOld(6,"原件退还"), Inattentive(7, "不予处理");
private int code; // 错误代码
private String msg; // 错误消息
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
MemberProductExchangeEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static MemberProductExchangeEnum valueOf(int code) { // 手写的从int到enum的转换函数
List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
MemberProductExchangeEnum result = enums.stream()
.filter(p -> p.getCode() == code)
.findFirst()
.orElse(null);
return result;
}
public static MemberProductExchangeEnum resolve(String code) {
List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
MemberProductExchangeEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
.findFirst()
.orElse(null);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author lauka
* @date 2018/03/30
* @description 菠萝派商城退款验证换货状态举类
*/
public enum PineappleExchangeEnum {
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductExchangeEnum.Pending.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductExchangeEnum.AuditSucceess.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductExchangeEnum.MemberDeliver.getCode())),
JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductExchangeEnum.Inattentive.getCode())),
JH_06("JH_06", "退款成功",Arrays.asList()),
JH_07("JH_07", "没有退款",Arrays.asList(MemberProductExchangeEnum.ReturnOld.getCode(),MemberProductExchangeEnum.ShopExchange.getCode())),
JH_99("JH_99", "其他",new ArrayList<>(MemberProductExchangeEnum.ShopDelivery.getCode()));
private String code; // 错误代码
private String msg; // 错误消息
List<Integer> mallOrderStatus;
PineappleExchangeEnum(String code, String msg, List<Integer> mallOrderStatus) {
this.code = code;
this.msg = msg;
this.mallOrderStatus = mallOrderStatus;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static PineappleExchangeEnum resolve(String code) {
List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
PineappleExchangeEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(p.code, code))
.findFirst()
.orElse(PineappleExchangeEnum.JH_99);
return result;
}
public static PineappleExchangeEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
PineappleExchangeEnum result = enums.stream()
.filter(p -> p.mallOrderStatus != null && p.mallOrderStatus.contains(platformOrderStatus))
.findFirst()
.orElse(PineappleExchangeEnum.JH_99);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class CourierCompany implements Serializable{
private Integer id;
private java.util.Date createTime;
private Integer state;
private String companyMark;
private String companyName;
private Integer seq;
private String companyType;
private Integer sellerId;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class MemberProductBack implements Serializable{
private java.lang.Integer id;
private java.lang.Integer sellerId;
private java.lang.String sellerName;
private java.lang.Integer orderId;
private java.lang.String orderSn;
private java.lang.Integer orderProductId;
private java.lang.Integer productId;
private java.lang.String productName;
private java.lang.Integer memberId;
private java.lang.String memberName;
private java.lang.Integer provinceId;
private java.lang.Integer cityId;
private java.lang.Integer areaId;
private java.lang.String addressAll;
private java.lang.String addressInfo;
private java.lang.String zipCode;
private java.lang.String contactPhone;
private java.lang.String contactName;
private java.lang.Integer logisticsId;
private java.lang.String logisticsName;
private java.lang.String logisticsMark;
private java.lang.String logisticsNumber;
private java.lang.String question;
private java.lang.String image;
private java.lang.Integer stateReturn;
private java.lang.Integer stateMoney;
private java.lang.Integer number;
private java.math.BigDecimal backMoney;
private java.lang.Integer backIntegral;
private java.math.BigDecimal backIntegralMoney;
private java.lang.Integer backCouponUserId;
private java.util.Date backMoneyTime;
private java.lang.Integer optId;
private java.lang.String optName;
private java.lang.String remark;
private java.util.Date createTime;
private java.util.Date updateTime;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class MemberProductExchange implements Serializable {
private java.lang.Integer id;
private java.lang.Integer sellerId;
private java.lang.String sellerName;
private java.lang.Integer orderId;
private java.lang.String orderSn;
private java.lang.Integer orderProductId;
private java.lang.Integer productId;
private java.lang.String productName;
private java.lang.Integer memberId;
private java.lang.String memberName;
private java.lang.Integer provinceId;
private java.lang.Integer cityId;
private java.lang.Integer areaId;
private java.lang.String addressAll;
private java.lang.String addressInfo;
private java.lang.String zipCode;
private java.lang.String changeName;
private java.lang.String phone;
private java.lang.Integer logisticsId;
private java.lang.String logisticsName;
private java.lang.String logisticsMark;
private java.lang.String logisticsNumber;
private java.lang.Integer provinceId2;
private java.lang.Integer cityId2;
private java.lang.Integer areaId2;
private java.lang.String addressAll2;
private java.lang.String addressInfo2;
private java.lang.String zipCode2;
private java.lang.String changeName2;
private java.lang.String phone2;
private java.lang.Integer logisticsId2;
private java.lang.String logisticsName2;
private java.lang.String logisticsMark2;
private java.lang.String logisticsNumber2;
private java.lang.Integer number;
private java.lang.String question;
private java.lang.String image;
private java.lang.String name;
private java.lang.Integer state;
private java.lang.Integer optId;
private java.lang.String optName;
private java.lang.String remark;
private java.util.Date createTime;
private java.util.Date updateTime;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@ToString
public class Orders implements Serializable{
private Integer id;
private String orderSn;
private String orderPsn;
private Integer isParent;
private Integer isShow;
private String relationOrderSn;
private Integer orderType;
private Integer sellerId;
private String sellerName;
private Integer memberId;
private String memberName;
private Integer orderState;
private Date payTime;
private Integer paymentStatus;
private Integer invoiceStatus;
private String invoiceTitle;
private String invoiceType;
private BigDecimal moneyProduct;
private BigDecimal moneyLogistics;
private BigDecimal moneyOrder;
private BigDecimal moneyPaidBalance;
private BigDecimal moneyPaidReality;
private BigDecimal moneyCoupon;
private BigDecimal moneyActFull;
private BigDecimal moneyDiscount;
private BigDecimal moneyBack;
private BigDecimal moneyIntegral;
private Integer integral;
private Integer couponUserId;
private Integer actFullId;
private Integer activityId;
private String ip;
private String paymentName;
private String paymentCode;
private String name;
private Integer provinceId;
private Integer cityId;
private Integer areaId;
private String addressAll;
private String addressInfo;
private String mobile;
private String email;
private String zipCode;
private String remark;
private String deliverTime;
private String finishTime;
private String tradeSn;
private Integer source;
private Integer logisticsId;
private String logisticsName;
private String logisticsNumber;
private Integer isCodconfim;
private Integer codconfirmId;
private String codconfirmName;
private String codconfirmTime;
private String codconfirmRemark;
private Integer codconfirmState;
private Date createTime;
private String updateTime;
private Integer evaluateState;
private String regionName1;
private String regionName2;
private String regionName3;
private BigDecimal deductionVbMoney;
private BigDecimal couponMoney;
private List<OrdersProduct> goodinfos;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ToString
public class OrdersProduct {
private Integer id;
private Integer ordersId;
private String ordersSn;
private String ordersPsn;
private Integer sellerId;
private String sellerName;
private Integer productCateId;
private Integer productId;
private Integer productGoodsId;
private String specInfo;
private String productName;
private String productSku;
private Integer packageGroupsId;
private Integer mallGroupsId;
private Integer giftId;
private Integer isGift;
private BigDecimal moneyPrice;
private Integer number;
private BigDecimal moneyAmount;
private BigDecimal moneyActSingle;
private Integer actSingleId;
private Integer actGroupId;
private Integer actFlashSaleId;
private Integer actFlashSaleProductId;
private Integer actBiddingId;
private Integer actIntegralId;
private Integer actIntegralNum;
private BigDecimal actIntegralMoney;
private String systemRemark;
private Integer backNumber;
private Integer exchangeNumber;
private Date createTime;
private Date updateTime;
private Integer isEvaluate;
private BigDecimal moneyFullAoumt;
private BigDecimal moneyCouponAmount;
private BigDecimal deductionProductVbMoney;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ToString
public class Product {
private Integer id;
private Integer productCateId;
private String productCatePath;
private String name1;
private String name2;
private String keyword;
private Integer productBrandId;
private Integer isSelf;
private BigDecimal costPrice;
private BigDecimal protectedPrice;
private BigDecimal marketPrice;
private BigDecimal mallPcPrice;
private BigDecimal malMobilePrice;
private Integer virtualSales;
private Integer actualSales;
private Integer productStock;
private Integer isNorm;
private String normIds;
private String normName;
private Integer state;
private Integer isTop;
private Date upTime;
private String description;
private String packing;
private Integer sellerId;
private Integer createId;
private Date createTime;
private Date updateTime;
private Integer sellerCateId;
private Integer sellerIsTop;
private Integer sellerState;
private Integer commentsNumber;
private Integer productCateState;
private Integer isInventedProduct;
private Integer transportType;
private Integer transportId;
private String masterImg;
private String productCode;
private BigDecimal saleScale1;
private BigDecimal saleScale2;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class ProductGoods {
private Long id;
private Long productId;
private String normAttrId;
private String normName;
private Double mallPcPrice;
private Double mallMobilePrice;
private Long productStock;
private Long productStockWarning;
private Long actualSales;
private String sku;
private String images;
private Long state;
private Double weight;
private Long length;
private Long width;
private Long height;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class Regions implements Serializable{
private Integer id;
private Integer parentId;
private String regionName;
private String parentPath;
private String firstLetter;
private Integer regionType;
private Integer agencyId;
private Integer shippingId;
private Integer visible;
private String rowId;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ToString
public class Seller implements Serializable{
private Integer id; //id
private Integer memberId; //用户ID
private String name; //用户名
private String sellerName; //店铺名称
private String sellerLogo; //店铺logo
private Integer sellerGrade; //店铺等级
private String scoreService; //店铺评分服务
private String scoreDeliverGoods; //店铺评分发货
private String scoreDescription; //店铺评分描述
private Integer productNumber; //商品数量
private Integer collectionNumber; //店铺收藏
private Date createTime; //创建时间
private BigDecimal saleMoney; //店铺总销售金额
private Integer orderCount; //店铺总订单量
private Integer orderCountOver; //店铺完成订单量
private String sellerKeyword; //SEO关键字
private String sellerDes; //SEO店铺描述
private Integer auditStatus; //审核状态 1、待审核;2、审核通过;3、冻结
private String storeSlide;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class SellerComplaint implements Serializable {
private java.lang.Integer id; //id
private java.lang.Integer userId; //投诉人ID
private java.lang.String userName; //投诉人账户
private java.lang.Integer orderId; //订单ID
private java.lang.Integer orderProductId; //网单ID
private java.lang.Integer productBackId; //退货管理id,如没有置为0
private java.lang.Integer productExchangeId; //换货管理id,如没有置为0
private java.lang.String content; //投诉内容
private java.lang.String image; //投诉图片
private java.util.Date complaintTime; //投诉时间
private java.lang.Integer sellerId; //投诉商家
private java.util.Date sellerComplaintTime; //商家申诉时间
private java.lang.String sellerCompContent; //商家申诉内容
private java.lang.String sellerCompImage; //商家申诉图片
private java.lang.Integer state; //状态:1、买家投诉待审核;2、买家投诉不通过;3、买家投诉通过;4、卖家申诉待审核;5、卖家申诉不通过;6、卖家申诉通过;
private java.lang.Integer optId; //平台处理人ID
private java.lang.String optContent; //平台处理结果
private java.lang.String userContent; //客户反馈意见
private java.util.Date createTime; //创建时间
private java.util.Date optTime; //处理时间
}
......@@ -12,6 +12,7 @@ public class PineappleSyncStockRequest {
@JsonProperty("PlatProductID")
private String platProductID;
@NotBlank(message = "skuid参数不能为空")
@JsonProperty("SkuID")
private String skuID;
......
......@@ -36,11 +36,17 @@
<artifactId>com.sibu.orderHelper.activeMQ</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.csource/fastdfs-client-java -->
<!-- fastDfs jar 导入 -->
<dependency>
<groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.25</version>
<artifactId>fastdfs-client-java</artifactId>
<version>5.0.4</version>
</dependency>
<dependency>
<groupId>com.sibu.sibu-mall-order</groupId>
<artifactId>sibu-mall-order-service-api</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
......
......@@ -6,9 +6,11 @@ import com.sibu.orderHelper.integral.dao.IMSupplierAppDao;
import com.sibu.orderHelper.integral.model.IMSupplierApp;
import com.sibu.orderHelper.integral.pineapple.request.BaseRequest;
import com.sibu.orderHelper.integral.service.IMSupplierAppService;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
......@@ -23,6 +25,9 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService {
@Autowired
private IMSupplierAppDao imSupplierAppDao;
@Resource
private MemberReadDao memberReadDao;
@Override
public IMSupplierApp findByAppIdAndAppType(String appId, SupplierAppTypeEnum appType) {
Map<String, String> params = new HashMap<>();
......@@ -37,6 +42,6 @@ public class IMSupplierAppServiceImpl implements IMSupplierAppService {
params.put("appId", requestParams.getAppkey());
params.put("appToken", requestParams.getToken());
params.put("appType", appType.getCode());
return imSupplierAppDao.findByAppIdAndAppType(params);
return memberReadDao.findByAppIdAndAppType(params);
}
}
......
......@@ -45,7 +45,7 @@ public class PineappleServiceImpl implements PineappleService {
params.put("endTime","");
params.put("pageNow","1");
params.put("PageSize","10");
return pineappleDao.pageGetRefundBean(params);
return null;
}
@Override
......@@ -68,7 +68,7 @@ public class PineappleServiceImpl implements PineappleService {
@Override
public PineappleSyncStockResponse updateSyncStock(PineappleSyncStockRequest pineappleSyncStockRequest) throws Exception {
PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
Map<String,Object> params = new HashMap<>();
/* Map<String,Object> params = new HashMap<>();
params.put("supplierId","");
params.put("productId",pineappleSyncStockRequest.getPlatProductID());
//先判断SKU在判断产品
......@@ -144,12 +144,13 @@ public class PineappleServiceImpl implements PineappleService {
pineappleSyncStockResponse.setQuantity(String.valueOf(pineappleSyncStockRequest.getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.ERROR.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.ERROR.getCode());
return pineappleSyncStockResponse;
return pineappleSyncStockResponse;*/
return null;
}
@Override
public BaseResponse shipments(PineappleSendRequest pineappleSend) throws Exception {
BaseResponse baseResponse =new BaseResponse();
/*BaseResponse baseResponse =new BaseResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
//订单号不符合
......@@ -200,12 +201,13 @@ public class PineappleServiceImpl implements PineappleService {
pineappleDao.updateBusinessSend(params);
baseResponse.setMessage(PineappleEnum.ERROR.getMsg());
baseResponse.setCode(PineappleEnum.ERROR.getCode());
return baseResponse;
return baseResponse;*/
return null;
}
@Override
public UpdateSellerMemoResponse updateSelle(UpdateSellerMemoRequest updateSellerMemoRequest)throws Exception {
UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
/* UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
//订单号不符合
......@@ -226,6 +228,7 @@ public class PineappleServiceImpl implements PineappleService {
UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return UpdateSellerMemoResponse;
return UpdateSellerMemoResponse;*/
return null;
}
}
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.utils.SeqGenUtil;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.*;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.CheckRefundStatusBean;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.SellerComplaint;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
......@@ -23,89 +30,97 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
private static Logger log = Logger.getLogger(CheckRefundStatusBizServiceImpl.class);
@Resource
private PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderCode",callRequest.getBizModel().getOrderID());
List<CheckRefundStatusBean> checkRefundStatusBeanList = new ArrayList<>();
//旧订单号处理
if(!callRequest.getBizModel().getOrderID().startsWith("B")){
callRequest.getBizModel().setOrderID(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getOrderID()));
}
//先判断是否有退款
if(pineappleDao.countCheckRefundStatusResponse(params)>0){
Map<String,Object> map = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getOrderID());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getOrderID());
map.put("doingOrderTable","im_doing_order_" + tableIndex);
map.put("orderStatus", IMOrderStatus.RefundSuccess);
map.put("orderCode",callRequest.getBizModel().getOrderID());
map.put("supplierId",callRequest.getSupplier().getId());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
//再判断是否有退款成功的(全部退款,部分退款,退款中)
IMDoingOrderBean IMDoingOrderBean = pineappleDao.getIMDoingOrderBean(map);
if(StringUtil.isNull(IMDoingOrderBean)){
log.error(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
//看是否全额退款 查询退款成功
checkRefundStatusBeanList = pineappleDao.childrenrefundStatusBySuccess(IMDoingOrderBean.getOrderCode());
if(PayOrderStatus.RefundSuccess.getCode()== IMDoingOrderBean.getOrderStatus().intValue()) {
if (StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
if(PayOrderStatus.HasReceived.getCode() == IMDoingOrderBean.getOrderStatus().intValue() || PayOrderStatus.HasDelive.getCode() == IMDoingOrderBean.getOrderStatus().intValue()
|| PayOrderStatus.RefundDoing.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ||PayOrderStatus.Finished.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ){
//部分退款
if (!StringUtil.isNull(checkRefundStatusBeanList) && !checkRefundStatusBeanList.isEmpty()) {
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
}
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getOrderID());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
Orders orders = null;
CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(commonResponse.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
}else {
throw new BizException(commonResponse.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
}
if(orders.getOrderState() == EJavaShopOrderStateEnum.RefundFail.getCode()){
log.error(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
}
//1.查询退货表有没有记录
List<MemberProductBack> memberProductBackList= memberReadDao.getMemberProductBackByOrderSn(callRequest.getBizModel().getOrderID());
//5.如果退货表有记录,退款状态为店铺收货,判断退款金额状态
if(!StringUtil.isNull(memberProductBackList) && !memberProductBackList.isEmpty()){
MemberProductBack memberProductBack = memberProductBackList.stream().findFirst().get();
PineappleRefundEnum refundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(memberProductBack.getStateReturn());
//如果退款状态是店铺收货需要判断该退款信息是否已付款
/*if(memberProductBack.getStateReturn().intValue() == MemberProductBackEnum.ShopDelivery.getCode()){
if(memberProductBack.getStateMoney() == 1){
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}else{
checkRefundStatusBeanList = pineappleDao.childrenrefundStatusByCourse(IMDoingOrderBean.getOrderCode());
if(StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
Optional<CheckRefundStatusBean> entity = checkRefundStatusBeanList.stream().findFirst();
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getMsg());
bean.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getCode());
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
return checkRefundStatusResponse;
}
}
}*/
checkRefundStatusResponse.setRefundStatus(refundEnum.getCode());
checkRefundStatusResponse.setSubmessage(refundEnum.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(refundEnum.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
//2.查询换货表有没有记录
List<MemberProductExchange> memberProductExchangeList = memberReadDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
if(!StringUtil.isNull(memberProductExchangeList) && !memberProductExchangeList.isEmpty()){
MemberProductExchange memberProductExchange = memberProductExchangeList.stream().findFirst().get();
PineappleExchangeEnum exchangeEnum = PineappleExchangeEnum.resolveByPlatformRefundStatus(memberProductExchange.getState());
checkRefundStatusResponse.setRefundStatus(exchangeEnum.getCode());
checkRefundStatusResponse.setSubmessage(exchangeEnum.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(exchangeEnum.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
//3.如果都没有记录需要查询seller_complaint(投诉表),根据order_id订单id查询
List<SellerComplaint> sellerComplaintList = memberReadDao.getSellerComplaintById(orders.getId());
if(!StringUtil.isNull(sellerComplaintList) && !sellerComplaintList.isEmpty()){
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg());
......
......@@ -10,6 +10,7 @@ import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.DownloadProductResponse;
import com.sibu.orderHelper.integral.request.DownloadProductRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......@@ -23,15 +24,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
private static Logger log = Logger.getLogger(DownloadProductBizServiceImpl.class);
@Resource
private PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Override
public DownloadProductResponse call(CallRequest<DownloadProductRequest> callRequest) throws Exception {
DownloadProductResponse downloadProductResponse = new DownloadProductResponse();
Map<String,Object> params =new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
params.put("sellerId",callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStatus())){
params.put("isShow", DownloadProductStatusEnum.resolve(callRequest.getBizModel().getStatus()).intValue());
params.put("state", DownloadProductStatusEnum.resolve(callRequest.getBizModel().getStatus()).intValue());
}
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
......@@ -42,35 +43,15 @@ public class DownloadProductBizServiceImpl extends AbstractBizService<DownloadP
params.put("productName",callRequest.getBizModel().getPageSize());
}
//查询产品
List<DownloadProductBean> downloadProductBeanList = pineappleDao.getProductListByMap(params);
List<DownloadProductBean> downloadProductBeanList = memberReadDao.downloadProductListByMap(params);
if(!StringUtil.isNull(downloadProductBeanList) && !downloadProductBeanList.isEmpty()){
for(DownloadProductBean product : downloadProductBeanList){
//产品SKU
List<DownloadProductSkuBean> downloadProductSkuBeanList = pineappleDao.getDownloadProductSkuBeanList(product.getPlatProductID());
if(!StringUtil.isNull(downloadProductSkuBeanList) && !downloadProductSkuBeanList.isEmpty()){
for(int i=0;i<downloadProductSkuBeanList.size();i++){
DownloadProductSkuBean sku = downloadProductSkuBeanList.get(i);
//查询SKU规格名称
List<DownloadProductSkuBean> skuList = pineappleDao.getDownloadSkuBean(sku.getSkuID());
if(!StringUtil.isNull(skuList) && !skuList.isEmpty()){
StringBuffer sb = new StringBuffer();
for(int j = 0;j<skuList.size();j++){
if(j ==0){
sb.append(skuList.get(j).getSkuname());
}else{
sb.append(","+skuList.get(j).getSkuname());
}
}
sku.setSkuname(sb.toString());
sku.setSkupictureurl(product.getPictureurl());
}
}
}
List<DownloadProductSkuBean> downloadProductSkuBeanList = memberReadDao.downloadSkuByProductId(product.getPlatProductID());
product.setSkus(downloadProductSkuBeanList);
};
downloadProductResponse.setTotalcount(downloadProductBeanList.size());
int count = memberReadDao.countDownloadProductListByMap(params);
downloadProductResponse.setTotalcount(count);
}else{
downloadProductResponse.setTotalcount(0);
}
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.response.PageResult;
import com.sibu.mall.common.utils.SeqGenUtil;
import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
import com.sibu.mall.order.request.third.ThirdPageQueryOrderListRequest;
import com.sibu.mall.order.response.api.ApiOrdersProductResponse;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ApiOrdersProductService;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.integral.dao.IMDoingOrderDao;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.model.IMProductBean;
import com.sibu.orderHelper.integral.model.IMSupplier;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
import com.sibu.orderHelper.integral.pineapple.model.Regions;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter;
import com.sibu.orderHelper.service.redis.RedisProductSkuService;
import org.apache.commons.lang3.StringUtils;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -44,145 +47,228 @@ import java.util.stream.Collectors;
@Service
public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> {
private static Logger log = Logger.getLogger(GetOrderBizServiceImpl.class);
@Resource
private IIMDoingOrderService iimDoingOrderService;
@Resource
private IMDoingOrderDao iMDoingOrderDao;
@Autowired
private PlatformOrderToPineAppleOrderConverter platformOrderToPineAppleOrderConverter;
@Resource
PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Override
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
if (StringUtils.isNotBlank(callRequest.getBizModel().getPlatOrderNo())) {
return this.findByOrderCode(callRequest);
} else {
return this.findList(callRequest);
}
}
@Reference
private ApiOrdersProductService apiOrdersProductService;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public String getHandleMethodName() {
return "Differ.JH.Business.GetOrder";
}
private GetOrderResponse findByOrderCode(CallRequest<GetOrderRequest> callRequest) {
DoingOrderDetailResponse order = null;
try {
order = iimDoingOrderService.getIMOrderDetailByOrderCode(callRequest.getBizModel().getPlatOrderNo());
if (order != null) {
this.getBarCode(order);
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
ThirdPageQueryOrderListRequest thirdPageQueryOrderListRequest = new ThirdPageQueryOrderListRequest();
if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
thirdPageQueryOrderListRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
}
int numTotalOrder = 0;
List<OrderResponse> orders = new ArrayList<>();
if (order != null) {
numTotalOrder = 1;
orders.add(this.convertOrder(order));
if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus());
thirdPageQueryOrderListRequest.setOrderState(orderStatusEnum.getMallOrderStatus());
}
thirdPageQueryOrderListRequest.setSellerId(callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
thirdPageQueryOrderListRequest.setStartTime(callRequest.getBizModel().getStartTime());
}
if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){
thirdPageQueryOrderListRequest.setEndTime(callRequest.getBizModel().getEndTime());
}
thirdPageQueryOrderListRequest.setPageNow(callRequest.getBizModel().getPageIndex());
thirdPageQueryOrderListRequest.setPageSize(callRequest.getBizModel().getPageSize());
thirdPageQueryOrderListRequest.setInitiationID(SeqGenUtil.getLogId());
CommonResponse<PageResult<ApiOrdersResponse>> thirdResponse = thirdApiOrderService.pageOrder(thirdPageQueryOrderListRequest);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(numTotalOrder);
response.setOrders(orders);
response.setNumTotalOrder(0);
response.setOrders(new ArrayList<>());
response.setCode(PineAppleConst.SUCCESS_CODE);
if(thirdResponse.isSuccess()){
List<Orders> ordersList = BeanCopyUtils.copyList(Orders.class,thirdResponse.getResult().getDatas());
List<Integer> provinceIdList = ordersList.stream().map(o->o.getProvinceId()).collect(Collectors.toList());
List<Regions> provinceList = memberReadDao.getRegionsByIds(provinceIdList);
List<Integer> cityIdList = ordersList.stream().map(o->o.getCityId()).collect(Collectors.toList());
List<Regions> cityList = memberReadDao.getRegionsByIds(cityIdList);
List<Integer> areaIdList = ordersList.stream().map(o->o.getAreaId()).collect(Collectors.toList());
List<Regions> areaList = memberReadDao.getRegionsByIds(areaIdList);
ordersList.stream().forEach(i->{
Optional<Regions> province = provinceList.stream().filter(p->p.getId().intValue() == i.getProvinceId()).findFirst();
province.ifPresent(e->{
i.setRegionName1(e.getRegionName());
});
Optional<Regions> city = cityList.stream().filter(p->p.getId().intValue() == i.getCityId()).findFirst();
city.ifPresent(e->{
i.setRegionName2(e.getRegionName());
});
Optional<Regions> area = areaList.stream().filter(p->p.getId().intValue() == i.getAreaId()).findFirst();
area.ifPresent(e->{
i.setRegionName3(e.getRegionName());
});
});
response.setNumTotalOrder(thirdResponse.getResult().getTotalRecord());
response.setOrders(findOrders(ordersList));
}else {
throw new BizException(thirdResponse.getErrorMsg());
}
return response;
}
private OrderResponse convertOrder(DoingOrderDetailResponse order) {
return this.platformOrderToPineAppleOrderConverter.convert(order);
}
private List<OrderResponse> findOrders(List<Orders> ordersList){
List<OrderResponse> orderResponseList = new ArrayList<>();
if(!StringUtil.isNull(ordersList) && !ordersList.isEmpty()){
ordersList.stream().forEach(o ->{
OrderResponse orderResponse = this.getOrderResponse(o);
try {
List<OrdersProduct> ordersProductList = null;
ApiOrdersSnRequest apiOrdersSnRequest = new ApiOrdersSnRequest(o.getOrderSn());
apiOrdersSnRequest.setInitiationID(SeqGenUtil.getLogId());
CommonResponse<List<ApiOrdersProductResponse>> commonResponse = apiOrdersProductService.getOrdersProductByOrderSn(apiOrdersSnRequest);
if(commonResponse.isSuccess()){
ordersProductList = BeanCopyUtils.copyList(OrdersProduct.class, commonResponse.getResult());
}
public DoingOrderDetailResponse getBarCode(DoingOrderDetailResponse source) throws Exception {
for (DoingOrder1DetailResponse entity:source.getOrder1s()){
IMProductBean product = pineappleDao.getIMProductBeanById(entity.getProductId());
if(StringUtil.isNotBlank(product.getBarCode())){
entity.setBarCode(product.getBarCode());
}
if(StringUtil.isNull(ordersProductList)){
throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
}
List<OrderGoodResponse> goodInfos = new ArrayList<>();
ordersProductList.stream().forEach(p ->{
OrderGoodResponse orderGoodResponse = this.getOrderGoodResponse(p);
goodInfos.add(orderGoodResponse);
});
orderResponse.setGoodInfos(goodInfos);
orderResponseList.add(orderResponse);
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException(String.format("获取订单数据业务异常:[%s]",o.getOrderSn()));
}
});
}
return source;
return orderResponseList;
}
/**
* 主订单数据
* @param orders
* @return
*/
private OrderResponse getOrderResponse(Orders orders){
OrderStatusEnum orderStatusEnum = this.convertAndCheckOrderStatusEnum(orders);
OrderResponse orderResponse = new OrderResponse();
orderResponse.setTradeStatus(orderStatusEnum.getCode());//订单状态
orderResponse.setTradeStatusDescription(orderStatusEnum.getMsg());
orderResponse.setPlatOrderNo(orders.getOrderSn());//订单号
orderResponse.setTradeStatusDescription(orders.getRemark());//订单备注
orderResponse.setTradeTime(this.buildDefaultSimpleDateFormat().format(orders.getCreateTime()));//交易时间
orderResponse.setProvince(orders.getRegionName1());//省
orderResponse.setCity(orders.getRegionName2());//市
orderResponse.setArea(orders.getRegionName3());//区
orderResponse.setAddress(orders.getAddressInfo());//地址
orderResponse.setNick(orders.getMemberName());//买家昵称
orderResponse.setPhone(orders.getMobile());//电话
orderResponse.setMobile(orders.getMobile());
orderResponse.setPostFee(this.convertAndCheckFreight(orders.getMoneyLogistics()));//邮费
orderResponse.setGoodsFee(this.convertAndCheckFreight(orders.getMoneyProduct()));//货款金额
orderResponse.setTotalMoney(this.convertAndCheckFreight(orders.getMoneyOrder()));//支付金额
orderResponse.setFavourableMoney(this.convertAndCheckFreight(orders.getMoneyDiscount()));//优惠金额
orderResponse.setPayTime(orders.getPayTime()==null?"":this.buildDefaultSimpleDateFormat().format(orders.getPayTime()));//支付时间
orderResponse.setShouldPayType("银行收款");//结算方式
orderResponse.setTown("");
orderResponse.setTaxAmount("");
orderResponse.setCommissionValue("");
orderResponse.setTariffAmount("");
orderResponse.setAddedValueAmount("");
orderResponse.setConsumptionDutyAmount("");
orderResponse.setSendStyle("");
orderResponse.setQq("");
orderResponse.setEmail("");
orderResponse.setInvoiceTitle("");
orderResponse.setTaxPayerIdent("");
orderResponse.setCodServiceFee("");
orderResponse.setCurrencyCode("");
orderResponse.setIdCard("");
orderResponse.setIdCardTrueName("");
orderResponse.setWhseCode("");
orderResponse.setIsHwgFlag("");
return orderResponse;
}
private BaseResponse findList(CallRequest<GetOrderRequest> callRequest) {
List<IMDoingOrderBean> list = new ArrayList<IMDoingOrderBean>();
//默认获取订单数量值
int[] modelValues = {0, 1, 2, 3, 4, 5, 6, 7};
String redisMysqlDbConfig = "";
Map<String, Object> params = new HashMap<>();
String orderTableName = "im_doing_order_";
String order1TableName = "im_doing_order1_";
List<String[]> tableNames = new ArrayList<String[]>();
//放入两个表名
for (int j = 0; j < DbUtil.TABLE_LASTCHAR1.size(); j++) {
tableNames.add(new String[]{orderTableName + DbUtil.TABLE_LASTCHAR1.get(j), order1TableName + DbUtil.TABLE_LASTCHAR1.get(j)});
}
params.put("tableNames", tableNames);
params.put("orderStatusList", callRequest.getBizModel().convertOrderStatus().getMallOrderStatus());
params.put("supplierId", callRequest.getSupplier().getId());
params.put("startTime", callRequest.getBizModel().convertAndCheckStartTime());
params.put("endTime", callRequest.getBizModel().convertAndCheckEndTime());
params.put("timeType", callRequest.getBizModel().convertTimeTypeEnum().getCode());
int pageStartInit = (callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize();
int pageSizeInt = callRequest.getBizModel().getPageSize();
int totalRecord = 0;
boolean queryFlag = true;
List<DoingOrderDetailResponse> orderBeans = new ArrayList<>();
//开始循环库查询
for (int i = 0; i < modelValues.length; i++) {
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, modelValues[i]);
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
int number = iMDoingOrderDao.countPineAppleOrder(params);
totalRecord += number;
if (queryFlag && number > 0) {
//已经查到有数据了,从下一张表的第一条记录开始查询
if (orderBeans != null && orderBeans.size() > 0) {
int pageSize = pageSizeInt - orderBeans.size();//减去已查到的数据
params.put("pageNow", 0);
params.put("pageSize", pageSize);
} else if (totalRecord > pageStartInit) {
int pageNow = pageStartInit - (totalRecord - number);
params.put("pageNow", pageNow);
params.put("pageSize", pageSizeInt);
} else {
continue;//继续循环
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
List<DoingOrderDetailResponse> orders = iMDoingOrderDao.pagerPineAppleOrders(params);
orderBeans.addAll(orders);
if (orderBeans.size() >= callRequest.getBizModel().getPageSize()) {
queryFlag = false;
}
}
/**
* 子订单数据
* @param ordersProduct
* @return
*
*
*/
private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
orderGoodResponse.setProductId(String.valueOf(ordersProduct.getProductGoodsId()));//平台商品ID或SKUID(SKUID优先)
orderGoodResponse.setSubOrderNo(String.valueOf(ordersProduct.getId()));//子订单号(若需要支持拆单发货,则必填)
orderGoodResponse.setTradeGoodsNo(ordersProduct.getProductSku());//外部商家编码或外部SKU编码(SKU编码优先)。注意,如果要与管家对接,这里一般返回管家的商品编码,作为平台的外部商家编码,与管家商品映射
orderGoodResponse.setTradeGoodsName(ordersProduct.getProductName());//商品交易名称
orderGoodResponse.setTradeGoodsSpec(ordersProduct.getSpecInfo());//商品交易规格
orderGoodResponse.setGoodsCount(String.valueOf(ordersProduct.getNumber()));//商品数量
orderGoodResponse.setPrice(this.convertAndCheckFreight(ordersProduct.getMoneyPrice()));//单价
orderGoodResponse.setDiscountMoney(this.convertAndCheckFreight(getOrdersProductDiscountMoney(ordersProduct)));//子订单优惠金额
orderGoodResponse.setTaxAmount("");
orderGoodResponse.setRefundStatus("");
orderGoodResponse.setStatus("");
orderGoodResponse.setRemark("");
return orderGoodResponse;
}
private BigDecimal getOrdersProductDiscountMoney(OrdersProduct ordersProduct){
BigDecimal moneyActSingle = ordersProduct.getMoneyActSingle() ==null? BigDecimal.ZERO : ordersProduct.getMoneyActSingle();//立减优惠金额
BigDecimal moneyFullAmount = ordersProduct.getMoneyFullAoumt() ==null? BigDecimal.ZERO:ordersProduct.getMoneyFullAoumt();//网单满减金额和
BigDecimal moneyCouponAmount = ordersProduct.getMoneyCouponAmount() ==null?BigDecimal.ZERO:ordersProduct.getMoneyCouponAmount();//网单优惠券优惠金额和
BigDecimal deductionProductVbMoney = ordersProduct.getDeductionProductVbMoney() ==null?BigDecimal.ZERO:ordersProduct.getDeductionProductVbMoney();
BigDecimal sumDiscountMoney =BigDecimal.ZERO;
sumDiscountMoney = sumDiscountMoney.add(moneyActSingle);
sumDiscountMoney = sumDiscountMoney.add(moneyFullAmount);
sumDiscountMoney = sumDiscountMoney.add(moneyCouponAmount);
sumDiscountMoney = sumDiscountMoney.add(deductionProductVbMoney);
return sumDiscountMoney;
}
private OrderStatusEnum convertAndCheckOrderStatusEnum(Orders orders) {
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(orders.getOrderState());
if (orderStatusEnum.equals(OrderStatusEnum.UNKNOWN) || orderStatusEnum.equals(OrderStatusEnum.ALL_ORDER)) {
throw new BizException(MessageFormat.format("订单状态【{0}】转换失败,", orders.getOrderState()));
}
List<OrderResponse> orders = orderBeans
.stream()
.map(p -> {
DoingOrderDetailResponse order = null;
try {
order = iimDoingOrderService.getIMOrderDetailByOrderCode(p.getOrderCode());
if(!StringUtil.isNull(order)){
this.getBarCode(order);
}
} catch (Exception e) {
log.error("获取订单数据业务异常", e);
throw new BizException("获取订单数据业务异常", e);
}
return order;
})
.map(p -> platformOrderToPineAppleOrderConverter.convert(p))
.collect(Collectors.toList());
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(totalRecord);
response.setOrders(orders);
response.setCode(PineAppleConst.SUCCESS_CODE);
return orderStatusEnum;
}
return response;
private SimpleDateFormat buildDefaultSimpleDateFormat() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf;
}
private String convertAndCheckFreight(BigDecimal money) {
BigDecimal price = money==null?BigDecimal.ZERO:money;
return price.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
}
@Override
public String getHandleMethodName() {
return "Differ.JH.Business.GetOrder";
}
}
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.utils.SeqGenUtil;
import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
import com.sibu.mall.order.request.third.ThirdOrdersProductIdRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ApiOrdersService;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
......@@ -7,6 +15,7 @@ import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.enums.PineappleRefundEnum;
import com.sibu.orderHelper.enums.PineappleRefundMoneyStateEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.GetRefundBean;
import com.sibu.orderHelper.integral.model.PineappleOderDetailBean;
......@@ -15,6 +24,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.GetRefundResponse;
import com.sibu.orderHelper.integral.request.GetRefundRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......@@ -31,6 +41,14 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
@Resource
private PineappleDao pineappleDao;
@Resource
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Reference
private ApiOrdersService apiOrdersService;
@Override
public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
......@@ -39,12 +57,53 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
params.put("supplierId",callRequest.getSupplier().getId());
params.put("beginTime",callRequest.getBizModel().getBeginTime());
params.put("endTime",callRequest.getBizModel().getEndTime());
params.put("pageNow",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
params.put("PageIndex",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<GetRefundBean> refundBeanList = pineappleDao.pageGetRefundBean(params);
List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params);
if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){
for(GetRefundBean getRefundBean:refundBeanList){
String orderSn = getRefundBean.getPlatorderno();
//旧订单号处理
if(!orderSn.startsWith("B")){
orderSn = memberReadDao.getNewOrderSnByOldOrderSn(orderSn);
}
ApiOrdersSnRequest apiOrdersSnRequest = new ApiOrdersSnRequest(orderSn);
apiOrdersSnRequest.setInitiationID(SeqGenUtil.getLogId());
CommonResponse<ApiOrdersResponse> orderResponse = apiOrdersService.getOrdersByOrderSn(apiOrdersSnRequest);
if(orderResponse.isSuccess()){
getRefundBean.setTotalamount(orderResponse.getResult().getMoneyOrder());
getRefundBean.setPayamount(orderResponse.getResult().getMoneyOrder());
getRefundBean.setOrderstatus(String.valueOf(orderResponse.getResult().getOrderState()));
}else {
throw new BizException(orderResponse.getErrorMsg());
}
ThirdOrdersProductIdRequest thirdOrdersProductIdRequest = new ThirdOrdersProductIdRequest(getRefundBean.getOrdersproductuid(),orderSn);
thirdOrdersProductIdRequest.setInitiationID(SeqGenUtil.getLogId());
CommonResponse<Integer> response = thirdApiOrderService.countOrderProductNum(thirdOrdersProductIdRequest);
getRefundBean.setProductnum(response.getResult());
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus()));
if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){
throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus()));
}
getRefundBean.setOrderstatus(orderStatusEnum.getCode());
getRefundBean.setOrderstatusdesc(orderStatusEnum.getMsg());
PineappleRefundEnum pineappleRefundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus()));
if(pineappleRefundEnum.getCode() == PineappleRefundEnum.JH_06.getCode()){
PineappleRefundMoneyStateEnum pineappleRefundMoneyStateEnum = PineappleRefundMoneyStateEnum.resolveByPlatformRefundStatus(getRefundBean.getStateMoney());
if(pineappleRefundMoneyStateEnum.getCode().equals(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN.getCode())){
throw new BizException(String.format("菠萝派退款单下载,枚举查询退款状态报错,订单状态【{0}】转换失败",getRefundBean.getRefundstatus()));
}
getRefundBean.setRefundstatus(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getCode());
getRefundBean.setRefundstatusdesc(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getMsg());
}else{
getRefundBean.setRefundstatus(pineappleRefundEnum.getCode());
getRefundBean.setRefundstatusdesc(pineappleRefundEnum.getMsg());
}
}
/*for(GetRefundBean getRefundBean:refundBeanList){
Map<String,Object> map = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno());
......@@ -54,7 +113,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
map.put("orderId1",getRefundBean.getSubplatorderno());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
PineappleOderDetailBean pineappleOderDetailBean = pineappleDao.getOneIMOrderById(map);
PineappleOderDetailBean pineappleOderDetailBean = null;
if(StringUtil.isNull(pineappleOderDetailBean)){
log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
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
getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode());
}
getRefundResponse.setTotalcount(refundBeanList.size());
}*/
getRefundResponse.setTotalcount(memberReadDao.countGetGetRefundBean(params));
}else{
getRefundResponse.setTotalcount(0);
}
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.utils.SeqGenUtil;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.CourierCompany;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.Regions;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.request.PineappleSendRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Service
public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSendRequest> {
private static Logger log = Logger.getLogger(PineappleSendBizServiceImpl.class);
@Resource
private PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Resource
private MemberWriteDao memberWriteDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception {
BaseResponse baseResponse =new BaseResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
params.put("doingOrderTable","im_doing_order_" + tableIndex);
params.put("orderCode",callRequest.getBizModel().getPlatOrderNo());
params.put("supplierId",callRequest.getSupplier().getId());
//只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params);
if(StringUtil.isNull(iMDoingOrderBean)){
log.error("获取订单数据业务异常");
throw new BizException("获取订单数据业务异常");
ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasReceived.getCode() || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasDelive.getCode()
|| iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){
if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){
params.put("orderStatus",PayOrderStatus.HasReceived.getCode());
params.put("erpImportDt",new Date());
params.put("shipDt",new Date());
}
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
params.put("expressCode",callRequest.getBizModel().getLogisticNo());
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
int num = pineappleDao.getOrderByMap(params);
thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
if(num > 0){
params.put("expressCode","");
}else{
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
if(StringUtil.isNull(iMDoingOrderBean.getExpressCode())){
params.put("expressCode",callRequest.getBizModel().getLogisticNo());
}else{
params.put("expressCode",iMDoingOrderBean.getExpressCode()+";"+callRequest.getBizModel().getLogisticNo());
}
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
Orders orders = null;
CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(commonResponse.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
}else {
throw new BizException(commonResponse.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
//只有订单状态为345可以允许操作该接口,其中状态为3才可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常,4、5只允许添加快递单号
if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()
&& orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitConfirmed.getCode()){
if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
//订单状态
thirdUpdateOrderRequest.setOrderState(EJavaShopOrderStateEnum.HasReceived.getCode());
//收货人名字
if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){
thirdUpdateOrderRequest.setName(callRequest.getBizModel().getSenderName());
}
}
if(StringUtil.isNull(callRequest.getBizModel().getSenderName())){
params.put("buyerUsername","");
}
if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
params.put("buyerPhone",callRequest.getBizModel().getSenderTel());
}
if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){
String [] str = callRequest.getBizModel().getSenderAddress().split(" ");
if(!StringUtil.isNull(str) && str.length >3){
params.put("province",str[0]);
params.put("city", str[1]);
params.put("area",str[2]);
StringBuffer address = new StringBuffer();
for(int i = 3;i<str.length;i++){
address.append(str[i]);
}
params.put("address",str[0]+"-"+str[1]+"-"+str[2]+"-"+address);
}else{
log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
//电话
if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
thirdUpdateOrderRequest.setMobile(callRequest.getBizModel().getSenderTel());
}
//地址、快递信息 建议去除
//this.gainInfo(params,callRequest,orders);
}
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
/* Map<String,Object> checkMap = new HashMap<>();
checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
checkMap.put("sellerId",callRequest.getSupplier().getId());
int num = memberWriteDao.checkLogisticsNumber(checkMap);*/
thirdQueryOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
CommonResponse<Boolean> response = thirdApiOrderService.checkLogisticsNumber(thirdQueryOrderRequest);
if(response.isSuccess() && !response.getResult()){
if(StringUtil.isNull(orders.getLogisticsNumber())){
thirdUpdateOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
}else{
thirdUpdateOrderRequest.setLogisticsNumber(orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
}
}
}
params.put("expressName",callRequest.getBizModel().getLogisticName());
}else{
log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo());
log.error(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
pineappleDao.updateBusinessSend(params);
//修改订单信息
thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
baseResponse.setCode(PineappleEnum.SUCCESS.getCode());
return baseResponse;
}
private void gainInfo(Map<String,Object> params,CallRequest<PineappleSendRequest> callRequest,Orders orders){
//地址
if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){
String [] str = callRequest.getBizModel().getSenderAddress().split(" ");
if(!StringUtil.isNull(str) && str.length >3){
StringBuffer address = new StringBuffer();
for(int i = 3;i<str.length;i++){
address.append(str[i]);
}
params.put("addressAll",str[0]+"-"+str[1]+"-"+str[2]);
params.put("addressInfo",str[0]+"-"+str[1]+"-"+str[2]+"-"+address);
//查询省市级ID 先寻找最低级 然后查询上去
Map<String,Object> map = new HashMap<>();
map.put("regionType",3);
map.put("name",str[2]);
List<Regions> regions = memberReadDao.getRegionsByMap(map);
if(StringUtil.isNull(regions) || regions.size() > 1){
params.put("provinceId","99999990");
params.put("cityId", "99999989");
params.put("areaId","99999988");
}else{
params.put("area",regions.get(0).getId());
Regions city = memberReadDao.getRegionsById(regions.get(0).getId());
Regions province = null;
if(!StringUtil.isNull(city)){
province = memberReadDao.getRegionsById(city.getId());
}
if(!StringUtil.isNull(city) && !StringUtil.isNull(province)){
params.put("provinceId", province.getId());
params.put("cityId", city.getId());
}else{
params.put("provinceId","99999990");
params.put("cityId", "99999989");
params.put("areaId","99999988");
}
}
}else{
log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
}
}
//物流公司名字
if(StringUtil.isNull(orders.getLogisticsName())){
Map<String,Object> m = new HashMap<>();
m.put("name","orders.getLogisticsName()");
m.put("sellerId",callRequest.getSupplier().getId());
List<CourierCompany> courierCompanyByName = memberReadDao.getCourierCompanyByName(m);
if(!StringUtil.isNull(courierCompanyByName) && !courierCompanyByName.isEmpty() && courierCompanyByName.size() == 1){
Optional<CourierCompany> first = courierCompanyByName.stream().findFirst();
params.put("logisticsName",callRequest.getBizModel().getLogisticName());
params.put("logisticsId", first.get().getId());
}else{
params.put("logisticsName","其他");
params.put("logisticsId","999999990");
}
}
}
@Override
public String getHandleMethodName() {
return PineappleMethodsEnum.Send.getMethod();
......
......@@ -4,14 +4,14 @@ import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMProductBean;
import com.sibu.orderHelper.integral.model.IMProductInventory;
import com.sibu.orderHelper.integral.model.SkuBean;
import com.sibu.orderHelper.integral.model.*;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.PineappleSyncStockResponse;
import com.sibu.orderHelper.integral.reponse.SkuApiResponse;
import com.sibu.orderHelper.integral.request.PineappleSyncStockRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
import com.sibu.orderHelper.service.redis.RedisProductSkuService;
import com.sibu.orderHelper.service.redis.RedisProductStockService;
import org.apache.log4j.Logger;
......@@ -26,101 +26,53 @@ import java.util.Map;
@Service
public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncStockRequest> {
private static Logger log = Logger.getLogger(SyncStockBizServiceImpl.class);
@Resource
private MemberReadDao memberReadDao;
@Resource
private PineappleDao pineappleDao;
private MemberWriteDao memberWriteDao;
@Transactional(rollbackFor = Exception.class)
@Transactional(value ="transactionManagerForMall",rollbackFor = Exception.class)
@Override
public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception {
PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse();
if(callRequest.getBizModel().getQuantity() < 0){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
Map<String,Object> params = new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
params.put("sellerId",callRequest.getSupplier().getId());
params.put("productId",callRequest.getBizModel().getPlatProductID());
//先判断SKU在判断产品
IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params);
if(StringUtil.isNull(iMProductBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
params.put("skuId",callRequest.getBizModel().getSkuID());
params.put("stock",callRequest.getBizModel().getQuantity());
DownloadProductBean downloadProductBeans = memberReadDao.getDownloadProductBeanByMap(params);
if(StringUtil.isNull(downloadProductBeans)){
log.error(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
if(callRequest.getBizModel().getQuantity() < 0){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
if(memberWriteDao.updateSkuStock(params) != 1){
log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) && !"0".equals(callRequest.getBizModel().getSkuID())) {
params.put("skuId",callRequest.getBizModel().getSkuID());
//查询该条SKUi
SkuBean skuBean = pineappleDao.getSkuBeanByMap(params);
if(StringUtil.isNull(skuBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
}
//更新该条SKU
skuBean.setStockNum(callRequest.getBizModel().getQuantity());
if(pineappleDao.updateSku(skuBean) > 0){
//根据产品ID获取所有SKU总数
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(StringUtil.isNull(skuBeanList)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey())));
}
//更新SKU缓存
RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID());
Integer sumStock = skuBeanList.stream().map(s -> s.getStockNum()).reduce(0,(a,b) ->{
return a+b;
});
//更新产品
params.put("stockNum",sumStock);
if(pineappleDao.updateProduct(params) > 0){
//更新产品缓存
RedisProductStockService.setProductStock(iMProductBean.getImProductId(), sumStock);
//1、更新商品库存
IMProductInventory productInventory = new IMProductInventory();
productInventory.setImProductId(iMProductBean.getImProductId());
productInventory.setStockNum(sumStock);
if(pineappleDao.updateProductInventory(productInventory) > 0){
//更新缓存
pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}
}else {
log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey())));
}
}else{
log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey())));
}
List<DownloadProductSkuBean> skuBean = memberReadDao.downloadSkuByProductId(callRequest.getBizModel().getPlatProductID());
if(StringUtil.isNull(skuBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
}
if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){
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()));
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()));
}
params.put("stockNum",callRequest.getBizModel().getQuantity());
if(pineappleDao.updateProduct(params) > 0){
//更新产品
RedisProductStockService.setProductStock(iMProductBean.getImProductId(), callRequest.getBizModel().getQuantity());
//1、更新商品库存
IMProductInventory productInventory = new IMProductInventory();
productInventory.setImProductId(iMProductBean.getImProductId());
productInventory.setStockNum(callRequest.getBizModel().getQuantity());
if(pineappleDao.updateProductInventory(productInventory) > 0){
//更新缓存
pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}else{
log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城更新sku库存失败", callRequest.getRequest().getAppkey())));
}
}
//获取sku总库存
Integer sumStock = skuBean.stream().map(s -> s.getSkuQuantity()).reduce(0,(a,b) ->{
return a+b;
});
params.put("productStock",sumStock);
if(memberWriteDao.updateProductStock(params) != 1){
log.error(String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新产品库存失败[%s]", callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())));
}
log.error(String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey())));
pineappleSyncStockResponse.setQuantity(String.valueOf(callRequest.getBizModel().getQuantity()));
pineappleSyncStockResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}
@Override
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.utils.SeqGenUtil;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse;
import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service
public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> {
private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class);
@Resource
private PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception {
UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
Map<String,Object> params = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo());
params.put("doingOrderTable","im_doing_order_" + tableIndex);
params.put("orderCode",callRequest.getBizModel().getPlatOrderNo());
params.put("sellerRemark",callRequest.getBizModel().getSellerMemo());
params.put("supplierId",callRequest.getSupplier().getId());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params);
if(StringUtil.isNull(iMDoingOrderBean)){
log.error("获取订单数据业务异常");
throw new BizException("获取订单数据业务异常");
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
thirdQueryOrderRequest.setInitiationID(SeqGenUtil.getLogId());
ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
thirdUpdateOrderRequest.setRemark(callRequest.getBizModel().getSellerMemo());
thirdUpdateOrderRequest.setInitiationID(SeqGenUtil.getLogId());
Orders orders = null;
CommonResponse<ApiOrdersResponse> response = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(response.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class,response.getResult());
}else {
throw new BizException(response.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
CommonResponse<Boolean> updateResponse = thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
if(!updateResponse.isSuccess()){
log.error(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
pineappleDao.updateSelle(params);
UpdateSellerMemoResponse.setCode(PineappleEnum.SUCCESS.getCode());
UpdateSellerMemoResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return UpdateSellerMemoResponse;
......
......@@ -25,12 +25,12 @@
</modules>
<properties>
<!-- spring版本 -->
<spring.version>4.0.0.RELEASE</spring.version>
<spring.version>4.3.16.RELEASE</spring.version>
<!-- mybatis版本 -->
<mybatis.version>3.2.4</mybatis.version>
<!-- log4j日志文件管理包版 -->
<slf4j.version>1.6.6</slf4j.version>
<log4j.version>1.2.13</log4j.version>
<slf4j.version>1.7.25</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<!-- mysql驱动的版 -->
<mysql.version>5.1.35</mysql.version>
<!-- <mysql.version>3.1.14</mysql.version> -->
......@@ -47,6 +47,10 @@
<doubo-parent.version>2.0.0</doubo-parent.version>
<dubbo.version>2.6.3</dubbo.version>
<curator.version>2.12.0</curator.version>
</properties>
<dependencies>
<dependency>
......@@ -406,6 +410,32 @@
<artifactId>protobuf-java</artifactId>
<version>2.6.1</version>
</dependency>
<!-- dubbo begin -->
<!-- https://mvnrepository.com/artifact/com.alibaba/dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${curator.version}</version>
</dependency>
<!-- dubbo begin -->
<!-- taobao sms start -->
<dependency>
<groupId>com.taobao</groupId>
......@@ -426,12 +456,6 @@
<version>${doubo-parent.version}</version>
</dependency>
<!--阿里mq-->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
......